|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: DTD to XPath
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 that..... Steven_DeRose@B...; http://www.stg.brown.edu/~sjd *************************************************************************** This is xml-dev, the mailing list for XML developers. To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev List archives are available at http://xml.org/archives/xml-dev/ ***************************************************************************
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








