Skip to main content



      Home
Home » Modeling » EMF » Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types
Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types [message #412174] Thu, 16 August 2007 18:07 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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>&nbsp; public String createName(String literal)</small><big><br>
</big><small>&nbsp; {</small><big><br>
</big><small>&nbsp;&nbsp;&nbsp; return literal;</small><big><br>
</big><small>&nbsp; }</small><big><br>
</big></blockquote>
Open a bugzilla and I'll look more closely at this issue.&nbsp; 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:

&lt;something&gt;
ABCD
&lt;/something&gt;

(something is an element of type xs:Name)

results in a value being returned from the model as " &lt;cr&gt;&lt;sp&gt;&lt;sp&gt;ABCD&a mp;lt;cr&gt; ",
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--
Re: Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types [message #412186 is a reply to message #412174] Fri, 17 August 2007 05:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: minhyuk.kut.ac.kr

Hi!

EMF has option for this situation.
find out XML Save Options.
Re: Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types [message #412196 is a reply to message #412186] Fri, 17 August 2007 07:40 Go to previous messageGo to next message
Eclipse UserFriend
His question was about loading...


minhyuk wrote:
> Hi!
>
> EMF has option for this situation.
> find out XML Save Options.
>
Re: Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types [message #412228 is a reply to message #412175] Fri, 17 August 2007 11:46 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Ed

I've submitted a bug report (with an example project):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=200382

David
Re: Whitespace is not collapsed for objects generated from xs:Name and xs:NMTOKEN types [message #412230 is a reply to message #412228] Fri, 17 August 2007 11:50 Go to previous message
Eclipse UserFriend
David,

Okay. I've moved it to the correct product and component.


David Lear wrote:
> Thanks Ed
>
> I've submitted a bug report (with an example project):
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=200382
>
> David
>
>
>
Previous Topic:Super class references get lost when saving ecore models
Next Topic:Bad enums generated?
Goto Forum:
  


Current Time: Wed Nov 05 10:51:42 EST 2025

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

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

Back to the top