Allow special character in WELL_FORMED_XML Message

  • 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!

  • A shot in the dark: Try using ã instead of ã

    Ref http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

  • 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?

  • 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
  • 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>

  • 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[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


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

  • Thanks so much! It worked after changing the datatype to NVARCHAR.

  • 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[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


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

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply