Search in sources :

Example 26 with XSBoolean

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

the class TestBugs method testAttrNode_Test4.

public void testAttrNode_Test4() 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(*, abc)";
    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 27 with XSBoolean

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

the class TestBugs method testXSByte.

public void testXSByte() throws Exception {
    // Bug 277639
    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);
    // min value of xs:byte is -128
    // max value of xs:byte is 127
    String xpath = "xs:byte('-128') eq -128";
    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 28 with XSBoolean

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

the class TestBugs method testBug338999_Fnsubsequence.

public void testBug338999_Fnsubsequence() throws Exception {
    // bug 338999
    URL fileURL = bundle.getEntry("/bugTestFiles/bug338999.xml");
    URL schemaURL = bundle.getEntry("/bugTestFiles/bug338999.xsd");
    loadDOMDocument(fileURL, schemaURL);
    // Get XSModel object for the Schema
    XSModel schema = getGrammar(schemaURL);
    setupDynamicContext(schema);
    // test a)
    String xpath = "count(subsequence(X/*, 2)) eq 2";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    String actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test b)
    xpath = "subsequence(X/*, 2) instance of element(*, xs:integer)+";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test c)
    xpath = "deep-equal(subsequence((1,2,3,4), 2), (2,3,4))";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test d)
    // hetrogeneous sequence as input. arity 3 mode.
    xpath = "deep-equal(subsequence(('a', 1, 1.5), 2, 2), (1, 1.5))";
    compileXPath(xpath);
    rs = evaluate(domDoc);
    actual = ((XSBoolean) rs.first()).getStringValue();
    assertEquals("true", actual);
    // test e)
    // hetrogeneous sequence as input. arity 3 mode (startingLoc is < 0).
    xpath = "deep-equal(subsequence(('a', 1, 1.5, 'b'), -2, 3), ())";
    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 29 with XSBoolean

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

the class TestBugs method testXPathInstanceOf7.

public void testXPathInstanceOf7() throws Exception {
    // Bug 298267
    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 instance of element(x, x_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 30 with XSBoolean

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

the class TestBugs method testIntDataType.

public void testIntDataType() throws Exception {
    // Bug 275105
    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);
    // int min value is -2147483648
    // and max value can be 2147483647
    String xpath = "xs:int('2147483647') gt 0";
    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