• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Question: is this possible in XML?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys new to these forums.

just wondering if its possible to restrict the "input" of a xml field.

for example

<root>
<option>
testing (i want to restrict this so only option1 or option2 will parse)
</option>


Testing is what i want to restrict, i know there a ways to restrict the value and type of a attribute but this isnt what im wanting to do

thanks for any help!
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Something like this?

 
joey mo
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes but instead of using a schema i want to only use a DTD

or eqaully efficient in DTD XML
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i want to only use a DTD


Why? DTDs can't do anything like this.
 
joey mo
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok thanks guys, so the only way i can do anything close in dtd is so store information in the attributes? like type=option1 etc?
 
Marshal
Posts: 28297
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you mean by "close", or even what you meant by that example. Perhaps you ought to clarify your requirement so we could have a practical discussion about it.
 
joey mo
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont know how i can explain it better then in the first post.

between <option>(This space here) </option> the only values i want accepted are the ones i choose so for example male or female. i need someway to do that without a schema.

i know its possible to give the attribute a name, but ive been told it is possible with the <!ELEMENET option (male|female)* >
 
Paul Clapham
Marshal
Posts: 28297
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

joey mo wrote:I dont know how i can explain it better then in the first post.



I understood the first post. But then you changed your mind to want something "close". I didn't understand that part.

Anyway, as Ulf already said, DTDs can't do anything like that. But it might be a good idea for you to read a DTD tutorial. Like this one for example. By the time you get to the end of it you should have a better understanding of both DTDs and XMLs. That can only be a good thing.
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic