Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Save special chars ?
Save special chars ? [message #420950] Thu, 17 July 2008 07:19 Go to next message
Petr Kalafatic is currently offline Petr KalafaticFriend
Messages: 10
Registered: July 2009
Junior Member
Hi,
I have problem to save model which contains special characters generated
by hash function.
//----
±£Ša\nµÄ�‡„•ðŽ
//----
case 0x1F:
{
if (allowControlCharacters)
{
outputPos = replaceChars(outputPos, CONTROL_CHARACTERS[ch],
inputLength);
changed = true;
}
else
{
throw new RuntimeException("An invalid XML character
(Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element
content:" + input);
}
break;
}
//----


Could you help please ?
Re: Save special chars ? [message #420956 is a reply to message #420950] Thu, 17 July 2008 11:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040204070809090107060000
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Petr,

Only XML 1.1 allows control characters, and even then, the null
character is no allowed. You could control that either of these two ways:

/**
* Specify the XML version to be used during save.
*/
String OPTION_XML_VERSION = "XML_VERSION";

/**
* Set the XML version for this resource
*/
void setXMLVersion(String version);


But you might be better off to define a special EDataType for the value
and do encoding and decoding yourself. The EDataType could just be a
wrapper for java.lang.String and you'd override
createMyDataTypeFromString and convertMyDataTypeToString in the
XyzFactoryImpl to encode and decode the special characters. You might
use URI.encodeFragment/decode for this purpose.


Petr Kalafatic wrote:
> Hi,
> I have problem to save model which contains special characters
> generated by hash function. //----
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Deleting objects with non containment references
Next Topic:Problems during serialization with cross-references
Goto Forum:
  


Current Time: Sat Apr 27 21:23:30 GMT 2024

Powered by FUDForum. Page generated in 0.04385 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top