use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathWTPTest method setupVariables.
protected DynamicContext setupVariables(DynamicContext dc) {
dc.add_variable(new QName("x"));
dc.add_variable(new QName("var"));
if (domDoc != null) {
AnyType docType = new DocType(domDoc, dc.getTypeModel(domDoc));
dc.set_variable(new QName("input-context1"), docType);
dc.set_variable(new QName("input-context"), docType);
if (domDoc2 == null) {
dc.set_variable(new QName("input-context2"), docType);
} else {
dc.set_variable(new QName("input-context2"), (AnyType) new DocType(domDoc2, dc.getTypeModel(domDoc2)));
}
}
return dc;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class SeqExprCastSITest method test_qname_cast_4.
// Evaluates casting QName type to a QName derived type.
public void test_qname_cast_4() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/SchemaImport/SeqExprCastSI/qname-cast-4.xq";
String resultFile = "/ExpectedTestResults/SchemaImport/SeqExprCastSI/value1.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
Schema jaxpSchema = loadSchema();
loadDOMDocument(fileURL, jaxpSchema);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
addUserDefinedSimpleTypes(schema);
String xpath = "xs:QName(\"value1\") cast as myType:QNameBased";
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method setVariable.
protected void setVariable(String name, ResultSequence values) {
if (useNewApi) {
staticContextBuilder.withVariable(new javax.xml.namespace.QName(name), new SimpleAtomicItemTypeImpl(BuiltinTypeLibrary.XS_ANYATOMICTYPE, ItemType.OCCURRENCE_NONE_OR_MANY));
dynamicContextBuilder.withVariable(new javax.xml.namespace.QName(name), values);
} else {
dynamicContext.set_variable(new QName(name), values);
}
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class ResolveQNameFuncTest method test_fn_resolve_qname_4.
public void test_fn_resolve_qname_4() throws Exception {
String inputFile = "/TestSources/MixNS.xml";
String xqFile = "/Queries/XQuery/Functions/URIFunc/ResolveURIFunc/fn-resolve-uri-1.xq";
String expectedResult = "c";
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
addNamespace("cm", "http://www.example.com");
addNamespace("ed", "http://www.example.edu");
String xpath = "fn:string(fn:local-name-from-QName(fn:resolve-QName(\"cm:c\", /a/b/cm:c)))";
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class ResolveQNameFuncTest method test_fn_resolve_qname_9.
public void test_fn_resolve_qname_9() throws Exception {
String inputFile = "/TestSources/examples.xml";
String xqFile = "/Queries/XQuery/Functions/URIFunc/ResolveURIFunc/fn-resolve-uri-1.xq";
String expectedResult = "http://www.w3.org/XQueryTest/someExamples";
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
addNamespace(null, "http://www.w3.org/XQueryTest/someExamples");
String xpath = "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(\"E6-Root\", /E6-Root)))";
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
Aggregations