TheJoey Posted March 30, 2010 Share Posted March 30, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/ Share on other sites More sharing options...
oni-kun Posted March 30, 2010 Share Posted March 30, 2010 How is this related to PHP? Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1033939 Share on other sites More sharing options...
TheJoey Posted March 30, 2010 Author Share Posted March 30, 2010 Couldnt find a forum for it to suit, and considering that php is loading my xml thought it would be ok. Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1033942 Share on other sites More sharing options...
ignace Posted March 30, 2010 Share Posted March 30, 2010 <!ELEMENT option (choose)><!-- you forgot > --> <!ELEMENT choose (one|two|three) > Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1034108 Share on other sites More sharing options...
TheJoey Posted March 31, 2010 Author Share Posted March 31, 2010 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" > Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1034475 Share on other sites More sharing options...
ignace Posted March 31, 2010 Share Posted March 31, 2010 What do you exactly want to do? Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1034575 Share on other sites More sharing options...
TheJoey Posted April 1, 2010 Author Share Posted April 1, 2010 i only want it to parse. if ethier option1 option2 option3 is selected or it will give me a error saying must be option1 - 3 etc is that possible with dtd? Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1035040 Share on other sites More sharing options...
ignace Posted April 1, 2010 Share Posted April 1, 2010 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> Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1035188 Share on other sites More sharing options...
TheJoey Posted April 2, 2010 Author Share Posted April 2, 2010 Is there a way to restrict the data that goes "inside" those <option> </option> <option> This here </option> "this here being the data we want to restrict for example to male or female" Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1035939 Share on other sites More sharing options...
ignace Posted April 2, 2010 Share Posted April 2, 2010 No but you can do: <!ATTLIST option sex (male|female) #REQUIRED> Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1036111 Share on other sites More sharing options...
TheJoey Posted April 3, 2010 Author Share Posted April 3, 2010 That would make it so <option sex="male" /> right? Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1036235 Share on other sites More sharing options...
TheJoey Posted April 3, 2010 Author Share Posted April 3, 2010 thank you for your help Quote Link to comment https://forums.phpfreaks.com/topic/196945-xml-dtd-issues/#findComment-1036297 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.