Tuesday, March 27, 2012

Error: An invalid character was found in text content.

Hello All,
I am currently importing datarows into a sql 2000 database. when I use my
stored procedure which contains sp_xml_preparedocument... and FROM OPENXML,
I get the error stated above in the subject heading.
In reading other websites I have found that the error above:
An invalid character was found in text content.
You will get this error message if a character in the XML document does not
match the encoding attribute. Normally you will get this error message if
your XML document contains "foreign" characters, and the file was saved with
a single-byte encoding editor like Notepad, and no encoding attribute was
specified.
The actual error is:
Server: Msg 6603, Level 16, State 1, Procedure sp_xml_preparedocument, Line
15
XML parsing error: An Invalid character was found in text content.
Based on what I found on the other webisite, the only foreign character in
my data the è in ARKTX="XXX CRèME 1x20 KG".
Is there anyway to encode this character so I do not get a parsing error?
Thank you in advance
EricI found that I have to place an xml declaration
of
<?xml version="1.0" encoding="ISO-8859-1"?>
in my XML string so the sp_xml_prepared_Document stored procedure will treat
the data as UTF-8 and not the Database's code page.
"E-Cube" wrote:

> Hello All,
> I am currently importing datarows into a sql 2000 database. when I use my
> stored procedure which contains sp_xml_preparedocument... and FROM OPENXML
,
> I get the error stated above in the subject heading.
> In reading other websites I have found that the error above:
> An invalid character was found in text content.
> You will get this error message if a character in the XML document does no
t
> match the encoding attribute. Normally you will get this error message if
> your XML document contains "foreign" characters, and the file was saved wi
th
> a single-byte encoding editor like Notepad, and no encoding attribute was
> specified.
>
> The actual error is:
> Server: Msg 6603, Level 16, State 1, Procedure sp_xml_preparedocument, Lin
e 15
> XML parsing error: An Invalid character was found in text content.
> Based on what I found on the other webisite, the only foreign character in
> my data the è in ARKTX="XXX CRèME 1x20 KG".
> Is there anyway to encode this character so I do not get a parsing error?
>
> Thank you in advance
> Eric
>sql

No comments:

Post a Comment