com.caucho.xml
Class AbstractParser

java.lang.Object
  extended by com.caucho.xml.AbstractParser
All Implemented Interfaces:
org.xml.sax.Parser, org.xml.sax.XMLReader
Direct Known Subclasses:
XmlParser

public abstract class AbstractParser
extends java.lang.Object
implements org.xml.sax.XMLReader, org.xml.sax.Parser


Method Summary
 org.xml.sax.ContentHandler getContentHandler()
           
 java.lang.String getDefaultEncoding()
          Gets the default encoding if none is specified.
 org.xml.sax.DTDHandler getDTDHandler()
           
 java.lang.String getEncoding()
           
 boolean getEntitiesAsText()
           
 org.xml.sax.EntityResolver getEntityResolver()
          Sets the callback object finding files from system ids.
 org.xml.sax.ErrorHandler getErrorHandler()
           
 boolean getFeature(java.lang.String name)
           
 boolean getForgiving()
          Returns true if the parser is forgiving.
 boolean getJsp()
          Returns true if the parser should handle special JSP forgiveness.
 java.lang.Object getProperty(java.lang.String name)
           
 boolean getResinInclude()
          Returns true if resin:include will include other XML documents.
 Path getSearchPath()
          Gets the search path for included documents.
 boolean getSkipComments()
           
 boolean isCoalescing()
          Returns true if text and cdata nodes will be combined.
 boolean isDtdValidating()
          Returns true if the XML should be validated
 boolean isNamespaceAware()
          Returns true if the parsing is namespace aware.
 boolean isNamespacePrefixes()
          Returns true if the parsing uses namespace prefixes
 boolean isSAXNamespaces()
          Returns true if the parsing uses sax namespaces
 boolean isValidating()
          Returns true if the XML should be validated
protected  java.io.InputStream openSource(org.xml.sax.InputSource source)
          Opens the source
 java.io.InputStream openStream(java.lang.String systemId, java.lang.String publicId)
          Looks up an input stream from the system id.
 java.io.InputStream openStream(java.lang.String systemId, java.lang.String publicId, org.xml.sax.EntityResolver entityResolver)
          Looks up an input stream from the system id.
protected  java.io.InputStream openStream(java.lang.String systemId, java.lang.String publicId, org.xml.sax.EntityResolver entityResolver, boolean isTop)
          Looks up an input stream from the system id.
 java.io.InputStream openTopStream(java.lang.String systemId, java.lang.String publicId)
          Looks up an input stream from the system id.
 void parse(org.xml.sax.InputSource source)
          SAX parsing from a SAX InputSource
 void parse(java.io.InputStream is)
          SAX parsing from an InputStream
 void parse(java.io.InputStream is, java.lang.String systemId)
          SAX parsing from an InputStream
 void parse(Path path)
          SAX parsing from a VFS path
 void parse(java.lang.String systemId)
          SAX parsing from a file path
 org.w3c.dom.Document parseDocument(org.xml.sax.InputSource source)
          Parses a document from a SAX InputSource
 org.w3c.dom.Document parseDocument(java.io.InputStream is)
          Parses an input stream into a DOM document
 org.w3c.dom.Document parseDocument(java.io.InputStream is, java.lang.String systemId)
          Parses an input stream into a DOM document
 org.w3c.dom.Document parseDocument(Path path)
          Parses a document from a VFS path
 void parseDocument(QDocument doc, java.io.InputStream is, java.lang.String systemId)
           
 org.w3c.dom.Document parseDocument(java.lang.String systemId)
          Parses a document from system path.
 org.w3c.dom.Document parseDocumentString(java.lang.String string)
          Parses a string into a DOM document
 void parseImpl(java.io.InputStream is, java.lang.String systemId)
          SAX parsing from an InputStream
 void parseString(java.lang.String string)
          SAX parsing from a string.
 void setAutodetectXml(boolean autodetectXml)
          Set true if the parser should switch from HTML to XML if it detects the <?xml ?> header.
 void setCoalescing(boolean isCoalescing)
          Set true if text and cdata nodes should be combined.
 void setConfig(javax.xml.parsers.DocumentBuilderFactory factory)
          Sets the configuration for a document builder.
 void setContentHandler(org.xml.sax.ContentHandler handler)
           
 void setDefaultEncoding(java.lang.String encoding)
          Sets the default encoding if none is specified.
 void setDocumentHandler(org.xml.sax.DocumentHandler handler)
          Configures the document handler callback.
 void setDTDHandler(org.xml.sax.DTDHandler handler)
           
 void setDtdValidating(boolean isValidating)
          Set true if the XML should be validated
 void setEntitiesAsText(boolean entitiesAsText)
           
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          Sets the callback object to find files.
 void setErrorHandler(org.xml.sax.ErrorHandler handler)
           
 void setExpandEntities(boolean expandEntities)
           
 void setFeature(java.lang.String name, boolean value)
           
 void setFilename(java.lang.String filename)
           
 void setForgiving(boolean forgiving)
          Sets the parser as a forgiving parser, allowing some non-strict XML.
 void setJsp(boolean isJsp)
          Sets the parser to handle special JSP forgiveness.
 void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
           
 void setLocale(java.util.Locale locale)
           
 void setNamespaceAware(boolean isNamespaceAware)
          Set true if the parsing is namespace aware.
 void setNamespacePrefixes(boolean isNamespaces)
          Set true if the parsing uses sax namespaces
 void setOwner(QDocument doc)
          Sets the owner.
 void setProperty(java.lang.String name, java.lang.Object obj)
           
 void setResinInclude(boolean doResinInclude)
          Enables including of other XML documents with resin:include.
 void setSAXNamespaces(boolean isNamespaces)
          Set true if the parsing uses sax namespaces
 void setSearchPath(Path path)
          Sets the search path for included documents.
 void setSkipComments(boolean skipComments)
          Set to true if comments should be skipped.
 void setSkipWhitespace(boolean skipWhitespace)
          Set to true if ignorable-whitespace should be skipped.
 void setToLower(boolean toLower)
          If true, normalizes HTML tags to lower case.
 void setValidating(boolean isValidating)
          Set true if the XML should be validated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setOwner

public void setOwner(QDocument doc)
Sets the owner.


getEncoding

public java.lang.String getEncoding()

setFilename

public void setFilename(java.lang.String filename)

setConfig

public void setConfig(javax.xml.parsers.DocumentBuilderFactory factory)
Sets the configuration for a document builder.


setEntitiesAsText

public void setEntitiesAsText(boolean entitiesAsText)

getEntitiesAsText

public boolean getEntitiesAsText()

setExpandEntities

public void setExpandEntities(boolean expandEntities)

setSkipComments

public void setSkipComments(boolean skipComments)
Set to true if comments should be skipped. If false events will be generated for the comments.


setSkipWhitespace

public void setSkipWhitespace(boolean skipWhitespace)
Set to true if ignorable-whitespace should be skipped.


isCoalescing

public boolean isCoalescing()
Returns true if text and cdata nodes will be combined.


setCoalescing

public void setCoalescing(boolean isCoalescing)
Set true if text and cdata nodes should be combined.


isValidating

public boolean isValidating()
Returns true if the XML should be validated


setValidating

public void setValidating(boolean isValidating)
Set true if the XML should be validated


isDtdValidating

public boolean isDtdValidating()
Returns true if the XML should be validated


setDtdValidating

public void setDtdValidating(boolean isValidating)
Set true if the XML should be validated


isNamespaceAware

public boolean isNamespaceAware()
Returns true if the parsing is namespace aware.


setNamespaceAware

public void setNamespaceAware(boolean isNamespaceAware)
Set true if the parsing is namespace aware.


isSAXNamespaces

public boolean isSAXNamespaces()
Returns true if the parsing uses sax namespaces


setSAXNamespaces

public void setSAXNamespaces(boolean isNamespaces)
Set true if the parsing uses sax namespaces


isNamespacePrefixes

public boolean isNamespacePrefixes()
Returns true if the parsing uses namespace prefixes


setNamespacePrefixes

public void setNamespacePrefixes(boolean isNamespaces)
Set true if the parsing uses sax namespaces


setToLower

public void setToLower(boolean toLower)
If true, normalizes HTML tags to lower case.


getSkipComments

public boolean getSkipComments()

setForgiving

public void setForgiving(boolean forgiving)
Sets the parser as a forgiving parser, allowing some non-strict XML.

Parameters:
forgiving - if true, forgives non-strict XML.

getForgiving

public boolean getForgiving()
Returns true if the parser is forgiving.

Returns:
true if the parser forgives non-strict XML.

setAutodetectXml

public void setAutodetectXml(boolean autodetectXml)
Set true if the parser should switch from HTML to XML if it detects the <?xml ?> header.


setJsp

public void setJsp(boolean isJsp)
Sets the parser to handle special JSP forgiveness.

Parameters:
isJsp - if true, handles special JSP forgiveness.

getJsp

public boolean getJsp()
Returns true if the parser should handle special JSP forgiveness.

Returns:
true if handles special JSP forgiveness.

setSearchPath

public void setSearchPath(Path path)
Sets the search path for included documents. MergePaths are often used.

Parameters:
path - the path to search

getSearchPath

public Path getSearchPath()
Gets the search path for included documents. MergePaths are often used.

Returns:
the path to search

setDefaultEncoding

public void setDefaultEncoding(java.lang.String encoding)
Sets the default encoding if none is specified.

Parameters:
encoding - the default encoding

getDefaultEncoding

public java.lang.String getDefaultEncoding()
Gets the default encoding if none is specified.


setResinInclude

public void setResinInclude(boolean doResinInclude)
Enables including of other XML documents with resin:include.

Parameters:
doResinInclude - if true, enables the include.

getResinInclude

public boolean getResinInclude()
Returns true if resin:include will include other XML documents.

Parameters:
doResinInclude - if true, enables the include.

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException
Specified by:
getProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object obj)
                 throws org.xml.sax.SAXNotSupportedException
Specified by:
setProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotSupportedException

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException
Specified by:
getFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotSupportedException
Specified by:
setFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotSupportedException

setLexicalHandler

public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Sets the callback object to find files.

Specified by:
setEntityResolver in interface org.xml.sax.Parser
Specified by:
setEntityResolver in interface org.xml.sax.XMLReader
Parameters:
resolver - the object to find files.

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Sets the callback object finding files from system ids.

Specified by:
getEntityResolver in interface org.xml.sax.XMLReader
Returns:
the resolver to find files.

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler handler)
Specified by:
setDTDHandler in interface org.xml.sax.Parser
Specified by:
setDTDHandler in interface org.xml.sax.XMLReader

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
Specified by:
getDTDHandler in interface org.xml.sax.XMLReader

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)
Specified by:
setContentHandler in interface org.xml.sax.XMLReader

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
Specified by:
getContentHandler in interface org.xml.sax.XMLReader

setDocumentHandler

public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
Configures the document handler callback.

Specified by:
setDocumentHandler in interface org.xml.sax.Parser
Parameters:
handler - the new document handler.

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler handler)
Specified by:
setErrorHandler in interface org.xml.sax.Parser
Specified by:
setErrorHandler in interface org.xml.sax.XMLReader

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface org.xml.sax.XMLReader

setLocale

public void setLocale(java.util.Locale locale)
Specified by:
setLocale in interface org.xml.sax.Parser

parse

public void parse(org.xml.sax.InputSource source)
           throws java.io.IOException,
                  org.xml.sax.SAXException
SAX parsing from a SAX InputSource

Specified by:
parse in interface org.xml.sax.Parser
Specified by:
parse in interface org.xml.sax.XMLReader
Parameters:
source - source containing the XML
Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public void parse(java.io.InputStream is)
           throws java.io.IOException,
                  org.xml.sax.SAXException
SAX parsing from an InputStream

Parameters:
is - stream containing the XML
Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public void parse(java.io.InputStream is,
                  java.lang.String systemId)
           throws java.io.IOException,
                  org.xml.sax.SAXException
SAX parsing from an InputStream

Parameters:
is - stream containing the XML
Throws:
java.io.IOException
org.xml.sax.SAXException

parseImpl

public void parseImpl(java.io.InputStream is,
                      java.lang.String systemId)
               throws java.io.IOException,
                      org.xml.sax.SAXException
SAX parsing from an InputStream

Parameters:
is - stream containing the XML
Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public void parse(java.lang.String systemId)
           throws java.io.IOException,
                  org.xml.sax.SAXException
SAX parsing from a file path

Specified by:
parse in interface org.xml.sax.Parser
Specified by:
parse in interface org.xml.sax.XMLReader
Parameters:
systemId - path to the file containing the XML
Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public void parse(Path path)
           throws java.io.IOException,
                  org.xml.sax.SAXException
SAX parsing from a VFS path

Throws:
java.io.IOException
org.xml.sax.SAXException

parseString

public void parseString(java.lang.String string)
                 throws java.io.IOException,
                        org.xml.sax.SAXException
SAX parsing from a string.

Parameters:
string - string containing the XML
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocument

public org.w3c.dom.Document parseDocument(org.xml.sax.InputSource source)
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException
Parses a document from a SAX InputSource

Parameters:
source - SAX InputSource containing the XML data.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocument

public org.w3c.dom.Document parseDocument(java.lang.String systemId)
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException
Parses a document from system path.

Parameters:
systemId - path to the XML data.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocument

public org.w3c.dom.Document parseDocument(Path path)
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException
Parses a document from a VFS path

Parameters:
path - the VFS path containing the XML document.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocument

public org.w3c.dom.Document parseDocument(java.io.InputStream is)
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException
Parses an input stream into a DOM document

Parameters:
is - the input stream containing the XML
Returns:
the parsed document.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocument

public org.w3c.dom.Document parseDocument(java.io.InputStream is,
                                          java.lang.String systemId)
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException
Parses an input stream into a DOM document

Parameters:
is - the input stream containing the XML
systemId - the URL of the stream.
Returns:
the parsed document.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocument

public void parseDocument(QDocument doc,
                          java.io.InputStream is,
                          java.lang.String systemId)
                   throws java.io.IOException,
                          org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocumentString

public org.w3c.dom.Document parseDocumentString(java.lang.String string)
                                         throws java.io.IOException,
                                                org.xml.sax.SAXException
Parses a string into a DOM document

Parameters:
string - the string containing the XML
Throws:
java.io.IOException
org.xml.sax.SAXException

openStream

public java.io.InputStream openStream(java.lang.String systemId,
                                      java.lang.String publicId)
                               throws java.io.IOException,
                                      org.xml.sax.SAXException
Looks up an input stream from the system id.

Throws:
java.io.IOException
org.xml.sax.SAXException

openTopStream

public java.io.InputStream openTopStream(java.lang.String systemId,
                                         java.lang.String publicId)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException
Looks up an input stream from the system id.

Throws:
java.io.IOException
org.xml.sax.SAXException

openStream

public java.io.InputStream openStream(java.lang.String systemId,
                                      java.lang.String publicId,
                                      org.xml.sax.EntityResolver entityResolver)
                               throws java.io.IOException,
                                      org.xml.sax.SAXException
Looks up an input stream from the system id.

Throws:
java.io.IOException
org.xml.sax.SAXException

openStream

protected java.io.InputStream openStream(java.lang.String systemId,
                                         java.lang.String publicId,
                                         org.xml.sax.EntityResolver entityResolver,
                                         boolean isTop)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException
Looks up an input stream from the system id.

Throws:
java.io.IOException
org.xml.sax.SAXException

openSource

protected java.io.InputStream openSource(org.xml.sax.InputSource source)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException
Opens the source

Throws:
java.io.IOException
org.xml.sax.SAXException