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