Package net.sf.saxon.s9api

Examples of net.sf.saxon.s9api.XdmNode


        JSONStringer js = new JSONStringer();

        json = S9apiUtils.getDocumentElement(json);

        if (c_body.equals(json.getNodeName())) {
            XdmNode jchild = null;
            XdmSequenceIterator iter = json.axisIterator(Axis.CHILD);
            while (iter.hasNext()) {
                XdmItem item = iter.next();
                if (item instanceof XdmNode) {
                    XdmNode child = (XdmNode) item;
                    if (child.getNodeKind() == XdmNodeKind.ELEMENT) {
                        if (jchild != null) {
                            throw new XProcException("Found c:body containing more than one JSON element?");
                        } else {
                            jchild = child;
                        }
View Full Code Here


    private static void processChildren(XdmNode json, JSONStringer js, int context) throws JSONException {
        XdmSequenceIterator iter = json.axisIterator(Axis.CHILD);
        while (iter.hasNext()) {
            XdmItem item = iter.next();
            if (item instanceof XdmNode) {
                XdmNode child = (XdmNode) item;
                if (child.getNodeKind() == XdmNodeKind.ELEMENT) {
                    build(child, js, context);
                }
            }
        }
    }
View Full Code Here

        initialized = true;

        nsBindings = new Hashtable<String,String> ();
        XdmSequenceIterator nsIter = node.axisIterator(Axis.NAMESPACE);
        while (nsIter.hasNext()) {
            XdmNode ns = (XdmNode) nsIter.next();
            QName nodeName = ns.getNodeName();
            String uri = ns.getStringValue();

            if (nodeName == null) {
                // Huh?
                nsBindings.put("", uri);
            } else {
View Full Code Here

        properties.put(ValidateProperty.ERROR_HANDLER, eh);
        RngProperty.CHECK_ID_IDREF.add(properties);

        properties.put(ValidateProperty.ENTITY_RESOLVER, runtime.getResolver());

        XdmNode srcdoc = source.read();
        XdmNode nvdldoc = nvdlSource.read();

        while (schemaSource.moreDocuments()) {
            XdmNode schema = schemaSource.read();
            runtime.getResolver().cache(schema, schema.getBaseURI());
        }

        ValidationDriver driver = new ValidationDriver(properties.toPropertyMap());

        InputSource nvdl = S9apiUtils.xdmToInputSource(runtime, nvdldoc);
View Full Code Here

            logger.debug(e.getMessage(), e);
            throw new XProcException(step.getNode(), "Failed to instantiate CSS provider");
        }

        while (css.moreDocuments()) {
            XdmNode style = css.read();
            provider.addStylesheet(style);
        }

        final String contentType;
        if (getOption(_content_type) != null) {
View Full Code Here

        }
    }

    public XdmNode get(int count) {
        if (count < documents.size()) {
            XdmNode doc = documents.get(count);
            //runtime.finest(logger, null, "Read " + (doc == null ? "null" : doc.getBaseURI()) + " from " + toString());
            return doc;
        } else {
            return null;
        }
View Full Code Here

        }

        matcher = new ProcessMatch(runtime, this);
        matcher.match(source.read(), new RuntimeValue("*", step.getNode()));

        XdmNode doc = matcher.getResult();
        result.write(doc);
    }
View Full Code Here

        matcher.addStartElement(node);

        boolean found = false;
        XdmSequenceIterator iter = node.axisIterator(Axis.ATTRIBUTE);
        while (iter.hasNext()) {
            XdmNode child = (XdmNode) iter.next();
            if (child.getNodeName().equals(xml_base)) {
                found = true;
                if ((all || addXmlBase || !node.getAttributeValue(xml_base).equals(xmlBase))
                    && !"".equals(xmlBase)) {
                    matcher.addAttribute(child, xmlBase);
                }
            } else {
                matcher.addAttribute(child, child.getStringValue());
            }
        }

        if (!found && addXmlBase) {
            matcher.addAttribute(xml_base, xmlBase);
View Full Code Here

    public void run() throws SaxonApiException {
        super.run();

        try {
            XdmNode doc = runtime.getConfigurer().getXMLCalabashConfigurer().loadDocument(this);
            result.write(doc);
        } catch (XProcException e) {
            logger.debug(e.getMessage(), e);
            if (err_XD0011.equals(e.getErrorCode())) {
                RuntimeValue href = getOption(_href);
View Full Code Here

        runtime = xproc;
        this.node = node;

        XdmSequenceIterator nsIter = node.axisIterator(Axis.NAMESPACE);
        while (nsIter.hasNext()) {
            XdmNode ns = (XdmNode) nsIter.next();
            nsBindings.put((ns.getNodeName()==null ? "" : ns.getNodeName().getLocalName()),ns.getStringValue());
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.s9api.XdmNode

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.