use of org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeModel in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathWTPTest method setupDynamicContext.
protected DefaultDynamicContext setupDynamicContext(XSModel schema) {
XercesTypeModel typeModel = schema != null ? new XercesTypeModel(schema) : null;
DefaultDynamicContext dc = new DefaultDynamicContext(typeModel);
// DefaultDynamicContext dc = new DefaultDynamicContext(schema, domDoc);
dynamicContext = dc;
dc.add_namespace("xs", "http://www.w3.org/2001/XMLSchema");
dc.add_namespace("xsd", "http://www.w3.org/2001/XMLSchema");
dc.add_namespace("fn", "http://www.w3.org/2005/xpath-functions");
dc.add_namespace("xml", "http://www.w3.org/XML/1998/namespace");
dc.add_function_library(new FnFunctionLibrary());
dc.add_function_library(new XSCtrLibrary());
setupVariables(dc);
return dc;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeModel in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method setupDynamicContext.
protected DefaultDynamicContext setupDynamicContext(XSModel schema) {
XercesTypeModel typeModel = schema != null ? new XercesTypeModel(schema) : null;
if (useNewApi) {
staticContextBuilder.withTypeModel(typeModel);
staticContextBuilder.withNamespace("xs", "http://www.w3.org/2001/XMLSchema");
staticContextBuilder.withNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
staticContextBuilder.withNamespace("fn", "http://www.w3.org/2005/xpath-functions");
staticContextBuilder.withNamespace("xml", "http://www.w3.org/XML/1998/namespace");
dynamicContextBuilder = new DynamicContextBuilder(staticContextBuilder);
setupVariables(dynamicContext);
try {
dynamicContextBuilder.withTimezoneOffset(DatatypeFactory.newInstance().newDuration(false, /*i.e. negative*/
0, 0, 0, 5, 0, 0));
} catch (DatatypeConfigurationException e) {
throw new RuntimeException("Shouldn't fail here", e);
}
return null;
}
DefaultDynamicContext dc = new DefaultDynamicContext(typeModel);
dynamicContext = dc;
dc.add_namespace("xs", "http://www.w3.org/2001/XMLSchema");
dc.add_namespace("xsd", "http://www.w3.org/2001/XMLSchema");
dc.add_namespace("fn", "http://www.w3.org/2005/xpath-functions");
dc.add_namespace("xml", "http://www.w3.org/XML/1998/namespace");
dc.add_function_library(new FnFunctionLibrary());
dc.add_function_library(new XSCtrLibrary());
setupVariables(dc);
return dc;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeModel in project webtools.sourceediting by eclipse.
the class CompleteNewApiTest method testNamesWhichAreKeywords.
public void testNamesWhichAreKeywords() throws Exception {
// Bug 273719
bundle = Platform.getBundle("org.eclipse.wst.xml.xpath2.processor.tests");
URL fileURL = bundle.getEntry("/bugTestFiles/bug311480.xml");
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
// String xpath = "($input-context/atomic:root/atomic:integer) union ($input-context/atomic:root/atomic:integer)";
String xpath = "((/element/eq eq 'eq') or //child::xs:*) and false";
Boolean b = (Boolean) evaluateSimpleXPath(xpath, new StaticContextBuilder().withNamespace("xs", "urn:joe").withTypeModel(new XercesTypeModel(schema)), domDoc, Boolean.class);
assertEquals(Boolean.FALSE, b);
}
Aggregations