|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.dom4j.io.SAXModifier
The SAXModifier reads, modifies and writes XML documents using SAX.
Registered 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 XMLWriter is specified.
SAXReader,
XMLWriter| Constructor Summary | |
SAXModifier()
Creates a new modifier. The XMLReader to parse the source will be created via the org.xml.sax.driver system property or JAXP if the system property is not set. |
|
SAXModifier(boolean pruneElements)
Creates a new modifier. The XMLReader to parse the source will be created via the org.xml.sax.driver system property or JAXP if the system property is not set. |
|
SAXModifier(XMLReader xmlReader)
Creates a new modifier that will the specified XMLReader
to parse the source. |
|
SAXModifier(XMLReader xmlReader,
boolean pruneElements)
Creates a new modifier that will the specified XMLReader
to parse the source. |
|
| Method Summary | |
void |
addModifier(java.lang.String path,
ElementModifier modifier)
Adds the ElementModifier to be called
when the specified element path is encounted while parsing the source. |
DocumentFactory |
getDocumentFactory()
Get the DocumentFactory used to create the DOM4J document structure |
XMLWriter |
getXMLWriter()
Returns the current XMLWriter. |
boolean |
isPruneElements()
Returns true when xml elements are not kept in memory while parsing. |
Document |
modify(java.io.File source)
Reads a Document from the given File
and writes it to the specified XMLWriter using SAX. |
Document |
modify(InputSource source)
Reads a Document from the given InputSource
and writes it to the specified XMLWriter using SAX. |
Document |
modify(java.io.InputStream source)
Reads a Document from the given InputStream
and writes it to the specified XMLWriter using SAX. |
Document |
modify(java.io.InputStream source,
java.lang.String systemId)
Reads a Document from the given InputStream
and writes it to the specified XMLWriter using SAX. |
Document |
modify(java.io.Reader source)
Reads a Document from the given Reader
and writes it to the specified XMLWriter using SAX. |
Document |
modify(java.io.Reader source,
java.lang.String systemId)
Reads a Document from the given Reader
and writes it to the specified XMLWriter using SAX. |
Document |
modify(java.lang.String source)
Reads a Document from the given URL or filename and writes it to the specified XMLWriter using SAX. |
Document |
modify(java.net.URL source)
Reads a Document from the given URL
and writes it to the specified XMLWriter using SAX. |
void |
removeModifier(java.lang.String path)
Removes the ElementModifier from the event based processor,
for the specified element path. |
void |
resetModifiers()
Removes all registered ElementModifier instances from the event based processor. |
void |
setDocumentFactory(DocumentFactory factory)
Sets the DocumentFactory used to create the DOM4J document tree. |
void |
setXMLWriter(XMLWriter xmlWriter)
Sets the XMLWriter used to write the modified document. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SAXModifier()
public SAXModifier(boolean pruneElements)
pruneElements - Set to true when the modified document must NOT be kept in memory.public SAXModifier(XMLReader xmlReader)
XMLReader
to parse the source.
xmlReader - The XMLReader to use
public SAXModifier(XMLReader xmlReader,
boolean pruneElements)
XMLReader
to parse the source.
xmlReader - The XMLReader to usepruneElements - Set to true when the modified document must NOT be kept in memory.| Method Detail |
public Document modify(java.io.File source)
throws DocumentException
File
and writes it to the specified XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the File to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public Document modify(InputSource source)
throws DocumentException
InputSource
and writes it to the specified XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the org.xml.sax.InputSource to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public Document modify(java.io.InputStream source)
throws DocumentException
InputStream
and writes it to the specified XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the java.io.InputStream to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public Document modify(java.io.InputStream source,
java.lang.String systemId)
throws DocumentException
InputStream
and writes it to the specified XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the java.io.InputStream to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public Document modify(java.io.Reader source)
throws DocumentException
Reader
and writes it to the specified XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the java.io.Reader to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public Document modify(java.io.Reader source,
java.lang.String systemId)
throws DocumentException
Reader
and writes it to the specified XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the java.io.Reader to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public Document modify(java.net.URL source)
throws DocumentException
URL
and writes it to the specified XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the java.net.URL to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public Document modify(java.lang.String source)
throws DocumentException
XMLWriter using SAX.
Registered ElementModifier objects are invoked on the fly.
source - is the URL or filename to read from.
{@link - org.dom4j.DocumentException} if an error occurs during parsing.
DocumentException
public void addModifier(java.lang.String path,
ElementModifier modifier)
ElementModifier to be called
when the specified element path is encounted while parsing the source.
path - The element path to be handledpublic void resetModifiers()
ElementModifier instances from the event based processor.
public void removeModifier(java.lang.String path)
ElementModifier from the event based processor,
for the specified element path.
path - The path to remove the ElementModifier for.public DocumentFactory getDocumentFactory()
DocumentFactory used to create the DOM4J document structure
DocumentFactory that will be usedpublic void setDocumentFactory(DocumentFactory factory)
DocumentFactory used to create the DOM4J document tree.
factory - DocumentFactory to be usedpublic XMLWriter getXMLWriter()
XMLWriter.
public void setXMLWriter(XMLWriter xmlWriter)
XMLWriter used to write the modified document.
xmlWriter - The writer to use.public boolean isPruneElements()
Document returned by the modify methods will be null.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||