How can i separate tags in a xml file

Posted on 2009-02-10
Last Modified: 2012-05-06
I have a code that create an xml file but when this code receive an empty string aperars like this  <Label /> and i need this structure <Label></Label> how can i get this? I have this code:
Question by:albloe1975
    LVL 27

    Accepted Solution

    Has to be more like this....
    With xWriter
          WriteElementString("Label", "")
    End With


    Expert Comment

    The suggested solution does not work for what I need. For a business requirement, I need an element like this: <ProviderID></ProviderID>. Following the suggested solution, I tried:
                writer.WriteElementString("ProviderID", String.Empty);

    This gives me either an extra tag I don't want:
      <ProviderID />

    Every other solution I've tried like the following gives me <ProviderID />.

    It appears that WriteEndElement() does not provide the single functionality it is designed to provide.

    Does anyone know how to accomplish this?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now