Results 1 to 3 of 3

Thread: (2003) XML Questions......

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Lancashire UK
    Posts
    375

    (2003) XML Questions......

    I'm currently writing an app that receives a byte array from a web service API, this array is basically an xml document. I'm converting it back to a string then to an xml document as follows:

    VB Code:
    1. Private Sub ConvertToString(ByVal wb() As Byte)
    2.         Dim strResponse As String
    3.         Dim enc As ASCIIEncoding = New ASCIIEncoding
    4.         strResponse = enc.GetString(wb)
    5.         rtbResult.Text = strResponse
    6.     End Sub

    VB Code:
    1. Private Sub createXML()
    2.         Dim xmlDoc As XmlDocument = New XmlDocument
    3.         xmlDoc.LoadXml(rtbResult.Text)
    4.         xmlDoc.Save("c:\XMLResult.xml")
    5.  
    6.     End Sub()

    Please bear in mind this is still in a 'getting to grips stage'.

    The question is twofold, one is there a better way to convert the byte array directly to an xml document?

    Secondly I originally thought about loading the xml data into a dataset and then manipluating it from there but the xml document is fairly complex and the dataset.readxml method throws an error about duplicate tables being created.

    Is it feasible to just utilise the data directly from the xml document its self and if so does this slow things down any ?

    I'm pretty green when it comes to xml so any advice appreciated.
    If my post helps , please feel free to rate it

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

    Re: (2003) XML Questions......

    Create a MemoryStream, write the binary data to that stream, then create an XmlTextReader on the stream.
    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
    Aug 2005
    Location
    Lancashire UK
    Posts
    375

    Re: (2003) XML Questions......

    Thanks, I'll give that a go.

    Are there any drawbacks to working with data directly from an xml document?

    I mean is it more complex than manipulating a dataset and if so is it worth the effort moving the data from the xml document to a dataset, bear in mind I dont have to add any data just read it and display it in a useable fashion.
    If my post helps , please feel free to rate it

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