use of nu.xom.DocType in project teiid by teiid.
the class BinaryXMLCodec method readDocTypeF.
/**
* Does not pack indexes of doctype (infrequent anyway)
*/
private Nodes readDocTypeF(ArrayByteList src) {
String rootElementName = symbols[src.getInt()];
String publicID = symbols[src.getInt()];
if (DOCTYPE_NULL_ID.equals(publicID))
publicID = null;
String systemID = symbols[src.getInt()];
if (DOCTYPE_NULL_ID.equals(systemID))
systemID = null;
String internalDTDSubset = symbols[src.getInt()];
if (internalDTDSubset.length() == 0)
internalDTDSubset = null;
Nodes nodes = factory.makeDocType(rootElementName, publicID, systemID);
for (int i = 0; i < nodes.size(); i++) {
if (nodes.get(i) instanceof DocType) {
DocType docType = (DocType) nodes.get(i);
if (docType.getInternalDTDSubset().length() == 0) {
try {
docType.setInternalDTDSubset(internalDTDSubset);
} catch (IllegalAccessError e) {
// ignore; setInternalDTDSubset() is private in xom < 1.1
;
}
}
}
}
return nodes;
}
use of nu.xom.DocType 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");
}
use of nu.xom.DocType in project teiid by teiid.
the class XQueryEvaluator method wrap.
/**
* Converts a xom node into something readable by Saxon
* @param node
* @param config
* @return
*/
static NodeInfo wrap(Node node, Configuration config) {
if (node == null)
// $NON-NLS-1$
throw new IllegalArgumentException("node must not be null");
if (node instanceof DocType)
// $NON-NLS-1$
throw new IllegalArgumentException("DocType can't be queried by XQuery/XPath");
Node root = node;
while (root.getParent() != null) {
root = root.getParent();
}
XOMDocumentWrapper docWrapper = new XOMDocumentWrapper(root, config);
return docWrapper.wrap(node);
}
Aggregations