public class SAXDocumentFactory extends org.xml.sax.helpers.DefaultHandler implements org.xml.sax.ext.LexicalHandler, DocumentFactory
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
SAXDocumentFactory.PreInfo |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
createDocumentDescriptor
Whether a document descriptor must be generated.
|
protected org.w3c.dom.Node |
currentNode
The current node.
|
protected org.w3c.dom.DocumentType |
doctype
The DTD to use when the document is created.
|
protected org.w3c.dom.Document |
document
The created document.
|
protected DocumentDescriptor |
documentDescriptor
The created document descriptor.
|
protected org.xml.sax.ErrorHandler |
errorHandler
The error handler.
|
protected org.w3c.dom.DOMImplementation |
implementation
The DOM implementation used to create the document.
|
protected boolean |
inCDATA
True if the parser is currently parsing a CDATA section.
|
protected boolean |
inDTD
True if the parser is currently parsing a DTD.
|
protected boolean |
inProlog
Whether the parser still hasn't read the document element's
opening tag.
|
protected boolean |
isStandalone
Whether the document just parsed was standalone.
|
protected boolean |
isValidating
Whether the parser is in validating mode.
|
protected org.xml.sax.Locator |
locator
The locator.
|
protected HashTableStack |
namespaces
The stack used to store the namespace URIs.
|
protected org.xml.sax.XMLReader |
parser
The SAX2 parser object.
|
protected java.lang.String |
parserClassName
The SAX2 parser classname.
|
protected java.util.List |
preInfo
Various elements encountered prior to real document root element.
|
protected java.lang.StringBuffer |
stringBuffer
Contains collected string data.
|
protected boolean |
stringContent
Indicates if stringBuffer has content, needed in case of
zero sized "text" content.
|
protected java.lang.String |
xmlVersion
XML version of the document just parsed.
|
| Constructor and Description |
|---|
SAXDocumentFactory(org.w3c.dom.DOMImplementation impl,
java.lang.String parser)
Creates a new SAXDocumentFactory object.
|
SAXDocumentFactory(org.w3c.dom.DOMImplementation impl,
java.lang.String parser,
boolean dd)
Creates a new SAXDocumentFactory object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendStringData() |
void |
characters(char[] ch,
int start,
int length)
SAX: Implements
ContentHandler.characters(char[],int,int). |
void |
comment(char[] ch,
int start,
int length)
SAX: Implements
LexicalHandler.comment(char[],int,int). |
protected org.w3c.dom.Document |
createDocument(org.xml.sax.InputSource is)
Creates a Document.
|
org.w3c.dom.Document |
createDocument(java.lang.String uri)
Creates a Document instance.
|
org.w3c.dom.Document |
createDocument(java.lang.String uri,
java.io.InputStream is)
Creates a Document instance.
|
org.w3c.dom.Document |
createDocument(java.lang.String uri,
java.io.Reader r)
Creates a Document instance.
|
org.w3c.dom.Document |
createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri)
Creates a Document instance.
|
protected org.w3c.dom.Document |
createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
org.xml.sax.InputSource is)
Creates a Document.
|
org.w3c.dom.Document |
createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
java.io.InputStream is)
Creates a Document instance.
|
org.w3c.dom.Document |
createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
java.io.Reader r)
Creates a Document instance.
|
org.w3c.dom.Document |
createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
org.xml.sax.XMLReader r)
Creates a Document instance.
|
void |
endCDATA()
SAX: Implements
LexicalHandler.endCDATA(). |
void |
endDTD()
SAX: Implements
LexicalHandler.endDTD(). |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName)
SAX: Implements
ContentHandler.endElement(String,String,String). |
void |
endEntity(java.lang.String name)
SAX: Implements
LexicalHandler.endEntity(String). |
void |
error(org.xml.sax.SAXParseException ex)
SAX: Implements
ErrorHandler.error(SAXParseException). |
void |
fatalError(org.xml.sax.SAXParseException ex)
SAX: Implements
ErrorHandler.fatalError(SAXParseException). |
DocumentDescriptor |
getDocumentDescriptor()
Returns the document descriptor associated with the latest created
document.
|
org.w3c.dom.DOMImplementation |
getDOMImplementation(java.lang.String ver) |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
SAX: Implements
ContentHandler.ignorableWhitespace(char[],int,int). |
boolean |
isValidating()
Returns true if the XML parser validates the XML stream, false
otherwise.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
SAX: Implements
ContentHandler.processingInstruction(String,String). |
void |
setDocumentLocator(org.xml.sax.Locator l)
SAX: Implements
ContentHandler.setDocumentLocator(Locator). |
void |
setErrorHandler(org.xml.sax.ErrorHandler eh)
Sets a custom error handler.
|
void |
setValidating(boolean isValidating)
Sets whether or not the XML parser will validate the XML document
depending on the specified parameter.
|
void |
startCDATA()
SAX: Implements
LexicalHandler.startCDATA(). |
void |
startDocument()
SAX: Implements
ContentHandler.startDocument(). |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
SAX: Implements
LexicalHandler.startDTD(String,String,String). |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attributes)
SAX: Implements
ContentHandler.startElement(String,String,String,Attributes). |
void |
startEntity(java.lang.String name)
SAX: Implements
LexicalHandler.startEntity(String). |
void |
warning(org.xml.sax.SAXParseException ex)
SAX: Implements
ErrorHandler.warning(SAXParseException). |
protected org.w3c.dom.DOMImplementation implementation
protected java.lang.String parserClassName
protected org.xml.sax.XMLReader parser
protected org.w3c.dom.Document document
protected DocumentDescriptor documentDescriptor
protected boolean createDocumentDescriptor
protected org.w3c.dom.Node currentNode
protected org.xml.sax.Locator locator
protected java.lang.StringBuffer stringBuffer
protected org.w3c.dom.DocumentType doctype
protected boolean stringContent
protected boolean inDTD
protected boolean inCDATA
protected boolean inProlog
protected boolean isValidating
protected boolean isStandalone
protected java.lang.String xmlVersion
protected HashTableStack namespaces
protected org.xml.sax.ErrorHandler errorHandler
protected java.util.List preInfo
public SAXDocumentFactory(org.w3c.dom.DOMImplementation impl,
java.lang.String parser)
impl - The DOM implementation to use for building the DOM tree.parser - The SAX2 parser classname.public SAXDocumentFactory(org.w3c.dom.DOMImplementation impl,
java.lang.String parser,
boolean dd)
impl - The DOM implementation to use for building the DOM tree.parser - The SAX2 parser classname.dd - Whether a document descriptor must be generated.public org.w3c.dom.Document createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri)
throws java.io.IOException
createDocument in interface DocumentFactoryns - The namespace URI of the root element of the document.root - The name of the root element of the document.uri - The document URI.java.io.IOException - if an error occured while reading the document.public org.w3c.dom.Document createDocument(java.lang.String uri)
throws java.io.IOException
uri - The document URI.java.io.IOException - if an error occured while reading the document.public org.w3c.dom.Document createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
java.io.InputStream is)
throws java.io.IOException
createDocument in interface DocumentFactoryns - The namespace URI of the root element of the document.root - The name of the root element of the document.uri - The document URI.is - The document input stream.java.io.IOException - if an error occured while reading the document.public org.w3c.dom.Document createDocument(java.lang.String uri,
java.io.InputStream is)
throws java.io.IOException
uri - The document URI.is - The document input stream.java.io.IOException - if an error occured while reading the document.public org.w3c.dom.Document createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
java.io.Reader r)
throws java.io.IOException
createDocument in interface DocumentFactoryns - The namespace URI of the root element of the document.root - The name of the root element of the document.uri - The document URI.r - The document reader.java.io.IOException - if an error occured while reading the document.public org.w3c.dom.Document createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
org.xml.sax.XMLReader r)
throws java.io.IOException
createDocument in interface DocumentFactoryns - The namespace URI of the root element of the document.root - The name of the root element of the document.uri - The document URI.r - an XMLReaderInstancejava.io.IOException - if an error occured while reading the document.public org.w3c.dom.Document createDocument(java.lang.String uri,
java.io.Reader r)
throws java.io.IOException
uri - The document URI.r - The document reader.java.io.IOException - if an error occured while reading the document.protected org.w3c.dom.Document createDocument(java.lang.String ns,
java.lang.String root,
java.lang.String uri,
org.xml.sax.InputSource is)
throws java.io.IOException
ns - The namespace URI of the root element.root - The name of the root element.uri - The document URI.is - The document input source.java.io.IOException - if an error occured while reading the document.protected org.w3c.dom.Document createDocument(org.xml.sax.InputSource is)
throws java.io.IOException
is - The document input source.java.io.IOException - if an error occured while reading the document.public DocumentDescriptor getDocumentDescriptor()
getDocumentDescriptor in interface DocumentFactorypublic void setDocumentLocator(org.xml.sax.Locator l)
ContentHandler.setDocumentLocator(Locator).setDocumentLocator in interface org.xml.sax.ContentHandlersetDocumentLocator in class org.xml.sax.helpers.DefaultHandlerpublic void setValidating(boolean isValidating)
setValidating in interface DocumentFactoryisValidating - indicates that the XML parser will validate the XML
documentpublic boolean isValidating()
isValidating in interface DocumentFactorypublic void setErrorHandler(org.xml.sax.ErrorHandler eh)
public org.w3c.dom.DOMImplementation getDOMImplementation(java.lang.String ver)
public void fatalError(org.xml.sax.SAXParseException ex)
throws org.xml.sax.SAXException
ErrorHandler.fatalError(SAXParseException).fatalError in interface org.xml.sax.ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void error(org.xml.sax.SAXParseException ex)
throws org.xml.sax.SAXException
ErrorHandler.error(SAXParseException).error in interface org.xml.sax.ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void warning(org.xml.sax.SAXParseException ex)
throws org.xml.sax.SAXException
ErrorHandler.warning(SAXParseException).warning in interface org.xml.sax.ErrorHandlerwarning in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void startDocument()
throws org.xml.sax.SAXException
ContentHandler.startDocument().startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
ContentHandler.startElement(String,String,String,Attributes).startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName)
throws org.xml.sax.SAXException
ContentHandler.endElement(String,String,String).endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void appendStringData()
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ContentHandler.characters(char[],int,int).characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ContentHandler.ignorableWhitespace(char[],int,int).ignorableWhitespace in interface org.xml.sax.ContentHandlerignorableWhitespace in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
ContentHandler.processingInstruction(String,String).processingInstruction in interface org.xml.sax.ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
LexicalHandler.startDTD(String,String,String).startDTD in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic void endDTD()
throws org.xml.sax.SAXException
LexicalHandler.endDTD().endDTD in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic void startEntity(java.lang.String name)
throws org.xml.sax.SAXException
LexicalHandler.startEntity(String).startEntity in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic void endEntity(java.lang.String name)
throws org.xml.sax.SAXException
LexicalHandler.endEntity(String).endEntity in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic void startCDATA()
throws org.xml.sax.SAXException
LexicalHandler.startCDATA().startCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic void endCDATA()
throws org.xml.sax.SAXException
LexicalHandler.endCDATA().endCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic void comment(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
LexicalHandler.comment(char[],int,int).comment in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionCopyright ? 2009 Apache Software Foundation. All Rights Reserved.