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. C / C++ / MFC
  4. how to format my xml file?

how to format my xml file?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialxmlquestion
7 Posts 4 Posters 0 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.
  • S Offline
    S Offline
    sharkmouse
    wrote on last edited by
    #1

    i use the msxml lib write a xml,but have such a problem,that is i want to the file that open by notepad looks like the open by ie which has the layer and tabbed space, for example: my file want to look like below in notepad: how to solve the problem?who can help me ,i tried some method but can not solve so well.

    L S K T 4 Replies Last reply
    0
    • S sharkmouse

      i use the msxml lib write a xml,but have such a problem,that is i want to the file that open by notepad looks like the open by ie which has the layer and tabbed space, for example: my file want to look like below in notepad: how to solve the problem?who can help me ,i tried some method but can not solve so well.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Write a program that will enter a new line and a tab(or 2-4 spaces) after every '>' char. Of course it is a little more complicated but it shouldn't be too hard to implement.

      █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

      1 Reply Last reply
      0
      • S sharkmouse

        i use the msxml lib write a xml,but have such a problem,that is i want to the file that open by notepad looks like the open by ie which has the layer and tabbed space, for example: my file want to look like below in notepad: how to solve the problem?who can help me ,i tried some method but can not solve so well.

        S Offline
        S Offline
        sharkmouse
        wrote on last edited by
        #3

        yes,that maybe ok.but how to control the layers,such like this, should i compute the tab numbers about each line? if i want to format the xml like this,what can i do? that is if the node is the leaf node,do not add a new line? is that possible?

        L 1 Reply Last reply
        0
        • S sharkmouse

          yes,that maybe ok.but how to control the layers,such like this, should i compute the tab numbers about each line? if i want to format the xml like this,what can i do? that is if the node is the leaf node,do not add a new line? is that possible?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I was looking for something similar a few days ago. Search google for "XML pretty Print" and you'll find a few things. In the end I opened it in VS2006 which formats the text, then copy & paste but I only needed to do it once

          1 Reply Last reply
          0
          • S sharkmouse

            i use the msxml lib write a xml,but have such a problem,that is i want to the file that open by notepad looks like the open by ie which has the layer and tabbed space, for example: my file want to look like below in notepad: how to solve the problem?who can help me ,i tried some method but can not solve so well.

            K Offline
            K Offline
            kakan
            wrote on last edited by
            #5

            I haven't found a way to do this in MSXML, but i know that Xerces can do it. Just use this: DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter(); theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); and possibly this: theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, true);

            Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

            1 Reply Last reply
            0
            • S sharkmouse

              i use the msxml lib write a xml,but have such a problem,that is i want to the file that open by notepad looks like the open by ie which has the layer and tabbed space, for example: my file want to look like below in notepad: how to solve the problem?who can help me ,i tried some method but can not solve so well.

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              sharkmouse wrote:

              how to solve the problem?who can help me ,i tried some method but can not solve so well.

              IMXWriter Interface

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief And You

              S 1 Reply Last reply
              0
              • T ThatsAlok

                sharkmouse wrote:

                how to solve the problem?who can help me ,i tried some method but can not solve so well.

                IMXWriter Interface

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief And You

                S Offline
                S Offline
                sharkmouse
                wrote on last edited by
                #7

                can you give me a simple example?

                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