[lxml-dev] validation with multiple XSD files
Hello all, I would like to so some schema validation and started with the instructions in : http://codespeak.net/lxml/dev/validation.html#xmlschema This all works great. Now I would like to extend this to a XSD file that includes many other files. In other words I have a directory of XSD files that I would like to use. The include statement look like this (the included file is referenced by its name): <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="base.xsd"/> <xsd:element name="Price"> ... ... some types defined in "base.xsd" are used here I am new to lxml so sorry in advance if the question does not make sense. Regards, Arye.
Arye: I had a similar problem and this is how I handled it. http://messagesleuth.svn.sourceforge.net/viewvc/messagesleuth/trunk/xsd/ xsd2one.py?view=markup I didn't ask the group so others may have a better or more full featured approach. John W. Lovell Web Applications Engineer Northwest Educational Service District 1601 R Avenue Anacortes, WA 98221 (360) 299-4086 jlovell@nwesd.org www.esd189.org <http://www.esd189.org/> Together We Can ... ________________________________ From: lxml-dev-bounces@codespeak.net [mailto:lxml-dev-bounces@codespeak.net] On Behalf Of Arye Sent: Friday, May 09, 2008 9:26 AM To: lxml-dev@codespeak.net Subject: [lxml-dev] validation with multiple XSD files Hello all, I would like to so some schema validation and started with the instructions in : http://codespeak.net/lxml/dev/validation.html#xmlschema This all works great. Now I would like to extend this to a XSD file that includes many other files. In other words I have a directory of XSD files that I would like to use. The include statement look like this (the included file is referenced by its name): <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="base.xsd"/> <xsd:element name="Price"> ... ... some types defined in "base.xsd" are used here I am new to lxml so sorry in advance if the question does not make sense. Regards, Arye.
Hello, I am coming back to this after a delay. On top of lxml I was also considering ZSI to process my schema file. It appears that ZSI has no problem following the includes. So I will explore ZSI for now. Not being an expert on XML/XSD, I suspect that this is the best thing to do to avoid some tricky issues with namespaces. Regards, Arye. On Fri, May 9, 2008 at 6:38 PM, John Lovell <jlovell@esd189.org> wrote:
Arye:
I had a similar problem and this is how I handled it.
http://messagesleuth.svn.sourceforge.net/viewvc/messagesleuth/trunk/xsd/xsd2...
I didn't ask the group so others may have a better or more full featured approach.
John W. Lovell Web Applications Engineer Northwest Educational Service District 1601 R Avenue Anacortes, WA 98221 (360) 299-4086 jlovell@nwesd.org
www.esd189.org Together We Can ... ________________________________ From: lxml-dev-bounces@codespeak.net [mailto:lxml-dev-bounces@codespeak.net] On Behalf Of Arye Sent: Friday, May 09, 2008 9:26 AM To: lxml-dev@codespeak.net Subject: [lxml-dev] validation with multiple XSD files
Hello all, I would like to so some schema validation and started with the instructions in : http://codespeak.net/lxml/dev/validation.html#xmlschema
This all works great. Now I would like to extend this to a XSD file that includes many other files. In other words I have a directory of XSD files that I would like to use. The include statement look like this (the included file is referenced by its name):
<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="base.xsd"/> <xsd:element name="Price"> ... ... some types defined in "base.xsd" are used here
I am new to lxml so sorry in advance if the question does not make sense.
Regards, Arye.
Hi, Arye wrote:
Now I would like to extend this to a XSD file that includes many other files. In other words I have a directory of XSD files that I would like to use. The include statement look like this (the included file is referenced by its name):
<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="base.xsd"/> <xsd:element name="Price"> ... ... some types defined in "base.xsd" are used here
I'm not sure what you are trying to do here. Including or importing XSD files should not be a problem at all, so maybe you could elaborate on the actual problem you are facing? Maybe with some example code that shows what you are doing? Stefan
Hello. Thanks for your attention. What I was trying to do is load MANY XSD files with lxml. I understand now that the proper way to do this is load just ONE file that includes the other and let lxml go and load the required includes. For this, this document had the piece of information that I was missing i.e. the different options to manage multiple schema files: http://www.xfront.com/ZeroOneOrManyNamespaces.html Sorry about the confusion and thanks again for your help. Sincerely, Arye. On Tue, Jun 24, 2008 at 6:36 PM, Stefan Behnel <stefan_ml@behnel.de> wrote:
Hi,
Arye wrote:
Now I would like to extend this to a XSD file that includes many other files. In other words I have a directory of XSD files that I would like to use. The include statement look like this (the included file is referenced by its name):
<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="base.xsd"/> <xsd:element name="Price"> ... ... some types defined in "base.xsd" are used here
I'm not sure what you are trying to do here. Including or importing XSD files should not be a problem at all, so maybe you could elaborate on the actual problem you are facing? Maybe with some example code that shows what you are doing?
Stefan
participants (3)
-
Arye
-
John Lovell
-
Stefan Behnel