com.cassinidivision.core.cassinijava
Class XMLHelper
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.cassinidivision.core.cassinijava.XMLHelper
- All Implemented Interfaces:
- ContentHandler, DTDHandler, EntityResolver, ErrorHandler
- public class XMLHelper
- extends DefaultHandler
Utilities to convert XML within strings to property lists.
This builds a hashtable from some xml, which in simple cases will
then allow us to pull out the values we need. Can be used where a custom
handler implementing its own startElement etc methods is overkill and you
couldn't be bothered to use DOM or SAX parsing.
The document is a hashtable, as is each element. Within an element, attributes
or child elements are put in as keys of whatever they are called. If an element
has more than one child of the same type, instead of a hashtable under that key
there will be a vector of hashtables.
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
XMLHelper
public XMLHelper()
plistFromXML
public static Hashtable plistFromXML(String xml)
throws ParserConfigurationException,
SAXException,
IOException
- Construct a property list object tree from the input XML supplied.
- Parameters:
xml
- String containing some XML.
- Returns:
- A hashtable containing an object structure corresponding to the XML.
- Throws:
ParserConfigurationException
SAXException
IOException
startElement
public void startElement(String uri,
String local,
String raw,
Attributes attrs)
characters
public void characters(char[] ch,
int start,
int length)
endElement
public void endElement(String uri,
String local,
String qName)