com.novell.xml.parser
Interface XMLParser

All Known Implementing Classes:
SAXParserImpl

public interface XMLParser

XML Parser abstraction. This allows us to use any parser for which we can write an implementation of this interface that creates a DOM tree.

Note: classes implementing this interface must be reusable - i.e., they should be able to parse more than one input xml doc sequentially


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)
          parse the input stream as an XML document
 Document parse(Reader input)
          parse 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.
 

Method Detail

parse

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

Parameters:
input - input stream to be treated as XML document
Returns:
DOM Document

parse

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

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

Parameters:
uri - The uri string
Throws:
FileNotFoundException
IOException
MalformedURLException

parse

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

Parameters:
file - file
Throws:
FileNotFoundException

parse

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

Parameters:
inputSource - The input source from which to get the input stream.
Throws:
FileNotFoundException
IOException

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).

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

Returns:
true if errors occurred during parsing

getErrorMsgs

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

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.

Returns:
String object (will never be null)

reportErrorMsgs

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

Parameters:
out - OutputStream object to write to