XML element references/links.
| From: | William Bailey | Date: | Tue, 27 Apr 2004 10:42:23 +0000 |
| Subject: | XML element references/links. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184745@lists.php.net to get a copy of this message | ||
Hi,
Im currently working with XML documents that have a lot of redundant data in them and am looking for a way to reference a already defined node from another node. How would one do this and how would this effect working with the xml document in php (DOM or simpleXML).
So if i have something like the following....
<recording title="a song">
<artist name="la la band, the"/>
<tracks>
<track name="track 01">
<artist name="la la band, the"/>
</track>
<track name="track 02">
<artist name="la la band, the"/>
</track>
<track name="track 03">
<artist name="some other band"/>
</track>
<track name="track 04">
<artist name="la la band, the"/>
</track>
</tracks>
<media type="cd" release="20040101" deleted="20040201" catno="123abc">
<label name="bad records">
<address>
<street>123 some street</street>
<town>my town</town>
<county>my county</county>
<country>my country</country>
</address>
<distributor name="fast records">
<address>
<street>456 some street</street>
<town>my town</town>
<county>my county</county>
<country>my country</country>
</address>
</distributor>
</label>
</media>
<!-- .... List more media items with the same label/dist into repeated over and over again -->
</recording>
Can i (for example) define the companies once and then put a reference to them where ever i want the information to go? Therefore reduceing the size of the XML document a lot (some recordings have 15+ media).