/** * Get information about the tree to which this NodeInfo belongs * * @return the TreeInfo * @since 9.7 */ public TreeInfo getTreeInfo() { return element.getTreeInfo(); }
/** * Get information about the tree to which this NodeInfo belongs * * @return the TreeInfo * @since 9.7 */ public TreeInfo getTreeInfo() { return element.getTreeInfo(); }
/** * Convenience method to get the Configuration. Always returns the same result as {@code getTreeInfo().getConfiguration()} * @return the Configuration to which the tree belongs. The default implementation invokes * {@code getTreeInfo().getConfiguration()}. * @since 8.4 */ default Configuration getConfiguration() { return getTreeInfo().getConfiguration(); }
public DocumentInfo(NodeInfo node) { if (node.getNodeKind() != Type.DOCUMENT) { throw new IllegalArgumentException("DocumentInfo must only be used for document nodes"); } this.node = node; this.parent = null; this.docWrapper = node.getTreeInfo(); }
/** * Convenience method to get the Configuration. Always returns the same result as {@code getTreeInfo().getConfiguration()} * @return the Configuration to which the tree belongs. The default implementation invokes * {@code getTreeInfo().getConfiguration()}. * @since 8.4 */ default Configuration getConfiguration() { return getTreeInfo().getConfiguration(); }
public DocumentInfo(NodeInfo node) { if (node.getNodeKind() != Type.DOCUMENT) { throw new IllegalArgumentException("DocumentInfo must only be used for document nodes"); } this.node = node; this.parent = null; this.docWrapper = node.getTreeInfo(); }
public int compare(Item a, /*@NotNull*/ Item b) { if (a == b) { return 0; } long d1 = ((NodeInfo) a).getTreeInfo().getDocumentNumber(); long d2 = ((NodeInfo) b).getTreeInfo().getDocumentNumber(); if (d1 == d2) { return ((NodeInfo) a).compareOrder((NodeInfo) b); } return Long.signum(d1 - d2); } }
public static void copyUnparsedEntities(NodeInfo source, Receiver out) throws XPathException { Iterator<String> unparsedEntities = source.getTreeInfo().getUnparsedEntityNames(); while (unparsedEntities.hasNext()) { String n = unparsedEntities.next(); String[] details = source.getTreeInfo().getUnparsedEntity(n); out.setUnparsedEntity(n, details[0], details[1]); } }
public static void copyUnparsedEntities(NodeInfo source, Receiver out) throws XPathException { Iterator<String> unparsedEntities = source.getTreeInfo().getUnparsedEntityNames(); while (unparsedEntities.hasNext()) { String n = unparsedEntities.next(); String[] details = source.getTreeInfo().getUnparsedEntity(n); out.setUnparsedEntity(n, details[0], details[1]); } }
public int compare(Item a, /*@NotNull*/ Item b) { if (a == b) { return 0; } long d1 = ((NodeInfo) a).getTreeInfo().getDocumentNumber(); long d2 = ((NodeInfo) b).getTreeInfo().getDocumentNumber(); if (d1 == d2) { return ((NodeInfo) a).compareOrder((NodeInfo) b); } return Long.signum(d1 - d2); } }
@Override public Stream<XdmNode> apply(XdmItem item) { if (doc.getNodeKind() != XdmNodeKind.DOCUMENT) { throw new IllegalArgumentException("id() - argument is not a document node"); } NodeInfo target = doc.getUnderlyingNode().getTreeInfo().selectID(item.getStringValue(), true); return target==null ? Stream.empty() : Stream.of((XdmNode)XdmNode.wrap(target)); } };
@Override public Stream<XdmNode> apply(XdmItem item) { if (doc.getNodeKind() != XdmNodeKind.DOCUMENT) { throw new IllegalArgumentException("id() - argument is not a document node"); } NodeInfo target = doc.getUnderlyingNode().getTreeInfo().selectID(item.getStringValue(), true); return target==null ? Stream.empty() : Stream.of((XdmNode)XdmNode.wrap(target)); } };
/** * Get the list of unparsed entities defined in this document * * @return an Iterator, whose items are of type String, containing the names of all * unparsed entities defined in this document. If there are no unparsed entities or if the * information is not available then an empty iterator is returned * @since 9.1 */ @Override public Iterator<String> getUnparsedEntityNames() { return ((VirtualCopy)getRootNode()).getOriginalNode().getTreeInfo().getUnparsedEntityNames(); }
/** * Get the list of unparsed entities defined in this document * * @return an Iterator, whose items are of type String, containing the names of all * unparsed entities defined in this document. If there are no unparsed entities or if the * information is not available then an empty iterator is returned * @since 9.1 */ @Override public Iterator<String> getUnparsedEntityNames() { return ((VirtualCopy)getRootNode()).getOriginalNode().getTreeInfo().getUnparsedEntityNames(); }
/** * Get the unparsed entity with a given name * * @param name the name of the entity * @return if the entity exists, return an array of two Strings, the first * holding the system ID of the entity (as an absolute URI if possible), * the second holding the public ID if there is one, or null if not. * If the entity does not exist, the method returns null. * Applications should be written on the assumption that this array may * be extended in the future to provide additional information. * @since 8.4 */ @Override public String[] getUnparsedEntity(String name) { return ((VirtualCopy) getRootNode()).getOriginalNode().getTreeInfo().getUnparsedEntity(name); } }
private void checkSequenceIsUntyped(Sequence value) throws XPathException { SequenceIterator iter = value.iterate(); Item item; while ((item = iter.next()) != null) { if (item instanceof NodeInfo && ((NodeInfo) item).getTreeInfo().isTyped()) { throw new XPathException("Schema-validated nodes cannot be passed to fn:transform() when it runs under a different Saxon Configuration", "FOXT0002"); } } }
private void checkSequenceIsUntyped(Sequence value) throws XPathException { SequenceIterator iter = value.iterate(); Item item; while ((item = iter.next()) != null) { if (item instanceof NodeInfo && ((NodeInfo) item).getTreeInfo().isTyped()) { throw new XPathException("Schema-validated nodes cannot be passed to fn:transform() when it runs under a different Saxon Configuration", "FOXT0002"); } } }
@Override public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException { URI absolute = getAbsoluteUri(href, baseUri); XdmDestination destination = new XdmDestination(); destination.setDestinationBaseURI(absolute); destination.onClose(() -> { XdmNode root = destination.getXdmNode(); results.put(absolute.toASCIIString(), root.getUnderlyingValue().getTreeInfo()); }); return destination.getReceiver(context.getReceiver().getPipelineConfiguration(), properties); }
@Override public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException { URI absolute = getAbsoluteUri(href, baseUri); XdmDestination destination = new XdmDestination(); destination.setDestinationBaseURI(absolute); destination.onClose(() -> { XdmNode root = destination.getXdmNode(); results.put(absolute.toASCIIString(), root.getUnderlyingValue().getTreeInfo()); }); return destination.getReceiver(context.getReceiver().getPipelineConfiguration(), properties); }
/** * Evaluate the expression * * @param context the dynamic evaluation context * @param arguments the values of the arguments, supplied as SequenceIterators * @return the result of the evaluation, in the form of a SequenceIterator * @throws net.sf.saxon.trans.XPathException * if a dynamic error occurs during the evaluation of the expression */ public Sequence<?> call(XPathContext context, Sequence[] arguments) throws XPathException { NodeInfo start = arguments.length == 1 ? getContextNode(context) : (NodeInfo) arguments[1].head(); NodeInfo arg2 = start.getRoot(); if (arg2.getNodeKind() != Type.DOCUMENT) { throw new XPathException("In the idref() function," + " the tree being searched must be one whose root is a document node", "FODC0001", context); } return SequenceTool.toLazySequence(getIdrefMultiple(arg2.getTreeInfo(), arguments[0].iterate(), context)); }