escaping chars in XSD [message #77722] |
Thu, 28 May 2009 11:36 |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
hi XSD
Do you have any built-in chars escaping that could change '\r' to
' ' in my XSD documents? I'm doing some operations on XSD model and
it's underlying DOM, and suddenly get \r chars escaped.
Because it's not only EMF-XSD involved, I'm a bit puzzled and trying to
figure out who is doing this "favour" to me :-)
thanks a lot for your help
--
Rational Elite Support for Eclipse
|
|
|
Re: escaping chars in XSD [message #77741 is a reply to message #77722] |
Thu, 28 May 2009 13:42 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Jacek,
Jacek Pospychala wrote:
> hi XSD
>
> Do you have any built-in chars escaping that could change '\r' to
> ' ' in my XSD documents? I'm doing some operations on XSD model
> and it's underlying DOM, and suddenly get \r chars escaped.
No, all the work is done by the doSerialize methods in XSDResourceImpl:
try
{
Transformer transformer = new
DefaultJAXPConfiguration().createTransformer(encoding);
// Be sure to use actual encoding of the transformer which might
be non-null even if encoding started as null.
encoding = transformer.getOutputProperty(OutputKeys.ENCODING);
Writer writer = encoding == null ? new
OutputStreamWriter(outputStream) : new OutputStreamWriter(outputStream,
encoding);
transformer.transform(new DOMSource(element), new
StreamResult(writer));
}
catch (TransformerException exception)
{
XSDPlugin.INSTANCE.log(exception);
}
>
> Because it's not only EMF-XSD involved, I'm a bit puzzled and trying
> to figure out who is doing this "favour" to me :-)
I'd have to assume it's the underlying JAXP implementation. Keep in
mind that when reading documents, JAXP normalizes the platform specific
linefeed convention to \n regardless of the platform, so when
serializing, it expects to see \n while \r will be considered a special
character that needs escaping. So probably your application should be
using \n exclusively to avoid any \r in the output...
>
> thanks a lot for your help
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: escaping chars in XSD [message #604206 is a reply to message #77722] |
Thu, 28 May 2009 13:42 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Jacek,
Jacek Pospychala wrote:
> hi XSD
>
> Do you have any built-in chars escaping that could change '\r' to
> ' ' in my XSD documents? I'm doing some operations on XSD model
> and it's underlying DOM, and suddenly get \r chars escaped.
No, all the work is done by the doSerialize methods in XSDResourceImpl:
try
{
Transformer transformer = new
DefaultJAXPConfiguration().createTransformer(encoding);
// Be sure to use actual encoding of the transformer which might
be non-null even if encoding started as null.
encoding = transformer.getOutputProperty(OutputKeys.ENCODING);
Writer writer = encoding == null ? new
OutputStreamWriter(outputStream) : new OutputStreamWriter(outputStream,
encoding);
transformer.transform(new DOMSource(element), new
StreamResult(writer));
}
catch (TransformerException exception)
{
XSDPlugin.INSTANCE.log(exception);
}
>
> Because it's not only EMF-XSD involved, I'm a bit puzzled and trying
> to figure out who is doing this "favour" to me :-)
I'd have to assume it's the underlying JAXP implementation. Keep in
mind that when reading documents, JAXP normalizes the platform specific
linefeed convention to \n regardless of the platform, so when
serializing, it expects to see \n while \r will be considered a special
character that needs escaping. So probably your application should be
using \n exclusively to avoid any \r in the output...
>
> thanks a lot for your help
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03948 seconds