/** * Callback from ElementCreator when constructing an element * * @param context XPath dynamic evaluation context * @param copiedNode the node being copied * @return the namecode of the element to be constructed * @throws XPathException */ public NodeName getElementName(XPathContext context, NodeInfo copiedNode) throws XPathException { return NameOfNode.makeName(copiedNode); }
/** * Callback from ElementCreator when constructing an element * * @param context XPath dynamic evaluation context * @param copiedNode the node being copied * @return the namecode of the element to be constructed * @throws XPathException */ public NodeName getElementName(XPathContext context, NodeInfo copiedNode) throws XPathException { return NameOfNode.makeName(copiedNode); }
/** * Test whether the NameTest matches a given QName * * @param qname the QName to be matched * @return true if the name matches */ public boolean matches(StructuredQName qname) { return NameOfNode.makeName(origin).getStructuredQName().equals(qname); }
/** * Test whether the NameTest matches a given QName * * @param qname the QName to be matched * @return true if the name matches */ public boolean matches(StructuredQName qname) { return NameOfNode.makeName(origin).getStructuredQName().equals(qname); }
/** * Get an iterator over all the properties available. The values returned by the iterator * will be of type String, and each string can be supplied as input to the getProperty() * method to retrieve the value of the property. */ public Iterator<String> getProperties() { List<String> list = new ArrayList<>(10); iterateAxis(AxisInfo.ATTRIBUTE).forEach(a -> list.add(NameOfNode.makeName(a).getStructuredQName().getClarkName()) ); return list.iterator(); }
/** * Get an iterator over all the properties available. The values returned by the iterator * will be of type String, and each string can be supplied as input to the getProperty() * method to retrieve the value of the property. */ public Iterator<String> getProperties() { List<String> list = new ArrayList<>(10); iterateAxis(AxisInfo.ATTRIBUTE).forEach(a -> list.add(NameOfNode.makeName(a).getStructuredQName().getClarkName()) ); return list.iterator(); }
/** * Test whether this node test is satisfied by a given node. This alternative * method is used in the case of nodes where calculating the fingerprint is expensive, * for example DOM or JDOM nodes. The default implementation calls the method * {@link #matches(int, NodeName, SchemaType)} * * @param node the node to be matched * @return true if the node test is satisfied by the supplied node, false otherwise */ public boolean matchesNode(/*@NotNull*/ NodeInfo node) { return matches(node.getNodeKind(), NameOfNode.makeName(node), node.getSchemaType()); }
/** * Test whether this node test is satisfied by a given node. This alternative * method is used in the case of nodes where calculating the fingerprint is expensive, * for example DOM or JDOM nodes. The default implementation calls the method * {@link #matches(int, NodeName, SchemaType)} * * @param node the node to be matched * @return true if the node test is satisfied by the supplied node, false otherwise */ public boolean matchesNode(/*@NotNull*/ NodeInfo node) { return matches(node.getNodeKind(), NameOfNode.makeName(node), node.getSchemaType()); }
/** * Create an absolute path given a Node * @param node the node whose path is required */ public static AbsolutePath pathToNode(NodeInfo node) { LinkedList<PathElement> list = new LinkedList<>(); while (node != null && node.getNodeKind() != Type.DOCUMENT) { PathElement pe = new PathElement(node.getNodeKind(), NameOfNode.makeName(node), Navigator.getNumberSimple(node, null)); list.addFirst(pe); node = node.getParent(); } return new AbsolutePath(list); }
/** * Create an absolute path given a Node * @param node the node whose path is required */ public static AbsolutePath pathToNode(NodeInfo node) { LinkedList<PathElement> list = new LinkedList<>(); while (node != null && node.getNodeKind() != Type.DOCUMENT) { PathElement pe = new PathElement(node.getNodeKind(), NameOfNode.makeName(node), Navigator.getNumberSimple(node, null)); list.addFirst(pe); node = node.getParent(); } return new AbsolutePath(list); }
/** * Copy this node to a given outputter */ public void copy(/*@NotNull*/ Receiver out, int copyOptions, Location locationId) throws XPathException { SimpleType typeCode = CopyOptions.includes(copyOptions, CopyOptions.TYPE_ANNOTATIONS) ? (SimpleType) getSchemaType() : BuiltInAtomicType.UNTYPED_ATOMIC; out.attribute(NameOfNode.makeName(this), typeCode, getStringValue(), locationId, 0); }
/** * Copy this node to a given outputter */ public void copy(/*@NotNull*/ Receiver out, int copyOptions, Location locationId) throws XPathException { SimpleType typeCode = (CopyOptions.includes(copyOptions, CopyOptions.TYPE_ANNOTATIONS) ? ((SimpleType) getSchemaType()) : BuiltInAtomicType.UNTYPED_ATOMIC); out.attribute(NameOfNode.makeName(this), typeCode, getStringValue(), locationId, 0); }
/** * Copy this node to a given outputter */ public void copy(/*@NotNull*/ Receiver out, int copyOptions, Location locationId) throws XPathException { SimpleType typeCode = (CopyOptions.includes(copyOptions, CopyOptions.TYPE_ANNOTATIONS) ? ((SimpleType) getSchemaType()) : BuiltInAtomicType.UNTYPED_ATOMIC); out.attribute(NameOfNode.makeName(this), typeCode, getStringValue(), locationId, 0); }
/** * Copy this node to a given outputter */ public void copy(/*@NotNull*/ Receiver out, int copyOptions, Location locationId) throws XPathException { SimpleType typeCode = CopyOptions.includes(copyOptions, CopyOptions.TYPE_ANNOTATIONS) ? (SimpleType) getSchemaType() : BuiltInAtomicType.UNTYPED_ATOMIC; out.attribute(NameOfNode.makeName(this), typeCode, getStringValue(), locationId, 0); }
public String toString() { switch (origin.getNodeKind()) { case Type.ELEMENT: return "element(" + NameOfNode.makeName(origin).getStructuredQName().getEQName() + ")"; case Type.ATTRIBUTE: return "attribute(" + NameOfNode.makeName(origin).getStructuredQName().getEQName() + ")"; case Type.PROCESSING_INSTRUCTION: return "processing-instruction(" + origin.getLocalPart() + ')'; case Type.NAMESPACE: return "namespace-node(" + origin.getLocalPart() + ')'; case Type.COMMENT: return "comment()"; case Type.DOCUMENT: return "document-node()"; case Type.TEXT: return "text()"; default: return "***"; } }
public String toString() { switch (origin.getNodeKind()) { case Type.ELEMENT: return "element(" + NameOfNode.makeName(origin).getStructuredQName().getEQName() + ")"; case Type.ATTRIBUTE: return "attribute(" + NameOfNode.makeName(origin).getStructuredQName().getEQName() + ")"; case Type.PROCESSING_INSTRUCTION: return "processing-instruction(" + origin.getLocalPart() + ')'; case Type.NAMESPACE: return "namespace-node(" + origin.getLocalPart() + ')'; case Type.COMMENT: return "comment()"; case Type.DOCUMENT: return "document-node()"; case Type.TEXT: return "text()"; default: return "***"; } }
public void addAttribute(XdmNode xdmattr, String newValue) { NodeInfo inode = xdmattr.getUnderlyingNode(); NodeName attrName = NameOfNode.makeName(inode); SimpleType typeCode = (SimpleType) inode.getSchemaType(); try { receiver.attribute(attrName, typeCode, newValue, VoidLocation.instance(), 0); } catch (XPathException e) { throw new XProcException(e); } }
public void addAttribute(XdmNode xdmattr, String newValue) { NodeInfo inode = xdmattr.getUnderlyingNode(); NodeName attrName = NameOfNode.makeName(inode); SimpleType typeCode = (SimpleType) inode.getSchemaType(); try { receiver.attribute(attrName, typeCode, newValue, VoidLocation.instance(), 0); } catch (XPathException e) { throw new XProcException(e); } }
/** * Get the absolute path to a node * * @param node the node in question * @return an object representing the path to the node */ public static AbsolutePath getAbsolutePath(NodeInfo node) { boolean streamed = node.getConfiguration().isStreamedNode(node); List<AbsolutePath.PathElement> path = new LinkedList<>(); String sysId = node.getSystemId(); while (node != null && node.getNodeKind() != Type.DOCUMENT) { path.add(0, new AbsolutePath.PathElement(node.getNodeKind(), NameOfNode.makeName(node), streamed ? -1 : getNumberSimple(node, null))); node = node.getParent(); } AbsolutePath a = new AbsolutePath(path); a.setSystemId(sysId); return a; }
/** * Get the absolute path to a node * * @param node the node in question * @return an object representing the path to the node */ public static AbsolutePath getAbsolutePath(NodeInfo node) { boolean streamed = node.getConfiguration().isStreamedNode(node); List<AbsolutePath.PathElement> path = new LinkedList<>(); String sysId = node.getSystemId(); while (node != null && node.getNodeKind() != Type.DOCUMENT) { path.add(0, new AbsolutePath.PathElement(node.getNodeKind(), NameOfNode.makeName(node), streamed ? -1 : getNumberSimple(node, null))); node = node.getParent(); } AbsolutePath a = new AbsolutePath(path); a.setSystemId(sysId); return a; }