• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

DTD  RSS feed

 
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).]
 
permaculture is giving a gift to your future self. After reading this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!