本文整理汇总了Java中net.sf.saxon.s9api.XdmNodeKind类的典型用法代码示例。如果您正苦于以下问题:Java XdmNodeKind类的具体用法?Java XdmNodeKind怎么用?Java XdmNodeKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XdmNodeKind类属于net.sf.saxon.s9api包,在下文中一共展示了XdmNodeKind类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildWhen
import net.sf.saxon.s9api.XdmNodeKind; //导入依赖的package包/类
private WhenEntry buildWhen(XdmNode whenNode, HashMap<QName,ParameterValue> parameters) throws InvalidSyntaxException {
String test = whenNode.getAttributeValue(WhenEntry.ATTR_TEST);
// particular case of the otherwise, which is implemented as a when[@test='true()']
if((test==null || test.length()==0) && WhenEntry.QN_OTHERWISE.equals(whenNode.getNodeName()) ) {
test="true()";
}
WhenEntry when = new WhenEntry(test);
XdmSequenceIterator it = whenNode.axisIterator(Axis.CHILD);
while(it.hasNext()) {
XdmItem item = it.next();
if(item instanceof XdmNode) {
XdmNode node = (XdmNode)item;
if(Xslt.QNAME.equals(node.getNodeName())) {
when.addStep(buildXslt(node,parameters));
} else if(JavaStep.QNAME.equals(node.getNodeName())) {
when.addStep(buildJavaStep(node, parameters));
} else if(ChooseStep.QNAME.equals(node.getNodeName())) {
when.addStep(buildChooseStep(node, parameters));
} else if(node.getNodeKind()==XdmNodeKind.TEXT) {
// on ignore
} else if(node.getNodeKind()==XdmNodeKind.COMMENT) {
// on ignore
} else {
throw new InvalidSyntaxException(node.getNodeKind().toString()+" - "+ node.getNodeName()+": unexpected element in "+Pipe.QNAME);
}
}
}
return when;
}
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:30,代码来源:ConfigUtil.java
示例2: parseFile
import net.sf.saxon.s9api.XdmNodeKind; //导入依赖的package包/类
private void parseFile(String fileHddCachePath) {
//logger.info("parseFile: " + decodedUrl);
try {
containsUncachableXsltConref = false;
isFileParsed = true; // on failure the value remains true since a reparsing makes no sense.
final XdmNode rootNode = bookCache.getDocumentBuilder().build(source, expandAttributeDefaults);
final XdmSequenceIterator iterator = rootNode.axisIterator(Axis.CHILD);
//logger.info(SaxonNodeWrapper.serializeNode(rootNode.getUnderlyingNode()));
rootElement = null;
while ((iterator.hasNext()) && (rootElement == null)) {
final XdmNode child =(XdmNode)iterator.next();
//logger.info(" node: " + node.getNodeName() + ", " + node.getNodeKind());
if (child.getNodeKind() == XdmNodeKind.ELEMENT) {
rootElement = new SaxonNodeWrapper(child.getUnderlyingNode(), bookCache.getXPathCache());
}
}
if (rootElement != null) {
parseNode(rootElement.getNodeInfo(), this, null);
rootClass = rootElement.getAttribute(DitaUtil.ATTR_CLASS, null);
rootTitle = extractString(rootElement, LINK_TITLE_XSL);
rootName = rootElement.getName();
if ((fileHddCachePath != null) && (isHddCachable())) {
writeHddCache(fileHddCachePath, fileTimestamp);
}
}
} catch(SaxonApiException | TransformerException e) {
logger.error(e, e);
rootElement = null;
}
}
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:38,代码来源:FileCache.java
示例3: doProcess2
import net.sf.saxon.s9api.XdmNodeKind; //导入依赖的package包/类
@Override
protected boolean doProcess2(Record inputRecord, InputStream stream) throws SaxonApiException, XMLStreamException {
incrementNumRecords();
for (Fragment fragment : fragments) {
Record template = inputRecord.copy();
removeAttachments(template);
XdmNode document = parseXmlDocument(stream);
LOG.trace("XQuery input document: {}", document);
XQueryEvaluator evaluator = fragment.xQueryEvaluator;
evaluator.setContextItem(document);
int i = 0;
for (XdmItem item : evaluator) {
i++;
if (LOG.isTraceEnabled()) {
LOG.trace("XQuery result sequence item #{} is of class: {} with value: {}", new Object[] { i,
item.getUnderlyingValue().getClass().getName(), item });
}
if (item.isAtomicValue()) {
LOG.debug("Ignoring atomic value in result sequence: {}", item);
continue;
}
XdmNode node = (XdmNode) item;
Record outputRecord = template.copy();
boolean isNonEmpty = addRecordValues(node, Axis.SELF, XdmNodeKind.ATTRIBUTE, outputRecord);
isNonEmpty = addRecordValues(node, Axis.ATTRIBUTE, XdmNodeKind.ATTRIBUTE, outputRecord) || isNonEmpty;
isNonEmpty = addRecordValues(node, Axis.CHILD, XdmNodeKind.ELEMENT, outputRecord) || isNonEmpty;
if (isNonEmpty) { // pass record to next command in chain
if (!getChild().process(outputRecord)) {
return false;
}
}
}
}
return true;
}
开发者ID:cloudera,项目名称:cdk,代码行数:37,代码来源:XQueryBuilder.java
示例4: addRecordValues
import net.sf.saxon.s9api.XdmNodeKind; //导入依赖的package包/类
protected boolean addRecordValues(XdmNode node, Axis axis, XdmNodeKind nodeTest, Record record) {
boolean isEmpty = true;
XdmSequenceIterator iter = node.axisIterator(axis);
while (iter.hasNext()) {
XdmNode child = (XdmNode) iter.next();
if (child.getNodeKind() == nodeTest) {
String strValue = child.getStringValue();
if (strValue.length() > 0) {
record.put(child.getNodeName().getLocalName(), strValue);
isEmpty = false;
}
}
}
return !isEmpty;
}
开发者ID:cloudera,项目名称:cdk,代码行数:16,代码来源:XQueryBuilder.java
示例5: getLabel
import net.sf.saxon.s9api.XdmNodeKind; //导入依赖的package包/类
static String getLabel(XdmNode n) {
String label = n.getAttributeValue(LABEL_QNAME);
if (label == null) {
XdmNode value = (XdmNode) n.axisIterator(Axis.CHILD).next();
XdmItem childItem = null;
try {
childItem = value.axisIterator(Axis.CHILD).next();
} catch (Exception e) {
// Not an error
}
if (childItem == null) {
XdmSequenceIterator it = value.axisIterator(Axis.ATTRIBUTE);
if (it.hasNext()) {
label = it.next().getStringValue();
} else {
label = "";
}
} else if (childItem.isAtomicValue()) {
label = childItem.getStringValue();
} else if (childItem instanceof XdmNode) {
XdmNode n2 = (XdmNode) childItem;
if (n2.getNodeKind() == XdmNodeKind.ELEMENT) {
label = "<" + n2.getNodeName().toString() + ">";
} else {
label = n2.toString();
}
}
}
return label;
}
开发者ID:opengeospatial,项目名称:teamengine,代码行数:31,代码来源:TECore.java
示例6: evaluateResults
import net.sf.saxon.s9api.XdmNodeKind; //导入依赖的package包/类
private void evaluateResults(List<ValidatorEvent> events, XPathSet xPathSet, String baseXPathExpression, ExpectedResults xPathSetContent)
throws SaxonApiException, XPathException {
ValidatorLocation loc;
CrigttLocation locObj;
boolean assertionStatus = false;
boolean xPathComparisonElementResult = xPathSet.getXPathResultComparison() && xPathSet.getElementNodeKindExpected();
ValidatorEvent event = CrigttTestcaseUtils.setEventDetails(loc = new ValidatorLocationImpl());
events.add(event);
loc.setNodeExpression(baseXPathExpression);
List<String> expectedResults =
CrigttTestcaseUtils.addNullFlavors(xPathSetContent.getIncludeNullFlavors(), this.nullFlavors, xPathSetContent.getExpectedResults());
List<XdmNode> locNodes = Arrays.asList(this.xpathCompiler.evaluateNodes(xPathSet.getXPathExpression(), this.xpathContext, this.doc));
MatchingCondition matchingCondition = xPathSet.getMatchingCondition();
Set<String> expectedXPathResults = new HashSet<>(expectedResults.size());
List<XdmNode> xPathNodeResults = new ArrayList<>(expectedResults.size());
for (XdmNode locNode : locNodes) {
if (locNode != null) {
loc.setColumnNumber((locObj = new CrigttLocation(locNode.getUnderlyingNode())).getColumnNumber());
loc.setLineNumber(locObj.getLineNumber());
XdmNodeKind locNodeKind = locNode.getNodeKind();
String actualResult = (locNodeKind == XdmNodeKind.ATTRIBUTE || locNodeKind == XdmNodeKind.TEXT) ? locNode.getStringValue() : locNode.toString();
if (xPathSet.getXPathResultComparison()) {
for (String expectedResult : expectedResults) {
XdmNode resultNode = this.xpathCompiler.evaluateNode(expectedResult, this.xpathContext, this.doc);
if (resultNode != null) {
XdmNodeKind nodeKind = resultNode.getNodeKind();
if (nodeKind == XdmNodeKind.ATTRIBUTE || nodeKind == XdmNodeKind.TEXT) {
expectedXPathResults.add(resultNode.getStringValue());
} else if (nodeKind == XdmNodeKind.ELEMENT) {
xPathNodeResults.add(resultNode);
}
}
}
assertionStatus = xPathSet.getElementNodeKindExpected()
? CrigttTestcaseUtils.getAssertionStatus(xPathNodeResults, locNode, this.xpathContext.getConfiguration(), matchingCondition)
: CrigttTestcaseUtils.getAssertionStatus(new ArrayList<>(expectedXPathResults), actualResult, baseXPathExpression, matchingCondition);
} else {
assertionStatus = CrigttTestcaseUtils.getAssertionStatus(expectedResults, actualResult, baseXPathExpression, matchingCondition);
}
event.setActualResult(actualResult);
if (assertionStatus) {
break;
}
} else {
assertionStatus =
expectedResults.isEmpty() || CrigttTestcaseUtils.getAssertionStatus(
xPathComparisonElementResult ? (expectedResults = findEmptyResult(expectedResults)) : expectedResults, CrigttTestcaseUtils.EMPTY_RESULT,
baseXPathExpression);
}
}
if (locNodes.size() == 0) {
assertionStatus =
expectedResults.isEmpty() || CrigttTestcaseUtils.getAssertionStatus(
xPathComparisonElementResult ? (expectedResults = findEmptyResult(expectedResults)) : expectedResults, CrigttTestcaseUtils.EMPTY_RESULT,
baseXPathExpression);
}
if (expectedXPathResults.size() > 0) {
expectedResults.addAll(expectedXPathResults);
} else if (xPathComparisonElementResult && xPathNodeResults.size() > 0) {
expectedResults.addAll(new HashSet<>(xPathNodeResults).stream().map(XdmNode::toString).collect(Collectors.toList()));
}
event.setExpectedResults(expectedResults);
event.setStatus(assertionStatus);
}
开发者ID:esacinc,项目名称:crigtt,代码行数:79,代码来源:ContextSpecificValidatorTaskImpl.java
注:本文中的net.sf.saxon.s9api.XdmNodeKind类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论