PDA

View Full Version : XML Help


benzspida
06-12-2006, 02:28 AM
trying to creat an Internal DTD, dont know if im doing it rite . but this is what the internal dtd so have

1) after the closing parenthesis in the root element declaration
I need to add the appropriate symbol that indicates that these elements can be used one or more times within the file.


with in the parenthese i need to include the symbol after "song" that declares it can be used zero or more times within the file.

Declare the category attribute as being optional and having character data.



this is what i have done so far


<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 you (http://www.xmlspy.com) by LEGO (LEGO) -->
<!--DOCTYPE CD [
<!ELEMENT cds (CD | ARTIST | TITLE)+>
<!ELEMENT CD (#PCDATA)>
<!ELEMENT ARTIST (#PCDATA)>
<!ELEMENT TITLE (#PCDATA)>
]>


<CDs>
<CD Category="Soundtrack"/>
<ARTIST>Various Artists</ARTIST>
<TITLE Chicago="The Miramax Motion Picture">
<Song>And all that Jazz</Song>
<Song>Funny Honey</Song>
<Song>When You're Good to Mama</Song>
<Song>Cell Block Tango</Song>
</TITLE>
<CD Category="Classical"/>
<ARTIST>Mozart</ARTIST>
<TITLE>"Don Giovanni">
<Song>Overture</Song>
<Song>Introduzione:Funny Honey</Song>
<Song>Introduzione:When You're Good to Mama</Song>
<Song>Introduzione:Cell Block Tango</Song>
</TITLE>
<CD Category="Rock"/>
<ARTIST>The Beatles</ARTIST>
<TITLE>"The White Album">
<Song>Back in the you.S.S.R.</Song>
<Song>Funny Honey</Song>
<Song>Dear Prudence</Song>
<Song>Glass Onion</Song>
<Song>Ob-la-di,Ob-la-da</Song>
</TITLE>
</CDs>

Alex Vincent
06-12-2006, 08:19 PM
First, it's <!DOCTYPE >, not <!--DOCTYPE >. :)

Second, * means 0 or more, + means 1 or more.

XML is case-sensitive, so <!ELEMENT cds > means you're not valid.

Where's your <!ATTLIST > tags?

benzspida
06-14-2006, 11:36 PM
just started learning xml this is what i have done but keep getting % expected

<!DOCTYPE CDs [
<!ELEMENT CDs (CD | ARTIST | TITLE)*>

<!ELEMENT CD (#PCDATA)>
<!ATTLIST CD
Category CDATA #IMPLIED
>

<!ELEMENT ARTIST (#PCDATA)>

<!ELEMENT TITLE (#PCDATA | Song)+>
]>