Home Forums Programming XML sp_xml_preparedocument does not recognize validated xml variable RE: sp_xml_preparedocument does not recognize validated xml variable

  • Hi, The reason why you are getting that message is because sp_xml_preparedocument does not support a typed xml document. Essentially a typed xml document is one that is bound by a schema.

    You have a few options from here. One is that could remove the schema declaration against the variable @XMLDATA.. Another is to have a second XML variable that which isn't bound to the xml schema but contains the same xml document and you pass that into sp_xml_preparedocument.

    But the approach that I would take is to use the xml method nodes() and value() method to shred the xml. You can keep the schema bound to the xml variable and easily shred the data accordingly.

    http://msdn.microsoft.com/en-GB/library/ms188282(v=sql.100).aspx