Package org.exist.contentextraction

Examples of org.exist.contentextraction.ContentExtraction


        if (args[0].isEmpty()) {
            return Sequence.EMPTY_SEQUENCE;
        }

        DocumentBuilderReceiver builder = new DocumentBuilderReceiver();
        ContentExtraction ce = new ContentExtraction();

        if (isCalledAs("stream-content")) {

            /* binary content */
            BinaryValue binary = (BinaryValue) args[0].itemAt(0);

            /* callback function */
            FunctionReference ref = (FunctionReference) args[2].itemAt(0);

            Map<String, String> mappings = new HashMap<>();
            if (args[3].hasOne()) {
                NodeValue namespaces = (NodeValue) args[3].itemAt(0);
                parseMappings(namespaces, mappings);
            }

            return streamContent(ce, binary, args[1], ref, mappings, args[4]);

        } else {

            try {
                if (isCalledAs("get-metadata")) {
                    ce.extractMetadata((BinaryValue) args[0].itemAt(0), (ContentHandler) builder);

                } else {
                    ce.extractContentAndMetadata((BinaryValue) args[0].itemAt(0), (ContentHandler) builder);
                }

                return (NodeValue) builder.getDocument();

            } catch (IOException | SAXException | ContentExtractionException ex) {
View Full Code Here

TOP

Related Classes of org.exist.contentextraction.ContentExtraction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.