Thanks for your reply Stefan. I'll look into the threads you pointed out in more detail. I am kinda glad that I didn't miss an obvious solution =) My need is rather simplistic, so maybe I can try to querying the schema. I did read a little bit about "Abbot" from MONK -- http://quest.library.illinois.edu/monk/project/ -- per Martin's suggestion (Thanks!), but it seems like it is no longer active and it is not a direct solution to my issue. Thanks!Aaron On Sunday, March 1, 2015 7:00 AM, "lxml-request@lxml.de" <lxml-request@lxml.de> wrote: Date: Sat, 28 Feb 2015 21:28:37 +0100 From: Stefan Behnel <stefan_ml@behnel.de> To: lxml@lxml.de Subject: Re: [lxml] Programmatically accessing schema Message-ID: <54F224F5.3030200@behnel.de> Content-Type: text/plain; charset=utf-8 Aaron Storm schrieb am 28.02.2015 um 12:29:
I went through the documentation and couldn't find any hints on this. And I am not sure what keywords to search on google. Is there a way to programmatically (or api?) query the XSD for a specific element to get its spec? For example, I would like to know if /MyContainer/Container2 can be repeated. Or if /MyContainer/Container1/Item1/ text() is optional.
Similar questions have been discussed in the past. These are related, for example: http://thread.gmane.org/gmane.comp.python.lxml.devel/7318 http://thread.gmane.org/gmane.comp.python.lxml.devel/5619 In general, figuring out what an XML Schema specification allows is rather difficult. It can be done for simple cases (it's XML, you can search in it), but schemas can be arbitrarily complex. Sometimes there are multiple ways to express something, and covering all cases is cumbersome. Stefan