Results 1 to 4 of 4

Thread: XmlTextWriter

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    XmlTextWriter

    Hi,
    in the text file i get &lt; names &gt; how to get <names>



    Dim xmlDoc As XmlDocument = New XmlDocument
    xmlDoc.LoadXml(ds.GetXml)
    Dim Output As New XmlTextWriter(fileLoc, System.Text.Encoding.Default)


    <?xml version="1.0" standalone="yes"?>
    <NewDataSet>
    <xml>
    <XML_F52E2B61-18A1-11d1-B105-00805F49916B>&lt; names &gt;&lt; name="Sam"/&gt;

    thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: XmlTextWriter

    The reason would be that you're writing XML as values in an XML file. If you want to save a DataSet to an XML file then you simply call the WriteXml method of the DataSet.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Re: XmlTextWriter

    Im actualy doing an sql xml query so the data is returned in xml format, i also tried using ds.writeXml() method, nothing changed though

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: XmlTextWriter

    OK then, what you're getting is exactly what you should be getting. If you're writing XML inside XML then that's what you'll get. Obviously you can't have chevrons inside chevrons, e.g.
    Code:
    <someElement value="<someValue>">
    The inner data has to be escaped and that's why you see &lt; and &gt;. That's the way it works so that's what you get. If you replace them with < and > then you will not have valid XML.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width