OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: DTD to XPath

[ Lists Home | Date Index | Thread Index ]
  • From: Steve DeRose <Steven_DeRose@brown.edu>
  • To: XML Dev <xml-dev@xml.org>
  • Date: Wed, 24 May 2000 09:25:42 -0400

At 10:26 PM -0400 5/23/00, Marcus Carr wrote:
>Hi all,
>I seem to recall seeing an announcement for something that would take a
>DTD as input and produce XPath addresses for every element - can anyone
>provide a pointer? Thanks,

If I'm understanding your question right, such a thing is not possible,
because a DTD contains no element instances, only declarations of element
*types*; and XPath intentionally does not provide a way to point to such
declarations. Since a DTD is not itself properly an XML document, XPath has
no access to its internals. Once XML Schema is complete, of course you will
be able to point to declarations because they are themselves expressed as
elements within XML documents (namely, the schemas).

If you perhaps instead mean that you want something to produce, for each
element type declared in a DTD, the XPath expression that will refer to all
instances of that element type, then it is possible but also trivial: for
each element type name declared, write out the element type name with "//"
in front....

This should take at most 3 lines on top of anything that can parse DTDs. Or
you can get quite close with a one-line Perl script that grabs tokens that
follow "<!ELEMENT ".  I wouldn't recommend paying a lot for software to do

Steven_DeRose@Brown.edu; http://www.stg.brown.edu/~sjd

This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/

  • References:


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS