Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6668417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:02:23+00:00 2026-05-26T03:02:23+00:00

I am posting to a website to get data back. The site returns it

  • 0

I am posting to a website to get data back. The site returns it as an xml. I am able to get the data into a string. But what i really want to do is to have each item in the xml in a different string field.

Sub lookup(ByVal Source As Object, ByVal e As EventArgs)
  Dim wData As String
  wData = WRequest("http://PostToThisSite.com", "POST","str=31&Password=pn&UserID=Q&Postcode="+txtPcode.Text)       
  Response.Write(wData)
End Sub

Function WRequest(URL As String, method As String, POSTdata As String) As String
    Dim responseData As String = ""
      Try
        Dim hwrequest As Net.HttpWebRequest = Net.Webrequest.Create(URL)
        hwrequest.Accept = "*/*"
        hwrequest.AllowAutoRedirect = true
        hwrequest.UserAgent = "http_requester/0.1"
        hwrequest.Timeout = 60000
        hwrequest.Method = method
        If hwrequest.Method = "POST" Then
          hwrequest.ContentType = "application/x-www-form-urlencoded"
          Dim encoding As New Text.ASCIIEncoding() 'Use UTF8Encoding for XML requests
          Dim postByteArray() As Byte = encoding.GetBytes(POSTdata)
          hwrequest.ContentLength = postByteArray.Length
          Dim postStream As IO.Stream = hwrequest.GetRequestStream()
          postStream.Write(postByteArray, 0, postByteArray.Length)
          postStream.Close()
        End If
        Dim hwresponse As Net.HttpWebResponse = hwrequest.GetResponse()
        If hwresponse.StatusCode = Net.HttpStatusCode.OK Then
          Dim responseStream As IO.StreamReader = _
            New IO.StreamReader(hwresponse.GetResponseStream())
          responseData = responseStream.ReadToEnd()
        End If
        hwresponse.Close()
        Catch e As Exception
          responseData = "An error occurred: " & e.Message
        End Try
      Return responseData
End Function

The above code works and writes out a line…

Some Road City LU1 5QG

The Xml being returned is ..

<Address xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://site.co.uk/">
  <strOrganisation /> 
  <strProperty /> 
  <strStreet>Some Road</strStreet> 
  <strLocality /> 
  <strTown>City</strTown> 
  <strCounty /> 
  <strPostcode>LU1 5QG</strPostcode> 
  <strDPS /> 

I want to be able to split these fields and set them to different text boxes on the page…help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:02:23+00:00Added an answer on May 26, 2026 at 3:02 am

    Load the xml string into an XmlDocument and extract the values with XPath:

    Dim doc = new XmlDocument()
    doc.LoadXml(yourXmlString)
    Dim nsm = new XmlNamespaceManager(doc.NameTable)
    nsm.AddNamespace("a", "http://site.co.uk/")
    txtStreet.Text = doc.SelectSingleNode("/a:Address/a:strStreet", nsm).InnerText
    

    Here’s a working snippet:

    Dim doc = New XmlDocument()
    doc.LoadXml("<Address xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://site.co.uk/""><strOrganisation /> <strProperty /> <strStreet>Some Road</strStreet> <strLocality /> <strTown>City</strTown> <strCounty /> <strPostcode>LU1 5QG</strPostcode><strDPS /></Address>")
    Dim nsm = New XmlNamespaceManager(doc.NameTable)
    nsm.AddNamespace("a", "http://site.co.uk/")
    Dim streetValue = doc.SelectSingleNode("/a:Address/a:strStreet", nsm).InnerText
    

    Some things to note:

    1. For XPath lookups, if your xml has a namespace you’ll need to add it to an
      XmlNameSpaceManager created from your XmlDocument’s NameTable.
    2. If you don’t want to
      bother with that, you can walk the node collections manually via
      doc.ChildNodes[0].ChildNodes[0] etc.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have logged into a website by posting data with curl. I now want
I have people posting their website address but variations are posted such as: theirsite.com
use this website a lot but first time posting. My program creates a number
fellow devs! I have a class for posting to website using a POST or
i am porting over a website from asp. i have one page that i
I am copying code from website matplotlib and pasting into the Vim editor in
Posting this one for a friend. They have an Icefaces app that uses Icefaces's
I'm posting some data to a PHP script via jQuery AJAX, and everything executes
I'm trying to upload a picture to a specific website using php cURL but
so I have been searching your website and im still very unclear on how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.