|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler org.zkoss.idom.input.SAXHandler
public class SAXHandler
The SAX Handler. It implements ContentHandler, LexicalHandler and DeclHandler. It is the caller's job to set up this handler properly if required.
This class doesn't depend on SAXBuilder, so it can be used in any other place, e.g., javax.xml.transform.sax.SAXResult.
SAXBuilder
Field Summary | |
---|---|
protected java.util.List<Namespace> |
_declNamespaces
The namespaces in between startPrefixMapping and endPrefixMapping. |
protected Document |
_doc
The Document being created. |
protected IDOMFactory |
_factory
The iDOM factory. |
protected boolean |
_inCData
Indicator of whether we are in a CDATA. |
protected boolean |
_inDTD
Indicator of whether we are in a DTD. |
protected org.xml.sax.Locator |
_loc
Locator. |
protected java.util.Stack<Group> |
_stack
The Group stack. |
Constructor Summary | |
---|---|
SAXHandler()
Constructor. |
|
SAXHandler(IDOMFactory factory)
Constructor. |
Method Summary | |
---|---|
protected void |
addToCurrentGroup(Item vtx)
Adds the item to the current group; also attach the locator. |
protected void |
attachLocator(Item vtx)
Attaches the locator to the item. |
void |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
|
void |
characters(char[] ch,
int start,
int length)
|
void |
comment(char[] ch,
int start,
int length)
|
protected org.xml.sax.InputSource |
defaultResolveEntity(java.lang.String publicId,
java.lang.String systemId)
The default entity resolver. |
void |
elementDecl(java.lang.String name,
java.lang.String model)
|
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(java.lang.String nsURI,
java.lang.String lname,
java.lang.String tname)
|
void |
endEntity(java.lang.String name)
|
void |
endPrefixMapping(java.lang.String prefix)
|
void |
error(org.xml.sax.SAXParseException ex)
|
void |
externalEntityDecl(java.lang.String name,
java.lang.String pubId,
java.lang.String sysId)
|
void |
fatalError(org.xml.sax.SAXParseException ex)
|
Document |
getDocument()
Gets the document being created. |
org.xml.sax.EntityResolver |
getEntityResolver()
Gets the org.xml.sax.EntityResolver. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Gets the org.xml.sax.ErrorHandler. |
IDOMFactory |
getIDOMFactory()
Gets the iDOM factory. |
protected Group |
getTopGroup()
Returns the top group, or null if not available. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
|
boolean |
isCoalescing()
Indicates whether or not the factory is configured to produce parsers which converts CDATA to Text and appends it to the adjacent (if any) Text node. |
boolean |
isExpandEntityReferences()
Tests whether to expand entity reference nodes. |
boolean |
isIgnoringComments()
Indicates whether or not the factory is configured to produce parsers which ignores comments. |
boolean |
isIgnoringElementContentWhitespace()
Tests whether to ignore whitespaces in element content. |
void |
notationDecl(java.lang.String name,
java.lang.String publicID,
java.lang.String systemID)
|
protected void |
popGroup()
Pops out the current group, and the one under it becomes the new current group. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
|
protected void |
pushGroup(Group group)
Adds a new group to the current group as a child, and pushes the new group to be the new current group. |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
|
void |
setCoalescing(boolean coalescing)
Specifies that the parser produced by this code will convert CDATA to Text and append it to the adjacent (if any) text. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
void |
setEntityResolver(org.xml.sax.EntityResolver er)
Specifies the org.xml.sax.EntityResolver to be used to resolve entities present in the XML document to be parsed. |
void |
setErrorHandler(org.xml.sax.ErrorHandler eh)
Specifies the org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
void |
setExpandEntityReferences(boolean expand)
Sets whether to expand entities during parsing. |
void |
setIDOMFactory(IDOMFactory factory)
Sets the iDOM factory. |
void |
setIgnoringComments(boolean ignoreComments)
Specifies that the parser produced by this code will ignore comments. |
void |
setIgnoringElementContentWhitespace(boolean ignore)
Sets whether the parser should eliminate whitespace in element content. |
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(java.lang.String name,
java.lang.String pubId,
java.lang.String sysId)
|
void |
startElement(java.lang.String nsURI,
java.lang.String lname,
java.lang.String tname,
org.xml.sax.Attributes attrs)
|
void |
startEntity(java.lang.String name)
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
|
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String pubId,
java.lang.String sysId,
java.lang.String notationName)
|
void |
warning(org.xml.sax.SAXParseException ex)
|
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
skippedEntity |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IDOMFactory _factory
protected Document _doc
protected org.xml.sax.Locator _loc
protected boolean _inDTD
protected boolean _inCData
protected java.util.Stack<Group> _stack
protected java.util.List<Namespace> _declNamespaces
Constructor Detail |
---|
public SAXHandler(IDOMFactory factory)
factory
- the iDOM factory; null for DefaultIDOMFactory.public SAXHandler()
Method Detail |
---|
public final boolean isIgnoringElementContentWhitespace()
public final void setIgnoringElementContentWhitespace(boolean ignore)
For this setting to take effect requires that validation be turned on.
Default: false.
ignore
- Whether to ignore whitespaces in element content.public final boolean isExpandEntityReferences()
public final void setExpandEntityReferences(boolean expand)
EntityReference
objects.
Default: true.
expand
- whether entity expansion should occur.public final boolean isCoalescing()
Default: false.
public final void setCoalescing(boolean coalescing)
Default: false.
public final boolean isIgnoringComments()
Default: false.
public final void setIgnoringComments(boolean ignoreComments)
Default: false.
public final void setErrorHandler(org.xml.sax.ErrorHandler eh)
Default: null -- to use the default implementation and behavior.
public final org.xml.sax.ErrorHandler getErrorHandler()
public final void setEntityResolver(org.xml.sax.EntityResolver er)
Default: null -- to use the default implementation and behavior.
public final org.xml.sax.EntityResolver getEntityResolver()
public final Document getDocument()
public final IDOMFactory getIDOMFactory()
public final void setIDOMFactory(IDOMFactory factory)
protected final void attachLocator(Item vtx)
protected final Group getTopGroup()
protected final void addToCurrentGroup(Item vtx)
protected final void pushGroup(Group group)
protected final void popGroup()
public void externalEntityDecl(java.lang.String name, java.lang.String pubId, java.lang.String sysId) throws org.xml.sax.SAXException
externalEntityDecl
in interface org.xml.sax.ext.DeclHandler
org.xml.sax.SAXException
public void internalEntityDecl(java.lang.String name, java.lang.String value) throws org.xml.sax.SAXException
internalEntityDecl
in interface org.xml.sax.ext.DeclHandler
org.xml.sax.SAXException
public void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value) throws org.xml.sax.SAXException
attributeDecl
in interface org.xml.sax.ext.DeclHandler
org.xml.sax.SAXException
public void elementDecl(java.lang.String name, java.lang.String model) throws org.xml.sax.SAXException
elementDecl
in interface org.xml.sax.ext.DeclHandler
org.xml.sax.SAXException
public void startDTD(java.lang.String name, java.lang.String pubId, java.lang.String sysId) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
startEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
startPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
endPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void startElement(java.lang.String nsURI, java.lang.String lname, java.lang.String tname, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endElement(java.lang.String nsURI, java.lang.String lname, java.lang.String tname) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ignorableWhitespace
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void notationDecl(java.lang.String name, java.lang.String publicID, java.lang.String systemID) throws org.xml.sax.SAXException
notationDecl
in interface org.xml.sax.DTDHandler
notationDecl
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void unparsedEntityDecl(java.lang.String name, java.lang.String pubId, java.lang.String sysId, java.lang.String notationName) throws org.xml.sax.SAXException
unparsedEntityDecl
in interface org.xml.sax.DTDHandler
unparsedEntityDecl
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
resolveEntity
in interface org.xml.sax.EntityResolver
resolveEntity
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
protected org.xml.sax.InputSource defaultResolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
setEntityResolver(org.xml.sax.EntityResolver)
is not called.
This implementation searches the class path under /metainfo/xml.
For example, http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd is asked. It searches from classpath for /metainfo/xml/java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd and /metainfo/xml/portlet-app_1_0.xsd
org.xml.sax.SAXException
public void warning(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
fatalError
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |