Cross-referencing support

anirudh nair <[email protected]> Tue, 20 Sep 2011 12:31:00 +0530
Newsgroups gmane.text.xml.expat.general
Message-ID <CAEKYpESwBHWqfz5WSBfs8CFZ+8J13VQ8rfSu+xCsgnO-K9hEOw@mail.gmail.com>
Hi all,

I have a requirement of reading and writing XML that is highly
cross-referenced(within the same XML). So, does Expat support cross
referencing. Basically, I want the below explained functionality.

<classes>
    <data:class id="ENGL6004">
      <title>From Here to Eternity: Studies in the Future
        and other Temporal Genres</title>
      <Teacher>Margaret Doornan</Teacher>
    </data:class>
    <data:class id="HIST6010">
      <title>The You Decade: A History of Finger Pointing
        in Post-War America</title>
      <Teacher>Kelly Griftman</Teacher>
     </data:class>
    <data:class id="ENGL6020">
      <title>Reading between the Lines: The Literature
        of Waiting</title>
      <Teacher>Norbert James</Teacher>
    </data:class>
 </classes>

<students>
    <student Index="0">
      <name>Kelly Griftman</name>
      <year>Senior</year>
      <status>full-time</status>
      <ref:class ref="HIST6010"/>
      <ref:class ref="ENGL6020"/>
    <student>
    <student Index="1">
      <name>Norbert James</name>
      <year>Senior</year>
      <status>full-time</status>
      <ref:class ref="ENGL6004"/>
      <ref:class ref="ENGL6020"/>
    <student>
</students>


So, now if I fetch the node student with Index==1, the node should look like

<student Index="1">
      <name>Norbert James</name>
      <year>Senior</year>
      <status>full-time</status>
      <class id="ENGL6004">
      <title>From Here to Eternity: Studies in the Future
        and other Temporal Genres</title>
      <Teacher>Margaret Doornan</Teacher>
      </class>
      <class id="ENGL6020">
      <title>Reading between the Lines: The Literature
        of Waiting</title>
      <Teacher>Norbert James</Teacher>
      </class>
<student>

Does, Expat provide such a functionality.

Thanks
Anirudh