June 2008
Intermediate to advanced
986 pages
27h 8m
English
To illustrate the value of linking, we’ll use a document that
defines several <component> and <part> elements. Each <component> uses some number of
<part>s. Because our XML
document contains ID and IDREF values, we can link different parts of
the document together.
Here’s how our document looks:
<?xml version="1.0"?>
<!-- parts-list1.xml -->
<!DOCTYPE parts-list [
...
]>
<parts-list>
<component component-id="C28392-33-TT">
<name>Turnip Twaddler</name>
<partref refid="P81952-26-PK"/>
<partref refid="P86679-52-SP"/>
<partref refid="P81472-68-FD"/>
<partref refid="P88107-39-GT"/>
</component>
...
<component component-id="C28772-63-OB">
<name>Olive Bruiser</name>
<partref refid="P80228-21-PT"/>
<partref refid="P82387-85-PA"/>
</component>
<part part-id="P80228-21-PT">
<name>Pitter</name>
</part>
...
<part part-id="P86994-25-RC">
<name>Ribbon Curler</name>
</part>
</parts-list>Our first task will be to look at each <component> and list the names of the
<part>s that it uses. Each of
the refid attributes of each of the
<partref> elements refers to
the id attribute of a <part> element.
Read now
Unlock full access