Proposal: [DESCEND X TO Y] in XML Query Paths

Hi,

I've read through the public documents and I'm excited
about XML Query.  Thanks for all the thought and work
you all are putting into this.

I think XML Query should also include the ability to
flatten an XML node hierarchy during a query in a way 
that does not require you to know the names or 
attributes of nodes in the path.

This is useful in cases where you need to find nodes
(based on a name or attribute), but you have no way
of knowing how deep inside the XML they reside (and/or
you don't know thier parent's names)

Please see a proposal for a "[DESCEND X TO Y] extension 
to "XML Query Path Expressions" below.

Thanks,
Chris Wilper

------------------------------------------------------

Sample Input: "links.xhtml"
----------------------------

<rootnode>
  <whateverZero>
    <whateverOne>
      <whateverTwo>
         <link id="a" url="http://www.google.com/"/>
      </whateverTwo>
      <link id="b" url="http://www.moreover.com/"/>
    </whateverOne>
  </whateverZero>
  <whateverThree>
    <whateverFour>
       <link id="c" url="http://www.w3c.org/"/>
       <whateverFive>
         <whateverSix>
           <link id="d" url="http://www.gnu.org/"/>
         </whateverSix>
       </whateverFive>
    </whateverFour>
  </whateverThree>
</rootnode>

CASE 1:
-------
The expression:
document("links.xhtml")/[DESCEND]

...which can also be expressed as:
document("links.xhtml")/[DESCEND 0 TO INF]

...returns the following XML nodes:
  rootnode
  whateverZero
  whateverOne
  whateverTwo
  link id="a" ...
  link id="b" ...
  whateverThree
  whateverFour
  link id="c" ...
  whateverFix
  whateverSix
  link id="d" ...

CASE 2:
-------
The expression:
document("links.xhtml")/[DESCEND 0]

...which can also be expressed as:
document("links.xhtml")

...returns the following XML nodes:
  rootnode

CASE 3:
-------
The expression:
document("links.xhtml")/[DESCEND 1]

...which can also be expressed as:
document("links.xhtml")/[DESCEND 0 TO 1]

...returns the following XML nodes:
  rootnode
  whateverZero
  whateverThree

CASE 4:
-------
The expression:
document("links.xhtml")/[DESCEND 4 TO INF]

...which in the case of this input is equivalent to:
document("links.xhtml")/[DESCEND 4 TO 100]

...returns the following XML nodes:
  link id="a" ...
  whateverSix
  link id="d" ...

------------------------------------------------------

Received on Monday, 2 April 2001 16:37:38 UTC