|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ls.util.xml.XMLComplexHandler
Processes xml structures as read from any input source and returns the Map implementation of a XMLFragment of that structures.
Constructor Summary | |
XMLComplexHandler()
constructs an XMLComplexHandler instance, which creates an instance of XMLReader .
|
Method Summary | |
String |
buildString(String documentType,
Map xmlMapping)
creates the string representation of an xml structure as specified in the given map. |
void |
characters(char[] ch,
int start,
int length)
any character within an element node will be interpreted as the value of this element node. |
Map |
convertAttributesToMap(org.xml.sax.Attributes attributeList)
converts the given instance of Attributes into a Map
and returns it. |
void |
endDocument()
if the document is finished there should be only one map left in the list. |
void |
endElement(String namespaceURI,
String localName,
String qName)
if the Parser receives the end tag of an element, he will remove it from the list of stuff to parse. |
void |
endPrefixMapping(String prefix)
end the scope of a prefix-URI mapping. This method is currently not be used in this class. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
receives notification of ignorable whitespace in element content. This method is currently not be used in this class. |
Map |
parse(org.xml.sax.InputSource inputSource)
parses an xml structure as read from the given input source and returns a map view on it. |
Map |
parse(Reader readerSource)
parses a xml structure as read from the given Reader and returns a map view on it. |
Map |
parse(String stringSource)
parses a xml structure as read from the given String and returns a map view on it. |
void |
processingInstruction(String target,
String data)
receives notification of a processing instruction. This method is currently not be used in this class. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
receive an object for locating the origin of SAX document events. This method is currently not be used in this class. |
void |
skippedEntity(String name)
receive notification of a skipped entity. This method is currently not be used in this class. |
void |
startDocument()
receives notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator). |
void |
startElement(String namespaceURI,
String localName,
String qName,
org.xml.sax.Attributes attributeList)
receive notification of the beginning of an element. |
void |
startPrefixMapping(String prefix,
String uri)
begins the scope of a prefix-URI Namespace mapping. This method is currently not be used in this class. |
void |
write(Writer writer,
String documentType,
Map xmlMapping)
creates the string representation of an xml structure as specified in the given map. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLComplexHandler() throws ProgrammingException
XMLReader
.
Note: For instantiating an XMLReader this method is trying to get
the value of the org.xml.sax.driver
system property.org.apache.crimson.parser.XMLReaderImpl
implementation of XMLReader will be taken as default.Method Detail |
public Map parse(org.xml.sax.InputSource inputSource) throws XMLException, IllegalArgumentException, ProgrammingException
parse
in interface IXMLHandler
inputSource
- the source from where to get the xml structureXMLException
- if the parsing process failsIllegalArgumentException
- if the given inputSource is nullProgrammingException
- if this.xmlParser is nullXMLFragment
public Map parse(Reader readerSource) throws XMLException, IllegalArgumentException, ProgrammingException
parse
in interface IXMLHandler
readerSource
- the source from where to get the xml structureXMLException
- if the parsing process failsIllegalArgumentException
- if the given reader is nullProgrammingException
- if this.xmlParser is nullXMLFragment
public Map parse(String stringSource) throws XMLException, IllegalArgumentException, ProgrammingException
parse
in interface IXMLHandler
stringSource
- the source from where to get the xml structureXMLException
- if the parsing process failsIllegalArgumentException
- if the given source is nullProgrammingException
- if this.xmlParser is nullXMLFragment
public String buildString(String documentType, Map xmlMapping) throws XMLException
documentType
will become the root
element of this structure.
Note: This implementation awaits the map to contain only
String/String mappings in order to perform successful. If you want to
specify more complex (nested) structures, please pass an XMLFragment.documentType
- specifies the root element of the new xml structurexmlMapping
- contains element/content mappings to be used in the new
xml structureXMLException
- if the conversion to xml failsXMLFragment
public void write(Writer writer, String documentType, Map xmlMapping) throws XMLException, IllegalArgumentException
documentType
will become the root
element of this structure. The final string will be written to the
specified Writer.
Note: This implementation awaits the Map to contain only
String/String mappings in order to perform successful. If you want to
specify more complex (nested) structures, please pass an XMLFragment.writer
- Writer to which the xml string should be writtendocumentType
- specifies the root element of the new xml structurexmlMapping
- contains element/content mappings to be used in the new
xml structureXMLException
- if the conversion to xml failsIllegalArgumentException
- if one of the arguments is is null, or if
the xmlMapping map is emptyXMLFragment
public void setDocumentLocator(org.xml.sax.Locator locator)
This method is currently not be used in this class.
setDocumentLocator
in interface org.xml.sax.ContentHandler
locator
- not being used ...public void startDocument()
The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).
startDocument
in interface org.xml.sax.ContentHandler
public void processingInstruction(String target, String data) throws org.xml.sax.SAXException
This method is currently not be used in this class.
processingInstruction
in interface org.xml.sax.ContentHandler
target
- not being used ...data
- not being used ...org.xml.sax.SAXException
- if any error occurspublic void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
This method is currently not be used in this class.
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ch
- not being used ...start
- not being used ...length
- not being used ...org.xml.sax.SAXException
- if any error occurspublic void skippedEntity(String name) throws org.xml.sax.SAXException
This method is currently not be used in this class.
skippedEntity
in interface org.xml.sax.ContentHandler
name
- not being used ...org.xml.sax.SAXException
- if any error occurspublic void startPrefixMapping(String prefix, String uri)
This method is currently not be used in this class.
startPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- not being used ...uri
- not being used ...public void startElement(String namespaceURI, String localName, String qName, org.xml.sax.Attributes attributeList) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
namespaceURI
- the namespace uri of that elementlocalName
- the name of that elementqName
- the fully qualified name of that elementattributeList
- the attributes of that elementorg.xml.sax.SAXException
- if the conversion to xml failspublic void characters(char[] ch, int start, int length)
characters
in interface org.xml.sax.ContentHandler
ch
- characters from the xml documentstart
- start position in the arraylength
- number of characters to be read from the arraypublic void endElement(String namespaceURI, String localName, String qName)
endElement
in interface org.xml.sax.ContentHandler
namespaceURI
- the namespace uri of that elementlocalName
- the name of that elementqName
- the fully qualified name of that elementpublic void endPrefixMapping(String prefix)
This method is currently not be used in this class.
endPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- not be used ...public void endDocument()
endDocument
in interface org.xml.sax.ContentHandler
public Map convertAttributesToMap(org.xml.sax.Attributes attributeList)
Attributes
into a Map
and returns it.attributeList
- the instance of Attributes
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |