Package com.microstrategy.utils.xml
Class SAXHelper
- java.lang.Object
-
- com.microstrategy.utils.xml.SAXHelper
-
public class SAXHelper extends java.lang.Object
This is a helper class that assists in the parsing of XML files using SAX. It provides three class level methods:parseXmlFile(File, DefaultContentHandler, boolean, MessageRouter)
,parseXmlStream(InputStream, String, DefaultContentHandler, boolean, MessageRouter)
andparseXmlSource(InputSource, DefaultContentHandler, boolean, MessageRouter)
. It uses standard classes for a content handler and message router.- Since:
- MicroStrategy Web 8.1.0
- See Also:
DefaultContentHandler
,MessageRouter
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
XML_FEATURE_VALIDATION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getSystemID(java.io.File file)
Constructs a SYSTEM ID from a supplied File (which should represent the XML File being parsed).static void
parseXmlFile(java.io.File file, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter)
Parse an XML file using the specified Content Handler and storing results in the supplied Subteam object.static void
parseXmlSource(org.xml.sax.InputSource inputSource, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter)
Parse an XMLInputSource
object.static void
parseXmlStream(java.io.InputStream inputStream, java.lang.String systemID, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter)
Parses an XML InputStream using the specified Content Handler and storing results in the supplied Subteam object.
-
-
-
Field Detail
-
XML_FEATURE_VALIDATION
public static final java.lang.String XML_FEATURE_VALIDATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseXmlFile
public static void parseXmlFile(java.io.File file, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter) throws SAXParsingException
Parse an XML file using the specified Content Handler and storing results in the supplied Subteam object.- Parameters:
file
- The XML File to process.contentHandler
- The ContentHandler to use to parse this file.validate
- Whether we should validate the XML document or not.msgRouter
- TheMessageRouter
object to use for routing information, warning and error messages.- Throws:
SAXParsingException
- If something fails while parsing.
-
parseXmlStream
public static void parseXmlStream(java.io.InputStream inputStream, java.lang.String systemID, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter) throws SAXParsingException
Parses an XML InputStream using the specified Content Handler and storing results in the supplied Subteam object.- Parameters:
inputStream
- The XML InputStream to process.systemID
- The SystemID associated with the input stream.contentHandler
- The ContentHandler to use to parse this file.validate
- Whether we should validate the XML document or not.msgRouter
- TheMessageRouter
object to use for routing information, warning and error messages.- Throws:
SAXParsingException
- If something fails while parsing.
-
parseXmlSource
public static void parseXmlSource(org.xml.sax.InputSource inputSource, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter) throws SAXParsingException
Parse an XMLInputSource
object.- Parameters:
inputSource
- TheInputSource
object that corresponds to the XML source.contentHandler
- The ContentHandler to use to parse this file.validate
- Whether we should validate the XML document or not.msgRouter
- TheMessageRouter
object to use for routing information, warning and error messages.- Throws:
SAXParsingException
- If something fails while parsing.
-
getSystemID
public static java.lang.String getSystemID(java.io.File file)
Constructs a SYSTEM ID from a supplied File (which should represent the XML File being parsed).- Parameters:
file
- TheFile
representing the XML file being parsed.- Returns:
- A SYSTEM ID for the file.
- Since:
- MicroStrategy Web 8.1.2
-
-