Python and XML Schema

T

Trond

I have a need to, given a XML document with XML Schema defined, to get the
type of each element in the XML file based on the XML Schema URI given. IE,
the <title> element is of simple datatype string. Is there any existing
Python libraries were I can parse the XML file, and for a given node ask for
the datatype (which should be taken from XML Schema?)

Trond
 
D

Dennis Benzinger

Trond said:
I have a need to, given a XML document with XML Schema defined, to get the
type of each element in the XML file based on the XML Schema URI given. IE,
the <title> element is of simple datatype string. Is there any existing
Python libraries were I can parse the XML file, and for a given node ask for
the datatype (which should be taken from XML Schema?)
[...]

Take a look at lxml. It's a pythonic binding for libxml2 and libxslt.
libxml2 <http://xmlsoft.org/> implements XML Schema Part 2: Datatypes
and partially XML Schema Part 1: Structures.
I don't know how complete the structures implementation is and if it can
already do what you want. So you might ask the libxml2 guys how to do
what you want with libxml2 and then use lxml to do it in Python.

Bye,
Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,840
Latest member
BrendanG78

Latest Threads

Top