Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > dtd newbie

Reply
Thread Tools

dtd newbie

 
 
Larry
Guest
Posts: n/a
 
      03-25-2005
Hi all,

I'm quite a XML/XSL/DTD newbie, is this DOCTYPE correct? thanks

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="stile.xsl"?>
<!DOCTYPE catalog
[
<!ELEMENT catalog (cd+)>
<!ELEMENT cd (title,artist,country,company,price,year)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT artist (#PCDATA)>
<!ELEMENT country (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT year (#PCDATA)>
]>

<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
</catalog>
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      03-25-2005


Larry wrote:


> I'm quite a XML/XSL/DTD newbie, is this DOCTYPE correct? thanks
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?xml-stylesheet type="text/xsl" href="stile.xsl"?>
> <!DOCTYPE catalog
> [
> <!ELEMENT catalog (cd+)>
> <!ELEMENT cd (title,artist,country,company,price,year)>
> <!ELEMENT title (#PCDATA)>
> <!ELEMENT artist (#PCDATA)>
> <!ELEMENT country (#PCDATA)>
> <!ELEMENT company (#PCDATA)>
> <!ELEMENT price (#PCDATA)>
> <!ELEMENT year (#PCDATA)>
> ]>
>
> <catalog>
> <cd>
> <title>Empire Burlesque</title>
> <artist>Bob Dylan</artist>
> <country>USA</country>
> <company>Columbia</company>
> <price>10.90</price>
> <year>1985</year>
> </cd>


Technically the DTD you have written is fine for the XML instance
document, the DTD is syntatically correct and its semantics models the
structure of the XML instance.

As for modelling a CD list however there might be more complex
scenarios, what happends if there is a CD done by multiple artists for
instance. And what currency is the price value for?

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML file from one DTD to another DTD test Java 2 07-28-2006 08:48 PM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 AM
Removing the dtd name when using print(...) on the dtd generated class Joseph Tilian Java 0 12-21-2004 02:58 PM
Newbie question - data collection driven by DTD/schema Ghee XML 0 05-28-2004 02:59 PM
Including a dtd into another dtd... possible? Asfand Yar Qazi XML 1 09-19-2003 12:10 PM



Advertisments