question

Eric6450 avatar image
Eric6450 asked

T-SQL xmls namespace issue

I have created the following script: with XMLNAMESPACES ( 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03' as Document, ' http://www.w3.org/2001/XMLSchema-instance' as xsi) SELECT 'en' as "English/en", 'food' as "English/food", 'ger' as "German/@xml:lang", 'Essen' as "German" FOR XML PATH ('Document') go It will result like this: en food Essen But I need to start this: Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" I have been puzzling on this for a while. does anyone have a suggestion? Thanks.... Regards, Eric
sqlxml
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·
could you expand upon "But I need to start this:"
0 Likes 0 ·
Eric6450 avatar image Eric6450 commented ·
Like this: Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" (off course including < and >)
0 Likes 0 ·
ThomasRushton avatar image ThomasRushton ♦♦ commented ·
So you mean that you need to fix the order of the first two `xmlns` items?
0 Likes 0 ·
Eric6450 avatar image Eric6450 commented ·
Yes and it should start only with *xmlns=..* and not with *xmlns:Document*
0 Likes 0 ·
Mister Magoo avatar image
Mister Magoo answered
I have no clue why you would care about the order, but.... with XMLNAMESPACES ( ' http://www.w3.org/2001/XMLSchema-instance' as xsi,DEFAULT 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03') SELECT 'en' as "English/en", 'food' as "English/food", 'ger' as "German/@xml:lang", 'Essen' as "German" FOR XML PATH ('Document')
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Eric6450 avatar image
Eric6450 answered
Thanks. That really works great Mister Magoo....
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mister Magoo avatar image Mister Magoo commented ·
You are most welcome - thanks for the update :o)
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.