Data Access Advice

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben

    #1

    Data Access Advice

    Hi

    I need to post xml data to a url, I have have created an xml file using an
    xml text writer as below but would rather a faster method that does not
    involve writing the file to disk but using it from memory instead. Could
    anyone suggest a method that is similar in coding (so as not to require too
    many code changes).

    Dim writer As New System.Xml.XmlT extWriter("c:\t emp\TestXml.xml ",
    System.Text.Enc oding.UTF8)

    ..Formatting = Xml.Formatting. Indented

    ..Indentation = 1

    ..IndentChar = ControlChars.Ta b

    ..WriteStartDoc ument()

    ..WriteStartEle ment("........

    Thanks
    B


  • Stephany Young

    #2
    Re: Data Access Advice


    "Ben" <Ben@Newsgroups .microsoft.comw rote in message
    news:ucYl1Yb4GH A.696@TK2MSFTNG P06.phx.gbl...
    Hi
    >
    I need to post xml data to a url, I have have created an xml file using an
    xml text writer as below but would rather a faster method that does not
    involve writing the file to disk but using it from memory instead. Could
    anyone suggest a method that is similar in coding (so as not to require
    too many code changes).
    >
    Dim writer As New System.Xml.XmlT extWriter("c:\t emp\TestXml.xml ",
    System.Text.Enc oding.UTF8)
    >
    .Formatting = Xml.Formatting. Indented
    >
    .Indentation = 1
    >
    .IndentChar = ControlChars.Ta b
    >
    .WriteStartDocu ment()
    >
    .WriteStartElem ent("........
    >
    Thanks
    B
    >

    Comment

    • Stephany Young

      #3
      Re: Data Access Advice

      Instead of backing your XmlTextWriter with a disk file, back it with some
      form of Stream object.

      I tend to use a StringWriter.

      """ONE""" way of using it could be:

      Dim _sw As New StringWriter

      Dim writer As New System.Xml.XmlT extWriter(_sw, System.Text.Enc oding.UTF8)

      ... Do your stuff here

      _sw.Close

      ... Post the result of _sw.ToString to the url.


      "Ben" <Ben@Newsgroups .microsoft.comw rote in message
      news:ucYl1Yb4GH A.696@TK2MSFTNG P06.phx.gbl...
      Hi
      >
      I need to post xml data to a url, I have have created an xml file using an
      xml text writer as below but would rather a faster method that does not
      involve writing the file to disk but using it from memory instead. Could
      anyone suggest a method that is similar in coding (so as not to require
      too many code changes).
      >
      Dim writer As New System.Xml.XmlT extWriter("c:\t emp\TestXml.xml ",
      System.Text.Enc oding.UTF8)
      >
      .Formatting = Xml.Formatting. Indented
      >
      .Indentation = 1
      >
      .IndentChar = ControlChars.Ta b
      >
      .WriteStartDocu ment()
      >
      .WriteStartElem ent("........
      >
      Thanks
      B
      >

      Comment

      Working...