Search in sources :

Example 16 with XSBoolean

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.

the class TestBugs method testAttrNode_Test5.

public void testAttrNode_Test5() throws Exception {
    // Bug 298535
    URL fileURL = bundle.getEntry("/bugTestFiles/attrNodeTest.xml");
    URL schemaURL = bundle.getEntry("/bugTestFiles/attrNodeTest.xsd");
    loadDOMDocument(fileURL, schemaURL);
    // Get XSModel object for the Schema
    XSModel schema = getGrammar(schemaURL);
    setupDynamicContext(schema);
    String xpath = "Example/x[1]/@mesg instance of attribute(mesg, mesg_Type)";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSBoolean result = (XSBoolean) rs.first();
    String actual = result.getStringValue();
    assertEquals("true", actual);
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Example 17 with XSBoolean

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.

the class TestBugs method testAttrNode_Test3.

public void testAttrNode_Test3() throws Exception {
    // Bug 298535
    URL fileURL = bundle.getEntry("/bugTestFiles/attrNodeTest.xml");
    URL schemaURL = bundle.getEntry("/bugTestFiles/attrNodeTest.xsd");
    loadDOMDocument(fileURL, schemaURL);
    // Get XSModel object for the Schema
    XSModel schema = getGrammar(schemaURL);
    setupDynamicContext(schema);
    String xpath = "Example/x[1]/@mesg instance of attribute(*, mesg_Type)";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSBoolean result = (XSBoolean) rs.first();
    String actual = result.getStringValue();
    assertEquals("true", actual);
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Example 18 with XSBoolean

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.

the class TestBugs method testStringLengthFunctionBug274471.

public void testStringLengthFunctionBug274471() throws Exception {
    // Bug 274471. string-length() with arity 0
    URL fileURL = bundle.getEntry("/bugTestFiles/bug274471.xml");
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    String xpath = "x/string-length() = 7";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSBoolean result = (XSBoolean) rs.first();
    String actual = result.getStringValue();
    assertEquals("false", actual);
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Example 19 with XSBoolean

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.

the class TestBugs method testXPathDefaultNamespace.

public void testXPathDefaultNamespace() throws Exception {
    // Test for the fix, for xpathDefaultNamespace
    URL fileURL = bundle.getEntry("/bugTestFiles/xpathDefNamespaceTest.xml");
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    // set up XPath default namespace in Dynamic Context
    setupDynamicContext(schema);
    addXPathDefaultNamespace("http://xyz");
    String xpath = "X/message = 'hello'";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSBoolean result = (XSBoolean) rs.first();
    String actual = result.getStringValue();
    assertEquals("true", actual);
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Example 20 with XSBoolean

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.

the class TestBugs method testDefNamespaceOnbuiltInTypes.

public void testDefNamespaceOnbuiltInTypes() throws Exception {
    bundle = Platform.getBundle("org.w3c.xqts.testsuite");
    URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    // set up XPath default namespace in Dynamic Context
    setupDynamicContext(schema);
    addXPathDefaultNamespace("http://www.w3.org/2001/XMLSchema");
    setVariable("value", new XSString("2.5"));
    String xpath = "$value castable as double";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSBoolean result = (XSBoolean) rs.first();
    String actual = result.getStringValue();
    assertEquals("true", actual);
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Aggregations

XSBoolean (org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean)87 XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)69 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)65 URL (java.net.URL)62 XSModel (org.apache.xerces.xs.XSModel)61 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)15 Iterator (java.util.Iterator)10 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)5 Collection (java.util.Collection)4 ListIterator (java.util.ListIterator)4 VarExprPair (org.eclipse.wst.xml.xpath2.processor.internal.ast.VarExprPair)4 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)4 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)3 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)3 XSInteger (org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 Schema (javax.xml.validation.Schema)2 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)2 ElementType (org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType)2