1

I want to use an XML file containing a collection of objects (it is a GML file for GIS applications) as input in models i am developping. Herefore, i want to transform the objects in my XML file into real Python objects so i can use them easily. Is there an easy way of doing this, i.e. transforming the XML collection into a database of objects ?

3
  • Could you provide some input/output example? It should be possible to parse the xml and create the structure you're looking for. Commented Feb 22, 2012 at 11:26
  • Well, i have the GML file and its XSD, e.g. like schemas.opengis.net/gml/2.1.2/feature.xsd and i am looking for an automated way in Python to make from this XSD a class type and from the GML (which is a collection of features) a list of objects. (But even parsing the GML seems to result in some problems ...) Commented Feb 22, 2012 at 11:36
  • 1
    Have you looked at lxml.objectify? Commented Feb 22, 2012 at 11:40

1 Answer 1

1

You might try generateDS. generateDS homepage. Last time I used it was a couple of years ago, and it had some limitations then---there were some valid xsd features that it would not handle. Looks like it has been evolving since then; those limitations may have disappeared, or they may not apply to your situation anyway.

Sign up to request clarification or add additional context in comments.

3 Comments

This indeed looks like what i am looking for, but i'm struggeling to make it work
It works ! Thank you, dis indeed is absolutly what i needed, automatically generating python code classes from my XML documents.
It was very helpful for me a couple of years ago. Big thanks to Dave Kuhlman.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.