Search in sources :

Example 36 with XSString

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

the class TestBugs method testTypedValueEnhancement_Bug323900_4.

public void testTypedValueEnhancement_Bug323900_4() throws Exception {
    // Bug 323900
    URL fileURL = bundle.getEntry("/bugTestFiles/bug323900_3.xml");
    URL schemaURL = bundle.getEntry("/bugTestFiles/bug323900_3.xsd");
    loadDOMDocument(fileURL, schemaURL);
    // Get XSModel object for the Schema
    XSModel schema = getGrammar(schemaURL);
    setupDynamicContext(schema);
    String xpath = "data(X)";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSString result = (XSString) rs.get(0);
    assertEquals("3.3", result.getStringValue());
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) 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)

Example 37 with XSString

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSString 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)

Example 38 with XSString

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

the class TestBugs method testTypedValueEnhancement_Bug323900_3.

public void testTypedValueEnhancement_Bug323900_3() 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);
    String xpath = "data(X)";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    assertTrue(rs.get(0) instanceof XSInteger);
    assertEquals(BigInteger.ONE, ((XSInteger) rs.get(0)).int_value());
    assertTrue(rs.get(1) instanceof XSInteger);
    assertEquals(BigInteger.valueOf(2), ((XSInteger) rs.get(1)).int_value());
    assertTrue(rs.get(2) instanceof XSString);
    assertEquals("3.3", ((XSString) rs.get(2)).getStringValue());
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSInteger(org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger) 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)

Example 39 with XSString

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

the class FnStringLength method expected_args.

/**
 * Calculate the expected arguments.
 *
 * @return The expected arguments.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_QMARK));
    }
    return _expected_args;
}
Also used : SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Example 40 with XSString

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

the class FnTokenize method expected_args.

/**
 * Obtain a list of expected arguments.
 *
 * @return Result of operation.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        SeqType arg = new SeqType(new XSString(), SeqType.OCC_QMARK);
        _expected_args.add(arg);
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_NONE));
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_NONE));
    }
    return _expected_args;
}
Also used : SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Aggregations

XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)73 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)37 ArrayList (java.util.ArrayList)32 Collection (java.util.Collection)32 Iterator (java.util.Iterator)29 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)29 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)9 Item (org.eclipse.wst.xml.xpath2.api.Item)7 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)7 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)6 XSInteger (org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger)6 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)5 AnyAtomicType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType)5 NumericType (org.eclipse.wst.xml.xpath2.processor.internal.types.NumericType)5 XSBoolean (org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean)5 XSDouble (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDouble)5 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)4 XSUntypedAtomic (org.eclipse.wst.xml.xpath2.processor.internal.types.XSUntypedAtomic)4 URL (java.net.URL)3 PatternSyntaxException (java.util.regex.PatternSyntaxException)3