use of org.eclipse.wst.xml.xpath2.processor.internal.types.DocType 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.processor.internal.types.DocType in project webtools.sourceediting by eclipse.
the class FnDocumentUri method document_uri.
/**
* Document-Uri operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:document-uri operation.
*/
public static ResultSequence document_uri(Collection args) throws DynamicError {
Collection cargs = Function.convert_arguments(args, expected_args());
ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
if (arg1.empty())
return ResultBuffer.EMPTY;
NodeType nt = (NodeType) arg1.first();
if (!(nt instanceof DocType))
return ResultBuffer.EMPTY;
DocType dt = (DocType) nt;
String documentURI = dt.value().getDocumentURI();
if (documentURI != null) {
XSAnyURI docUri = new XSAnyURI(documentURI);
return docUri;
}
return ResultBuffer.EMPTY;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.DocType in project webtools.sourceediting by eclipse.
the class FnDoc method doc.
/**
* Doc operation.
*
* @param args
* Result from the expressions evaluation.
* @param dc
* Result of dynamic context operation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:doc operation.
*/
public static ResultSequence doc(Collection args, EvaluationContext ec) throws DynamicError {
Collection cargs = Function.convert_arguments(args, expected_args());
// get args
Iterator argiter = cargs.iterator();
ResultSequence arg1 = (ResultSequence) argiter.next();
if (arg1.empty())
return ResultSequenceFactory.create_new();
String uri = ((XSString) arg1.item(0)).value();
DynamicContext dc = ec.getDynamicContext();
URI resolved = dc.resolveUri(uri);
if (resolved == null)
throw DynamicError.invalid_doc(null);
Document doc = dc.getDocument(resolved);
if (doc == null)
throw DynamicError.doc_not_found(null);
return new DocType(doc, ec.getStaticContext().getTypeModel());
}
Aggregations