casxml
Class XMLScanner

java.lang.Object
  extended by casxml.XMLScanner

public class XMLScanner
extends java.lang.Object

An XMLScanner provides a convenient packaging of a JAXP-based SAX 2 XML Parser.

Each of the methods scanXML(InputSource,DefaultHandler) and scanXMLText(String,DefaultHandler) takes some form of XML source and a DefaultHandler (or sub-class) instance as arguments, and invokes the parser on that XML source -- resulting in the delivery of a sequence of SAX events to the handler.


Nested Class Summary
 class XMLScanner.ScanException
          All-purpose scanner exception class.
 
Field Summary
static java.lang.String SAX_NAMESPACES
          SAX namespaces feature name.
static java.lang.String SAX_NS_PREFIXES
          SAX namespace prefixes feature name.
static java.lang.String SAX_STRING_INTERN
          SAX string interning feature name.
 
Constructor Summary
XMLScanner(java.lang.String intag)
          Constructs a new validating scanner with the given idenfification tag.
XMLScanner(java.lang.String intag, boolean validate)
          Constructs a new scanner with the given idenfification tag, performing XML validataion or not, as specified.
 
Method Summary
static java.lang.String getSPXLineColText(org.xml.sax.SAXParseException spx)
          Returns line and column number text for the given SAX parse exception.
static java.lang.String getSPXLocationText(org.xml.sax.SAXParseException spx)
          Returns a full location text, including System Id if available, for the given SAX parse exception.
 void scanXML(org.xml.sax.InputSource insrc, org.xml.sax.helpers.DefaultHandler hndlr)
          Parses the given source XML document, feeding SAX parse events to the given handler.
 void scanXMLText(java.lang.String txt, org.xml.sax.helpers.DefaultHandler hndlr)
          Parses the given XML document text, feeding SAX parse events to the given handler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAX_NAMESPACES

public static final java.lang.String SAX_NAMESPACES
SAX namespaces feature name.

See Also:
Constant Field Values

SAX_NS_PREFIXES

public static final java.lang.String SAX_NS_PREFIXES
SAX namespace prefixes feature name.

See Also:
Constant Field Values

SAX_STRING_INTERN

public static final java.lang.String SAX_STRING_INTERN
SAX string interning feature name.

See Also:
Constant Field Values
Constructor Detail

XMLScanner

public XMLScanner(java.lang.String intag)
           throws XMLScanner.ScanException
Constructs a new validating scanner with the given idenfification tag.

Throws:
XMLScanner.ScanException

XMLScanner

public XMLScanner(java.lang.String intag,
                  boolean validate)
           throws XMLScanner.ScanException
Constructs a new scanner with the given idenfification tag, performing XML validataion or not, as specified.

Throws:
XMLScanner.ScanException
Method Detail

scanXML

public void scanXML(org.xml.sax.InputSource insrc,
                    org.xml.sax.helpers.DefaultHandler hndlr)
             throws XMLScanner.ScanException
Parses the given source XML document, feeding SAX parse events to the given handler.

Throws:
XMLScanner.ScanException

scanXMLText

public void scanXMLText(java.lang.String txt,
                        org.xml.sax.helpers.DefaultHandler hndlr)
                 throws XMLScanner.ScanException
Parses the given XML document text, feeding SAX parse events to the given handler.

Throws:
XMLScanner.ScanException

getSPXLocationText

public static java.lang.String getSPXLocationText(org.xml.sax.SAXParseException spx)
Returns a full location text, including System Id if available, for the given SAX parse exception.


getSPXLineColText

public static java.lang.String getSPXLineColText(org.xml.sax.SAXParseException spx)
Returns line and column number text for the given SAX parse exception.