Search in sources :

Example 81 with XSBoolean

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

the class TestBugs method testTypedValueEnhancement_Bug323900_2.

public void testTypedValueEnhancement_Bug323900_2() throws Exception {
    // Bug 323900
    URL fileURL = bundle.getEntry("/bugTestFiles/bug323900_2.xml");
    URL schemaURL = bundle.getEntry("/bugTestFiles/bug323900_2.xsd");
    loadDOMDocument(fileURL, schemaURL);
    // Get XSModel object for the Schema
    XSModel schema = getGrammar(schemaURL);
    setupDynamicContext(schema);
    // 1st test
    String xpath = "data(X) instance of xs:integer+";
    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 82 with XSBoolean

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

the class KindTestSITest method testXPathInstanceOf5.

public void testXPathInstanceOf5() throws Exception {
    // Bug 298267
    // This test should fail
    String inputFile = "/TestSources/SpecialTypes.xml";
    String expectedResult = "false";
    URL fileURL = bundle.getEntry(inputFile);
    Schema jaxpSchema = loadSchema();
    loadDOMDocument(fileURL, jaxpSchema);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    addNamespace(null, "http://typedecl");
    // addUserDefinedSimpleTypes(schema, dc);
    String xpath = "/root/InterleaveType instance of element(InterleaveType, InterleaveType2)";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSBoolean result = (XSBoolean) rs.first();
    String actual = result.getStringValue();
    assertEquals(expectedResult, actual);
}
Also used : XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) Schema(javax.xml.validation.Schema) XSModel(org.apache.xerces.xs.XSModel) URL(java.net.URL)

Example 83 with XSBoolean

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

the class KindTestSITest method testXPathInstanceOf4.

public void testXPathInstanceOf4() throws Exception {
    // Bug 298267
    // This test should fail
    String inputFile = "/TestSources/SpecialTypes.xml";
    String expectedResult = "true";
    URL fileURL = bundle.getEntry(inputFile);
    Schema jaxpSchema = loadSchema();
    loadDOMDocument(fileURL, jaxpSchema);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    addNamespace(null, "http://typedecl");
    // addUserDefinedSimpleTypes(schema, dc);
    String xpath = "/root/InterleaveType instance of element(InterleaveType, InterleaveType)";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSBoolean result = (XSBoolean) rs.first();
    String actual = result.getStringValue();
    assertEquals(expectedResult, actual);
}
Also used : XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) Schema(javax.xml.validation.Schema) XSModel(org.apache.xerces.xs.XSModel) URL(java.net.URL)

Example 84 with XSBoolean

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

the class FnDeepEqual method deep_equal.

/**
 * Deep-Equal expression operation.
 *
 * @param args
 *            Result from the expressions evaluation.
 * @param context
 *            Dynamic context
 * @throws DynamicError
 *             Dynamic error.
 * @return Result of fn:deep-equal operation.
 */
public static ResultSequence deep_equal(Collection args, EvaluationContext context) throws DynamicError {
    // get args
    Iterator citer = args.iterator();
    ResultSequence arg1 = (ResultSequence) citer.next();
    ResultSequence arg2 = (ResultSequence) citer.next();
    ResultSequence arg3 = null;
    String collationURI = context.getStaticContext().getCollationProvider().getDefaultCollation();
    if (citer.hasNext()) {
        arg3 = (ResultSequence) citer.next();
        if (!arg3.empty()) {
            collationURI = arg3.first().getStringValue();
        }
    }
    boolean result = deep_equal(arg1, arg2, context, collationURI);
    return ResultSequenceFactory.create_new(new XSBoolean(result));
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean) Iterator(java.util.Iterator) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Example 85 with XSBoolean

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

the class FnNot method fn_not.

/**
 * Not operation.
 *
 * @param arg
 *            Result from the expressions evaluation.
 * @return Result of fn:note operation.
 * @throws DynamicError
 */
public static ResultSequence fn_not(ResultSequence arg) throws DynamicError {
    XSBoolean ret = FnBoolean.fn_boolean(arg);
    boolean answer = false;
    if (ret.value() == false)
        answer = true;
    return ResultSequenceFactory.create_new(new XSBoolean(answer));
}
Also used : XSBoolean(org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean)

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