Formating XML
-
Hi everyone: I'm having trouble exporting the follow query to XML in a valid format. For some reason it wraps in the middle of a few elements causing .NET to say the end tag is missing. I'm using SQL '05 and when I show the query results in text the same exact thing happens. Is it possible for to "Export to File" from within Management Studio and specify the format?
SELECT DISTINCT origin_location AS location FROM famis_locations WHERE origin_location <> '' ORDER BY origin_location FOR XML AUTO, ELEMENTS
Thanks! -
Hi everyone: I'm having trouble exporting the follow query to XML in a valid format. For some reason it wraps in the middle of a few elements causing .NET to say the end tag is missing. I'm using SQL '05 and when I show the query results in text the same exact thing happens. Is it possible for to "Export to File" from within Management Studio and specify the format?
SELECT DISTINCT origin_location AS location FROM famis_locations WHERE origin_location <> '' ORDER BY origin_location FOR XML AUTO, ELEMENTS
Thanks!nickiii wrote:
I'm having trouble exporting the follow query to XML
I'm assuming you mean inserting the SQL String as text into an XML TextNode yes?
nickiii wrote:
For some reason .... causing .NET to say the end tag is missing.
you can't store text in XML that contains the lessthan and/or greaterthan ('<', '>') characters since they are XML syntax characters. There are various methods to account for this like using entities or encoding the string and then decoding it when you read it back into memory.
led mike
-
nickiii wrote:
I'm having trouble exporting the follow query to XML
I'm assuming you mean inserting the SQL String as text into an XML TextNode yes?
nickiii wrote:
For some reason .... causing .NET to say the end tag is missing.
you can't store text in XML that contains the lessthan and/or greaterthan ('<', '>') characters since they are XML syntax characters. There are various methods to account for this like using entities or encoding the string and then decoding it when you read it back into memory.
led mike
led mike wrote:
I'm assuming you mean inserting the SQL String as text into an XML TextNode yes?
No. The posted query is what I use to get the locations from SQL. I want to export the location list to XML and read the XML with .NET. The query is actually being ran in Query Analyzer.
-
led mike wrote:
I'm assuming you mean inserting the SQL String as text into an XML TextNode yes?
No. The posted query is what I use to get the locations from SQL. I want to export the location list to XML and read the XML with .NET. The query is actually being ran in Query Analyzer.
-