Class DOM2SAX
java.lang.Object
org.apache.fop.util.DOM2SAX
Helper class that produces a SAX stream from a DOM Document.
Part of the code here copied and adapted from Apache Xalan-J, src/org/apache/xalan/xsltc/trax/DOM2SAX.java
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContentHandlerprivate static final Stringprivate LexicalHandlerprivate Mapprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidendPrefixMapping(String prefix) private static StringgetLocalName(Node node) If the DOM was created using a DOM 1.0 API, the local name may be null.private booleanstartPrefixMapping(String prefix, String uri) Begin the scope of namespace prefix.voidwriteDocument(Document doc, boolean fragment) Writes the given document using the given ContentHandler.voidwriteFragment(Node node) Writes the given fragment using the given ContentHandler.private voidWrites a node using the given writer.
-
Field Details
-
EMPTYSTRING
- See Also:
-
XMLNS_PREFIX
- See Also:
-
contentHandler
-
lexicalHandler
-
prefixes
-
-
Constructor Details
-
DOM2SAX
Main constructor- Parameters:
handler- the ContentHandler to send SAX events to
-
-
Method Details
-
writeDocument
Writes the given document using the given ContentHandler.- Parameters:
doc- DOM documentfragment- if false no startDocument() and endDocument() calls are issued.- Throws:
SAXException- In case of a problem while writing XML
-
writeFragment
Writes the given fragment using the given ContentHandler.- Parameters:
node- DOM node- Throws:
SAXException- In case of a problem while writing XML
-
startPrefixMapping
Begin the scope of namespace prefix. Forward the event to the SAX handler only if the prefix is unknown or it is mapped to a different URI.- Throws:
SAXException
-
endPrefixMapping
- Throws:
SAXException
-
getLocalName
-
writeNode
Writes a node using the given writer.- Parameters:
node- node to serialize- Throws:
SAXException- In case of a problem while writing XML
-