Search in sources :

Example 1 with ProcessingInstruction

use of nu.xom.ProcessingInstruction in project teiid by teiid.

the class BinaryXMLCodec method writeDocument.

private void writeDocument(Document doc) throws IOException {
    if (DEBUG)
        System.err.println("writing document");
    writeXMLDeclaration(doc.getBaseURI());
    for (int i = 0; i < doc.getChildCount(); i++) {
        Node node = doc.getChild(i);
        if (node instanceof Element) {
            writeElement((Element) node);
        } else if (node instanceof Comment) {
            writeComment((Comment) node);
        } else if (node instanceof ProcessingInstruction) {
            writeProcessingInstruction((ProcessingInstruction) node);
        } else if (node instanceof DocType) {
            writeDocType((DocType) node);
        } else {
            throw new IllegalAddException("Cannot write node type: " + node);
        }
    }
    writeEndDocument();
    if (DEBUG)
        System.err.println("finished writing document");
}
Also used : Comment(nu.xom.Comment) IllegalAddException(nu.xom.IllegalAddException) ParentNode(nu.xom.ParentNode) Node(nu.xom.Node) Element(nu.xom.Element) ProcessingInstruction(nu.xom.ProcessingInstruction) DocType(nu.xom.DocType)

Aggregations

Comment (nu.xom.Comment)1 DocType (nu.xom.DocType)1 Element (nu.xom.Element)1 IllegalAddException (nu.xom.IllegalAddException)1 Node (nu.xom.Node)1 ParentNode (nu.xom.ParentNode)1 ProcessingInstruction (nu.xom.ProcessingInstruction)1