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.
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).]