sql server - How to eliminate superfluous namespace declarations in SQL generated XML? -


I am tuning a web application that supports SOAP services through SQL stored procedure calls. Generally stored procs generate XML which becomes part of the SOAP response, and there are many unnecessary xmlns name placement announcements in that XML. In case of disease, it can be 30% or more characters encoded in byte encoded XML, e.g.:

  & amp; Lt; GetFooResponse xmlns = "http: //service.url/" & gt; & Lt; GetFooResult & gt; & Lt; FooItems xmlns = "http://www.thisisalongishurl.com/schema12345/version12345" & gt; & Lt; Item xmlns = "http://www.thisisalongishurl.com/schema12345/version12345" data = "afu" /> & Lt; Item xmlns = "http://www.thisisalongishurl.com/schema12345/version12345" data = "afu" /> & Lt; Item xmlns = "http://www.thisisalongishurl.com/schema12345/version12345" data = "afu" /> & Lt; Item xmlns = "http://www.thisisalongishurl.com/schema12345/version12345" data = "afu" /> & Lt; Item xmlns = "http://www.thisisalongishurl.com/schema12345/version12345" data = "afu" /> & Lt; / FooItems & gt; & Lt; / GetFooResult & gt; & Lt; / GetFooResponse & gt;  

The SQL I am using to create XML generally follows this pattern:

  with XMLNAME (DEFAULT 'http : //www.thisisalongishurl.com/ Schema 12345 / Version 12345 ') [Name], [Price] From [Foo] XML Path (' Item '), Type, Root (' Fu Itims');  

Is there any way to avoid the generation announcing Xploren XMLName on each item XML element?

Thank you.

XMLNAMESPACES with ('http://www.thisisalongishurl.com/schema12345/version12345 Select AS (Select 'Testonum', 'Test Value'), from 'F.A.AM. ([short: name], [short: value]' AS short, default 'http: // service URL /'), [FU] XML path ('item'), type, root ('FooItems')

returns

  & lt; FooItems xmlns = "http: //service.url/" xmlns: short = "http: /www.thisisalongishurl.com/schema12345/version12345"> & Lt; Item & gt; & Lt; Less: Name & gt; TestName & lt; / Less: Name & gt; & Lt; Low: Value & gt; TestValue & lt; / Low: Value & gt; & Lt; / Item & gt; & Lt; / FooItems & gt;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -