Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have an xml document of this sort

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
I have an xml document of this sort of format:

<Collections>
<Collection>
<CollectionName>ASDF</CollectionName>
<Items>
<Item>
<Assets>
<Asset>
<AssetName>something</AssetName>
<AssetType>Anything</AssetType>
</Asset>
<Asset>
<AssetName>anything</AssetName>
<AssetType>something</AssetType>
</Asset>
</Assets>
<Item>
</Items>
</Collection>
.
.
.
</Collections>

This is a cut down version of the full XMl file, but this is the bit that is causing problems

I am writing a DTD for this XML file and was wondering how i specify the Assets section. This is what i have so far:

<!ELEMENT Collections (Collection*)>
<!ELEMENT Collection (CollectionName, Items)>
<!ELEMENT CollectionName (#PCDATA)>
<!ELEMENT Items (Item*)>
<!ELEMENT Item (Assets)>
<!ELEMENT Assets (Asset*)>
<!ELEMENT Asset (AssetName, AssetType)>
<!ELEMENT AssetName (#PCDATA)>
<!ELEMENT AssetType (#PCDATA)>

Like i said this is a cut down version of the document there are more elements in the item, assets and collection nodes than are here but this illustrates my point.

Is this the correct way of specifying a DTD for this XML structure?

any help appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top