Search in sources :

Example 1 with TinyTree

use of net.sf.saxon.tree.tiny.TinyTree in project ddf by codice.

the class DynamicSchemaResolver method createTinyBinary.

private byte[] createTinyBinary(String xml) throws XMLStreamException, SaxonApiException {
    SaxonDocBuilder builder = new SaxonDocBuilder(processor);
    XmlReader xmlReader = new XmlReader();
    xmlReader.addHandler(builder);
    xmlReader.setStripNamespaces(true);
    xmlReader.read(IOUtils.toInputStream(xml));
    XdmNode node = builder.getDocument();
    TinyTree tinyTree = ((TinyDocumentImpl) node.getUnderlyingNode()).getTree();
    TinyBinary tinyBinary = new TinyBinary(tinyTree, StandardCharsets.UTF_8);
    return tinyBinary.getBytes();
}
Also used : TinyDocumentImpl(net.sf.saxon.tree.tiny.TinyDocumentImpl) TinyTree(net.sf.saxon.tree.tiny.TinyTree) TinyBinary(lux.xml.tinybin.TinyBinary) XmlReader(lux.xml.XmlReader) XdmNode(net.sf.saxon.s9api.XdmNode) SaxonDocBuilder(lux.xml.SaxonDocBuilder)

Aggregations

SaxonDocBuilder (lux.xml.SaxonDocBuilder)1 XmlReader (lux.xml.XmlReader)1 TinyBinary (lux.xml.tinybin.TinyBinary)1 XdmNode (net.sf.saxon.s9api.XdmNode)1 TinyDocumentImpl (net.sf.saxon.tree.tiny.TinyDocumentImpl)1 TinyTree (net.sf.saxon.tree.tiny.TinyTree)1