From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java | 134 +++++++++++++ .../w3c_dom/org/w3c/dom/xpath/XPathException.java | 39 ++++ .../w3c_dom/org/w3c/dom/xpath/XPathExpression.java | 65 +++++++ .../w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java | 34 ++++ .../w3c_dom/org/w3c/dom/xpath/XPathNamespace.java | 67 +++++++ .../w3c_dom/org/w3c/dom/xpath/XPathResult.java | 214 +++++++++++++++++++++ 6 files changed, 553 insertions(+) create mode 100644 libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java create mode 100644 libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java create mode 100644 libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java create mode 100644 libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java create mode 100644 libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java create mode 100644 libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java (limited to 'libjava/classpath/external/w3c_dom/org/w3c/dom/xpath') diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java new file mode 100644 index 000000000..848c67329 --- /dev/null +++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2004 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.xpath; + +import org.w3c.dom.Node; +import org.w3c.dom.DOMException; + +/** + * The evaluation of XPath expressions is provided by + * XPathEvaluator. In a DOM implementation which supports the + * XPath 3.0 feature, as described above, the XPathEvaluator + * interface will be implemented on the same object which implements the + * Document interface permitting it to be obtained by the usual + * binding-specific method such as casting or by using the DOM Level 3 + * getInterface method. In this case the implementation obtained from the + * Document supports the XPath DOM module and is compatible with the XPath + * 1.0 specification. + *

Evaluation of expressions with specialized extension functions or + * variables may not work in all implementations and is, therefore, not + * portable. XPathEvaluator implementations may be available + * from other sources that could provide specific support for specialized + * extension functions or variables as would be defined by other + * specifications. + *

See also the Document Object Model (DOM) Level 3 XPath Specification. + */ +public interface XPathEvaluator { + /** + * Creates a parsed XPath expression with resolved namespaces. This is + * useful when an expression will be reused in an application since it + * makes it possible to compile the expression string into a more + * efficient internal form and preresolve all namespace prefixes which + * occur within the expression. + * @param expression The XPath expression string to be parsed. + * @param resolver The resolver permits translation of all + * prefixes, including the xml namespace prefix, within + * the XPath expression into appropriate namespace URIs. If this is + * specified as null, any namespace prefix within the + * expression will result in DOMException being thrown + * with the code NAMESPACE_ERR. + * @return The compiled form of the XPath expression. + * @exception XPathException + * INVALID_EXPRESSION_ERR: Raised if the expression is not legal + * according to the rules of the XPathEvaluator. + * @exception DOMException + * NAMESPACE_ERR: Raised if the expression contains namespace prefixes + * which cannot be resolved by the specified + * XPathNSResolver. + */ + public XPathExpression createExpression(String expression, + XPathNSResolver resolver) + throws XPathException, DOMException; + + /** + * Adapts any DOM node to resolve namespaces so that an XPath expression + * can be easily evaluated relative to the context of the node where it + * appeared within the document. This adapter works like the DOM Level 3 + * method lookupNamespaceURI on nodes in resolving the + * namespaceURI from a given prefix using the current information + * available in the node's hierarchy at the time lookupNamespaceURI is + * called. also correctly resolving the implicit xml prefix. + * @param nodeResolver The node to be used as a context for namespace + * resolution. + * @return XPathNSResolver which resolves namespaces with + * respect to the definitions in scope for a specified node. + */ + public XPathNSResolver createNSResolver(Node nodeResolver); + + /** + * Evaluates an XPath expression string and returns a result of the + * specified type if possible. + * @param expression The XPath expression string to be parsed and + * evaluated. + * @param contextNode The context is context node for the + * evaluation of this XPath expression. If the XPathEvaluator was + * obtained by casting the Document then this must be + * owned by the same document and must be a Document, + * Element, Attribute, Text, + * CDATASection, Comment, + * ProcessingInstruction, or XPathNamespace + * node. If the context node is a Text or a + * CDATASection, then the context is interpreted as the + * whole logical text node as seen by XPath, unless the node is empty + * in which case it may not serve as the XPath context. + * @param resolver The resolver permits translation of all + * prefixes, including the xml namespace prefix, within + * the XPath expression into appropriate namespace URIs. If this is + * specified as null, any namespace prefix within the + * expression will result in DOMException being thrown + * with the code NAMESPACE_ERR. + * @param type If a specific type is specified, then the + * result will be returned as the corresponding type.For XPath 1.0 + * results, this must be one of the codes of the + * XPathResult interface. + * @param result The result specifies a specific result + * object which may be reused and returned by this method. If this is + * specified as nullor the implementation does not reuse + * the specified result, a new result object will be constructed and + * returned.For XPath 1.0 results, this object will be of type + * XPathResult. + * @return The result of the evaluation of the XPath expression.For XPath + * 1.0 results, this object will be of type XPathResult. + * @exception XPathException + * INVALID_EXPRESSION_ERR: Raised if the expression is not legal + * according to the rules of the XPathEvaluatori + *
TYPE_ERR: Raised if the result cannot be converted to return the + * specified type. + * @exception DOMException + * NAMESPACE_ERR: Raised if the expression contains namespace prefixes + * which cannot be resolved by the specified + * XPathNSResolver. + *
WRONG_DOCUMENT_ERR: The Node is from a document that is not + * supported by this XPathEvaluator. + *
NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath + * context node or the request type is not permitted by this + * XPathEvaluator. + */ + public Object evaluate(String expression, + Node contextNode, + XPathNSResolver resolver, + short type, + Object result) + throws XPathException, DOMException; + +} diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java new file mode 100644 index 000000000..6b13cdf00 --- /dev/null +++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2004 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.xpath; + +/** + * A new exception has been created for exceptions specific to these XPath + * interfaces. + *

See also the Document Object Model (DOM) Level 3 XPath Specification. + */ +public class XPathException extends RuntimeException { + public XPathException(short code, String message) { + super(message); + this.code = code; + } + public short code; + // XPathExceptionCode + /** + * If the expression has a syntax error or otherwise is not a legal + * expression according to the rules of the specific + * XPathEvaluator or contains specialized extension + * functions or variables not supported by this implementation. + */ + public static final short INVALID_EXPRESSION_ERR = 51; + /** + * If the expression cannot be converted to return the specified type. + */ + public static final short TYPE_ERR = 52; + +} diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java new file mode 100644 index 000000000..ab5d28c43 --- /dev/null +++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2004 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.xpath; + +import org.w3c.dom.Node; +import org.w3c.dom.DOMException; + +/** + * The XPathExpression interface represents a parsed and resolved + * XPath expression. + *

See also the Document Object Model (DOM) Level 3 XPath Specification. + */ +public interface XPathExpression { + /** + * Evaluates this XPath expression and returns a result. + * @param contextNode The context is context node for the + * evaluation of this XPath expression.If the XPathEvaluator was + * obtained by casting the Document then this must be + * owned by the same document and must be a Document, + * Element, Attribute, Text, + * CDATASection, Comment, + * ProcessingInstruction, or XPathNamespace + * node.If the context node is a Text or a + * CDATASection, then the context is interpreted as the + * whole logical text node as seen by XPath, unless the node is empty + * in which case it may not serve as the XPath context. + * @param type If a specific type is specified, then the + * result will be coerced to return the specified type relying on + * XPath conversions and fail if the desired coercion is not possible. + * This must be one of the type codes of XPathResult. + * @param result The result specifies a specific result + * object which may be reused and returned by this method. If this is + * specified as nullor the implementation does not reuse + * the specified result, a new result object will be constructed and + * returned.For XPath 1.0 results, this object will be of type + * XPathResult. + * @return The result of the evaluation of the XPath expression.For XPath + * 1.0 results, this object will be of type XPathResult. + * @exception XPathException + * TYPE_ERR: Raised if the result cannot be converted to return the + * specified type. + * @exception DOMException + * WRONG_DOCUMENT_ERR: The Node is from a document that is not supported + * by the XPathEvaluator that created this XPathExpression + * . + *
NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath + * context node or the request type is not permitted by this + * XPathExpression. + */ + public Object evaluate(Node contextNode, + short type, + Object result) + throws XPathException, DOMException; + +} diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java new file mode 100644 index 000000000..5ce068de9 --- /dev/null +++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2004 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.xpath; + +/** + * The XPathNSResolver interface permit prefix + * strings in the expression to be properly bound to + * namespaceURI strings. XPathEvaluator can + * construct an implementation of XPathNSResolver from a node, + * or the interface may be implemented by any application. + *

See also the Document Object Model (DOM) Level 3 XPath Specification. + */ +public interface XPathNSResolver { + /** + * Look up the namespace URI associated to the given namespace prefix. The + * XPath evaluator must never call this with a null or + * empty argument, because the result of doing this is undefined. + * @param prefix The prefix to look for. + * @return Returns the associated namespace URI or null if + * none is found. + */ + public String lookupNamespaceURI(String prefix); + +} diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java new file mode 100644 index 000000000..d644051f2 --- /dev/null +++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2004 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.xpath; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * The XPathNamespace interface is returned by + * XPathResult interfaces to represent the XPath namespace node + * type that DOM lacks. There is no public constructor for this node type. + * Attempts to place it into a hierarchy or a NamedNodeMap result in a + * DOMException with the code HIERARCHY_REQUEST_ERR + * . This node is read only, so methods or setting of attributes that would + * mutate the node result in a DOMException with the code + * NO_MODIFICATION_ALLOWED_ERR. + *

The core specification describes attributes of the Node + * interface that are different for different node types but does not + * describe XPATH_NAMESPACE_NODE, so here is a description of + * those attributes for this node type. All attributes of Node + * not described in this section have a null or + * false value. + *

ownerDocument matches the ownerDocument of the + * ownerElement even if the element is later adopted. + *

nodeName is always the string "#namespace". + *

prefix is the prefix of the namespace represented by the + * node. + *

localName is the same as prefix. + *

nodeType is equal to XPATH_NAMESPACE_NODE. + *

namespaceURI is the namespace URI of the namespace + * represented by the node. + *

nodeValue is the same as namespaceURI. + *

adoptNode, cloneNode, and + * importNode fail on this node type by raising a + * DOMException with the code NOT_SUPPORTED_ERR. + *

Note: In future versions of the XPath specification, the + * definition of a namespace node may be changed incomatibly, in which case + * incompatible changes to field values may be required to implement + * versions beyond XPath 1.0. + *

See also the Document Object Model (DOM) Level 3 XPath Specification. + */ +public interface XPathNamespace extends Node { + // XPathNodeType + /** + * The node is a Namespace. + */ + public static final short XPATH_NAMESPACE_NODE = 13; + + /** + * The Element on which the namespace was in scope when it + * was requested. This does not change on a returned namespace node even + * if the document changes such that the namespace goes out of scope on + * that element and this node is no longer found there by XPath. + */ + public Element getOwnerElement(); + +} diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java new file mode 100644 index 000000000..06fd29dac --- /dev/null +++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2004 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.xpath; + +import org.w3c.dom.Node; +import org.w3c.dom.DOMException; + +/** + * The XPathResult interface represents the result of the + * evaluation of an XPath 1.0 expression within the context of a particular + * node. Since evaluation of an XPath expression can result in various + * result types, this object makes it possible to discover and manipulate + * the type and value of the result. + *

See also the Document Object Model (DOM) Level 3 XPath Specification. + */ +public interface XPathResult { + // XPathResultType + /** + * This code does not represent a specific type. An evaluation of an XPath + * expression will never produce this type. If this type is requested, + * then the evaluation returns whatever type naturally results from + * evaluation of the expression. + *
If the natural result is a node set when ANY_TYPE was + * requested, then UNORDERED_NODE_ITERATOR_TYPE is always + * the resulting type. Any other representation of a node set must be + * explicitly requested. + */ + public static final short ANY_TYPE = 0; + /** + * The result is a number as defined by [XPath 1.0]. + * Document modification does not invalidate the number, but may mean + * that reevaluation would not yield the same number. + */ + public static final short NUMBER_TYPE = 1; + /** + * The result is a string as defined by [XPath 1.0]. + * Document modification does not invalidate the string, but may mean + * that the string no longer corresponds to the current document. + */ + public static final short STRING_TYPE = 2; + /** + * The result is a boolean as defined by [XPath 1.0]. + * Document modification does not invalidate the boolean, but may mean + * that reevaluation would not yield the same boolean. + */ + public static final short BOOLEAN_TYPE = 3; + /** + * The result is a node set as defined by [XPath 1.0] that + * will be accessed iteratively, which may not produce nodes in a + * particular order. Document modification invalidates the iteration. + *
This is the default type returned if the result is a node set and + * ANY_TYPE is requested. + */ + public static final short UNORDERED_NODE_ITERATOR_TYPE = 4; + /** + * The result is a node set as defined by [XPath 1.0] that + * will be accessed iteratively, which will produce document-ordered + * nodes. Document modification invalidates the iteration. + */ + public static final short ORDERED_NODE_ITERATOR_TYPE = 5; + /** + * The result is a node set as defined by [XPath 1.0] that + * will be accessed as a snapshot list of nodes that may not be in a + * particular order. Document modification does not invalidate the + * snapshot but may mean that reevaluation would not yield the same + * snapshot and nodes in the snapshot may have been altered, moved, or + * removed from the document. + */ + public static final short UNORDERED_NODE_SNAPSHOT_TYPE = 6; + /** + * The result is a node set as defined by [XPath 1.0] that + * will be accessed as a snapshot list of nodes that will be in original + * document order. Document modification does not invalidate the + * snapshot but may mean that reevaluation would not yield the same + * snapshot and nodes in the snapshot may have been altered, moved, or + * removed from the document. + */ + public static final short ORDERED_NODE_SNAPSHOT_TYPE = 7; + /** + * The result is a node set as defined by [XPath 1.0] and + * will be accessed as a single node, which may be nullif + * the node set is empty. Document modification does not invalidate the + * node, but may mean that the result node no longer corresponds to the + * current document. This is a convenience that permits optimization + * since the implementation can stop once any node in the resulting set + * has been found. + *
If there is more than one node in the actual result, the single + * node returned might not be the first in document order. + */ + public static final short ANY_UNORDERED_NODE_TYPE = 8; + /** + * The result is a node set as defined by [XPath 1.0] and + * will be accessed as a single node, which may be null if + * the node set is empty. Document modification does not invalidate the + * node, but may mean that the result node no longer corresponds to the + * current document. This is a convenience that permits optimization + * since the implementation can stop once the first node in document + * order of the resulting set has been found. + *
If there are more than one node in the actual result, the single + * node returned will be the first in document order. + */ + public static final short FIRST_ORDERED_NODE_TYPE = 9; + + /** + * A code representing the type of this result, as defined by the type + * constants. + */ + public short getResultType(); + + /** + * The value of this number result. If the native double type of the DOM + * binding does not directly support the exact IEEE 754 result of the + * XPath expression, then it is up to the definition of the binding to + * specify how the XPath number is converted to the native binding + * number. + * @exception XPathException + * TYPE_ERR: raised if resultType is not + * NUMBER_TYPE. + */ + public double getNumberValue() + throws XPathException; + + /** + * The value of this string result. + * @exception XPathException + * TYPE_ERR: raised if resultType is not + * STRING_TYPE. + */ + public String getStringValue() + throws XPathException; + + /** + * The value of this boolean result. + * @exception XPathException + * TYPE_ERR: raised if resultType is not + * BOOLEAN_TYPE. + */ + public boolean getBooleanValue() + throws XPathException; + + /** + * The value of this single node result, which may be null. + * @exception XPathException + * TYPE_ERR: raised if resultType is not + * ANY_UNORDERED_NODE_TYPE or + * FIRST_ORDERED_NODE_TYPE. + */ + public Node getSingleNodeValue() + throws XPathException; + + /** + * Signifies that the iterator has become invalid. True if + * resultType is UNORDERED_NODE_ITERATOR_TYPE + * or ORDERED_NODE_ITERATOR_TYPE and the document has been + * modified since this result was returned. + */ + public boolean getInvalidIteratorState(); + + /** + * The number of nodes in the result snapshot. Valid values for + * snapshotItem indices are 0 to + * snapshotLength-1 inclusive. + * @exception XPathException + * TYPE_ERR: raised if resultType is not + * UNORDERED_NODE_SNAPSHOT_TYPE or + * ORDERED_NODE_SNAPSHOT_TYPE. + */ + public int getSnapshotLength() + throws XPathException; + + /** + * Iterates and returns the next node from the node set or + * nullif there are no more nodes. + * @return Returns the next node. + * @exception XPathException + * TYPE_ERR: raised if resultType is not + * UNORDERED_NODE_ITERATOR_TYPE or + * ORDERED_NODE_ITERATOR_TYPE. + * @exception DOMException + * INVALID_STATE_ERR: The document has been mutated since the result was + * returned. + */ + public Node iterateNext() + throws XPathException, DOMException; + + /** + * Returns the indexth item in the snapshot collection. If + * index is greater than or equal to the number of nodes in + * the list, this method returns null. Unlike the iterator + * result, the snapshot does not become invalid, but may not correspond + * to the current document if it is mutated. + * @param index Index into the snapshot collection. + * @return The node at the indexth position in the + * NodeList, or null if that is not a valid + * index. + * @exception XPathException + * TYPE_ERR: raised if resultType is not + * UNORDERED_NODE_SNAPSHOT_TYPE or + * ORDERED_NODE_SNAPSHOT_TYPE. + */ + public Node snapshotItem(int index) + throws XPathException; + +} -- cgit v1.2.3