[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Writing a DTD

  • From: "Hanson, Jon" <jhanson@l...>
  • To: 'Pramod Rao Pesara' <ppesara@c...>
  • Date: Fri, 03 Nov 2000 17:08:52 +0000

write dtd
i'm not sure why or in what context you would want to do that. as far as i'm
aware the only place such characters might appear in a DTD is in the content
of an internal entity definition, e.g.:-

<!ENTITY copyright "(c) jon hanson 2000">

where they can appear as is since they are not special. if you really don't
want to write '(' or any other character literally you can use a character
reference - &#40; for '(' and &#41; for ')'. The only special chars in XML
are the following with their equivalent entity and character reference:-
&	&amp;	&#38;
<	&lt;	&#60;
>	&gt;	&#62;
'	&apos;	&#39;
"	&quot;	&#34;

e.g. some well-formed XML from the xml spec:-

<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a
general entity (&amp;amp;).</p>

which might be rendered as:-

An ampersand (&) may be escaped numerically (&#38;) or with a general entity
(&amp;).

jon



> -----Original Message-----
> From:	Pramod Rao Pesara [SMTP:ppesara@c...]
> Sent:	Friday, November 03, 2000 4:44 PM
> To:	Hanson, Jon
> Cc:	xml-dev@l...
> Subject:	RE: Writing a DTD
> 
> 
> thanks a lot. But is there a way to represent special characters like "(",
> ")" and "/" in a DTD?
> Pramod.
> 
> 
> 
>  
> 
> On Fri, 3 Nov 2000, Hanson, Jon wrote:
> 
> > assuming your grammar is BNF so valid sentences would be e.g.:-
> > 
> > (lambda fred xyz)
> > 
> > (lambda a234 adf)
> > etc
> > 
> > then such expressions would not be valid xml,  so you can't really write
> a
> > DTD for them.
> > an XML equivalent of what you appear to be attempting might be something
> > like:-
> > 
> > <lambda>
> > 	<name>fred</name>
> > 	<body>xyz</body>
> > </lambda>
> > 
> > for which the DTD would look like:-
> > 
> > <!ELEMENT lambda  (name , body )> 
> > <!ELEMENT name  (#PCDATA )> 
> > <!ELEMENT body  (#PCDATA )>  
> > 
> > jon
> > 
> > > -----Original Message-----
> > > From:	Pramod Rao Pesara [SMTP:ppesara@c...]
> > > Sent:	Friday, November 03, 2000 3:55 PM
> > > 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 
> > 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.