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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. XML Writer

XML Writer

Scheduled Pinned Locked Moved C / C++ / MFC
c++xml
7 Posts 3 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.
  • A Offline
    A Offline
    amit code
    wrote on last edited by
    #1

    Hi.. i want to write xmlwriter function for writing in xml file in c++.Is there any MFC class by which i can implement it or any sample code as reference. Thanks

    amit

    S CPalliniC 2 Replies Last reply
    0
    • A amit code

      Hi.. i want to write xmlwriter function for writing in xml file in c++.Is there any MFC class by which i can implement it or any sample code as reference. Thanks

      amit

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Don't think MFC has any XML functionality built in. If you're just writing XML, genx is very easy to use. Other options include MSXML or libxml2 (which has an XML writer API). I personally don't like MSXML too much for C++, as calling it via COM is a bit of a pain.

      1 Reply Last reply
      0
      • A amit code

        Hi.. i want to write xmlwriter function for writing in xml file in c++.Is there any MFC class by which i can implement it or any sample code as reference. Thanks

        amit

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        If you need to write some simple XML then you can hand-craft it (writing XML is far simpler than reading -parsing- it). If you need a full-fledged XMLWriter then you may use a library, as suggested by Stuart Dootson. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        S 1 Reply Last reply
        0
        • CPalliniC CPallini

          If you need to write some simple XML then you can hand-craft it (writing XML is far simpler than reading -parsing- it). If you need a full-fledged XMLWriter then you may use a library, as suggested by Stuart Dootson. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          CPallini wrote:

          If you need to write some simple XML then you can hand-craft it

          To be honest, I'd always recommend using a writer, as it'll (hopefully) remember to do things like specifying the file's encoding, closing tags, quoting text etc. The quoting text bit, especially, is very easy to forget to do or, even if you remember it, easy to get wrong.

          CPalliniC 1 Reply Last reply
          0
          • S Stuart Dootson

            CPallini wrote:

            If you need to write some simple XML then you can hand-craft it

            To be honest, I'd always recommend using a writer, as it'll (hopefully) remember to do things like specifying the file's encoding, closing tags, quoting text etc. The quoting text bit, especially, is very easy to forget to do or, even if you remember it, easy to get wrong.

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            All do you need then is an XML validator tool. IMHO Writing hand-crafted XML has some educational purposes too. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            A 1 Reply Last reply
            0
            • CPalliniC CPallini

              All do you need then is an XML validator tool. IMHO Writing hand-crafted XML has some educational purposes too. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              A Offline
              A Offline
              amit code
              wrote on last edited by
              #6

              Thanks for reply. I have looked for msxml for doing xml operation. I have my parser reader function I need to implement writer function or function to modify existing file. So if I had an xml document and I want to move to specific tag given its ID. Would I have to iterate through all the nodes until I found the tag with the id I wanted or is there a quicker way in msxml. I have read its sdk but fails to find anything regarding this. Thanks amit

              amit

              CPalliniC 1 Reply Last reply
              0
              • A amit code

                Thanks for reply. I have looked for msxml for doing xml operation. I have my parser reader function I need to implement writer function or function to modify existing file. So if I had an xml document and I want to move to specific tag given its ID. Would I have to iterate through all the nodes until I found the tag with the id I wanted or is there a quicker way in msxml. I have read its sdk but fails to find anything regarding this. Thanks amit

                amit

                CPalliniC Offline
                CPalliniC Offline
                CPallini
                wrote on last edited by
                #7

                No, you haven't to. You may search for nodes, see for instance [^] or [^]. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                In testa che avete, signor di Ceprano?

                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