Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: xml::libxml open, add and save not formatting properly

by itsscott (Sexton)
on Mar 23, 2010 at 23:57 UTC ( [id://830420]=note: print w/replies, xml ) Need Help??


in reply to Re^3: xml::libxml open, add and save not formatting properly
in thread xml::libxml open, add and save not formatting properly

Yes it is a little odd, I am using the 1 option as opposed to the 2 option as I don't like all the carriage returns :-) I've toyed and toyed with this for a whole day last week and it's just odd, that the document I created in the first place was with the same exact methods, steps etc as the 'revised' document. All this effort so I can make a new entry in this xml file and the lead on the project likes it a certain way.

I do thank you all for your input, even if I can't solve this the way I want, I have learned new things!

Replies are listed 'Best First'.
Re^5: xml::libxml open, add and save not formatting properly
by ikegami (Patriarch) on Mar 24, 2010 at 00:36 UTC
    xmllint is a tool that uses libxml and comes with it. It's --format option does what you want. All the work appears to be done by a library function htmlSaveFileFormat. You could patch XML::LibXML to expose that function. You're not the first whose wanted a pretty print function from XML::LibXML.

    Update: The simplest solution would be to add an optional format argument to $doc->toStringHTML and swap in htmlDocDumpMemoryFormat for htmlDocDumpMemory in that function.

    Update: Never mind, htmlDocDumpMemory simply calls htmlDocDumpMemoryFormat with the format option set, and it doesn't help.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://830420]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-03-29 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found