org.dom4j.io
public class SAXModifier extends Object
Registered {@link ElementModifier}objects can provide modifications to (part of) the xml tree, while the document is still being processed. This makes it possible to change large xml documents without having them in memory.
The modified document is written when the {@link XMLWriter}is specified.
Constructor Summary | |
---|---|
SAXModifier()
Creates a new modifier. | |
SAXModifier(boolean pruneElements)
Creates a new modifier. | |
SAXModifier(XMLReader xmlReader)
Creates a new modifier that will the specified {@link
org.xml.sax.XMLReader} to parse the source.
| |
SAXModifier(XMLReader xmlReader, boolean pruneElements)
Creates a new modifier that will the specified {@link
org.xml.sax.XMLReader} to parse the source.
|
Method Summary | |
---|---|
void | addModifier(String path, ElementModifier modifier)
Adds the {@link ElementModifier}to be called when the specified element
path is encounted while parsing the source.
|
DocumentFactory | getDocumentFactory()
Get the {@link org.dom4j.DocumentFactory}used to create the DOM4J
document structure
|
XMLWriter | getXMLWriter()
Returns the current {@link XMLWriter}.
|
boolean | isPruneElements()
Returns true when xml elements are not kept in memory while parsing. |
Document | modify(File source)
Reads a Document from the given {@link java.io.File}and writes it to the
specified {@link XMLWriter}using SAX. |
Document | modify(InputSource source)
Reads a Document from the given {@link org.xml.sax.InputSource}and
writes it to the specified {@link XMLWriter}using SAX. |
Document | modify(InputStream source)
Reads a Document from the given {@link java.io.InputStream}and writes it
to the specified {@link XMLWriter}using SAX. |
Document | modify(InputStream source, String systemId)
Reads a Document from the given {@link java.io.InputStream}and writes it
to the specified {@link XMLWriter}using SAX. |
Document | modify(Reader source)
Reads a Document from the given {@link java.io.Reader}and writes it to
the specified {@link XMLWriter}using SAX. |
Document | modify(Reader source, String systemId)
Reads a Document from the given {@link java.io.Reader}and writes it to
the specified {@link XMLWriter}using SAX. |
Document | modify(URL source)
Reads a Document from the given {@link java.net.URL}and writes it to the
specified {@link XMLWriter}using SAX. |
Document | modify(String source)
Reads a Document from the given URL or filename and writes it to the
specified {@link XMLWriter}using SAX. |
void | removeModifier(String path)
Removes the {@link ElementModifier}from the event based processor, for
the specified element path.
|
void | resetModifiers()
Removes all registered {@link ElementModifier}instances from the event
based processor. |
void | setDocumentFactory(DocumentFactory factory)
Sets the {@link org.dom4j.DocumentFactory}used to create the DOM4J
document tree.
|
void | setXMLWriter(XMLWriter writer)
Sets the {@link XMLWriter}used to write the modified document.
|
Parameters: pruneElements Set to true when the modified document must NOT be kept in memory.
Parameters: xmlReader The XMLReader to use
Parameters: xmlReader The XMLReader to use pruneElements Set to true when the modified document must NOT be kept in memory.
Parameters: path The element path to be handled modifier The {@link ElementModifier}to be called by the event based processor.
Returns: DocumentFactory
that will be used
Returns: XMLWriter
Returns: Returns the pruneElements.
Parameters: source
is the File
to read from.
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: source
is the org.xml.sax.InputSource
to read from.
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: source
is the java.io.InputStream
to read from.
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: source
is the java.io.InputStream
to read from. systemId
DOCUMENT ME!
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: source
is the java.io.Reader
to read from.
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: source
is the java.io.Reader
to read from. systemId
DOCUMENT ME!
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: source
is the java.net.URL
to read from.
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: source is the URL or filename to read from.
Returns: the newly created Document instance
Throws: DocumentException DocumentException org.dom4j.DocumentException} if an error occurs during parsing.
Parameters: path The path to remove the {@link ElementModifier}for.
Parameters: factory
DocumentFactory
to be used
Parameters: writer The writer to use.