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 http://msdn.microsoft.com/en-us/library/bb986126.aspx > 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 _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
