public class

SAXHelper

extends Object
java.lang.Object
   ↳ com.microstrategy.utils.xml.SAXHelper

Class Overview

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) and parseXmlSource(InputSource, DefaultContentHandler, boolean, MessageRouter). It uses standard classes for a content handler and message router.

Summary

Constants
String XML_FEATURE_VALIDATION
Public Methods
static String getSystemID(File file)
Constructs a SYSTEM ID from a supplied File (which should represent the XML File being parsed).
static void parseXmlFile(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(InputSource inputSource, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter)
Parse an XML InputSource object.
static void parseXmlStream(InputStream inputStream, 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.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String XML_FEATURE_VALIDATION

Constant Value: "http://xml.org/sax/features/validation"

Public Methods

public static String getSystemID (File file)

Constructs a SYSTEM ID from a supplied File (which should represent the XML File being parsed).

Parameters
file The File representing the XML file being parsed.
Returns
  • A SYSTEM ID for the file.

public static void parseXmlFile (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.

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 The MessageRouter object to use for routing information, warning and error messages.
Throws
SAXParsingException If something fails while parsing.

public static void parseXmlSource (InputSource inputSource, DefaultContentHandler contentHandler, boolean validate, MessageRouter msgRouter)

Parse an XML InputSource object.

Parameters
inputSource The InputSource 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 The MessageRouter object to use for routing information, warning and error messages.
Throws
SAXParsingException If something fails while parsing.

public static void parseXmlStream (InputStream inputStream, 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.

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 The MessageRouter object to use for routing information, warning and error messages.
Throws
SAXParsingException If something fails while parsing.