Package net.sf.saxon.om

Examples of net.sf.saxon.om.NodeInfo


    public List execQuery(Object node, Map variableBindings)
    {
        try
        {
            Node contextNode = (Node)node;
            NodeInfo contextItem =
                config.buildDocument(new DOMSource(contextNode));
                //config.unravel(new DOMSource(contextNode));
            DynamicQueryContext dc = new DynamicQueryContext(config);
            dc.setContextItem(contextItem);
            dc.setParameter(contextVar, contextItem);
View Full Code Here


                        (String) entry.getValue());
            }
            xpe.setStaticContext(sc);
            XPathVariable thisVar = xpe.declareVariable("", contextVar);
            XPathExpression xpath = xpe.createExpression(path);
            NodeInfo contextItem =
                //config.buildDocument(new DOMSource(contextNode));
                config.unravel(new DOMSource(contextNode));
            XPathDynamicContext dc = xpath.createDynamicContext(null);
            dc.setContextItem(contextItem);
            dc.setVariable(thisVar, contextItem);
View Full Code Here

    public NodeInfo transform(Node source, TransformationContext context) {
      Configuration configuration = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
        if (configuration == null) {
            configuration = new Configuration();
        }
        NodeInfo docInfo = null;
        try {
            source = DOMHelper.promote(source);
            docInfo = Builder.build(new DOMSource(source), null, configuration);
        } catch (XPathException e) {
            throw new TransformationException(e);
View Full Code Here

            DocumentInfo saxonDocInfo = qp.buildDocument(new StreamSource(
                    new StringReader(outputter.outputString(document))));
            DynamicQueryContext dynamicQueryContext = new DynamicQueryContext();
            dynamicQueryContext.setContextNode(saxonDocInfo);
            resultObj = xQueryExpression.evaluateSingle(dynamicQueryContext);
            NodeInfo nodeInfo = (NodeInfo) resultObj;
            //my code to parse SAXON resulting XML tree and produce a string
            //because saxons QueryResult class isn't yet able to produce the desired string from anything
            //but the root node
            if (nodeInfo != null) {
                YSaxonOutPutter saxonOutputter = new YSaxonOutPutter(nodeInfo);
View Full Code Here

            List nodeList = xQueryExpression.evaluate(dynamicQueryContext);
            //my code to parse SAXON resulting XML tree and produce a string
            //because saxons QueryResult class isn't yet able to produce the desired string from anything
            //but the root node
            for (int i = 0; i < nodeList.size(); i++) {
                NodeInfo nodeInfo = (NodeInfo) nodeList.get(i);
                YSaxonOutPutter saxonOutputter = new YSaxonOutPutter(nodeInfo);
                String result = saxonOutputter.getString();
                if (result != null) {
                    SAXBuilder builder = new SAXBuilder();
                    Document doclet = builder.build(new StringReader(result));
View Full Code Here

    public NodeInfo transform(Node source, TransformationContext context) {
      Configuration configuration = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
        if (configuration == null) {
            configuration = new Configuration();
        }
        NodeInfo docInfo = null;
        try {
            source = DOMHelper.promote(source);
            docInfo = Builder.build(new DOMSource(source), null, configuration);
        } catch (XPathException e) {
            throw new TransformationException(e);
View Full Code Here

        Configuration configuration = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
        if (configuration == null) {
            configuration = new Configuration();
        }       
       
        NodeInfo docInfo = null;
        try {
            source = DOMHelper.promote(source);
            docInfo = Builder.build(new DOMSource(source), null, configuration);
        } catch (XPathException e) {
            throw new TransformationException(e);
View Full Code Here

        int moduleNC = pool.allocate("", "http://www.w3.org/2005/02/query-test-XQTSCatalog", "module");
        int namespaceNC = pool.allocate("", "", "namespace");
        AxisIterator iter = testCase.iterateAxis(Axis.CHILD, new NameTest(Type.ELEMENT, moduleNC, pool));
        List catalogLocations = new ArrayList(5);
        while (true) {
            NodeInfo m = (NodeInfo)iter.next();
            if (m == null) break;
            if (moduleURI.equals(m.getAttributeValue(namespaceNC))) {
                String moduleRef = m.getStringValue();
                // take a short cut here: hard code information from the catalog
                if (moduleRef.equals("module-defs")) {
                    moduleRef = "moduleDefs-lib";
                }
                moduleRef = "../TestSources/" + moduleRef + ".xq";
View Full Code Here

     * @param context the XPath dynamic evaluation context
     * @param pul     the pending update list to which the results should be written
     */

    public void evaluatePendingUpdates(XPathContext context, PendingUpdateList pul) throws XPathException {
        NodeInfo node = (NodeInfo)argument[0].evaluateItem(context);
        int kind = node.getNodeKind();
        if (kind != Type.ELEMENT && kind != Type.DOCUMENT) {
            dynamicError("Node in put() must be a document or element node",
                    "FOUP0001", context);
        }
        String relative = argument[1].evaluateItem(context).getStringValue();
View Full Code Here

            if (errorObject instanceof SingletonItem) {
                Item root = ((SingletonItem)errorObject).getItem();
                if ((root instanceof NodeInfo) && ((NodeInfo)root).getNodeKind() == Type.DOCUMENT) {
                    XPathEvaluator xpath = new XPathEvaluator();
                    XPathExpression exp = xpath.createExpression("/error/@module");
                    NodeInfo moduleAtt = (NodeInfo)exp.evaluateSingle((NodeInfo)root);
                    String module = (moduleAtt == null ? null : moduleAtt.getStringValue());
                    exp = xpath.createExpression("/error/@line");
                    NodeInfo lineAtt = (NodeInfo)exp.evaluateSingle((NodeInfo)root);
                    int line = (lineAtt == null ? -1 : Integer.parseInt(lineAtt.getStringValue()));
                    exp = xpath.createExpression("/error/@column");
                    NodeInfo columnAtt = (NodeInfo)exp.evaluateSingle((NodeInfo)root);
                    int column = (columnAtt == null ? -1 : Integer.parseInt(columnAtt.getStringValue()));
                    ExpressionLocation locator = new ExpressionLocation();
                    locator.setSystemId(module);
                    locator.setLineNumber(line);
                    locator.setColumnNumber(column);
                    e.setLocator(locator);
View Full Code Here

TOP

Related Classes of net.sf.saxon.om.NodeInfo

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.