create xmlReader from string

In vb.net, how can we load a string [well formated xml] to XMLReader?

XMLReader.create only accepts a xml file saved in file system?
LVL 6
sansofturaAsked:
Who is Participating?
 
sjturner2Connect With a Mentor Commented:
You need to create a StringReader arounf the string and pass that to the XmlReader.Create method.
Dim xmlData As String = "<item productID='124390'>" & _ 
                                     "<price>5.95</price>" & _ 
                                     "</item>"
 
' Create the XmlReader object.
Dim reader As XmlReader = XmlReader.Create(New StringReader(xmlData))

Open in new window

0
 
sansofturaAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.