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