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

Re: Writing a DTD

  • From: Rick JELLIFFE <ricko@g...>
  • To: xml-dev@l...
  • Date: Sun, 05 Nov 2000 23:31:13 +0800

writing a dtd attributes
Rick JELLIFFE wrote:
> 
> Pramod Rao Pesara wrote:
> >
> > thanks a lot. But is there a way to represent special characters like "(",
> > ")" and "/" in a DTD?
> > Pramod.
> 
> It sounds like Pramod is expecting a DTD to act like a grammar over
> tokens or strings, like a perl regular expression.  Instead, a DTD
> element declaration's content model is a grammar over which elements can
> appear as a child.
> 
> So there is no way in XML DTDs to say that any particular string or
> token must appear in data.  (If you want that, you will have to use an
> external function referenced using a notation declaration.)
> 
> YOu can specify the allowed tokens in an attribute value, but these
> tokens are whitespace separated names, not punctuation marks.
> 
> XML DTDs are not like YACC, to let you parse arbitrary data. Instead,
> XML predefines certain delimiters and treats the various tags it finds
> as signifying various "information items": elements, attributes, and so
> on.
> 
> If you want to be able to parse arbitrary data into XML using DTDs, you
> should use an SGML parser to read the data in, then normalize the data
> out as XML.  SGML has many facilities for parsing strings and treating
> characters as start or end tags.
> 
> Another approach that might be useful is to use XML Schemas.  In XML
> Schemas, you can assign datatypes to "simple" content (attribute values,
> element content which has no subelements).  You can declare that the
> element contains a "string", and then use a regular expression (like in
> perl) to describe the data. This gives you strong datatyping.  However,
> XML Schemas does not let you assign subpatterns to identifiers (like
> perl does) which you can then retrieve in some program, and if you
> decide your data does need to have subelements after all you must switch
> off datatyping by redeclaring the element as a "complex type".
> 
> In other words, XML does not provide good facilities yet to parse data
> which has "embedded notations" and XML Schemas does not have good
> facilities for validating data that has "embedded notations which
> include markup".
> 
> I hope this is helpful.
> Rick Jelliffe

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.