use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.
the class FsLe method fs_le_value.
/**
* Operation on the values of the arguments.
*
* @param args
* input arguments.
* @param
* DynamicContext
* @throws DynamicError
* Dynamic error.
* @return Result of the operation.
*/
public static ResultSequence fs_le_value(Collection args, DynamicContext dc) throws DynamicError {
ResultSequence less = FsLt.fs_lt_value(args, dc);
if (((XSBoolean) less.first()).value())
return less;
ResultSequence equal = FsEq.fs_eq_value(args, dc);
if (((XSBoolean) equal.first()).value())
return equal;
return ResultSequenceFactory.create_new(new XSBoolean(false));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testXPathInstanceOf2.
public void testXPathInstanceOf2() throws Exception {
// Bug 298267
URL fileURL = bundle.getEntry("/bugTestFiles/elementTypedValueBug.xml");
URL schemaURL = bundle.getEntry("/bugTestFiles/elementTypedValueBug.xsd");
loadDOMDocument(fileURL, schemaURL);
// Get XSModel object for the Schema
XSModel schema = getGrammar(schemaURL);
setupDynamicContext(schema);
String xpath = "Example/Transportation/mode instance of element(mode)";
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.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testXSNonNegativeInteger.
public void testXSNonNegativeInteger() throws Exception {
// Bug 277609
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:nonNegativeInteger is 0
// max value of xs:nonNegativeInteger is INF
String xpath = "xs:nonNegativeInteger('0') eq 0";
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.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testXSNonPositiveInteger.
public void testXSNonPositiveInteger() throws Exception {
// Bug 277599
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:nonPositiveInteger is -INF
// max value is 0
String xpath = "xs:nonPositiveInteger('0') eq 0";
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.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testBaseUriBug.
public void testBaseUriBug() throws Exception {
// Bug 274725
// DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// DocumentBuilder docBuilder = dbf.newDocumentBuilder();
loadDOMDocument(new URL("http://resolved-locally/xml/note.xml"));
// for testing this bug, we read the XML document from the web.
// this ensures, that base-uri property of DOM is not null.
// domDoc = docBuilder.parse("http://resolved-locally/xml/note.xml");
// we pass XSModel as null for this test case. Otherwise, we would
// get an exception.
setupDynamicContext(null);
String xpath = "base-uri(note) eq xs:anyURI('http://resolved-locally/xml/note.xml')";
// please note: The below XPath would also work, with base-uri using
// arity 0.
// String xpath =
// "note/base-uri() eq xs:anyURI('http://resolved-locally/xml/note.xml')";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
XSBoolean result = (XSBoolean) rs.first();
String actual = result.getStringValue();
assertEquals("true", actual);
}
Aggregations