7 May 15:09
Querying valid children of an element?
From: Brad Smith <usernamenumber <at> gmail.com>
Subject: Querying valid children of an element?
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-07 13:13:04 GMT
Subject: Querying valid children of an element?
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-07 13:13:04 GMT
Hello, I just discovered lxml and am pretty excited about it. There is one thing I'm having trouble figuring out how to do, though, if it's even possible: I am writing a tool that translates xml tags mixed with a wiki-like shorthand into full xml. It would be helpful to be able to sanity-check the mix of explicit tags and implicit tags I'm deriving from the shorthand by querying our DTD along the lines: "Is element foo legal within element bar" Same for CDATA. Is this possible using lxml? If not, is it possible using anything else? The best I've been able to come up with so far is to assemble a tree of dummy nodes in the proposed order and then validate it, but this seems wasteful. Thanks in advance for any help offered, --Brad -- -- ~ Second Shift: An original, serialized audio adventure ~ http://www.secondshiftpodcast.com
RSS Feed