开发者

Parse XML string in VB.NET

开发者 https://www.devze.com 2022-12-21 07:57 出处:网络
I am trying to parse a particular attribute/value pair from XML in VB.NET. The XML is originally a string that looks like XML but it needs to be converted to an XML-like datatype or structure before

I am trying to parse a particular attribute/value pair from XML in VB.NET.

The XML is originally a string that looks like XML but it needs to be converted to an XML-like datatype or structure before I can parse it开发者_如何学编程.

How can I convert this string into XML, and then parse the info that I need?

EDIT:

Dim doc As XDocument = XDocument.Parse(str) gets the string into xml, however Call doc.attribute("name").Value doesn't work. I've confirmed that the name of the Sub that I'm trying to call is correct. What am I doing wrong?

I've tried converting the value of the XML back into a string. Is here a special datatype for Subs? Am I missing something else?

Edit2 The value of the XML attribute is the name of a function. I'd like to call different functions based on the value of the value, which will be changed by me via a flash activex control. I pretty much have total control over what values i'm dealing with here.

(Do I need a delegate function? )

Edit3:

I got it. 'CallByName()' with appropriate arguments.


Dim doc As XDocument = XDocument.Parse(str)


What function are you talking about calling? "Value"? That's not a function. It's a property.

Dim val As Object = doc.Attribute("name").Value
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号