com.novell.xml.parser
Class SAXParserImpl

java.lang.Object
  extended bycom.novell.xml.parser.SAXParserImpl
All Implemented Interfaces:
XMLParser

public class SAXParserImpl
extends Object
implements XMLParser

Implementation class that implements com.novell.xml.parser.XMLParser using a SAX Parser.

The actual parser to use is determined from the system property "com.novell.xml.parser". If this property is not set, the system property "org.xml.sax.parser" is used. If this property is also not set, the parser used defaults to com.jclark.xml.sax.CommentDriver.

See Also:
XMLParser

Constructor Summary
SAXParserImpl()
          Construct an object that implements XMLParser using a SAX Parser.
 
Method Summary
 boolean anyErrors()
          return if any errors occurred while parsing
 Vector getErrorMsgs()
          Return any error messages generated during parsing
 String getErrorMsgString()
          Return any error messages generated during parsing as a single string, with each message separated by a newline.
 Document parse(File file)
          parse the passed file as an XML document
 Document parse(InputSource inputSource)
          parse the passed SAX InputSource as an XML document
 Document parse(InputStream input)
          parser the input stream as an XML document
 Document parse(Reader input)
          parser the input stream as an XML document
 Document parse(String uri)
          parse the passed uri as an XML document
 void reportErrorMsgs(OutputStream out)
          Output any error messages from last parse operation
 void setContextURI(String uri)
          Set the context URI for parsing.
 void setConverter(SAXtoDOM converter)
          Set the converter object to use for converting the SAX events to a DOM tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXParserImpl

public SAXParserImpl()
Construct an object that implements XMLParser using a SAX Parser.

Method Detail

parse

public Document parse(InputStream input)
parser the input stream as an XML document

Specified by:
parse in interface XMLParser
Parameters:
input - input stream to be treated as XML document
Returns:
DOM Document

parse

public Document parse(Reader input)
parser the input stream as an XML document

Specified by:
parse in interface XMLParser
Parameters:
input - reader to be treated as XML document
Returns:
DOM Document

parse

public Document parse(String uri)
               throws FileNotFoundException,
                      IOException,
                      MalformedURLException
parse the passed uri as an XML document

Specified by:
parse in interface XMLParser
Parameters:
uri - The uri string
Throws:
FileNotFoundException
IOException
MalformedURLException

parse

public Document parse(InputSource inputSource)
               throws FileNotFoundException,
                      IOException
parse the passed SAX InputSource as an XML document

Specified by:
parse in interface XMLParser
Parameters:
inputSource - The input source from which to get the input stream.
Throws:
FileNotFoundException
IOException

parse

public Document parse(File file)
               throws FileNotFoundException
parse the passed file as an XML document

Specified by:
parse in interface XMLParser
Parameters:
file - file
Throws:
FileNotFoundException

setConverter

public void setConverter(SAXtoDOM converter)
Set the converter object to use for converting the SAX events to a DOM tree. If this is not called, a base com.novell.xml.sax.SAXtoDOM object is used.

Parameters:
converter - A SAXtoDOM-derived object (may be null, in which case the behavior reverts to standard)

setContextURI

public void setContextURI(String uri)
                   throws MalformedURLException
Set the context URI for parsing. This is useful for parse(java.io.InputStream input) and parse(java.io.Reader input).

Specified by:
setContextURI in interface XMLParser
Parameters:
uri - the URI
Throws:
MalformedURLException - If the passed URI is malformed or can't be made into a URL.

anyErrors

public boolean anyErrors()
return if any errors occurred while parsing

Specified by:
anyErrors in interface XMLParser
Returns:
true if errors occurred during parsing

getErrorMsgs

public Vector getErrorMsgs()
Return any error messages generated during parsing

Specified by:
getErrorMsgs in interface XMLParser
Returns:
Vector object containing zero or more String objects

getErrorMsgString

public String getErrorMsgString()
Return any error messages generated during parsing as a single string, with each message separated by a newline.

Specified by:
getErrorMsgString in interface XMLParser
Returns:
String object (will never be null)

reportErrorMsgs

public void reportErrorMsgs(OutputStream out)
Output any error messages from last parse operation

Specified by:
reportErrorMsgs in interface XMLParser
Parameters:
out - OutputStream object to write to