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#
  4. XML Version

XML Version

Scheduled Pinned Locked Moved C#
xmlhelpquestionannouncement
7 Posts 2 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.
  • R Offline
    R Offline
    Rijz
    wrote on last edited by
    #1

    Hi, Am totally new to the XML part.... i am creating an XML using XMLDocument. have created parent nodes, attributes, child nodes etc.. I wanted to get <?xml version="1.0" standalone="yes"?> at the top of the XML. How will I be able to mention the XML version on the top of it. Any help appreciated. Thanks Rijz

    D 1 Reply Last reply
    0
    • R Rijz

      Hi, Am totally new to the XML part.... i am creating an XML using XMLDocument. have created parent nodes, attributes, child nodes etc.. I wanted to get <?xml version="1.0" standalone="yes"?> at the top of the XML. How will I be able to mention the XML version on the top of it. Any help appreciated. Thanks Rijz

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      When you save your XmlDocument either to a file or stream it will automatically create that for you.

      R 1 Reply Last reply
      0
      • D DaveyM69

        When you save your XmlDocument either to a file or stream it will automatically create that for you.

        R Offline
        R Offline
        Rijz
        wrote on last edited by
        #3

        Thanks for the reply. I am saving the creatred XML using the save method into a physical Location as xmlDoc.Save(@"d://xmltest/InputxmlNew.xml")... But the version is not getting displayed. Am I missing something somewhere? Thanks Rijz

        D 1 Reply Last reply
        0
        • R Rijz

          Thanks for the reply. I am saving the creatred XML using the save method into a physical Location as xmlDoc.Save(@"d://xmltest/InputxmlNew.xml")... But the version is not getting displayed. Am I missing something somewhere? Thanks Rijz

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          Opps - sorry will edit this when I've sorted it! Solution (NB: declaration node!):

          System.Xml.XmlDocument MyXmlDoc = new System.Xml.XmlDocument();
          System.Xml.XmlNode DeclarationNode = MyXmlDoc.CreateNode(System.Xml.XmlNodeType.XmlDeclaration, "", "");
          MyXmlDoc.AppendChild(DeclarationNode);
          System.Xml.XmlElement RootElement = MyXmlDoc.CreateElement("", "root", "");
          MyXmlDoc.AppendChild(RootElement);
          MyXmlDoc.Save(@"C:\\test.xml");

          modified on Friday, February 8, 2008 6:55 AM

          R 1 Reply Last reply
          0
          • D DaveyM69

            Opps - sorry will edit this when I've sorted it! Solution (NB: declaration node!):

            System.Xml.XmlDocument MyXmlDoc = new System.Xml.XmlDocument();
            System.Xml.XmlNode DeclarationNode = MyXmlDoc.CreateNode(System.Xml.XmlNodeType.XmlDeclaration, "", "");
            MyXmlDoc.AppendChild(DeclarationNode);
            System.Xml.XmlElement RootElement = MyXmlDoc.CreateElement("", "root", "");
            MyXmlDoc.AppendChild(RootElement);
            MyXmlDoc.Save(@"C:\\test.xml");

            modified on Friday, February 8, 2008 6:55 AM

            R Offline
            R Offline
            Rijz
            wrote on last edited by
            #5

            Thank you very much.. I will be here..

            D 1 Reply Last reply
            0
            • R Rijz

              Thank you very much.. I will be here..

              D Offline
              D Offline
              DaveyM69
              wrote on last edited by
              #6

              Above...

              R 1 Reply Last reply
              0
              • D DaveyM69

                Above...

                R Offline
                R Offline
                Rijz
                wrote on last edited by
                #7

                Thank you..... works fine!!!

                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