Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Writing XML to file with tabs etc

Writing XML to file with tabs etc

Scheduled Pinned Locked Moved XML / XSL
questionc++htmlxml
8 Posts 5 Posters 21 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jan R Hansen
    wrote on last edited by
    #1

    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

    A R 2 Replies Last reply
    0
    • J Jan R Hansen

      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

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      This has already been answered just a few lines down click here to read it :cool:

      J 1 Reply Last reply
      0
      • A Anonymous

        This has already been answered just a few lines down click here to read it :cool:

        J Offline
        J Offline
        Jan R Hansen
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • J Jan R Hansen

          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

          C Offline
          C Offline
          Christopher Lord
          wrote on last edited by
          #4

          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

          J 1 Reply Last reply
          0
          • C Christopher Lord

            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

            J Offline
            J Offline
            Jan R Hansen
            wrote on last edited by
            #5

            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

            P C 2 Replies Last reply
            0
            • J Jan R Hansen

              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

              P Offline
              P Offline
              Philip Fitzsimons
              wrote on last edited by
              #6

              there is property of xmlwriter than creates/preserves space. personally I allways turn it off.

              1 Reply Last reply
              0
              • J Jan R Hansen

                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

                C Offline
                C Offline
                Christopher Lord
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • J Jan R Hansen

                  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

                  R Offline
                  R Offline
                  Ranjan Banerji
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups