Results 1 to 40 of 53

Thread: Indenting XML properly using MSXML4

Threaded View

  1. #1

    Thread Starter
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Indenting XML properly using MSXML4

    Could you guys help me with a way to indent XML properly using MSXML4 and nodes (instead of using InStr to find < and />). I am looking for a clean and proper way to do it.

    I currenly have something like this:
    <PropertyBag><CProject name="TestProj1"><FileName>test.lfp</FileName></CProject></PropertyBag>


    and I would like it to turn out like this:
    Code:
    <PropertyBag>
        <CProject name="TestProj1">
            <FileName>test.lfp</FileName>
        </CProject>
    </PropertyBag>
    Notice how the inner-most node contents doesn't go on a new line. I think it looks better this way.

    I have searched the forums and google and not found anything. I'm not good with MSXML so I don't even know where to start.

    Also, having the option to use 4 spaces or tabs would be great.

    Thanks a ton.
    Last edited by eyeRmonkey; Oct 14th, 2005 at 02:17 PM.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width