org.dom4j.io
Class SAXContentHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.dom4j.io.SAXContentHandler
All Implemented Interfaces:
ContentHandler, DeclHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler

public class SAXContentHandler
extends DefaultHandler
implements LexicalHandler, DeclHandler, DTDHandler

SAXContentHandler builds a dom4j tree via SAX events.

Version:
$Revision: 1.59 $
Author:
James Strachan

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, 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)
          Receive notification of character data inside an element.
 void comment(char[] ch, int start, int end)
          Report an XML comment anywhere in the document.
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()
          Report the end of a CDATA section.
 void endDocument()
          Receive notification of the end of the document.
 void endDTD()
          Report the end of DTD declarations.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Receive notification of the end of an element.
 void endEntity(java.lang.String name)
          Report the end of an entity.
 void endPrefixMapping(java.lang.String prefix)
          Receive notification of the end of a Namespace mapping.
 void error(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(SAXParseException exception)
          This method is called when a fatal error occurs during parsing.
 Document getDocument()
           
 org.dom4j.io.ElementStack getElementStack()
           
 EntityResolver getEntityResolver()
           
 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)
          Receive notification of a processing instruction.
 void setDocumentLocator(Locator locator)
          Receive a Locator object for document events.
 void setElementStack(org.dom4j.io.ElementStack elementStack)
           
 void setEntityResolver(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(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()
          Report the start of a CDATA section.
 void startDocument()
          Receive notification of the beginning of the document.
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Report the start of DTD declarations, if any.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, Attributes attributes)
          Receive notification of the start of an element.
 void startEntity(java.lang.String name)
          Report the beginning of some internal and external XML entities.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Receive notification of the start of a Namespace mapping.
 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(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, skippedEntity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXContentHandler

public SAXContentHandler()

SAXContentHandler

public SAXContentHandler(DocumentFactory documentFactory)

SAXContentHandler

public SAXContentHandler(DocumentFactory documentFactory,
                         ElementHandler elementHandler)

SAXContentHandler

public SAXContentHandler(DocumentFactory documentFactory,
                         ElementHandler elementHandler,
                         org.dom4j.io.ElementStack elementStack)
Method Detail

getDocument

public Document getDocument()
Returns:
the document that has been or is being built

setDocumentLocator

public void setDocumentLocator(Locator locator)
Description copied from class: DefaultHandler
Receive a Locator object for document events.

By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.

Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class DefaultHandler
Parameters:
locator - A locator for all SAX document events.
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator), Locator

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws SAXException
Description copied from class: DefaultHandler
Receive notification of a processing instruction.

By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class DefaultHandler
Parameters:
target - The processing instruction target.
data - The processing instruction data, or null if none is supplied.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws SAXException
Description copied from class: DefaultHandler
Receive notification of the start of a Namespace mapping.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each Namespace prefix scope (such as storing the prefix mapping).

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class DefaultHandler
Parameters:
prefix - The Namespace prefix being declared.
uri - The Namespace URI mapped to the prefix.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws SAXException
Description copied from class: DefaultHandler
Receive notification of the end of a Namespace mapping.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each prefix mapping.

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class DefaultHandler
Parameters:
prefix - The Namespace prefix being declared.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

startDocument

public void startDocument()
                   throws SAXException
Description copied from class: DefaultHandler
Receive notification of the beginning of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws SAXException
Description copied from class: DefaultHandler
Receive notification of the end of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalising a tree or closing an output file).

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endDocument()

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qualifiedName,
                         Attributes attributes)
                  throws SAXException
Description copied from class: DefaultHandler
Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qualifiedName - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws SAXException
Description copied from class: DefaultHandler
Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int end)
                throws SAXException
Description copied from class: DefaultHandler
Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
ch - The characters.
start - The start position in the character array.
end - The number of characters to use from the character array.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.characters(char[], int, int)

warning

public void warning(SAXParseException exception)
             throws SAXException
This method is called when a warning occurs during the parsing of the document. This method does nothing.

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Parameters:
exception - The warning information encoded as an exception.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

error

public void error(SAXParseException exception)
           throws SAXException
This method is called when an error is detected during parsing such as a validation error. This method rethrows the exception

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Parameters:
exception - The warning information encoded as an exception.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

fatalError

public void fatalError(SAXParseException exception)
                throws SAXException
This method is called when a fatal error occurs during parsing. This method rethrows the exception

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Parameters:
exception - The error information encoded as an exception.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException), SAXParseException

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String publicId,
                     java.lang.String systemId)
              throws SAXException
Description copied from interface: LexicalHandler
Report the start of DTD declarations, if any.

This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.

All declarations reported through DTDHandler or DeclHandler events must appear between the startDTD and endDTD events. Declarations are assumed to belong to the internal DTD subset unless they appear between startEntity and endEntity events. Comments and processing instructions from the DTD should also be reported between the startDTD and endDTD events, in their original order of (logical) occurrence; they are not required to appear in their correct locations relative to DTDHandler or DeclHandler events, however.

Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.

Specified by:
startDTD in interface LexicalHandler
Parameters:
name - The document type name.
publicId - The declared public identifier for the external DTD subset, or null if none was declared.
systemId - The declared system identifier for the external DTD subset, or null if none was declared. (Note that this is not resolved against the document base URI.)
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.endDTD(), LexicalHandler.startEntity(java.lang.String)

endDTD

public void endDTD()
            throws SAXException
Description copied from interface: LexicalHandler
Report the end of DTD declarations.

This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.

Specified by:
endDTD in interface LexicalHandler
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)

startEntity

public void startEntity(java.lang.String name)
                 throws SAXException
Description copied from interface: LexicalHandler
Report the beginning of some internal and external XML entities.

The reporting of parameter entities (including the external DTD subset) is optional, and SAX2 drivers that report LexicalHandler events may not implement it; you can use the http://xml.org/sax/features/lexical-handler/parameter-entities feature to query or control the reporting of parameter entities.

General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".

When a SAX2 driver is providing these events, all other events must be properly nested within start/end entity events. There is no additional requirement that events from DeclHandler or DTDHandler be properly ordered.

Note that skipped entities will be reported through the skippedEntity event, which is part of the ContentHandler interface.

Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:

These will be silently expanded, with no indication of where the original entity boundaries were.

Note also that the boundaries of character references (which are not really entities anyway) are not reported.

All start/endEntity events must be properly nested.

Specified by:
startEntity in interface LexicalHandler
Parameters:
name - The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]".
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.endEntity(java.lang.String), DeclHandler.internalEntityDecl(java.lang.String, java.lang.String), DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)

endEntity

public void endEntity(java.lang.String name)
               throws SAXException
Description copied from interface: LexicalHandler
Report the end of an entity.

Specified by:
endEntity in interface LexicalHandler
Parameters:
name - The name of the entity that is ending.
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.startEntity(java.lang.String)

startCDATA

public void startCDATA()
                throws SAXException
Description copied from interface: LexicalHandler
Report the start of a CDATA section.

The contents of the CDATA section will be reported through the regular characters event; this event is intended only to report the boundary.

Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.endCDATA()

endCDATA

public void endCDATA()
              throws SAXException
Description copied from interface: LexicalHandler
Report the end of a CDATA section.

Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.startCDATA()

comment

public void comment(char[] ch,
                    int start,
                    int end)
             throws SAXException
Description copied from interface: LexicalHandler
Report an XML comment anywhere in the document.

This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).

Specified by:
comment in interface LexicalHandler
Parameters:
ch - An array holding the characters in the comment.
start - The starting position in the array.
end - The number of characters to use from the array.
Throws:
SAXException - The application may raise an exception.

elementDecl

public void elementDecl(java.lang.String name,
                        java.lang.String model)
                 throws SAXException
Report an element type declaration.

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.

Specified by:
elementDecl in interface DeclHandler
Parameters:
name - The element type name.
model - The content model as a normalized string.
Throws:
SAXException - The application may raise an exception.

attributeDecl

public void attributeDecl(java.lang.String eName,
                          java.lang.String aName,
                          java.lang.String type,
                          java.lang.String valueDefault,
                          java.lang.String value)
                   throws SAXException
Report an attribute type declaration.

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.

Specified by:
attributeDecl in interface DeclHandler
Parameters:
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.
Throws:
SAXException - The application may raise an exception.

internalEntityDecl

public void internalEntityDecl(java.lang.String name,
                               java.lang.String value)
                        throws SAXException
Report an internal entity declaration.

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.

Specified by:
internalEntityDecl in interface DeclHandler
Parameters:
name - The name of the entity. If it is a parameter entity, the name will begin with '%'.
value - The replacement text of the entity.
Throws:
SAXException - The application may raise an exception.
See Also:
externalEntityDecl(java.lang.String, java.lang.String, java.lang.String), DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

externalEntityDecl

public void externalEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId)
                        throws SAXException
Report a parsed external entity declaration.

Only the effective (first) declaration for each entity will be reported.

Specified by:
externalEntityDecl in interface DeclHandler
Parameters:
name - The name of the entity. If it is a parameter entity, the name will begin with '%'.
publicId - The declared public identifier of the entity, or null if none was declared.
systemId - The declared system identifier of the entity.
Throws:
SAXException - The application may raise an exception.
See Also:
internalEntityDecl(java.lang.String, java.lang.String), DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws SAXException
Receive notification of a notation declaration event.

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.

Specified by:
notationDecl in interface DTDHandler
Overrides:
notationDecl in class DefaultHandler
Parameters:
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.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String), AttributeList

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notationName)
                        throws SAXException
Receive notification of an unparsed entity declaration event.

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.

Specified by:
unparsedEntityDecl in interface DTDHandler
Overrides:
unparsedEntityDecl in class DefaultHandler
Parameters:
name - The unparsed entity's name.
publicId - The entity's public identifier, or null if none was given.
systemId - The entity's system identifier.
notationName - The name of the associated notation.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
notationDecl(java.lang.String, java.lang.String, java.lang.String), AttributeList

getElementStack

public org.dom4j.io.ElementStack getElementStack()

setElementStack

public void setElementStack(org.dom4j.io.ElementStack elementStack)

getEntityResolver

public EntityResolver getEntityResolver()

setEntityResolver

public void setEntityResolver(EntityResolver entityResolver)

getInputSource

public InputSource getInputSource()

setInputSource

public void setInputSource(InputSource inputSource)

isIncludeInternalDTDDeclarations

public boolean isIncludeInternalDTDDeclarations()
Returns:
whether internal DTD declarations should be expanded into the DocumentType object or not.

setIncludeInternalDTDDeclarations

public void setIncludeInternalDTDDeclarations(boolean includeInternalDTDDeclarations)
Sets whether internal DTD declarations should be expanded into the DocumentType object or not.

Parameters:
includeInternalDTDDeclarations - whether or not DTD declarations should be expanded and included into the DocumentType object.

isIncludeExternalDTDDeclarations

public boolean isIncludeExternalDTDDeclarations()
Returns:
whether external DTD declarations should be expanded into the DocumentType object or not.

setIncludeExternalDTDDeclarations

public void setIncludeExternalDTDDeclarations(boolean includeExternalDTDDeclarations)
Sets whether DTD external declarations should be expanded into the DocumentType object or not.

Parameters:
includeExternalDTDDeclarations - whether or not DTD declarations should be expanded and included into the DocumentType object.

isMergeAdjacentText

public boolean isMergeAdjacentText()
Returns whether adjacent text nodes should be merged together.

Returns:
Value of property mergeAdjacentText.

setMergeAdjacentText

public void setMergeAdjacentText(boolean mergeAdjacentText)
Sets whether or not adjacent text nodes should be merged together when parsing.

Parameters:
mergeAdjacentText - New value of property mergeAdjacentText.

isStripWhitespaceText

public boolean isStripWhitespaceText()
Sets whether whitespace between element start and end tags should be ignored

Returns:
Value of property stripWhitespaceText.

setStripWhitespaceText

public void setStripWhitespaceText(boolean stripWhitespaceText)
Sets whether whitespace between element start and end tags should be ignored.

Parameters:
stripWhitespaceText - New value of property stripWhitespaceText.

isIgnoreComments

public boolean isIgnoreComments()
Returns whether we should ignore comments or not.

Returns:
boolean

setIgnoreComments

public void setIgnoreComments(boolean ignoreComments)
Sets whether we should ignore comments or not.

Parameters:
ignoreComments - whether we should ignore comments or not.

completeCurrentTextNode

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


createDocument

protected Document createDocument()
Returns:
the current document

isIgnorableEntity

protected boolean isIgnorableEntity(java.lang.String name)
a Strategy Method to determine if a given entity name is ignorable


addDeclaredNamespaces

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


addAttributes

protected void addAttributes(Element element,
                             Attributes attributes)
Add all the attributes to the given elements


addDTDDeclaration

protected void addDTDDeclaration(java.lang.Object declaration)
Adds an internal DTD declaration to the list of declarations


addExternalDTDDeclaration

protected void addExternalDTDDeclaration(java.lang.Object declaration)
Adds an external DTD declaration to the list of declarations


createElementStack

protected org.dom4j.io.ElementStack createElementStack()


Copyright © 2004 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge Logo