You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by anirudh nair <an...@gmail.com> on 2011/09/20 13:10:40 UTC

Cross referencing support

Hi all,

I have a requirement of reading and writing XML that is highly
cross-referenced(within the same XML). So, does Xerces 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, Xerces provide such a functionality?

P.S: My understanding about XML and XML parsing is very naive.

Thanks
Anirudh