Writing XML to file with tabs etc
-
Hi, I'm currently using the XML DOM from VC++ in order to load / manipulate / save XML files. I like to format my XML files nicely with tabular indents and so on, in order to form a readble document. However, the parts of the document modified from within VC are just written in "one-huge-line"-style. No nice linebreaks and tab indents... How do I do that ? The IXMLDOMNodePtr->xml property hasn't got a put method, so I can't manually append a linebreak directly. Any ideas folks ? Thanks a lot in advance ;o) Best regards /Jan
-
Hi, I'm currently using the XML DOM from VC++ in order to load / manipulate / save XML files. I like to format my XML files nicely with tabular indents and so on, in order to form a readble document. However, the parts of the document modified from within VC are just written in "one-huge-line"-style. No nice linebreaks and tab indents... How do I do that ? The IXMLDOMNodePtr->xml property hasn't got a put method, so I can't manually append a linebreak directly. Any ideas folks ? Thanks a lot in advance ;o) Best regards /Jan
This has already been answered just a few lines down click here to read it :cool:
-
This has already been answered just a few lines down click here to read it :cool:
yeah - well.. sort of. Thats "my" thread as well - as you've probably seen. However, I can't find anything in the helping link about how to format the XML file - not the data output. Or I'm just missing something important here ;o) Anyway, could you be a bit more specific about how I fix it ? the problem is that hello world hello xml after updating child 2 data is turned into hello world helloxml - which is pretty annoying. And I just can't find any way of telling the XML document object/nodes how to physically dump the data. Maybe that was more clear - or maybe I've just misunderstood the entire concept. Who knows ? /Jan
-
yeah - well.. sort of. Thats "my" thread as well - as you've probably seen. However, I can't find anything in the helping link about how to format the XML file - not the data output. Or I'm just missing something important here ;o) Anyway, could you be a bit more specific about how I fix it ? the problem is that hello world hello xml after updating child 2 data is turned into hello world helloxml - which is pretty annoying. And I just can't find any way of telling the XML document object/nodes how to physically dump the data. Maybe that was more clear - or maybe I've just misunderstood the entire concept. Who knows ? /Jan
There is a 'whitespace' element in the DOM, I've never used it since it costs performance to use. see http://www.xml.com/pub/a/2001/12/05/whitespace.html
-
There is a 'whitespace' element in the DOM, I've never used it since it costs performance to use. see http://www.xml.com/pub/a/2001/12/05/whitespace.html
Allright, I may be completely off track here - but the link you refer to deals with the problems of showing the data from the XML file using a stylesheet, and getting line breaks in the resulting "view". What I want, is linebreaks in my XML file. When I generate this data structure : bla bla from VC++, the _file_ looks like this : blabla - which, of course, is correct - but not what I want. What do you think ? completely off track and unable to understand the link you gave me ;o) ? Thanks anyway. /Jan
-
Allright, I may be completely off track here - but the link you refer to deals with the problems of showing the data from the XML file using a stylesheet, and getting line breaks in the resulting "view". What I want, is linebreaks in my XML file. When I generate this data structure : bla bla from VC++, the _file_ looks like this : blabla - which, of course, is correct - but not what I want. What do you think ? completely off track and unable to understand the link you gave me ;o) ? Thanks anyway. /Jan
there is property of xmlwriter than creates/preserves space. personally I allways turn it off.
-
Allright, I may be completely off track here - but the link you refer to deals with the problems of showing the data from the XML file using a stylesheet, and getting line breaks in the resulting "view". What I want, is linebreaks in my XML file. When I generate this data structure : bla bla from VC++, the _file_ looks like this : blabla - which, of course, is correct - but not what I want. What do you think ? completely off track and unable to understand the link you gave me ;o) ? Thanks anyway. /Jan
whoops, yea, posted wrong link! My bad. You definately are looking for the whitespace setting. I cant find the link I was going to give you now, though.
-
Hi, I'm currently using the XML DOM from VC++ in order to load / manipulate / save XML files. I like to format my XML files nicely with tabular indents and so on, in order to form a readble document. However, the parts of the document modified from within VC are just written in "one-huge-line"-style. No nice linebreaks and tab indents... How do I do that ? The IXMLDOMNodePtr->xml property hasn't got a put method, so I can't manually append a linebreak directly. Any ideas folks ? Thanks a lot in advance ;o) Best regards /Jan
The problem you are facing is true if you read the xml in a text editor. But any xml editor should automatically reorganize the display of your data in the "neat" way. I am assuming this is your objective. Unless you wish to read it in a simple text editor and yet have it formatted. In which case.... hmmmm... too much effort, when there are so manty xml editors and tools available. Including IE which will display your XML in the "neat" way.