[lxml-dev] examine XSD xml schema
Hello,
I would like to examine a XSD schema in python. Currently I'm using lxml
which is doing it's job very very well when it only has to validate a
document against the schema. But, I want to know whats inside of the
schema and access the elements in the lxml behavior.
The schema:
|<?xml version="1.0"?>
On Tue, Apr 27, 2010 at 02:01:53PM +0200, Michael Konietzny wrote: [snip]
I'm then able to use schema_document (which is etree._Element) to go through the schema as an XML document. But since etree.fromstring (at least it seams like that) expects a XML document the xsd:include elements are not processed.
The problem is currently solved by parsing the first schema document, then load the include elements and then insert them one by one into the main document by hand:
You might be interested in looking at process_includes.py. It is part of the generateDS.py package. It reads and parses an XML Schema (using lxml, of course) and replaces the include and import elements in that document with the included document. process_includes.py is imported and used by generateDS.py itself, but you can also run it from the command line. You can find the latest version of generateDS.py here: http://www.rexx.com/~dkuhlman/#generateds-py-generate-python-data-bindings-f... or at the Python project index: http://pypi.python.org/pypi If you try it, let me know if you have questions, suggestions, etc.. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman
participants (2)
-
Dave Kuhlman
-
Michael Konietzny