public class NVPXmlHandler extends AbstractXmlHandler
<Inventories xmlns:_cat="http://www.ibm.com/xmlns/prod/commerce/9/catalog" xmlns:_inv="http://www.ibm.com/xmlns/prod/commerce/9/inventory" > <_inv:Inventory ProductPartNumber="TAPL-01" > <_cat:Item ItemPartNumber="TAPL-0101" > <Quantity>101</Quantity> </_cat:Item> <_cat:Item ItemPartNumber="TAPL-0102"> <Quantity>102</Quantity> </_cat:Item> </_inv:Inventory> </Inventories>It will build a map and the key is the name and the value is either a string or a list if there are multiple values for the same name.
Constructor and Description |
---|
NVPXmlHandler() |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] chars,
int start,
int length)
Handle the characters event in the xml.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Handle the end element event in the xml.
|
void |
init()
Initializes some instance variables.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Handle the start element event in the xml.
|
error, fatalError, getConfigProperties, getDataLoader, setConfigProperties, setDataLoader, setDocumentLocator
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void characters(char[] chars, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class AbstractXmlHandler
chars
- the char arraystart
- the start index position in the char arraylength
- the lengthorg.xml.sax.SAXException
- if there are some errors to handle it.public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class AbstractXmlHandler
uri
- the uri of the elementlocalName
- the location name of the elementqName
- the qualified name of the elementattributes
- the attributes in the element.org.xml.sax.SAXException
- if there are some errors to handle it.public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class AbstractXmlHandler
uri
- the uri of the elementlocalName
- the location name of the elementqName
- the qualified name of the elementorg.xml.sax.SAXException
- if there are some errors to handle it.public void init() throws DataLoadException
init
in interface XmlHandler
init
in class AbstractXmlHandler
DataLoadException
- if there are some errors in the initialization.