I have function in my asp.net/vb application with following signature:
Public Function ExtractText(node As XmlNode) As String
I want to call it/pass xmlnode. How to create an Xml node with value:
<mynode Id="7743" Type="context" StartNode="4356" EndNode="1234"></mynode>
Please suggest
Here's one way of doing this:
Dim xmlDoc as new XmlDocument()
Dim xmlElem = xmlDoc.CreateElement("mynode")
xmlElem.SetAttribute("Id","7743")
This returns:
<mynode Id="7743" />
Since the type XmlElement
inherits from XmlNode
you can simply pass this to your function:
ExtractText(xmlElem)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.