Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Creating EMF model from XML schema - special characters - com.montages.xml.zip (0/1)
Creating EMF model from XML schema - special characters - com.montages.xml.zip (0/1) [message #422900] Thu, 18 September 2008 11:53 Go to next message
Marc Moser is currently offline Marc MoserFriend
Messages: 66
Registered: July 2009
Member
Hi,

I have a problem with some characters when creating an EMF model from
an XML schema. The relevant parts of the XML schema looks like this:

<?xml version="1.0" encoding="UTF-8"?>
....
<xsd:complexType name="Questionnaire">
...
<xsd:attribute ecore:transient="true"
ecore:derived="true" ecore:volatile="true" ecore:changeable="false"
name="maxPoints" type="xsd:int">
<xsd:annotation>
<xsd:appinfo ecore:key="derive"
source="http://www.xocl.org/OCL">self.questions->collect(q: Query |
q.maxPoints)->sum()</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
....
</xsd:schema>

In particular, the OCL expression

self.questions->collect(q: Query | q.maxPoints)->sum()

gets transformed into

self.questions-&gt;collect(q: Query | q.maxPoints)-&gt;sum()

Now I understand that > is a special character in XML schema and that
it is correctly escaped using &gt; but I don't know what I have to do
in order to end up with > in the ecore. I tried escaping the > with
&gt; in my XML schema, but then I still end up with &gt; in the ecore.
Anyone has an idea?

Attached is simple project with the complete XML schema in it.

Best,
Marc
Re: Creating EMF model from XML schema - special characters - com.montages.xml.zip (0/1) [message #422924 is a reply to message #422900] Thu, 18 September 2008 19:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30896
Registered: July 2009
Senior Member
Marc,

Comments below.

Marc Moser wrote:
> Hi,
>
> I have a problem with some characters when creating an EMF model from
> an XML schema. The relevant parts of the XML schema looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> ...
> <xsd:complexType name="Questionnaire">
> ...
> <xsd:attribute ecore:transient="true"
> ecore:derived="true" ecore:volatile="true" ecore:changeable="false"
> name="maxPoints" type="xsd:int">
> <xsd:annotation>
> <xsd:appinfo ecore:key="derive"
> source="http://www.xocl.org/OCL">self.questions->collect(q: Query |
> q.maxPoints)->sum()</xsd:appinfo>
> </xsd:annotation>
> </xsd:attribute>
> ...
> </xsd:schema>
>
> In particular, the OCL expression
>
> self.questions->collect(q: Query | q.maxPoints)->sum()
>
> gets transformed into
>
> self.questions-&gt;collect(q: Query | q.maxPoints)-&gt;sum()
>
> Now I understand that > is a special character in XML schema and that
> it is correctly escaped using &gt; but I don't know what I have to do
> in order to end up with > in the ecore.
It should not matter. By the time you read it into memory it will be
the right character.
> I tried escaping the > with
> &gt; in my XML schema, but then I still end up with &gt; in the ecore.
> Anyone has an idea?
>
You shouldn't worry about what it looks like in the *.ecore file, as
long as it's the correct character once it's read in. Any XML parser
will yield the correct characters from reading &gt...
> Attached is simple project with the complete XML schema in it.
>
> Best,
> Marc
>
Previous Topic:Can I generate enums mixed case?
Next Topic:CDO Adding a new resource
Goto Forum:
  


Current Time: Sat Feb 22 13:42:45 GMT 2020

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

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

Back to the top