Package com.topologi.diffx.xml
Class XMLHelper
java.lang.Object
com.topologi.diffx.xml.XMLHelper
Utility class that provides common XML operations so that the calling class uses lighter
code.
Most methods in this implementation will forward the exceptions should occur, so they will have to be handled externally.
- Version:
- 1.0, 6 May 2004
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XMLReadermakeXMLReader(ContentHandler handler) Creates a non-validating, non-namespace-awareXMLReaderusing the specifiedContentHandler.static void
-
Constructor Details
-
XMLHelper
private XMLHelper()Prevents creation of instances.
-
-
Method Details
-
makeXMLReader
public static XMLReader makeXMLReader(ContentHandler handler) throws SAXException, ParserConfigurationException Creates a non-validating, non-namespace-awareXMLReaderusing the specifiedContentHandler.If the given
ContentHandlerisnull, theXMLReaderis not initialised.- Parameters:
handler- The content handler to use.- Returns:
- The requested
XMLReader - Throws:
SAXException- Should a SAX exception occurParserConfigurationException- Should a parser config exception occur
-
parse
public static void parse(XMLReader xmlreader, File file) throws FileNotFoundException, SAXException, IOException Parses the givenFilewith the specifiedXMLReader.This method assumes the XML is in 'UTF-8', it will not sniff the XML to determine the encoding to use.
- Parameters:
xmlreader- The XML reader to use.file- The file to parse- Throws:
FileNotFoundException- If the file does not existsSAXException- Should an SAX exception occurIOException- Should an I/O exception occur
-