Re: [xml] Question about xmlDumpDoc()



Let me try asking the question a different way.

I'm working with a pre-formated (human generated) XML file, so there's text all through out the document consisting of things like "\n\n\n\t" and "              \n" etc.

When I run into these characters, I see them as children of whichever node I happen to be working in and they're of the type  XML_TEXT_NODE
 

When I run calls to xmlDocDumpFormat(), it seems to be treating these nodes as if they contained more than white spaces, newlines and tabs.  

Is there a work-around for this?   Something that's a bit more intelligent than XmlDocDumpFormat()?

If not, I'm thinking any of the following would be the best course of action (looking for a recommendation):

1) Go through each node and their children one by one and simply remove any XML_TEXT_NODE node types that contain only white spaces, newlines and tabs.  Then simply call xmlDocDumpFormat()

2) Crawl through each node and their child and manually ADD these XML_TEXT_NODEs and call xmlDocDump()

3) ???

-Daniel
 
On 8/28/07, Callum Gibson < callum_r_gibson yahoo com au> wrote:
On 28 Aug 08:49, Daniel Corbe wrote:
}Is there a mode of operation or an equivalent function which causes the XML
}file to be written with proper indentation?

Use the *Format* variation of the dump/save functions. eg.

xmlDocFormatDump vs xmlDocDump
xmlDocDumpFormatMemory vs xmlDocDumpMemory
xmlSaveFormatFile vs xmlFormatFile

and so on.

--

Callum Gibson @ home

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]