Reading XML like Python!

J

John

I have to read a lot of XML for my upcoming project.
XML is hard on my eyes.
Is there some sort of converter that converts XML to something more
eye friendly? maybe like Python? I have seen restructured text. There
is a paper at EuroPython 2004 that seems to do something similar.

"Pythonic Alternatives for declarative XML-based specifications of
robot behavior"

Anyone know of any tools along these lines?

Thanks.
 
R

Roy Smith

I have to read a lot of XML for my upcoming project.
XML is hard on my eyes.
Is there some sort of converter that converts XML to something more
eye friendly? maybe like Python? I have seen restructured text. There
is a paper at EuroPython 2004 that seems to do something similar.

"Pythonic Alternatives for declarative XML-based specifications of
robot behavior"

Anyone know of any tools along these lines?

Thanks.

I had the same problem recently. I used the standard xml.dom.minidom
module to parse the XML, and about a page of Python code to pretty-print
it. Unfortunately, I'm not able to release the code, but if you're
familiar with how DOM works, you should be able to replicate it in under
an hour. If you're not familiar with DOM, it'll take you longer, but
it'll also give you a chance to get familiar :)

Have you tried DAGS for "xml pretty-print"?
 
J

John

I had the same problem recently. I used the standard xml.dom.minidom
module to parse the XML, and about a page of Python code to pretty-print
it. Unfortunately, I'm not able to release the code, but if you're
familiar with how DOM works, you should be able to replicate it in under
an hour. If you're not familiar with DOM, it'll take you longer, but
it'll also give you a chance to get familiar :)

Have you tried DAGS for "xml pretty-print"?

I suppose I could write a simple parser myself but I was wondering if
this was a problem well solved by someone else already with all the
bells and whistles.

What is DAGS? A Google search came up with "Directed Acyclic Graphs".
Not being a CS guy, I am not sure about the relationship to pretty
printing. Any link?

Thanks.
 
D

Diez B. Roggisch

John said:
I have to read a lot of XML for my upcoming project.
XML is hard on my eyes.
Is there some sort of converter that converts XML to something more
eye friendly? maybe like Python? I have seen restructured text. There
is a paper at EuroPython 2004 that seems to do something similar.

I used yaml - actually its not exactly what you asked for, but a different
way of producing markup, which is much more friendly to the eye, and as
whitespace is significant, resembles python in that respect. I'm not aware
of xml2yaml converters, but I haven't looked so there might be some.
 
J

John

Diez B. Roggisch said:
I used yaml - actually its not exactly what you asked for, but a different
way of producing markup, which is much more friendly to the eye, and as
whitespace is significant, resembles python in that respect. I'm not aware
of xml2yaml converters, but I haven't looked so there might be some.

Thanks for the info. I found some YAML and PYX converters on CPAN. Will do for now.
 
B

bowman

John said:
I have to read a lot of XML for my upcoming project.
XML is hard on my eyes.
Is there some sort of converter that converts XML to something more
eye friendly?

I don't know what your XML data is, but an XSLT stylesheet and xsltproc will
turn it into about anything you want.
 
A

Andrew Dalke

bowman said:
I don't know what your XML data is, but an XSLT stylesheet and xsltproc will
turn it into about anything you want.

But if the OP thinks "XML is hard on my eyes" then
I suspect the stylesheet itself, written as it is in XML,
would be similarly hard on the eyes.

I know I don't like reading XSLT. Also in part because
I don't have much experience with functional programming
languages.

Andrew
(e-mail address removed)
 
W

Wade Leftwich

I have to read a lot of XML for my upcoming project.
XML is hard on my eyes.
Is there some sort of converter that converts XML to something more
eye friendly? maybe like Python? I have seen restructured text. There
is a paper at EuroPython 2004 that seems to do something similar.

"Pythonic Alternatives for declarative XML-based specifications of
robot behavior"

Anyone know of any tools along these lines?

Thanks.

I am on a similar quest, for a notation that will let me write XSLT
without typing '<xsl:' a gazillion times. (And, more important, will
be easier to read.)

I have not made a choice yet, but Paul Tchistopolskii has assembled a
list of XML Alternatives at
http://www.pault.com/pault/pxml/xmlalternatives.html.

His own XSLScript looks promising for my project:
http://www.pault.com/pault/XSLScript/index.html

-- Wade Leftwich
Ithaca, NY
 
J

Jarek Zgoda

John said:
I have to read a lot of XML for my upcoming project.
XML is hard on my eyes.
Is there some sort of converter that converts XML to something more
eye friendly? maybe like Python?

effbot's ElementTree is a most pythonic API to XML documents I've ever
see.
 
D

Dave Cook

I have to read a lot of XML for my upcoming project.
XML is hard on my eyes.
Is there some sort of converter that converts XML to something more
eye friendly? maybe like Python? I have seen restructured text. There
is a paper at EuroPython 2004 that seems to do something similar.

"Pythonic Alternatives for declarative XML-based specifications of
robot behavior"

Anyone know of any tools along these lines?

Check out xmlobject:

http://xmlobject.base-art.net/

Dave Cook
 
K

Kevin Dahlhausen

Dave Cook said:
Check out xmlobject:

I was looking for something exactly like this last week. Amazing how
much code it cuts out. Thanks for posting the link.
 

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

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top