Package com.xmlcalabash.util

Examples of com.xmlcalabash.util.TreeWriter.addSubtree()


        treeWriter.addAttribute(_name, step.getName());
        treeWriter.addAttribute(_type, "p:error");
        treeWriter.addAttribute(_code, errorCode.toString());
        treeWriter.startContent();
        if (doc != null) {
            treeWriter.addSubtree(doc);
        }
        treeWriter.addEndElement();
        treeWriter.endDocument();

        step.reportError(treeWriter.getResult());
View Full Code Here


        tree.startDocument(doc.getBaseURI());

        XdmSequenceIterator iter = doc.axisIterator(Axis.CHILD);
        XdmNode child = (XdmNode) iter.next();
        while (child.getNodeKind() != XdmNodeKind.ELEMENT) {
            tree.addSubtree(child);
            child = (XdmNode) iter.next();
        }
        tree.addStartElement(child);
        tree.addAttributes(child);
        tree.startContent();
View Full Code Here

                tagDoc = tagSoup(escapedContent);
            } else {
                tagDoc = parseHTML(escapedContent);
            }
            if (namespace == null) {
                tree.addSubtree(tagDoc);
            } else {
                remapDefaultNamespace(tree, tagDoc);
            }
        } else if ("application/json".equals(contentType) || "text/json".equals(contentType)) {
            JSONTokener jt = new JSONTokener(escapedContent);
View Full Code Here

                remapDefaultNamespace(tree, tagDoc);
            }
        } else if ("application/json".equals(contentType) || "text/json".equals(contentType)) {
            JSONTokener jt = new JSONTokener(escapedContent);
            XdmNode jsonDoc = JSONtoXML.convert(runtime.getProcessor(), jt, runtime.jsonFlavor());
            tree.addSubtree(jsonDoc);
        } else if (!"application/xml".equals(contentType)) {
            throw XProcException.stepError(51);
        } else {
            // Put a wrapper around it so that it doesn't have to have a single root...
            escapedContent = "<wrapper>" + escapedContent + "</wrapper>";
View Full Code Here

            XdmNode dummyWrapper = S9apiUtils.getDocumentElement(unesc);
            XdmSequenceIterator realNodes = dummyWrapper.axisIterator(Axis.CHILD);
            while (realNodes.hasNext()) {
                unesc = (XdmNode) realNodes.next();
                if (namespace == null) {
                    tree.addSubtree(unesc);
                } else {
                    remapDefaultNamespace(tree, unesc);
                }
            }
        }
View Full Code Here

            treeWriter.addStartElement(c_errors);
            treeWriter.startContent();

            boolean reported = false;
            for (XdmNode doc : runtime.getXProcData().errors()) {
                treeWriter.addSubtree(doc);
                reported = true;
            }

            for (XdmNode doc : errors) {
                treeWriter.addSubtree(doc);
View Full Code Here

                treeWriter.addSubtree(doc);
                reported = true;
            }

            for (XdmNode doc : errors) {
                treeWriter.addSubtree(doc);
                reported = true;
            }

            if (!reported) {
                // Hey, no one reported this exception. We better do it.
View Full Code Here

    public boolean processStartElement(XdmNode node) {
        // Use a TreeWriter to make the matching node into a proper document
        TreeWriter treeWriter = new TreeWriter(runtime);
        treeWriter.startDocument(node.getBaseURI());
        treeWriter.addSubtree(node);
        treeWriter.endDocument();

        current.resetWriter();
        current.write(treeWriter.getResult());
View Full Code Here

        if ("svg".equals(format)) {
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray(), 0, baos.size());
            XdmNode svg = runtime.parse(new InputSource(bais));
            if (html) {
                // Perhaps I should remove the SVG namespace and do other stuff here?
                tree.addSubtree(svg);
            } else {
                tree.addSubtree(svg);
            }
        } else {
            String base64 = Base64.encodeBytes(baos.toByteArray(), 0, baos.size());
View Full Code Here

            XdmNode svg = runtime.parse(new InputSource(bais));
            if (html) {
                // Perhaps I should remove the SVG namespace and do other stuff here?
                tree.addSubtree(svg);
            } else {
                tree.addSubtree(svg);
            }
        } else {
            String base64 = Base64.encodeBytes(baos.toByteArray(), 0, baos.size());

            if (html) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.