Search in sources :

Example 1 with DefaultDynamicContext

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

Example 2 with DefaultDynamicContext

use of org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext 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;
}
Also used : DatatypeConfigurationException(javax.xml.datatype.DatatypeConfigurationException) FnFunctionLibrary(org.eclipse.wst.xml.xpath2.processor.function.FnFunctionLibrary) DynamicContextBuilder(org.eclipse.wst.xml.xpath2.processor.util.DynamicContextBuilder) DefaultDynamicContext(org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext) XercesTypeModel(org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeModel) XSCtrLibrary(org.eclipse.wst.xml.xpath2.processor.function.XSCtrLibrary)

Example 3 with DefaultDynamicContext

use of org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext in project webtools.sourceediting by eclipse.

the class TestXPath20 method testSetupNullContenxt.

public void testSetupNullContenxt() throws Exception {
    DynamicContext dc = new DefaultDynamicContext(null, null);
    dc.add_namespace("xsd", "http://www.w3.org/2001/XMLSchema");
}
Also used : DefaultDynamicContext(org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext) DynamicContext(org.eclipse.wst.xml.xpath2.processor.DynamicContext) DefaultDynamicContext(org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext)

Example 4 with DefaultDynamicContext

use of org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext in project webtools.sourceediting by eclipse.

the class TestXPath20 method testAddLibraries.

public void testAddLibraries() throws Exception {
    DynamicContext dc = new DefaultDynamicContext(null, domDoc);
    dc.add_namespace("xsd", "http://www.w3.org/2001/XMLSchema");
    dc.add_function_library(new FnFunctionLibrary());
    dc.add_function_library(new XSCtrLibrary());
}
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) DynamicContext(org.eclipse.wst.xml.xpath2.processor.DynamicContext) DefaultDynamicContext(org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext)

Example 5 with DefaultDynamicContext

use of org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext 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)

Aggregations

DefaultDynamicContext (org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext)6 FnFunctionLibrary (org.eclipse.wst.xml.xpath2.processor.function.FnFunctionLibrary)5 XSCtrLibrary (org.eclipse.wst.xml.xpath2.processor.function.XSCtrLibrary)4 DynamicContext (org.eclipse.wst.xml.xpath2.processor.DynamicContext)2 XercesTypeModel (org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeModel)2 DatatypeConfigurationException (javax.xml.datatype.DatatypeConfigurationException)1 DefaultEvaluator (org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator)1 Evaluator (org.eclipse.wst.xml.xpath2.processor.Evaluator)1 JFlexCupParser (org.eclipse.wst.xml.xpath2.processor.JFlexCupParser)1 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)1 StaticChecker (org.eclipse.wst.xml.xpath2.processor.StaticChecker)1 StaticNameResolver (org.eclipse.wst.xml.xpath2.processor.StaticNameResolver)1 XPathParser (org.eclipse.wst.xml.xpath2.processor.XPathParser)1 XPath (org.eclipse.wst.xml.xpath2.processor.ast.XPath)1 DefaultStaticContext (org.eclipse.wst.xml.xpath2.processor.internal.DefaultStaticContext)1 XSDecimal (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal)1 DynamicContextBuilder (org.eclipse.wst.xml.xpath2.processor.util.DynamicContextBuilder)1