Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 FOR XML EXPLICT in xml document

Author  Topic 

jagdishkab
Starting Member

1 Post

Posted - 2003-12-01 : 16:15:24
Hi,

I am running a FOR XML EXPLICIT QUERY which is quite big. I am getting the required xml format in the query analyser.

But when i try to copy that into xml spy , it is not well formed .

How do i get a well formed xml from the query.

thanks

Jag

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-12-01 : 18:07:53
You may have reserved characters (ie. <,>,etc...) in your elements/attributes which are preventing you from viewing it in XML Spy.

One option might be MS XML Notepad, which will open it but show you where the invalid formed XML is.

http://www.webattack.com/get/xmlnotepad.shtml
Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2003-12-01 : 18:09:53
FOR XML returns a XML Fragment and not a XML Document. I hope you know the difference.
You will need to add a "root" element.

DavidM

"SQL-3 is an abomination.."
Go to Top of Page

Granick
Starting Member

46 Posts

Posted - 2003-12-01 : 18:26:07
I also had an issue arise a little while ago, when my returned values included characters of alternate character sets, since the fields being returned were nvarchar. In notepad it just looked like a comma(,), but it was actually a foreign language letter in the database. Took me a while to figure out that was the problem. Before I had to actually fix it however, the record was removed from the resultset, so the problem went away.

Just something else to be careful of.

Shannon
Go to Top of Page
   

- Advertisement -