Search in sources :

Example 61 with XSBoolean

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

the class TestBugs method testFnNumber_Evaluation2.

public void testFnNumber_Evaluation2() throws Exception {
    // Bug 298519
    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();
    setupDynamicContext(schema);
    String xpath = "number(xs:unsignedByte('20')) ge 18";
    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 62 with XSBoolean

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

the class TestBugs method testBug341862_TypedBooleanNode.

public void testBug341862_TypedBooleanNode() throws Exception {
    // bug 341862
    URL fileURL = bundle.getEntry("/bugTestFiles/bug341862.xml");
    URL schemaURL = bundle.getEntry("/bugTestFiles/bug341862.xsd");
    loadDOMDocument(fileURL, schemaURL);
    // Get XSModel object for the Schema
    XSModel schema = getGrammar(schemaURL);
    setupDynamicContext(schema);
    // test a)
    String xpath = "/X/a[1] = true()";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    String actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test b)
    xpath = "/X/a[1]/@att = true()";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test c)
    xpath = "/X/a[2] = true()";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test d)
    xpath = "/X/a[2]/@att = true()";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test e)
    xpath = "/X/a[3] = false()";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test f)
    xpath = "/X/a[3]/@att = false()";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test g)
    xpath = "/X/a[4] = false()";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test h)
    xpath = "/X/a[4]/@att = false()";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).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 63 with XSBoolean

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

the class TestBugs method testBug339025_distinctValuesOnNodeSequence.

public void testBug339025_distinctValuesOnNodeSequence() throws Exception {
    // bug 339025
    URL fileURL = bundle.getEntry("/bugTestFiles/bug339025.xml");
    URL schemaURL = bundle.getEntry("/bugTestFiles/bug339025.xsd");
    loadDOMDocument(fileURL, schemaURL);
    // Get XSModel object for the Schema
    XSModel schema = getGrammar(schemaURL);
    setupDynamicContext(schema);
    ;
    // test a)
    String xpath = "count(//a) = count(distinct-values(//a))";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    String actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test b)
    xpath = "count(X/a) = count(distinct-values(X/a))";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test c)
    xpath = "count(//b) = count(distinct-values(//b))";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).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 64 with XSBoolean

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

the class TestBugs method testStringFunctionBug274471.

public void testStringFunctionBug274471() throws Exception {
    // Bug 274471
    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() = 'unhappy'";
    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 65 with XSBoolean

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

the class TestBugs method testXSBase64Binary.

public void testXSBase64Binary() throws Exception {
    // Bug 281046
    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();
    setupDynamicContext(schema);
    String xpath = "xs:base64Binary('cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q') eq xs:base64Binary('cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q')";
    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)

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