• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

DTD

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am writing a DTD.My method : m1(String name, boolean ok) .
I want to indicate the datatypes as:
<!ELEMENT name (#PCDATA)>
how do i indicate for the boolean value.Since PCDATA is only
for String.What is the indication for boolean datatypes.

Thanks

 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naresh, first of all, in DTD you can specify datatype for attribute values only, not for element content.
Next, unfortunately different XML specifications support different data models.
So XPath knows four data types: numbers, strings, boolean, node-sets.
DTD knows only these data types:

Alternative to DTD, schemas, have very elaborated set of datatypes, and define a way to derive your own data type from any other.
XSLT doesn�t understand schema data types...
W3C is now working on �linking� parts of XML family. So XSLT 2.0 processors will support schemas, for example.
To be more practical (= more useful ):
You can emulate �boolean� type with enumerated type:
<!ATTLIST ElementName attributeName (true | false) #REQUIRED >
or
<!ATTLIST ElementName AttributeName (0 | 1) #REQUIRED >
your values still will be a text, but parser can check that they have only (true/false) or (0/1) values.
But again, all this for attribute values, not for element content.

[This message has been edited by Mapraputa Is (edited April 23, 2001).]
 
Good night. Drive safely. Here's a tiny ad for the road:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic