1

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

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.