[Home] [By Thread] [By Date] [Recent Entries]

  • From: johns@s... (John F. Schlesinger)
  • To: 'Pramod Rao Pesara' <ppesara@c...>, xml-dev@l...
  • Date: Tue, 07 Nov 2000 17:03:15 -0500

Pramod asked for help writing a DTD for:
	Expression  ::=  "(" "lambda" text1 text2 ")"

I assume that what you are asking for is a DTD to describe an XML syntax for
representing a grammar where left and right parenthesis and lambda are
special characters. In addition, 'Expression' and '::=' have special
meaning. On the other hand, text1 and text2 are place holders for some kind
of text.

One XML representation of the line above might, therefore, be:

<expression>
	<parenthesis>
		<lambda/>
		<text/>
		<text/>
	</parenthesis>
</expression>

with a DTD of

<!ELEMENT expression  (parenthesis )>
<!ELEMENT parenthesis  (lambda , text+ )>
<!ELEMENT lambda EMPTY>
<!ELEMENT text EMPTY>

I have assumed that "(" and ")" always balance. If this is not the case,
then the following is better:

<expression>
	<lparenthesis/>
	<lambda/>
	<text/>
	<text/>
	<rparenthesis/>
</expression>

with a DTD of:

<!ELEMENT expression  (lparenthesis, lambda , text+, rparenthesis)>
<!ELEMENT lparenthesis EMPTY>
<!ELEMENT lambda EMPTY>
<!ELEMENT text EMPTY>
<!ELEMENT rparenthesis EMPTY>

Yours,
John F Schlesinger
SysCore Solutions
212 619 5200 x 219
917 886 5895 Mobile

-----Original Message-----
From: Pramod Rao Pesara [mailto:ppesara@c...]
Sent: Friday, November 03, 2000 10:55 AM
To: xml-dev@l...
Subject: Writing a DTD


 Hi,
    I new to XMl and just learning to write DTDs. Could anyone please help
me in writing a DTD for the following Grammar. Here "lamda", "(" and
,")" are keywords and text1 and test2 can be any character data.

    Expression  ::=  "(" "lambda" text1 text2 ")"

Thank You.
Pramod



  • References:
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member