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. XML / XSL
  4. Problems with a well formed XML

Problems with a well formed XML

Scheduled Pinned Locked Moved XML / XSL
xmlquestion
3 Posts 2 Posters 1 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
    Rekha Patel
    wrote on last edited by
    #1

    Hi.. I am having some problems with the xmldocument. Below is my code...can anyone tell me why the output is not well formed..this is my ouput for the following code... - - why is the Title element not complete??? XmlDocument xmlDoc = new XmlDocument(); XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0",null,null); XmlElement rootNode = xmlDoc.CreateElement("Persons"); xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement); xmlDoc.AppendChild(rootNode); XmlElement Node = xmlDoc.CreateElement("Person"); Node.SetAttribute("Name", name); Node.SetAttribute("Age", age); xmlDoc.DocumentElement.AppendChild(Node); XmlElement Node1 = xmlDoc.CreateElement("Title"); Node1.SetAttribute("Title", title); Node.AppendChild(Node1); Thank you

    C 2 Replies Last reply
    0
    • R Rekha Patel

      Hi.. I am having some problems with the xmldocument. Below is my code...can anyone tell me why the output is not well formed..this is my ouput for the following code... - - why is the Title element not complete??? XmlDocument xmlDoc = new XmlDocument(); XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0",null,null); XmlElement rootNode = xmlDoc.CreateElement("Persons"); xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement); xmlDoc.AppendChild(rootNode); XmlElement Node = xmlDoc.CreateElement("Person"); Node.SetAttribute("Name", name); Node.SetAttribute("Age", age); xmlDoc.DocumentElement.AppendChild(Node); XmlElement Node1 = xmlDoc.CreateElement("Title"); Node1.SetAttribute("Title", title); Node.AppendChild(Node1); Thank you

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The output IS well formed. When a node does not have children, it can be shown like this: OR like this: Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer</x-turndown>

      1 Reply Last reply
      0
      • R Rekha Patel

        Hi.. I am having some problems with the xmldocument. Below is my code...can anyone tell me why the output is not well formed..this is my ouput for the following code... - - why is the Title element not complete??? XmlDocument xmlDoc = new XmlDocument(); XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0",null,null); XmlElement rootNode = xmlDoc.CreateElement("Persons"); xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement); xmlDoc.AppendChild(rootNode); XmlElement Node = xmlDoc.CreateElement("Person"); Node.SetAttribute("Name", name); Node.SetAttribute("Age", age); xmlDoc.DocumentElement.AppendChild(Node); XmlElement Node1 = xmlDoc.CreateElement("Title"); Node1.SetAttribute("Title", title); Node.AppendChild(Node1); Thank you

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Ooops - I meant to say that is the same as <Title></Title>, but I forgot to check the little box :-) Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer</x-turndown>

        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