Jump to content

XML DTD Issues


TheJoey

Recommended Posts

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
https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1034475
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
https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1035188
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.