Solved

Parse a URL key value

Posted on 2014-10-28
4
192 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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