Python and XML?

L

Leonard J. Reder

Hello,

What is the best way to process a Relax NG Schema and auto generate XML
Python parser/generator code?
Any suggestions?

Thanks for all replies,

Len
--
===================================
Leonard J. Reder
Home office email : (e-mail address removed)
Lab email : (e-mail address removed)
Lab web page : http://reder.jpl.nasa.gov
===================================
 
S

Stefan Behnel

Leonard said:
What is the best way to process a Relax NG Schema and auto generate XML
Python parser/generator code?
Any suggestions?

Not sure what you mean with "XML Python parser/generator code", but regarding
RNG, you should definitely give lxml a try. It may already be what you were
looking for anyway.

http://codespeak.net/lxml

Have fun,
Stefan
 
L

Leonard J. Reder

Thanks for the response. This package does look interesting.
What I as really after though was other possible solutions
like JAX in the Java world or Gnosis in the Python world.

Something that can take a Relax NG Schema and compile
it into a bunch of parser/generator objects for handling
an XML format. Guess I am going to just have try out
Gnosis since it seems like the only game in town.

Len

Stefan said:
Not sure what you mean with "XML Python parser/generator code", but regarding
RNG, you should definitely give lxml a try. It may already be what you were
looking for anyway.

http://codespeak.net/lxml

Have fun,
Stefan


--
===================================
Leonard J. Reder
Home office email : (e-mail address removed)
Lab email : (e-mail address removed)
Lab web page : http://reder.jpl.nasa.gov
===================================
 
S

Stefan Behnel

Leonard said:
What I as really after though was other possible solutions
like JAX in the Java world or Gnosis in the Python world.

Something that can take a Relax NG Schema and compile
it into a bunch of parser/generator objects for handling
an XML format.

That's why I was asking why you need this. Validation is provided by RNG
itself, so all you would need is some kind of mapping that outputs and parses
it for you? What's your target format? Python objects?

http://codespeak.net/lxml/objectify.html

Stefan
 
L

Leonard J. Reder

Stefan said:
That's why I was asking why you need this. Validation is provided by RNG
itself, so all you would need is some kind of mapping that outputs and parses
it for you? What's your target format? Python objects?

http://codespeak.net/lxml/objectify.html

Stefan

My target format are Python objects. What I want to do is
auto-covert the Relax NG Schema into Python API objects
that can be used to intelligently read in an XML file.

Our XML files specify interfaces to flight software
but in the future I have an interest in using XMI to do more
complete modeling of software. Hopefully the OMG publishes
a stand XMI schema.

Looks like this stuff might do what I want. Need to work through the
example.

Are you the author? Why is this better then using gnossis?

Thanks,

Len

--
===================================
Leonard J. Reder
Home office email : (e-mail address removed)
Lab email : (e-mail address removed)
Lab web page : http://reder.jpl.nasa.gov
===================================
 
S

Stefan Behnel

Hi,
Looks like this stuff might do what I want. Need to work through the
example.

Are you the author?

Yup! :)

Why is this better then using gnossis?

lxml is faster and supports more XML standards. It's also more flexible in
that it allows you to replace element classes at basically any granularity and
thus add things to the Element API or even replace it as you see fit, without
loosing the standard XML features. You can even do that at the C-level, in
case you really need high-performance.

See the "extending lxml" section in the side menu at
http://codespeak.net/lxml/dev/
especially:
http://codespeak.net/lxml/dev/element_classes.html

Stefan
 
L

Leonard J. Reder

Stefan,

This package is looking better I tried the validation example, but it
did not work
with 1.3beta so I grabbed 1.2. If objectify works well I think this is a
great pick for anyone using xml. Please post to me and the python announce
when 1.3 is released.

thanks,
Len
Stefan said:
Hi,


Yup! :)



lxml is faster and supports more XML standards. It's also more flexible in
that it allows you to replace element classes at basically any granularity and
thus add things to the Element API or even replace it as you see fit, without
loosing the standard XML features. You can even do that at the C-level, in
case you really need high-performance.

See the "extending lxml" section in the side menu at
http://codespeak.net/lxml/dev/
especially:
http://codespeak.net/lxml/dev/element_classes.html

Stefan


--
===================================
Leonard J. Reder
Home office email : (e-mail address removed)
Lab email : (e-mail address removed)
Lab web page : http://reder.jpl.nasa.gov
===================================
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top