title: Quick way SqlXml to XmlDocument in C# for a SQLCLR function?
body: <p>Which is better way to load <code>SqlXml</code> into <code>XmlDocument</code> (if any) without intermediate <code>string</code>?</p>
  
  <p>I need to validate <code>xml</code> using <code>xsd</code> from database inside <code>CLR UDF</code>. I try to optimize my code.</p>
  
  <p>My code is:</p>
  
  <pre><code>        schema1 = XmlSchema.Read(new StringReader(cXmlSchemaText), ValidateSchema);
  
          asset1.Schemas.Add(schema1);
          asset1.LoadXml(ValueString.ToString());
          asset1.Validate(ValidateXmlValue);
  </code></pre>
  
  <p>where <code>ValueString</code> is my <code>SqlXml</code>.</p>