Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » escaping chars in XSD
escaping chars in XSD [message #77722] Thu, 28 May 2009 11:36 Go to next message
Eclipse UserFriend
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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26237
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
>
>
Re: escaping chars in XSD [message #604206 is a reply to message #77722] Thu, 28 May 2009 13:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26237
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
>
>
Previous Topic:escaping chars in XSD
Next Topic:Is xsd validator cannot validate an xpath with character [ or ] ?
Goto Forum:
  


Current Time: Fri Nov 28 08:53:30 GMT 2014

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

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