?
Solved

Parse a URL key value

Posted on 2014-10-28
4
Medium Priority
?
202 Views
Last Modified: 2014-10-28
I need to parse this:

"<key><cv><c>ID</c><v>245</v></cv></key>"

I used QueryString("parm_name") to obtain this value.  I need the 245.  Now , I could just use Split or some other general parse mechanism, but is that a specific URL parse mechanism to do this?
0
Comment
Question by:HLRosenberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
Ron Malmstead earned 2000 total points
ID: 40408957
If I understand correctly.. you're already using the normal way to parse a key/val URL, ..using "QueryString", ..and this string is the entire value..so yes, you will have to parse it yourself.

Try this..

Dim val as string = cstr("<key><cv><c>ID</c><v>245</v></cv></key>").ToString.Replace("<v>", "~").Replace("</v>", "~").Split("~").GetValue(1).ToString
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 40409006
ok.  thanks.  I thought maybe I was doing something wrong,  I'm using a thirds party product that generates the WEB pages, so I suppose they are using this format on the URL parms.
0
 
LVL 5

Expert Comment

by:ReneD100
ID: 40409084
Or you can parse the XML using system.xml - you can also easily access the rest of the string:
Imports System.XML
Public Sub test()
        Dim strData As String = "<key><cv><c>ID</c><v>245</v></cv></key>"
        Dim xmlDoc As New XmlDocument
        xmlDoc.LoadXml(strData)
        Dim xmlNode As XmlNodeList = xmlDoc.GetElementsByTagName("v")
        MessageBox.Show(xmlNode(0).InnerXml)
End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 40409125
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question