Jump to content

XML DTD Issues


TheJoey

Recommended Posts

Im having problems getting my dtd to work

i want the user to have a option like

<!ELEMENT option (choose)

<!ELEMENT choose (one|two|three) >

 

But it doesnt seem to like it because my whole dtd works without that line.

im completely stuck!

Thanks in advance for any help i can get

 

Link to comment
Share on other sites

What does that acutally do?

 

ive tried alot of things, it parses fine, although i want it to only accept the values option1-3

<!DOCTYPE root SYSTEM "root.dtd">
<root>
<option>
dsfsdf
</option>
</root>

root.dtd

<!ELEMENT root (option)>
<!ELEMENT option (#PCDATA)>
<!ATTLIST option
option (option1|option2) "option1" >

Link to comment
Share on other sites

Can you give me an example XML because I don't understand what you mean besides I think your DTD is wrong and should be:

 

<!ELEMENT root (option1|option2|option3)>
<!ELEMENT option1 (#PCDATA)>
<!ELEMENT option2 (#PCDATA)>
<!ELEMENT option3 (#PCDATA)>

 

The following is all valid

 

<root>
    <option1></option1>
</root>

<root>
    <option2></option2>
</root>

<root>
    <option3></option3>
</root>

 

This code is invalid

 

<root>
    <option1></option1>
    <option2></option2>
    <option3></option3>
</root>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.