| Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types [message #412174] |
Thu, 16 August 2007 18:07  |
Eclipse User |
|
|
|
Hi
I've generated an EMF model from a set of XSD schemas, and everything is
fine, except for whitespace handling.
The schemas make use of xs:Name and xs:NMTOKEN types. These type have the
"whiteSpace" facet as "collapse".
However with the generated model code, I am not getting whitespace being
stripped when the data is read, so for
example, reading the XML fragment:
<something>
ABCD
</something>
(something is an element of type xs:Name)
results in a value being returned from the model as "<cr><sp><sp>ABCD<cr>",
not "ABCD".
Is there some setting or option that I can specify, either at generation or
runtime, that will make the model strip whitespace for these types?
Many thanks
David
|
|
|
| Re: Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types [message #412175 is a reply to message #412174] |
Thu, 16 August 2007 19:04   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------030801050801040303030608
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
David,
I suppose methods like this in XMLTypeFactoryImpl should do that
processing kind of white space processing:
public String createName(String literal)
{
return literal;
}
Open a bugzilla and I'll look more closely at this issue. Probably it's
best to address this only in 2.4, since a change in behavior could
potentially be disruptive...
In the mean time, you can use XMLTypeUtil.normalize to accomplish this
goal...
David Lear wrote:
> Hi
>
> I've generated an EMF model from a set of XSD schemas, and everything is
> fine, except for whitespace handling.
>
> The schemas make use of xs:Name and xs:NMTOKEN types. These type have the
> "whiteSpace" facet as "collapse".
> However with the generated model code, I am not getting whitespace being
> stripped when the data is read, so for
> example, reading the XML fragment:
>
> <something>
> ABCD
> </something>
>
> (something is an element of type xs:Name)
>
> results in a value being returned from the model as "<cr><sp><sp>ABCD<cr>",
> not "ABCD".
>
>
> Is there some setting or option that I can specify, either at generation or
> runtime, that will make the model strip whitespace for these types?
>
> Many thanks
>
> David
>
>
>
--------------030801050801040303030608
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
I suppose methods like this in XMLTypeFactoryImpl should do that
processing kind of white space processing:<br>
<blockquote><small> public String createName(String literal)</small><big><br>
</big><small> {</small><big><br>
</big><small> return literal;</small><big><br>
</big><small> }</small><big><br>
</big></blockquote>
Open a bugzilla and I'll look more closely at this issue. Probably
it's best to address this only in 2.4, since a change in behavior could
potentially be disruptive...<br>
<br>
In the mean time, you can use XMLTypeUtil.normalize to accomplish this
goal...<br>
<br>
<br>
David Lear wrote:
<blockquote cite="mid:fa2hqu$h03$1@build.eclipse.org" type="cite">
<pre wrap="">Hi
I've generated an EMF model from a set of XSD schemas, and everything is
fine, except for whitespace handling.
The schemas make use of xs:Name and xs:NMTOKEN types. These type have the
"whiteSpace" facet as "collapse".
However with the generated model code, I am not getting whitespace being
stripped when the data is read, so for
example, reading the XML fragment:
<something>
ABCD
</something>
(something is an element of type xs:Name)
results in a value being returned from the model as " <cr><sp><sp>ABCD&a mp;lt;cr> ",
not "ABCD".
Is there some setting or option that I can specify, either at generation or
runtime, that will make the model strip whitespace for these types?
Many thanks
David
</pre>
</blockquote>
<br>
</body>
</html>
--------------030801050801040303030608--
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08047 seconds