|
Re: XML Parsing fails due to special character [message #1781323 is a reply to message #1781051] |
Tue, 06 February 2018 04:52 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
You've not mentioned what's special about the character, so I can only guess. Of course you should specifying an character encoding that can encode all your characters, i.e., org.eclipse.emf.ecore.xmi.XMLResource.setEncoding(String) with the value "UTF-8" in your resource factory. You should use OPTION_SKIP_ESCAPE only if there are known to be no characters that need escaping. You should use OPTION_SKIP_ESCAPE_URI mapped to FALSE if your URIs for cross references contain characters that need escaping; but best you avoid that by not using resources with things like <, >, or & in the URI. And finally, there are the control characters, <= 0x1F. XML 1.0 cannot serialize many of these, but XML 1.1 can, so you could use org.eclipse.emf.ecore.xmi.XMLResource.setXMLVersion(String) with the value 1.1 to serialize these. But no version of XML can serialize the null character 0x0. If you need that , you'll have to define your own EDataType (that wraps java.util.String), and does encoding and decoding.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02706 seconds