[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Tool to query dtd/schema for valid element children|attributes
Hi David, > I'm looking for a tool that will enable me to query the docbook dtd -- > given a particular element, I want to get lists of its valid children > and attributes. Ideally it could also provide information about an > attribute's content type. Have you tried Earl Hood's perlSGML (SGML::DTD Perl module)? The distribution includes a "dtdview" utility that enables interactive querying of DTDs; example: $ dtdview dtd/4.2/docbookx.dtd Reading catalog(s) ... Warning: Unable to open entity map file: catalog Warning: Unable to open entity map file: /sandbox/xsl/catalog Reading dtd/4.2/docbookx.dtd ... (docbookx) -> content personname Content model for PERSONNAME: ((honorific | firstname | surname | lineage | othername)+) If you type "attributes [elementname]", it'll give you information about those. It's packaged for Debian (perlsgml). One glitch I've run into with it is that it does not seem to be able to correctly handle the standard multi-file/modular version of the DocBook DTD. But it does work correctly with a "flattened" single-file version. You can download flattened versions of the DocBook XML DTDs here: http://docbook.sourceforge.net/dtd/ > So far I've tried the perl modules XML::DTDParser, XML::ParseDTD and > XML::SMART::DTD. All of them work with other DTDs, but fail to process > http://oasis-open.org/docbook/xml/4.2/docbookx.dtd (or the local copy on > my system). I've never tried any of those, but perhaps like perlSGML they might work better with a flattened version of the DTD. > Can anyone point me to a tool that might suit my needs? If there's a > tool that can query RNG, I can translate the DTD using trang. oXygen XML Editor includes a tool that enables you to view the contents of an RNG grammar in graphical form (like ELM-tree diagrams for the SGML days). It's point-and-click. I only tried it once briefly but I remember one great feature of it being that it can give you both "unexpanded" and "expanded" views of content models. That is, if the pattern for an element contains named patterns, it doesn't automatically expand those named patterns unless you explicitly click on them.[1] Other than that, I don't know of any other tools or libraries that enable interactive querying of RNG grammars. Perhaps there's something for querying XSD schemas? You could also convert the DTD to an XSD schema with trang. --Mike [1] One problem I always had with the SGML tools that could generate ELM diagrams was that they all automically expanded parameter entities. So they couldn't give you an "unexpanded" view of content models. -- Michael Smith http://sideshowbarker.net/
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]