|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.dom4j.io.SAXContentHandler
SAXContentHandler
builds a dom4j tree via SAX events.
Constructor Summary | |
SAXContentHandler()
|
|
SAXContentHandler(DocumentFactory documentFactory)
|
|
SAXContentHandler(DocumentFactory documentFactory,
ElementHandler elementHandler)
|
|
SAXContentHandler(DocumentFactory documentFactory,
ElementHandler elementHandler,
org.dom4j.io.ElementStack elementStack)
|
Method Summary | |
protected void |
addAttributes(Element element,
org.xml.sax.Attributes attributes)
Add all the attributes to the given elements |
protected void |
addDeclaredNamespaces(Element element)
Add all namespaces declared before the startElement() SAX event to the current element so that they are available to child elements and attributes |
protected void |
addDTDDeclaration(java.lang.Object declaration)
Adds an internal DTD declaration to the list of declarations |
protected void |
addExternalDTDDeclaration(java.lang.Object declaration)
Adds an external DTD declaration to the list of declarations |
void |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
Report an attribute type declaration. |
void |
characters(char[] ch,
int start,
int end)
|
void |
comment(char[] ch,
int start,
int end)
|
protected void |
completeCurrentTextNode()
If the current text buffer contains any text then create a new text node with it and add it to the current element |
protected Document |
createDocument()
|
protected org.dom4j.io.ElementStack |
createElementStack()
|
void |
elementDecl(java.lang.String name,
java.lang.String model)
Report an element type declaration. |
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
|
void |
endEntity(java.lang.String name)
|
void |
endPrefixMapping(java.lang.String prefix)
|
void |
error(org.xml.sax.SAXParseException exception)
This method is called when an error is detected during parsing such as a validation error. |
void |
externalEntityDecl(java.lang.String name,
java.lang.String publicID,
java.lang.String systemID)
Report a parsed external entity declaration. |
void |
fatalError(org.xml.sax.SAXParseException exception)
This method is called when a fatal error occurs during parsing. |
Document |
getDocument()
|
org.dom4j.io.ElementStack |
getElementStack()
|
org.xml.sax.EntityResolver |
getEntityResolver()
|
org.xml.sax.InputSource |
getInputSource()
|
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
Report an internal entity declaration. |
protected boolean |
isIgnorableEntity(java.lang.String name)
a Strategy Method to determine if a given entity name is ignorable |
boolean |
isIgnoreComments()
Returns whether we should ignore comments or not. |
boolean |
isIncludeExternalDTDDeclarations()
|
boolean |
isIncludeInternalDTDDeclarations()
|
boolean |
isMergeAdjacentText()
Returns whether adjacent text nodes should be merged together. |
boolean |
isStripWhitespaceText()
Sets whether whitespace between element start and end tags should be ignored |
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Receive notification of a notation declaration event. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
|
void |
setElementStack(org.dom4j.io.ElementStack elementStack)
|
void |
setEntityResolver(org.xml.sax.EntityResolver entityResolver)
|
void |
setIgnoreComments(boolean ignoreComments)
Sets whether we should ignore comments or not. |
void |
setIncludeExternalDTDDeclarations(boolean includeExternalDTDDeclarations)
Sets whether DTD external declarations should be expanded into the DocumentType object or not. |
void |
setIncludeInternalDTDDeclarations(boolean includeInternalDTDDeclarations)
Sets whether internal DTD declarations should be expanded into the DocumentType object or not. |
void |
setInputSource(org.xml.sax.InputSource inputSource)
|
void |
setMergeAdjacentText(boolean mergeAdjacentText)
Sets whether or not adjacent text nodes should be merged together when parsing. |
void |
setStripWhitespaceText(boolean stripWhitespaceText)
Sets whether whitespace between element start and end tags should be ignored. |
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
|
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
|
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 publicId,
java.lang.String systemId,
java.lang.String notationName)
Receive notification of an unparsed entity declaration event. |
void |
warning(org.xml.sax.SAXParseException exception)
This method is called when a warning occurs during the parsing of the document. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
ignorableWhitespace, resolveEntity, setDocumentLocator, skippedEntity |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SAXContentHandler()
public SAXContentHandler(DocumentFactory documentFactory)
public SAXContentHandler(DocumentFactory documentFactory, ElementHandler elementHandler)
public SAXContentHandler(DocumentFactory documentFactory, ElementHandler elementHandler, org.dom4j.io.ElementStack elementStack)
Method Detail |
public Document getDocument()
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
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
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
endElement
in interface org.xml.sax.ContentHandler
public void characters(char[] ch, int start, int end) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) 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 end) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void elementDecl(java.lang.String name, java.lang.String model) throws org.xml.sax.SAXException
The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all parameter entities are fully resolved and all whitespace is removed,and will include the enclosing parentheses. Other normalization (such as removing redundant parentheses or simplifying occurrence indicators) is at the discretion of the parser.
elementDecl
in interface org.xml.sax.ext.DeclHandler
name
- The element type name.model
- The content model as a normalized string.
org.xml.sax.SAXException
- The application may raise an exception.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
Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group with the separator "|" and all whitespace removed, or the word "NOTATION" followed by a space followed by a parenthesized token group with all whitespace removed.
Any parameter entities in the attribute value will be expanded, but general entities will not.
attributeDecl
in interface org.xml.sax.ext.DeclHandler
eName
- The name of the associated element.aName
- The name of the attribute.type
- A string representing the attribute type.valueDefault
- A string representing the attribute default
("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
none of these applies.value
- A string representing the attribute's default value,
or null if there is none.
org.xml.sax.SAXException
- The application may raise an exception.public void internalEntityDecl(java.lang.String name, java.lang.String value) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported. All parameter entities in the value will be expanded, but general entities will not.
internalEntityDecl
in interface org.xml.sax.ext.DeclHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.value
- The replacement text of the entity.
org.xml.sax.SAXException
- The application may raise an exception.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void externalEntityDecl(java.lang.String name, java.lang.String publicID, java.lang.String systemID) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported.
externalEntityDecl
in interface org.xml.sax.ext.DeclHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.
org.xml.sax.SAXException
- The application may raise an exception.internalEntityDecl(java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
It is up to the application to record the notation for later reference, if necessary.
At least one of publicId and systemId must be non-null. If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application through this event.
There is no guarantee that the notation declaration will be reported before any unparsed entities that use it.
notationDecl
in interface org.xml.sax.DTDHandler
name
- The notation name.publicId
- The notation's public identifier, or null if
none was given.systemId
- The notation's system identifier, or null if
none was given.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws org.xml.sax.SAXException
Note that the notation name corresponds to a notation
reported by the notationDecl
event.
It is up to the application to record the entity for later
reference, if necessary.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
unparsedEntityDecl
in interface org.xml.sax.DTDHandler
name
- The unparsed entity's name.publicId
- The entity's public identifier, or null if none
was given.systemId
- The entity's system identifier.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.notationDecl(java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public org.dom4j.io.ElementStack getElementStack()
public void setElementStack(org.dom4j.io.ElementStack elementStack)
public org.xml.sax.EntityResolver getEntityResolver()
public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
public org.xml.sax.InputSource getInputSource()
public void setInputSource(org.xml.sax.InputSource inputSource)
public boolean isIncludeInternalDTDDeclarations()
public void setIncludeInternalDTDDeclarations(boolean includeInternalDTDDeclarations)
includeInternalDTDDeclarations
- whether or not DTD declarations should be expanded
and included into the DocumentType object.public boolean isIncludeExternalDTDDeclarations()
public void setIncludeExternalDTDDeclarations(boolean includeExternalDTDDeclarations)
public boolean isMergeAdjacentText()
public void setMergeAdjacentText(boolean mergeAdjacentText)
mergeAdjacentText
- New value of property mergeAdjacentText.public boolean isStripWhitespaceText()
public void setStripWhitespaceText(boolean stripWhitespaceText)
stripWhitespaceText
- New value of property stripWhitespaceText.public boolean isIgnoreComments()
public void setIgnoreComments(boolean ignoreComments)
ignoreComments
- whether we should ignore comments or not.protected void completeCurrentTextNode()
protected Document createDocument()
protected boolean isIgnorableEntity(java.lang.String name)
protected void addDeclaredNamespaces(Element element)
protected void addAttributes(Element element, org.xml.sax.Attributes attributes)
protected void addDTDDeclaration(java.lang.Object declaration)
protected void addExternalDTDDeclaration(java.lang.Object declaration)
protected org.dom4j.io.ElementStack createElementStack()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |