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());
}
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);
}
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());
}
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;
}
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;
}
Aggregations