• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xml/dtd

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
I am preparing dtd.Can I restrict user to specify a predefined entry for element.
for example..
<male>true</male>
male is a element.
I want, user can only specify either true or false.I know i can do it with XMLschema.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the XML forum.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go to http://www.w3schools.com/dtd/dtd_attributes.asp and look the section titled "Enumerated attribute values".
 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With XML Schema, it's very easy, just use the type boolean:
<xs:element name="male" type="xs:boolean"/>
With DTD, as said Lasse, you have to use enumerated attribute values:
<!ATTLIST Element male (true|false) "true">
XML Example:
<Element male="true"/>
<Element male="false"/>
<Element/>
Hope this helps,
Cyril.
 
reply
    Bookmark Topic Watch Topic
  • New Topic