SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Allow special character in WELL_FORMED_XML Message


Allow special character in WELL_FORMED_XML Message

Author
Message
sql server developer
sql server developer
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4210 Visits: 472
Hi All,

I've created a Message Type with VALIDATION = WELL_FORMED_XML.

When I have special characters like ãpple in the XML string it is not sending the message. If I don't have special characters then it is working. How can i make it to work ever with special characters like ã, ñ etc?

Any help would be highly appreciated.

Thanks!
Nils Gustav Stråbø
Nils Gustav Stråbø
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10283 Visits: 3575
A shot in the dark: Try using ã instead of ã

Ref http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
sql server developer
sql server developer
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4210 Visits: 472
I'm not using just ã. I want to be able to use all special characters like these...When i run a query like CAST('ãpple' AS XML) works but why is Service Broker message type not treating that as well formed XML?
Mark Cowne
Mark Cowne
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24159 Visits: 27268
Does your XML have an encoding attribute such as

<?xml version="1.0" encoding="UTF-16"?>

____________________________________________________

Deja View - The strange feeling that somewhere, sometime you've optimised this query before

How to get the best help on a forum

http://www.sqlservercentral.com/articles/Best+Practices/61537




sql server developer
sql server developer
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4210 Visits: 472
Below is the XML string that i'm trying to send....I'm getting error because we have special character ã in <NewValue>ãpple</NewValue> tag. If I replace that with apple, it is working. My question is how can i send message even if we have such special characters

<Message>
<MsgHeader>
<MessageType>UPDATE </MessageType>
<HeaderBody>
<DatabaseName>DataBaseName</DatabaseName>
<PrimaryKey>XXXX </PrimaryKey>
<TableName>TableName</TableName>
</HeaderBody>
</MsgHeader>
<MessageBody>
<FieldCount>1 </FieldCount>
<FieldInfo>
<FieldName>Name</FieldName>
<OldValue>John</OldValue>
<NewValue>ãpple</NewValue>
</FieldInfo>
</MessageBody>
</Message>
R.P.Rozema
R.P.Rozema
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11075 Visits: 1774
To be able to store all characters you should use nvarchar() or nchar() (as opposed to varchar() or char()) everywhere where the values are stored. i.e. in all your tables, variables and constants.

A text constant is made into a n-type by prefixing it with a capital N. For example:
declare @txt nvarchar(100);
select @txt = N'test';





Posting Data Etiquette - Jeff Moden
Posting Performance Based Questions - Gail Shaw
Hidden RBAR - Jeff Moden
Cross Tabs and Pivots - Jeff Moden
Catch-all queries - Gail Shaw


If you don't have time to do it right, when will you have time to do it over?
sql server developer
sql server developer
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4210 Visits: 472
Thanks so much! It worked after changing the datatype to NVARCHAR.
R.P.Rozema
R.P.Rozema
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11075 Visits: 1774
Good to see that that helped you. But it was merely a guess for me.

You're only getting vague answers and you only have yourself to blame for that: you've not given enough information. For example:
- what's the code you're trying to execute?
- what's the text & number of the error you're getting?
The good people here can do a lot, but they're not mindreaders.

Provide us some details and you'll likely get much more useful answers.



Posting Data Etiquette - Jeff Moden
Posting Performance Based Questions - Gail Shaw
Hidden RBAR - Jeff Moden
Cross Tabs and Pivots - Jeff Moden
Catch-all queries - Gail Shaw


If you don't have time to do it right, when will you have time to do it over?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search