Re: [lxml] Programmatically accessing schema
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
Abbot is alive and kicking at http://abbot.unl.edu/cocoon/vicar/Signin.html. But you're probably right in saying that it's more than you need for your purpose. MM Martin Mueller Professor emeritus of English and Classics Northwestern University From: Aaron Storm <aaron_storm@yahoo.com<mailto:aaron_storm@yahoo.com>> Reply-To: Aaron Storm <aaron_storm@yahoo.com<mailto:aaron_storm@yahoo.com>> Date: Sunday, March 1, 2015 10:12 AM To: "lxml@lxml.de<mailto:lxml@lxml.de>" <lxml@lxml.de<mailto:lxml@lxml.de>> Subject: Re: [lxml] Programmatically accessing schema 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<mailto:lxml-request@lxml.de>" <lxml-request@lxml.de<mailto:lxml-request@lxml.de>> wrote: Date: Sat, 28 Feb 2015 21:28:37 +0100 From: Stefan Behnel <stefan_ml@behnel.de<mailto:stefan_ml@behnel.de>> To: lxml@lxml.de<mailto:lxml@lxml.de> Subject: Re: [lxml] Programmatically accessing schema Message-ID: <54F224F5.3030200@behnel.de<mailto: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
Am .03.2015, 17:12 Uhr, schrieb Aaron Storm <aaron_storm@yahoo.com>:
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.
The Spyne library referred to in previous mails has a pretty complete schema reader. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a Düsseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226
participants (3)
-
Aaron Storm -
Charlie Clark -
Martin Mueller