Hiehefribra
New Member
With the following\[code\]DECLARE @t TABLE (Test nvarchar(50), Location_ID uniqueidentifier);INSERT INTO @t (Test,Location_ID ) SELECT Test,Location_ID fromdbo.TEST;DECLARE @xml XML;WITH XMLNAMESPACES ('typens:GPCodedValueDomain2' as type,'http://www.esri.com/schemas/ArcGIS/10.0' as typens, 'http://www.w3.org/TR/html4/' AS xs, 'http://www.w3.org/2001/XMLSchema-instance' AS xsi )SELECT @xml = ( SELECT 'typens:CodedValue' AS "@xsi:type", TEST AS "Name", Location_ID AS "Code" FROM @t order by Location_ID FOR XML PATH ('CodedValue'), ROOT ('GPCodedValueDomain2'),TYPE )SELECT @xml\[/code\]it outputs \[code\]<GPCodedValueDomain2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/TR/html4/" xmlns:typens="http://www.esri.com/schemas/ArcGIS/10.0" xmlns:type="typens:GPCodedValueDomain2"> <CodedValue xsi:type="typens:CodedValue"> <Name>test update</Name> <Code>B59D3BEB-CBCE-E111-B5B0-002564D275D1</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>test update</Name> <Code>B69D3BEB-CBCE-E111-B5B0-002564D275D1</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>test update</Name> <Code>B79D3BEB-CBCE-E111-B5B0-002564D275D1</Code> </CodedValue></GPCodedValueDomain2>\[/code\]I've been trying different iterations of namespace definition for hours, all fail. I'm looking for the output to be:\[code\]<GPCodedValueDomain2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/TR/html4/" xmlns:typens="http://www.esri.com/schemas/ArcGIS/10.0" xmlns:type="typens:GPCodedValueDomain2"> <CodedValue xsi:type="typens:CodedValue"> <Name>test update</Name> <Code xsi:type="xs:string">B59D3BEB-CBCE-E111-B5B0-002564D275D1</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>test update</Name> <Code xsi:type="xs:string">B69D3BEB-CBCE-E111-B5B0-002564D275D1</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>test update</Name> <Code xsi:type="xs:string">B79D3BEB-CBCE-E111-B5B0-002564D275D1</Code> </CodedValue></GPCodedValueDomain2>\[/code\]Any thoughts on how to implement this? Thanks