I keep running into xml format issues in various editors ... please advise
-
I have a SQL Server project that I'm currently adding code to using SSMSE2k8 and beside the fact that this is all TSQL, there's this creep that's occuring in the facility. Namely the .xml. Now, here's the more technical side of TSQL as related to XML, using a FOR XML PATH juncture. I can do a basic SELECT query and get output of xml (pseudo output really because ... this is the creep; in ssmse that's as far as development WENT) but I'm constrained by all these substitutions in he editor: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> Control characters! What's the purpose of eliminating right & left arrows ... anyway? And how might I preserve them and keep the phantom formatter from invading my ... "style" (if you could call it that)? [Edit] And wouldn't you know it? This phantom has got me here in a paste! That tagged string up there in the midst of my paragraph is suposed to be:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document>
[End edit]
-
I have a SQL Server project that I'm currently adding code to using SSMSE2k8 and beside the fact that this is all TSQL, there's this creep that's occuring in the facility. Namely the .xml. Now, here's the more technical side of TSQL as related to XML, using a FOR XML PATH juncture. I can do a basic SELECT query and get output of xml (pseudo output really because ... this is the creep; in ssmse that's as far as development WENT) but I'm constrained by all these substitutions in he editor: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> Control characters! What's the purpose of eliminating right & left arrows ... anyway? And how might I preserve them and keep the phantom formatter from invading my ... "style" (if you could call it that)? [Edit] And wouldn't you know it? This phantom has got me here in a paste! That tagged string up there in the midst of my paragraph is suposed to be:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document>
[End edit]
Wow, Could have knocked me over with a feather ... the reason that my editor (was) going south was because of the type I had used to reassign parsed lines of singleline .xml while striking it up as data in a table!. [nvarchar](MAX) throws (bad use of an alliteration) the phantom formatter into overdrive, while [xml] is silently overlooked. Thus arrows are preserved.
-
I have a SQL Server project that I'm currently adding code to using SSMSE2k8 and beside the fact that this is all TSQL, there's this creep that's occuring in the facility. Namely the .xml. Now, here's the more technical side of TSQL as related to XML, using a FOR XML PATH juncture. I can do a basic SELECT query and get output of xml (pseudo output really because ... this is the creep; in ssmse that's as far as development WENT) but I'm constrained by all these substitutions in he editor: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> Control characters! What's the purpose of eliminating right & left arrows ... anyway? And how might I preserve them and keep the phantom formatter from invading my ... "style" (if you could call it that)? [Edit] And wouldn't you know it? This phantom has got me here in a paste! That tagged string up there in the midst of my paragraph is suposed to be:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document>
[End edit]
To avoid XML Escape Characters (" ",' '< <> >& &) Use this: FOR XML PATH(''), TYPE).value('.', 'VARCHAR(MAX)')
-
I have a SQL Server project that I'm currently adding code to using SSMSE2k8 and beside the fact that this is all TSQL, there's this creep that's occuring in the facility. Namely the .xml. Now, here's the more technical side of TSQL as related to XML, using a FOR XML PATH juncture. I can do a basic SELECT query and get output of xml (pseudo output really because ... this is the creep; in ssmse that's as far as development WENT) but I'm constrained by all these substitutions in he editor: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> Control characters! What's the purpose of eliminating right & left arrows ... anyway? And how might I preserve them and keep the phantom formatter from invading my ... "style" (if you could call it that)? [Edit] And wouldn't you know it? This phantom has got me here in a paste! That tagged string up there in the midst of my paragraph is suposed to be:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document>
[End edit]
Have you got the result...
-
Have you got the result...
My bad, The original code that I used as the query:
SELECT [xmliform] AS 'data()' FROM [database].[xml].[tblXMLAsTypeNvarchar] FOR XML PATH('')
So, as you can see, an editor will try to format anything from a table where the type is [nvarchar] using it's xml parser when I specify "FOR XML PATH" regardless of how bad I "want" it as xml. And that is with substituted control characters.