private XdmNode expandXIncludes(XdmNode doc) { logger.trace(MessageFormatter.nodeMessage(doc, "Starting expandXIncludes")); ProcessMatch matcher = new ProcessMatch(runtime, this); matcherStack.push(matcher); matcher.match(doc, new RuntimeValue("/|*", step.getNode())); XdmNode result = matcher.getResult(); matcher = matcherStack.pop(); return result; }
public boolean processStartElement(XdmNode node) throws SaxonApiException { matcher.addStartElement(node); XdmSequenceIterator iter = node.axisIterator(Axis.ATTRIBUTE); while (iter.hasNext()) { XdmNode attr = (XdmNode) iter.next(); if (!attrs.contains(attr.getNodeName())) { matcher.addAttribute(attr); } } matcher.addAttributes(root); matcher.startContent(); return true; }
public void processComment(XdmNode node) throws SaxonApiException { if (!inGroup.peek()) { matcher.addStartElement(wrapperCode, Untyped.getInstance(), null); } matcher.addComment(node.getStringValue()); if (groupAdjacent != null && nextMatches(node)) { inGroup.pop(); inGroup.push(true); } else { matcher.addEndElement(); inGroup.pop(); inGroup.push(false); } }
public boolean processStartElement(XdmNode node) throws SaxonApiException { matcher.addStartElement(node, newName); matcher.addAttributes(node); return true; }
public boolean processStartDocument(XdmNode node) throws SaxonApiException { matcher.startDocument(node.getBaseURI()); matcher.addStartElement(wrapperCode, Untyped.getInstance(), null); matcher.startContent(); matcher.addSubtree(node); matcher.addEndElement(); matcher.endDocument(); return false; }
public boolean processStartElement(XdmNode node) throws SaxonApiException { if ("before".equals(position)) { doInsert(); } matcher.addStartElement(node); matcher.addAttributes(node); matcher.startContent(); if ("first-child".equals(position)) { doInsert(); } return true; }
for (XdmItem item : items) { if (item.isAtomicValue()) { matcher.addText(item.getStringValue()); } else { XdmNode nitem = (XdmNode) item; switch (nitem.getNodeKind()) { case ELEMENT: matcher.addSubtree(nitem); break; case ATTRIBUTE: matcher.addAttribute(nitem); break; case PROCESSING_INSTRUCTION: matcher.addSubtree(nitem); break; case COMMENT: matcher.addComment(nitem.getStringValue()); break; default: matcher.addText(nitem.getStringValue()); matcher.addText(value);
matcher = new ProcessMatch(runtime, this); sequenceLength = matcher.count(doc, match, false); matcher.match(doc, match); runtime.finish(this); String wport = port.substring(1); WritablePipe pipe = outputs.get(wport); XdmNode result = matcher.getResult(); pipe.write(result); logger.trace(MessageFormatter.nodeMessage(step.getNode(), "Viewport output copy from matcher to " + pipe));
inside.push(iuri); XdmNode ex = expandXIncludes(snode); matcher.addSubtree(ex); inside.pop(); } else { matcher.addSubtree(snode); throw new XProcException("Invalid placement for xi:fallback element"); } else { matcher.addStartElement(node); matcher.addAttributes(node); matcher.startContent(); return true;
public boolean processStartElement(XdmNode node) throws SaxonApiException { matcher.addStartElement(node); matcher.addAttributes(node); String value = node.getStringValue(); value = URIUtils.encode(value); URI baseURI = setBaseURI == null ? node.getBaseURI() : setBaseURI; String resolved = baseURI.resolve(value).toString(); matcher.addText(resolved); return false; }
public void processPI(XdmNode node) throws SaxonApiException { if (!inGroup.peek()) { matcher.addStartElement(wrapperCode, Untyped.getInstance(), null); } matcher.addPI(node.getNodeName().getLocalName(),node.getStringValue()); if (groupAdjacent != null && nextMatches(node)) { inGroup.pop(); inGroup.push(true); } else { matcher.addEndElement(); inGroup.pop(); inGroup.push(false); } }
private void process(XdmNode node) throws SaxonApiException { if ("before".equals(position)) { doInsert(); } if (node.getNodeKind() == XdmNodeKind.COMMENT) { matcher.addComment(node.getStringValue()); } else if (node.getNodeKind() == XdmNodeKind.PROCESSING_INSTRUCTION) { matcher.addPI(node.getNodeName().getLocalName(), node.getStringValue()); } else if (node.getNodeKind() == XdmNodeKind.TEXT) { matcher.addText(node.getStringValue()); } else { throw new IllegalArgumentException("What kind of node was that!?"); } if ("after".equals(position)) { doInsert(); } if ("first-child".equals(position) || "last-child".equals(position)) { throw XProcException.stepError(25); } }
matcher.addStartElement(NameOfNode.makeName(inode), inode.getSchemaType(), inscopeNS); } else { if (inscopeNS.length > 0) { matcher.addStartElement(nameCode, inode.getSchemaType(), newNS); matcher.addAttribute(nameCode, (SimpleType) inode.getSchemaType(), attr.getStringValue()); matcher.addAttributes(node);
public void processAttribute(XdmNode node) throws SaxonApiException { String newValue = computeReplacement(node); matcher.addAttribute(node, newValue); }
public void processPI(XdmNode node) throws SaxonApiException { matcher.addPI(node.getNodeName().getLocalName(),encoded); }
public boolean processStartElement(XdmNode node) throws SaxonApiException { matcher.addText(hash); return false; }
public void processComment(XdmNode node) throws SaxonApiException { matcher.addComment(encoded); }
public void processEndElement(XdmNode node) throws SaxonApiException { matcher.addEndElement(); inGroup.pop(); if (!inGroup.peek()) { matcher.addEndElement(); } }
private void doReplace() throws SaxonApiException { while (replacement.moreDocuments()) { matcher.addSubtree(replacement.read()); } replacement.resetReader(); } }
public boolean processStartDocument(XdmNode node) throws SaxonApiException { matcher.startDocument(node.getBaseURI()); matcher.addStartElement(wrapperCode, Untyped.getInstance(), null); matcher.startContent(); matcher.addSubtree(node); matcher.addEndElement(); matcher.endDocument(); return false; }