[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Q: SW for parsing DTD's
Stefan Mintert wrote: > For the project I'm currently working on, I need to parse DTD's and query > information like this: > > - which elements are valid in a given context? > - which elements can contain an element of a certain type? > > > > Now I'm looking for software that does the parsing for me (Java classe are > preferred) and provides a high-level interface. MSXML returns DTD information in the form of a tree of XML-Data elements. This will save you from parsing the DTD, but you will need to traverse this tree or build an additional tree structure on top of it to answer the questions you have. There was a comment earlier on this list that MSXML cannot return information from external DTDs. I haven't yet found where this is true, but I don't access schema information in all possible ways -- I just call tree.getDTD().getSchema() to return the root of the XML-Data tree. XML-Data is probably richer than you need. To explore the basic structure of a DTD, I use the following XML-Data elements and attributes (Simon -- here's a starting point): Element Tag Relevent part of the content model Relevant attributes ----------- ---------------------------------- -------------------- schema elementType* id elementType ((element | group)* | empty | any | id string | mixed)?, attribute* element essentially EMPTY type, occurs group (element | group)+ occurs groupOrder (SEQ and OR only) empty EMPTY -- any EMPTY -- string EMPTY -- mixed element+ -- attribute ??????? -- -- Ron Bourret xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
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
|