You are here: Re: XML issue. « MsSQL Server « IT news, forums, messages
Re: XML issue.

Posted by Erland Sommarskog on 05/31/06 21:47

rhaazy (rhaazy@gmail.com) writes:
> using ms sql 2000
>
> EXEC sp_xml_preparedocument @iTree OUTPUT, @doc
>
> I get an error unless I remove the encoding attribute(<?xml
> version="1.0" encoding="utf-8" ?>) from my XML document prior to
> running my stored procedure. So I need a way to strip this out via my
> C# code that prepares the output.

I'm not really sure what the question is. If you want C# assistence, this
is not the best place.

Then again, OPENXML is perfectly able to handle UTF-8, but you must of
course pass the XML string as UTF-8. Specifically, you need to pass it
as a varchar value.

Try this example (which is posted in Latin-1, and should be handled as
Latin-1):

DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc = '<?xml version="1.0" encoding="utf-8" ?>
<ROOT>
<Customers CustomerID="VINET" ContactName=""Räksmörgåis">
</Customers>
</ROOT>'
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- SELECT statement that uses the OPENXML rowset provider.
SELECT *
FROM OPENXML (@idoc, '/ROOT/Customers')
EXEC sp_xml_removedocument @idoc


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация