Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Formating XML

Formating XML

Scheduled Pinned Locked Moved XML / XSL
databasecsharpxmlquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nickiii
    wrote on last edited by
    #1

    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!

    L 1 Reply Last reply
    0
    • N nickiii

      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!

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      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

      N 1 Reply Last reply
      0
      • L 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

        N Offline
        N Offline
        nickiii
        wrote on last edited by
        #3

        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.

        L 1 Reply Last reply
        0
        • N nickiii

          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.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          Ah, I should have figured that from the FOR XML, by bad. However it's probably the same problem with the results from the query containing invalid XML Text characters. You might find more detailed answers in places like this[^]

          led mike

          N 1 Reply Last reply
          0
          • L led mike

            Ah, I should have figured that from the FOR XML, by bad. However it's probably the same problem with the results from the query containing invalid XML Text characters. You might find more detailed answers in places like this[^]

            led mike

            N Offline
            N Offline
            nickiii
            wrote on last edited by
            #5

            I Googled this issue earlier and that site came up. Just thought I'd take the easy way out hoping someone has tried the exact same thing as myself. Thanks for responses led mike!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups