Search in sources :

Example 1 with DocumentParser

use of org.brackit.xquery.node.parser.DocumentParser in project sirix by sirixdb.

the class Load method add.

private TemporalCollection<?> add(final org.brackit.xquery.xdm.Store store, final DBCollection coll, final String resName, final Sequence resources) throws DocumentException, IOException {
    if (resources instanceof Atomic) {
        final Atomic res = (Atomic) resources;
        coll.add(resName, new DocumentParser(URIHandler.getInputStream(res.stringValue())));
        return coll;
    } else {
        final ParserStream parsers = new ParserStream(resources);
        try {
            for (SubtreeParser parser = parsers.next(); parser != null; parser = parsers.next()) {
                coll.add(resName, parser);
            }
        } finally {
            parsers.close();
        }
        return coll;
    }
}
Also used : DocumentParser(org.brackit.xquery.node.parser.DocumentParser) SubtreeParser(org.brackit.xquery.node.parser.SubtreeParser) StreamSubtreeParser(org.brackit.xquery.node.parser.StreamSubtreeParser) Atomic(org.brackit.xquery.atomic.Atomic)

Example 2 with DocumentParser

use of org.brackit.xquery.node.parser.DocumentParser in project sirix by sirixdb.

the class IndexController method deserialize.

/**
 * Deserialize from an {@link InputStream}.
 *
 * @param out the {@link InputStream} from which to deserialize the XML fragment
 * @throws SirixException if an exception occurs during serialization
 */
public Node<?> deserialize(final InputStream in) throws SirixException {
    try {
        final DocumentParser parser = new DocumentParser(in);
        final D2NodeBuilder builder = new D2NodeBuilder();
        parser.parse(builder);
        return builder.root();
    } catch (final DocumentException e) {
        throw new SirixException(e);
    }
}
Also used : DocumentParser(org.brackit.xquery.node.parser.DocumentParser) DocumentException(org.brackit.xquery.xdm.DocumentException) SirixException(org.sirix.exception.SirixException) D2NodeBuilder(org.brackit.xquery.node.d2linked.D2NodeBuilder)

Aggregations

DocumentParser (org.brackit.xquery.node.parser.DocumentParser)2 Atomic (org.brackit.xquery.atomic.Atomic)1 D2NodeBuilder (org.brackit.xquery.node.d2linked.D2NodeBuilder)1 StreamSubtreeParser (org.brackit.xquery.node.parser.StreamSubtreeParser)1 SubtreeParser (org.brackit.xquery.node.parser.SubtreeParser)1 DocumentException (org.brackit.xquery.xdm.DocumentException)1 SirixException (org.sirix.exception.SirixException)1