|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.zkoss.idom.input.SAXHandler
public class SAXHandler
The SAX Hanlder. 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 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 Locator |
_loc
Locator. |
protected 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(String eName,
String aName,
String type,
String valueDefault,
String value)
|
void |
characters(char[] ch,
int start,
int length)
|
void |
comment(char[] ch,
int start,
int length)
|
protected InputSource |
defaultResolveEntity(String publicId,
String systemId)
The default entity resolver. |
void |
elementDecl(String name,
String model)
|
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(String nsURI,
String lname,
String tname)
|
void |
endEntity(String name)
|
void |
endPrefixMapping(String prefix)
|
void |
error(SAXParseException ex)
|
void |
externalEntityDecl(String name,
String pubId,
String sysId)
|
void |
fatalError(SAXParseException ex)
|
Document |
getDocument()
Gets the document being created. |
EntityResolver |
getEntityResolver()
Gets the org.xml.sax.EntityResolver. |
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(String name,
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(String name,
String publicID,
String systemID)
|
protected void |
popGroup()
Pops out the current group, and the one under it becomes the new current group. |
void |
processingInstruction(String target,
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. |
InputSource |
resolveEntity(String publicId,
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(Locator locator)
|
void |
setEntityResolver(EntityResolver er)
Specifies the org.xml.sax.EntityResolver to be used to resolve entities present in the XML docu-ment to be parsed. |
void |
setErrorHandler(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 elminate whitespace in element content. |
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(String name,
String pubId,
String sysId)
|
void |
startElement(String nsURI,
String lname,
String tname,
Attributes attrs)
|
void |
startEntity(String name)
|
void |
startPrefixMapping(String prefix,
String uri)
|
void |
unparsedEntityDecl(String name,
String pubId,
String sysId,
String notationName)
|
void |
warning(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 Locator _loc
protected boolean _inDTD
protected boolean _inCData
protected Stack<Group> _stack
protected 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(ErrorHandler eh)
Default: null -- to use the default imple-mentation and behavior.
public final ErrorHandler getErrorHandler()
public final void setEntityResolver(EntityResolver er)
Default: null -- to use the default implementation and behavior.
public final 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(String name,
String pubId,
String sysId)
throws SAXException
externalEntityDecl in interface DeclHandlerSAXException
public void internalEntityDecl(String name,
String value)
throws SAXException
internalEntityDecl in interface DeclHandlerSAXException
public void attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
throws SAXException
attributeDecl in interface DeclHandlerSAXException
public void elementDecl(String name,
String model)
throws SAXException
elementDecl in interface DeclHandlerSAXException
public void startDTD(String name,
String pubId,
String sysId)
throws SAXException
startDTD in interface LexicalHandlerSAXException
public void endDTD()
throws SAXException
endDTD in interface LexicalHandlerSAXException
public void startEntity(String name)
throws SAXException
startEntity in interface LexicalHandlerSAXException
public void endEntity(String name)
throws SAXException
endEntity in interface LexicalHandlerSAXException
public void startCDATA()
throws SAXException
startCDATA in interface LexicalHandlerSAXException
public void endCDATA()
throws SAXException
endCDATA in interface LexicalHandlerSAXException
public void comment(char[] ch,
int start,
int length)
throws SAXException
comment in interface LexicalHandlerSAXException
public void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerSAXException
public void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class org.xml.sax.helpers.DefaultHandler
public void processingInstruction(String target,
String data)
throws SAXException
processingInstruction in interface ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlerSAXException
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.DefaultHandlerSAXException
public void endPrefixMapping(String prefix)
throws SAXException
endPrefixMapping in interface ContentHandlerendPrefixMapping in class org.xml.sax.helpers.DefaultHandlerSAXException
public void startElement(String nsURI,
String lname,
String tname,
Attributes attrs)
throws SAXException
startElement in interface ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerSAXException
public void endElement(String nsURI,
String lname,
String tname)
throws SAXException
endElement in interface ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerSAXException
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerSAXException
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerignorableWhitespace in class org.xml.sax.helpers.DefaultHandlerSAXException
public void notationDecl(String name,
String publicID,
String systemID)
throws SAXException
notationDecl in interface DTDHandlernotationDecl in class org.xml.sax.helpers.DefaultHandlerSAXException
public void unparsedEntityDecl(String name,
String pubId,
String sysId,
String notationName)
throws SAXException
unparsedEntityDecl in interface DTDHandlerunparsedEntityDecl in class org.xml.sax.helpers.DefaultHandlerSAXException
public InputSource resolveEntity(String publicId,
String systemId)
throws SAXException
resolveEntity in interface EntityResolverresolveEntity in class org.xml.sax.helpers.DefaultHandlerSAXException
protected InputSource defaultResolveEntity(String publicId,
String systemId)
throws 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
SAXException
public void warning(SAXParseException ex)
throws SAXException
warning in interface ErrorHandlerwarning in class org.xml.sax.helpers.DefaultHandlerSAXException
public void error(SAXParseException ex)
throws SAXException
error in interface ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlerSAXException
public void fatalError(SAXParseException ex)
throws SAXException
fatalError in interface ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlerSAXException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||