> For the project I'm currently working on, I need to parse DTD's and =
query
> information like this:
>=20
> - which elements are valid in a given context?
> - which elements can contain an element of a certain type?
>=20
>=20
>=20
> 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=20
will save you from parsing the DTD, but you will need to traverse this =
tree or=20
build an additional tree structure on top of it to answer the questions =
you=20
have.
There was a comment earlier on this list that MSXML cannot return =
information=20
from external DTDs. I haven't yet found where this is true, but I don't =
access=20
schema information in all possible ways -- I just call =
tree.getDTD().getSchema()=20
to return the root of the XML-Data tree.
XML-Data is probably richer than you need. To explore the basic =
structure of a=20
DTD, I use the following XML-Data elements and attributes (Simon -- =
here's a=20
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