Read xml string into XmlReader

W

wapsiii

How do I read the xml string below (saved in varchar field in ms sql
db) into a XmlReader or a XmlTextReader?

<?xml version="1.0" encoding="utf-8"?>
<Class_bizContact xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Property_PersonId>22</Property_PersonId>
<Property_UserId>11</Property_UserId>
<Property_ContactTypeId>1</Property_ContactTypeId>
<Property_ContactStatusId>1</Property_ContactStatusId>
<Property_Subject>Test serialization</Property_Subject>
<Property_Description>hello hello hello</Property_Description>
</Class_bizContact>

Morten
 
M

Matt Dinovo

You didn't say which version of .NET you're using, so here's both:

1.1:

Dim rdr as new System.Xml.XmlTextReader(new
System.IO.StringReader(<xmlstring>))

2.0

Dim rdr as System.Xml.XmlReader = System.Xml.XmlReader.Create(new
System.IO.StringReader(<xmlstring>))

HTH,

Matt Dinovo
 
W

wapsiii

1.1 ahh. via the StringReader - thanks... :)


You didn't say which version of .NET you're using, so here's both:

1.1:

Dim rdr as new System.Xml.XmlTextReader(new
System.IO.StringReader(<xmlstring>))

2.0

Dim rdr as System.Xml.XmlReader = System.Xml.XmlReader.Create(new
System.IO.StringReader(<xmlstring>))

HTH,

Matt Dinovo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top