Monday 15 April 2013

c# - Do XmlReaders return XML Declarations? -


I am trying to create a SQLLL scalar function which parses a nvarchar (max) string and returns XML . Data is always being returned as a snippet without an entire document instead of XML declaration -

  XmlDocument doc = New XmlDocument (); XmlDeclaration xDec = doc.CreateXmlDeclaration ("1.0", "UTF-8", blank); Doc.AppendChild (xDec); XMLAlmentRotnode = Doctor Crate Element ("root node"); Doc.AppendChild (rootnode); ... snippet ... XmlReader xread = new XmlNodeReader (doc); XmlReaderSettings xsetRead = New XmlReaderSettings (); XsetRead.ConformanceLevel = System.Xml.ConformanceLevel.Document; Return new SqlXml (XmlReader.Create (xread, xsetRead));  

I can not determine whether I am misusing XmlReader or if it is the result of the SQLCLR environment. The only thing that I can find back in the SQL query is the root node and it's children.

XML declaration PI, for example, & lt; ? Xml version = '1.0'? & Gt; , the XML declaration ( & lt;? Xml ...? & Gt; ) and its properties (Version / encoding / stand-alone) data is lost after being converted into xml XML declaration is considered as the instructions of XML Parser. XML data is stored internally as a UK-2 XML all other PIs in the example are preserved.

Data is stored in internal representation that preserves XML content of data. This internal representation contains information about prevention hierarchy, document order and element and attribute values. In particular, the InfoSet content of XML data is preserved. For more information about InfoSet, visit InfoSet content can not be a similar copy of the text XML, because the following information is not kept: trivial white space, feature order, namespace prefixes, and XML declaration.


No comments:

Post a Comment