datasets & xmlhttp?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sfslug@hotmail.com

    #1

    datasets & xmlhttp?

    Hello. I'm using xmlhttp in a windows application to return xml data.
    The xml data is returned successfully, but I get errors when I try
    loading the xmlhttp response object to a dataset. I can write the xml
    to a file & read that in to a dataset, but what fun is that?
    ---------------
    code:
    xmlhttp = New MSXML2.XMLHTTP
    xmlhttp.open("P OST", strUrl, False)
    xmlhttp.setRequ estHeader("Cont ent-Type", "text/xml")
    xmlhttp.Send(". ..request ...")
    Dim ds1 As New DataSet
    ds.ReadXml(xmlh ttp.responsexml .xml, XmlReadMode.Fra gment)
    ---------------
    the last line above, and any variations I've tried(xmlreadmo de.auto,
    etc.), all result in varying errors. This variation gives: "Illegal
    characters in path."

    Any insight appreciated.

  • David Browne

    #2
    Re: datasets & xmlhttp?


    <sfslug@hotmail .com> wrote in message
    news:1128648840 .532272.47630@g 47g2000cwa.goog legroups.com...[color=blue]
    > Hello. I'm using xmlhttp in a windows application to return xml data.
    > The xml data is returned successfully, but I get errors when I try
    > loading the xmlhttp response object to a dataset. I can write the xml
    > to a file & read that in to a dataset, but what fun is that?
    > ---------------
    > code:
    > xmlhttp = New MSXML2.XMLHTTP
    > xmlhttp.open("P OST", strUrl, False)
    > xmlhttp.setRequ estHeader("Cont ent-Type", "text/xml")
    > xmlhttp.Send(". ..request ...")
    > Dim ds1 As New DataSet
    > ds.ReadXml(xmlh ttp.responsexml .xml, XmlReadMode.Fra gment)
    > ---------------
    > the last line above, and any variations I've tried(xmlreadmo de.auto,
    > etc.), all result in varying errors. This variation gives: "Illegal
    > characters in path."
    >
    > Any insight appreciated.
    >[/color]

    Why are you using (old) MSXML2.XMLHTTP instead of (new)
    System.Net.WebC lient?

    David


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: datasets &amp; xmlhttp?

      Hi,

      In addition to David.

      A dataset in XML is a file using XML. Not every XML file is a dataset.

      I hope this helps,

      Cor

      <sfslug@hotmail .com> schreef in bericht
      news:1128648840 .532272.47630@g 47g2000cwa.goog legroups.com...[color=blue]
      > Hello. I'm using xmlhttp in a windows application to return xml data.
      > The xml data is returned successfully, but I get errors when I try
      > loading the xmlhttp response object to a dataset. I can write the xml
      > to a file & read that in to a dataset, but what fun is that?
      > ---------------
      > code:
      > xmlhttp = New MSXML2.XMLHTTP
      > xmlhttp.open("P OST", strUrl, False)
      > xmlhttp.setRequ estHeader("Cont ent-Type", "text/xml")
      > xmlhttp.Send(". ..request ...")
      > Dim ds1 As New DataSet
      > ds.ReadXml(xmlh ttp.responsexml .xml, XmlReadMode.Fra gment)
      > ---------------
      > the last line above, and any variations I've tried(xmlreadmo de.auto,
      > etc.), all result in varying errors. This variation gives: "Illegal
      > characters in path."
      >
      > Any insight appreciated.
      >[/color]


      Comment

      • Slug

        #4
        Re: datasets &amp; xmlhttp?

        Hello. Thanks for the tips, but I'm not sure I'm any closer. I
        changed the code to use the system.net.webc lient, but the problem is
        still in trying to load the response object into a dataset. Cor, I'm
        not sure I fully understand your comment "not every xml file is a
        dataset". Shouldn't I be able to make a dataset out of any valid xml?
        David, I was using xmlhttp because I'm adapting this from an old asp
        page, and that's what it used.

        Here's the modified code I'm using.
        -----------------
        Dim objW3client As New System.Net.WebC lient
        objW3client.Hea ders.Set("Conte nt-Type", "text/xml")
        Dim bytArguments As Byte() =
        System.Text.Enc oding.ASCII.Get Bytes(strMacro)
        Try
        Dim bytRetData As Byte() = objW3client.Upl oadData(strURL,
        "POST", bytArguments)
        Dim objInxText As String = ""
        objInxText =
        System.Text.Enc oding.ASCII.Get String(bytRetDa ta)
        Dim ds As New DataSet
        ds.ReadXml(objI nxText)
        -----------------
        It's still failing in the same place, in the same way. Message "The
        path is too long after being fully qualified. Make sure path is less
        than 260 characters."

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: datasets &amp; xmlhttp?

          Slug,
          [color=blue]
          > Shouldn't I be able to make a dataset out of any valid xml?[/color]

          A normal dataset uses only elements. It has by instance no attributes.
          Although that it in a lot of cases a dataset with attributes can be used to
          read. (It converts than to a related XSD). However I did not really
          investigate the last part when it does and when not.

          I hope this gives an idea

          Cor


          Comment

          Working...