but when I try to translate a string with a char greater than hex 7f I got an empty string so XMLCh * xmlStr = X( "1234 \x28 & \x29 " ) give a string "1234 ( & )" while if I add the char \x80 I got an empty styring. what can I do to manage also the char with code between 127 and 255 ?
-----Messaggio originale----- Da: Jesse Pelton [mailto:[EMAIL PROTECTED] Inviato: lunedì 19 settembre 2005 15.25 A: [email protected]; [EMAIL PROTECTED] Oggetto: RE: R: R: R: using non standard character with zerces Sure, you can store 0xA5 in a DOM string, but you have to represent it properly in the string that you store. This means you have to store the character value 0xA5 in the string; you cannot represent it in the string as a numeric entity like "¥": XMLCh* pszA5Good = X("\xA5"); // Yen XMLCh* pszA5Bad = X("¥"); // goobledygook Both strings are perfectly legitimate, but if you put the latter into the DOM, the serializer MUST escape the ampersand so that the string you are adding to the DOM can be faithfully recovered. In other words, if you say the string is "¥", the serializer must escape it so that when it's parsed, the string's value remains "¥", because that's the string you specified. If you put the former into the DOM, the serializer will likewise do what it must to ensure that the specified string comes back when Xerces or some other conforming XML processor parses the document. Depending on the document encoding, it may or may not be serialized as "¥." Any conforming processor that recognizes the document encoding will parse the serialized value correctly. The bottom line is, don't pre-escape anything that you put into the DOM. If you do, the serializer must escape it again, and you won't get your desired results. Rather than: stmp = " start ' < > & ( ¤ ¥ ) end"; dtxt = pDoc->createTextNode( X( stmp.c_str())); Do: dtxt = pDoc->createTextNode( X(" start ' < > & \x28 \xA4; \xA5; \x29 end)"); Or equivalently: dtxt = pDoc->createTextNode( X(" start ' < > & ( \xA4; \xA5; ) end)"); Note that none of this is specific to Xerces. Any XML processor that conforms to the specifications (available at www.w3.org) must behave this way.
<<attachment: winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
