I am reading some data stored in Xml format in SQL Server database and I am using C# to read this data. We have a type called XmlText in System.Xml but it doesn’t allow me to convert and store the data from SqlXml to XmlText. I need to copy the data from database in XML format to some object and then serialize that object. Then I need to send a collection of objects over the network. What is the solution here?
Share
Ultimately, there is no direct link between
SqlXmlandXmlText(and indeed,XmlTextonly represents a specific type of node, not xml). You are going to have to go down tostringorbyte[]level and back up again (since you aren’t using the streaming reader). For example:or:
or (perhaps more efficient) using the
XmlReaderAPI:and