use of org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathWTPTest method setupDynamicContext2.
protected DefaultDynamicContext setupDynamicContext2(TypeModel model) {
DefaultDynamicContext dc = new DefaultDynamicContext(model);
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.api.typesystem.TypeModel in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method setupVariables.
protected DynamicContext setupVariables(DynamicContext dc) {
setVariable("x", (AnyType) null);
setVariable("var", (AnyType) null);
if (domDoc != null) {
TypeModel typeModel = dynamicContext != null ? dynamicContext.getTypeModel(domDoc) : staticContextBuilder.getTypeModel();
AnyType docType = new DocType(domDoc, typeModel);
setVariable("input-context1", docType);
setVariable("input-context", docType);
if (domDoc2 == null) {
setVariable("input-context2", docType);
} else {
setVariable("input-context2", (AnyType) new DocType(domDoc2, typeModel));
}
}
return dc;
}
use of org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel in project webtools.sourceediting by eclipse.
the class ElementTest method createElementForXSDType.
private AnyType createElementForXSDType(NodeList nodeList, StaticContext sc) {
for (int i = 0; i < nodeList.getLength(); i++) {
Element element = (Element) nodeList.item(i);
TypeModel typeModel = sc.getTypeModel();
TypeDefinition typedef = typeModel.getType(element);
if (type() == null || typedef == null) {
anyType = new ElementType(element, typeModel);
break;
} else {
if (typedef.derivedFrom(type().namespace(), type().local(), getDerviationTypes())) {
anyType = new ElementType(element, typeModel);
break;
}
}
}
return anyType;
}
Aggregations