Search in sources :

Example 6 with TypeModel

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;
}
Also used : FnFunctionLibrary(org.eclipse.wst.xml.xpath2.processor.function.FnFunctionLibrary) DefaultDynamicContext(org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext) XSCtrLibrary(org.eclipse.wst.xml.xpath2.processor.function.XSCtrLibrary)

Example 7 with TypeModel

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;
}
Also used : TypeModel(org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel) XercesTypeModel(org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeModel) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) DocType(org.eclipse.wst.xml.xpath2.processor.internal.types.DocType)

Example 8 with TypeModel

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;
}
Also used : ElementType(org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType) Element(org.w3c.dom.Element) TypeModel(org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel) TypeDefinition(org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition)

Aggregations

TypeModel (org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel)5 TypeDefinition (org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition)3 DefaultDynamicContext (org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext)3 FnFunctionLibrary (org.eclipse.wst.xml.xpath2.processor.function.FnFunctionLibrary)3 XSCtrLibrary (org.eclipse.wst.xml.xpath2.processor.function.XSCtrLibrary)3 XercesTypeModel (org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeModel)3 URI (java.net.URI)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 DatatypeConfigurationException (javax.xml.datatype.DatatypeConfigurationException)1 NamespaceContext (javax.xml.namespace.NamespaceContext)1 QName (javax.xml.namespace.QName)1 CollationProvider (org.eclipse.wst.xml.xpath2.api.CollationProvider)1 Function (org.eclipse.wst.xml.xpath2.api.Function)1 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)1 StaticContext (org.eclipse.wst.xml.xpath2.api.StaticContext)1 StaticVariableResolver (org.eclipse.wst.xml.xpath2.api.StaticVariableResolver)1 ItemType (org.eclipse.wst.xml.xpath2.api.typesystem.ItemType)1 Engine (org.eclipse.wst.xml.xpath2.processor.Engine)1 StaticTypeNameError (org.eclipse.wst.xml.xpath2.processor.internal.StaticTypeNameError)1