Package javax.xml.xpath

Examples of javax.xml.xpath.XPath.evaluate()


                {// ((//*:test-group)//*:test-case)/*:input-file
                    NodeList vars1 = (NodeList) xpath.evaluate("./*[local-name()='input-file']/@variable", testCase, XPathConstants.NODESET);
                    loadVariables(vars1, testCase, xqmod, statEnv, xpath, catalog, false);
                }
                { // ((//*:test-group)//*:test-case)/*:input-URI
                    NodeList vars2 = (NodeList) xpath.evaluate("./*[local-name()='input-URI']/@variable", testCase, XPathConstants.NODESET);
                    loadVariables(vars2, testCase, xqmod, statEnv, xpath, catalog, true);
                }
                {// ((//*:test-group)//*:test-case)/*:defaultCollection
                    String colId = xpath.evaluate("./*[local-name()='defaultCollection']/text()", testCase);
                    if(colId != null) {
View Full Code Here


                { // ((//*:test-group)//*:test-case)/*:input-URI
                    NodeList vars2 = (NodeList) xpath.evaluate("./*[local-name()='input-URI']/@variable", testCase, XPathConstants.NODESET);
                    loadVariables(vars2, testCase, xqmod, statEnv, xpath, catalog, true);
                }
                {// ((//*:test-group)//*:test-case)/*:defaultCollection
                    String colId = xpath.evaluate("./*[local-name()='defaultCollection']/text()", testCase);
                    if(colId != null) {
                        NodeList list = (NodeList) xpath.evaluate("/*[local-name()='test-suite']/*[local-name()='sources']/*[local-name()='collection'][@ID='"
                                + colId + "']/*[local-name()='input-document']/text()", catalog, XPathConstants.NODESET);
                        final int listlen = list.getLength();
                        if(listlen > 0) {
View Full Code Here

                    loadVariables(vars2, testCase, xqmod, statEnv, xpath, catalog, true);
                }
                {// ((//*:test-group)//*:test-case)/*:defaultCollection
                    String colId = xpath.evaluate("./*[local-name()='defaultCollection']/text()", testCase);
                    if(colId != null) {
                        NodeList list = (NodeList) xpath.evaluate("/*[local-name()='test-suite']/*[local-name()='sources']/*[local-name()='collection'][@ID='"
                                + colId + "']/*[local-name()='input-document']/text()", catalog, XPathConstants.NODESET);
                        final int listlen = list.getLength();
                        if(listlen > 0) {
                            final Map<String, DTMDocument> defaultCollectionMap = new HashMap<String, DTMDocument>(listlen);
                            for(int j = 0; j < listlen; j++) {
View Full Code Here

                        }
                    }
                }
                Sequence<? extends Item> contextItem = null;
                {// ((//*:test-group)//*:test-case)/*:contextItem
                    String contextItemRef = xpath.evaluate("./*[local-name()='contextItem']/text()", testCase);
                    if(contextItemRef != null && contextItemRef.length() > 0) {
                        String contextItemFileRef = xpath.evaluate("/*[local-name()='test-suite']/*[local-name()='sources']/*[local-name()='source']/@FileName[../@ID='"
                                + contextItemRef + "']", catalog);
                        DTMDocument contextItemDoc = _docCache.get(contextItemRef);
                        if(contextItemDoc == null) {
View Full Code Here

                }
                Sequence<? extends Item> contextItem = null;
                {// ((//*:test-group)//*:test-case)/*:contextItem
                    String contextItemRef = xpath.evaluate("./*[local-name()='contextItem']/text()", testCase);
                    if(contextItemRef != null && contextItemRef.length() > 0) {
                        String contextItemFileRef = xpath.evaluate("/*[local-name()='test-suite']/*[local-name()='sources']/*[local-name()='source']/@FileName[../@ID='"
                                + contextItemRef + "']", catalog);
                        DTMDocument contextItemDoc = _docCache.get(contextItemRef);
                        if(contextItemDoc == null) {
                            File contextItemFile = new File(xqtsDir, contextItemFileRef);
                            DocumentTableModel dtm = new DocumentTableModel(false);
View Full Code Here

                        }
                        contextItem = contextItemDoc;
                    }
                }
                {// ((//*:test-group)//*:test-case)/*:input-query
                    String inputVarName = xpath.evaluate("./*[local-name()='input-query']/@variable", testCase);
                    if(inputVarName != null && inputVarName.length() > 0) {
                        String dateData = xpath.evaluate("./*[local-name()='input-query']/@date", testCase);
                        assert (dateData != null) : dateData;
                        QualifiedName varName = QNameTable.instantiate(XMLConstants.DEFAULT_NS_PREFIX, inputVarName);
                        Variable var = new Variable.GlobalVariable(varName, null);
View Full Code Here

                    }
                }
                {// ((//*:test-group)//*:test-case)/*:input-query
                    String inputVarName = xpath.evaluate("./*[local-name()='input-query']/@variable", testCase);
                    if(inputVarName != null && inputVarName.length() > 0) {
                        String dateData = xpath.evaluate("./*[local-name()='input-query']/@date", testCase);
                        assert (dateData != null) : dateData;
                        QualifiedName varName = QNameTable.instantiate(XMLConstants.DEFAULT_NS_PREFIX, inputVarName);
                        Variable var = new Variable.GlobalVariable(varName, null);
                        var.setResult(new DateTimeValue(dateData, DateType.DATE));
                        xqmod.putVariable(varName, var);
View Full Code Here

                    final String query = IOUtils.toString(new FileInputStream(queryFile), "UTF-8");
                    if(doPrint) {
                        println("Query: ");
                        println(query);
                    }
                    final NodeList expectedErrors = (NodeList) xpath.evaluate("./*[local-name()='expected-error']", testCase, XPathConstants.NODESET);
                    {
                        XQueryProcessor proc = new XQueryProcessor(xqmod);
                        proc.setStaticContext(statEnv);
                        if(contextItem != null) {
                            proc.setContextItem(contextItem);
View Full Code Here

                            Serializer ser = new SAXSerializer(saxwriter, res_sw);
                            ser.emit(result);
                        } catch (Throwable ex) {
                            final int errors = expectedErrors.getLength();
                            if(errors == 0) {
                                final Node expectedOutputs = (Node) xpath.evaluate("./*[local-name()='output-file'][last()]", testCase, XPathConstants.NODE);
                                assert (expectedOutputs != null);
                                final Element output = (Element) expectedOutputs;
                                final String expFileName = output.getTextContent();
                                final File testFileDir = new File(xqtsResultPath, testFilePath);
                                String expectedResult = _expectedResultStrCache.get(expFileName);
View Full Code Here

                }

                // -----------------------------------------------------------
                // #2 probe
                {
                    NodeList expectedOutputs = (NodeList) xpath.evaluate("./*[local-name()='output-file']", testCase, XPathConstants.NODESET);
                    final int expectedOuts = expectedOutputs.getLength();
                    if(expectedOuts == 0) {
                        Assert.fail("Expected condition is not found in '" + testName + '\'');
                    }
                    final File testFileDir = new File(xqtsResultPath, testFilePath);
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.