Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > custom xml pretty print

Reply
Thread Tools

custom xml pretty print

 
 
akbar
Guest
Posts: n/a
 
      11-20-2005
Hi,

I have Document. If I print it like this:

print doc.toprettyxml(" ")

I will get this:
<a>
<b>
<c>
blablablabla
</c>
</b>
</a>

What do I have to do if I want to print it like this:
<a>
<b>
<c>blablablabla</c>
</b>
</a>

Thank you.

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      11-20-2005
akbar wrote:
> Hi,
>
> I have Document. If I print it like this:
>
> print doc.toprettyxml(" ")
>
> I will get this:
> <a>
> <b>
> <c>
> blablablabla
> </c>
> </b>
> </a>
>
> What do I have to do if I want to print it like this:
> <a>
> <b>
> <c>blablablabla</c>
> </b>
> </a>


Use a SAX-Handler, parse it yourself and pretty-print your own. You
_could_ use DOM, but I don't think its needed here.

Diez
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding best way to pretty print XML files Pk Z. Ruby 3 01-13-2011 12:05 AM
Re: One more Pretty Face - Pretty face9.jpg [1/1] Harvey Digital Photography 7 11-04-2004 09:53 AM
How to pretty-print XML with a regular expression? Andrew Montgomery Perl 0 09-17-2003 12:54 PM
Re: Pretty Please Peer2Peer need help Pretty Please John Haithwaite @ Blue Case Solutions Computer Support 0 07-06-2003 10:20 PM
Re: Pretty Please Peer2Peer need help Pretty Please Ralph Wade Phillips Computer Support 0 07-06-2003 09:07 PM



Advertisments