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


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: Q: SW for parsing DTD's

[ Lists Home | Date Index | Thread Index ]
  • From: rbourret@dvs1.informatik.tu-darmstadt.de (Ron Bourret)
  • To: xml-dev@ic.ac.uk
  • Date: Mon, 25 May 1998 13:46:07 +0200

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 

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@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


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

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