Re: [xml] Tools to look inside a DTD allows?

Jack Schwartz schrieb am 03.12.2010 um 16:48 (-0800):

I'm looking for a documented way to look into a DTD [â], but haven't
seen one.

I haven't seen any either. Googling for the following didn't turn up
anything either:

  programmatic access dtd -html

MSDN said back in 2002:

  Most XML 1.0 processors support DTD validation, but they don't support
  programmatic access to the information found in the DTD due to the
  complexity of the syntax.

From the April 2002 issue of MSDN Magazine

The closest I've come up with is dumping the DTD with the following
python program:

Looks simple enough, but I understand your concerns.

The output shows what I need: the names, order and quantity of
different children per parent element.  However, I am reliant on an
undocumented output format, which could change and which would break
my code if it did.

Another approach would be to just look at the original DTD,
searching for "<!ELEMENT" lines.

However, it would be better if I used a tool to get this information
if one existed.  (In my simple case, at least it would help with
skipping comments in the DTD file, etc.)  Does such a tool or API
exist in libxml2, lxml or somewhere else?

I think XML editors with DTD support must have a way of getting at the
information. At least if they want to assist you in editing.

Michael Ludwig

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]