Hi Boris, Those changes look good as far as I can see. Note that XPath 2.0 implementations ought to be able to give meaningful results to a request for any of the resultType enumerations types.
Boris Kolpackov wrote: > I went ahead and merged the two interfaces. Could you please > review the result (and notes below) to see if it's good enough > for XQilla: > > http://codesynthesis.com/~boris/tmp/DOMXPathResult.hpp > > The overall goal of the merger is to come up with an interface that > can serve both XPath 1.0 and XPath 2.0 (so that we can return > DOMXPathResult* instead of void* from DOMXPathExpression::evaluate()) > even though the semantic can be quite different in some cases > (e.g., XPath 2.0 can have a result which is a sequence of strings > while XPath 1.0 can only have a sequence of nodes). > > Here is a list of changes: > > - add FIRST_RESULT, ITERATOR_RESULT, and SNAPSHOT_RESULT to > resultType enum > > - add getTypeInfo() > > - add NO_RESULT_ERROR code to DOMXPathException which is used > instead of INVALID_STATE_ERR in get*Value() function. > > - add getIntegerValue() > > - rename getSingleNodeValue() to getNodeValue() > > - change iterateNext() and snapshotItem () to return bool instead > of const DOMNode* > > I also left out the isNode() function that is present in DOMXPath2Result. > I am not sure it is needed (and if it is, why there is no isBoolen(), > isString(), etc.). isNode() is needed because the DOMTypeInfo does not provide a way to distinguish between a node of type xs:string and a value of type xs:string. > Finally, I am wondering why the DOM node returned by getNodeValue() > (and asNode()) is const? Finding nodes with XPath and then modifying > them sounds like a perfectly reasonable idea (in fact not long ago I > wrote a small XML Scheam simplifier which needed this so I had to > resort to const_cast). Plus it is fairly easy to "break out" of > constness in DOM (e.g., getParentNode() is const and returns non- > const node). Are there any problems with returning non-const node? I think returning a non-const node would be fine. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
