- From: Peter Fankhauser <fankhaus@infonyte.com>
- Date: Mon, 29 Apr 2002 07:25:01 +0200
- To: <www-dom@w3.org>
- Cc: <pcotton@microsoft.com>, <w3c-xml-query-wg@w3.org>
Hello, please find enclosed the comments on the DOM3-XPath-module from the W3C XML Query WG. Best regards, Peter Fankhauser, Infonyte GmbH Ingo Macherius, Fraunhofer IPSI ------------------------------------------------------------------- Executive Summary: The XPath Module of DOM3 (http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020328/) is in Last Call. The review period ends on May 1, 2002. The spec is well written and implementable. Because the XPath Module considers XPath 1.0 only, there's no action required from the XQuery WG. The XML Schema module of DOM3 (not in last call) may be more relevant for XQuery 1.0 and XPath 2.0. Introduction to the XPath Module in DOM3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The XPath Module of DOM3 extends DOM2 with five interfaces: (1) XPathEvaluator has methods to evaluate and to create XPathExpressions (see 2) and a method to create an XPathNSResolver for a particular node (see 4) (2) XPathExpression can be used to represent compiled and namespace resolved XPathExpressions in some internal format. Has a method to evaluate the XPathExpression (3) XPathResult This is the most interesting interface; It distinguishes the four types of XPath; number, string, boolean, and nodeset. Nodesets can be further differentiated along the following dimensions: (a) ordered vs. unordered (interestingly, DOM XPath does allow for explicitly disregarding order by means of a type) (b) live vs. snapshot (a live node is invalidated upon update) (c) nodeset vs. any(first) node from nodeset (the latter being used e.g. by predicates in XPath) and provides (read-only) attributes to access values of simple type, and methods for iteration and indexed access for nodesets (4) XPathNamespaceResolver Provides a method to map from a given prefix to it's URI w.r.t. the node for which it has been created (see 1) (5) XPathNamespace This extends the DOM-node interface to represent namespace nodes a'la XPath. It can exclusively be used for nodes in the nodeset of an XPathResult (see 3) We have reviewed the spec from two perspectives: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (1) One of the members of the XML Query WG ships an XPath implementation on top of a (persistent) DOM. Can the spec be implemented with reasonable effort on our XPath implementation, such that it meets "DOM Level 3 XPath conformance" (= "DOM Level 2 Core" + "DOM Level 3 XPath"? Indeed it can. One (minor) qualm we have is the treatment of (general) entities (which are a DOM-node type, but not an XPath node-type). While it is clear that (a) entity-nodes raise an error if returned (on top level) of a nodeset (b) entity-nodes don't raise an error if "encapsulated" in some returned node. it is unclear what should happen when the evaluation of an XPath Expression encounters an entity-node. Does this raise an error or is it expanded? (this might be covered by Issue XPath-17-18) Similar issues hold w.r.t. the treatment of CDATA sections. (2) What does this mean for XQuery (and its datamodel)? Rather little. The XPath Module of DOM3 deliberately and explicitly focusses on the XPath 1.0 datamodel. It provides a reasonable (or at least reasonably clear) approach to reconcile the differences between the DOM 2 datamodel and the XPath datamodel: DOM 2 has no namespace nodes, has entity-nodes, and may represent contingent text-nodes). As to whether the particular approach to treating these differences meets XPath 1.0 taste should be judged by other WGs. Altogether we do not see the need for any specific action from the XML Query WG at this point. The extensions of XQuery (XPath 2.0) to take into account the much more differentiated type-system of XML-Schema, need to be compared with the Schema-module of DOM 3, which is not yet in CR phase. Some minor, personal editorial remarks: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (1) In Section 1.2 (Mapping DOM to XPath) it may be beneficial to add a small paragraph on entity-nodes (raise an exception whenever they're encountered by an XPath expression). (2) The description of result-types may be improved. In particular, a uniform wording may be used for the snapshot semantics of nodetypes "ANY_UNORDERED_NODE_TYPE", ""FIRST_ORDERED_NODE_TYPE", "ORDERED_NODE_SNAPSHOT_TYPE", "UNORDERED_NODE_SNAPSHOT_TYPE", and all simple node types. Altogether: Nice job, obviousely the spec has been written along (at least) one implementation.
Received on Monday, 29 April 2002 01:39:57 UTC