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. XML / XSL
  4. .removing empty elements

.removing empty elements

Scheduled Pinned Locked Moved XML / XSL
helpalgorithmsxmltutorialquestion
3 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
    ruud ortmans
    wrote on last edited by
    #1

    Hi, I've written data from a dataset to xml with ds.WriteXml. The problem is that empty fields in a record are written as empty elements in the xml-file. Example The best option is to avoid these empty elements directly at the WriteXml-method of the dataset. The second option is to read the xml-file after construction, remove al the empty elements from it and save. After searching the web i couldn't find any suitable solution for this problem. Can someone help me? Note that the xml-file contains nested elements. Some of the nested elements can be empty also. thanks Ruud

    S 1 Reply Last reply
    0
    • R ruud ortmans

      Hi, I've written data from a dataset to xml with ds.WriteXml. The problem is that empty fields in a record are written as empty elements in the xml-file. Example The best option is to avoid these empty elements directly at the WriteXml-method of the dataset. The second option is to read the xml-file after construction, remove al the empty elements from it and save. After searching the web i couldn't find any suitable solution for this problem. Can someone help me? Note that the xml-file contains nested elements. Some of the nested elements can be empty also. thanks Ruud

      S Offline
      S Offline
      softty
      wrote on last edited by
      #2

      then what is your problem ?? do u need to write non empty element only ?? love2code

      R 1 Reply Last reply
      0
      • S softty

        then what is your problem ?? do u need to write non empty element only ?? love2code

        R Offline
        R Offline
        ruud ortmans
        wrote on last edited by
        #3

        Indeed, only the elements who have content need to be written from the dataset to xml. Otherwise, a solution who will remove all the empty elements from the output xml-file would be a good alternative. Every solution is right. Ruud

        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