Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Avoid qualification of XML-tags in nested elements
Avoid qualification of XML-tags in nested elements [message #429098] Wed, 08 April 2009 13:28 Go to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Hi.
I have a Schema:

<xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:module="http://www.logismata.ch/module"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="module"
ecore:package="ch.logismata.module"
targetNamespace="http://www.logismata.ch/module">
<xsd:element name="MODULE" type="module:Module"/>
....
<xsd:complexType name="ProjectGroup">
<xsd:attribute ecore:name="name" name="NAME"
type="xsd:anySimpleType" use="required"/>
....

And expected the generted editor could read/write files like:

<?xml version="1.0" encoding="UTF-8"?>
<module:MODULE xmlns:module="http://www.logismata.ch/module">
<PROJECT_GROUP>
</PROJECT_GROUP>
</module:MODULE>

Instead it can only read files like:

<?xml version="1.0" encoding="UTF-8"?>
<module:MODULE xmlns:module="http://www.logismata.ch/module">
<module:PROJECT_GROUP>
</module:PROJECT_GROUP>
</module:MODULE>

Any idea how I get the first behavior?

Regards, Philipp
Re: Avoid qualification of XML-tags in nested elements [message #429102 is a reply to message #429098] Wed, 08 April 2009 15:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Philipp,

Comments below.


Philipp Kutter wrote:
> Hi.
> I have a Schema:
>
> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:module="http://www.logismata.ch/module"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="module"
> ecore:package="ch.logismata.module"
> targetNamespace="http://www.logismata.ch/module">
> <xsd:element name="MODULE" type="module:Module"/>
> ...
> <xsd:complexType name="ProjectGroup">
> <xsd:attribute ecore:name="name" name="NAME"
> type="xsd:anySimpleType" use="required"/>
> ...
>
> And expected the generted editor could read/write files like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <module:MODULE xmlns:module="http://www.logismata.ch/module">
> <PROJECT_GROUP>
> </PROJECT_GROUP>
> </module:MODULE>
>
> Instead it can only read files like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <module:MODULE xmlns:module="http://www.logismata.ch/module">
> <module:PROJECT_GROUP>
> </module:PROJECT_GROUP>
> </module:MODULE>
>
> Any idea how I get the first behavior?
Is PROJECT_GROUP a global element declaration? To get the first
behavior, you'd need it to be a local element declaration.
>
> Regards, Philipp


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Avoid qualification of XML-tags in nested elements [message #429158 is a reply to message #429102] Fri, 10 April 2009 14:54 Go to previous messageGo to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000405060305080402040702
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi, Ed.
As far as I can judge, it is local. The only global element is MODULE:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:module="http://www.gugus.ch/module"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
ecore:nsPrefix="module" ecore:package="ch.gugus.module"
targetNamespace="http://www.gugus.ch/module">
<xsd:element name="MODULE" type="module:Module" />
<xsd:complexType name="Module">
<xsd:sequence>
<xsd:element ecore:name="projectGroup" form="qualified"
maxOccurs="unbounded" minOccurs="0" name="PROJECT_GROUP"
type="module:ProjectGroup"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ProjectGroup">
<xsd:attribute ecore:name="name" name="NAME"
type="xsd:anySimpleType" use="required"/>
</xsd:complexType>
</xsd:schema>

But the generated Editor writes the second behavior, not the second:
<?xml version="1.0" encoding="UTF-8"?>
<module:MODULE xmlns:module="http://www.gugus.ch/module">
<module:PROJECT_GROUP NAME="xyz"/>
</module:MODULE>

The ready to generate project is attached.

How do I get the inner "module:" qualification removed?

As well, I thought because I did set a targetNamespace, all elements
from that namespace do not need to be qualified. Is this not the case?

If so, how do I get all qualifications away?

Regards, Philipp

PS: I read the long thread with Waqas Ilyas, and I almost do not dare to
repeat the question he repeated again and again:
"I can solve this problem if I add an ExtendedMetaData to the packages
with qualified->false entity. But I want to control everything from
schema and not touch the intermediate Ecore models. Is this possible?"

Would the answer to this question solve my problem?

Regards, Philipp

Ed Merks wrote:
> Philipp,
>
> Comments below.
>
>
> Philipp Kutter wrote:
>> Hi.
>> I have a Schema:
>>
>> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> xmlns:module="http://www.logismata.ch/module"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="module"
>> ecore:package="ch.logismata.module"
>> targetNamespace="http://www.logismata.ch/module">
>> <xsd:element name="MODULE" type="module:Module"/>
>> ...
>> <xsd:complexType name="ProjectGroup">
>> <xsd:attribute ecore:name="name" name="NAME"
>> type="xsd:anySimpleType" use="required"/>
>> ...
>>
>> And expected the generted editor could read/write files like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <module:MODULE xmlns:module="http://www.logismata.ch/module">
>> <PROJECT_GROUP>
>> </PROJECT_GROUP>
>> </module:MODULE>
>>
>> Instead it can only read files like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <module:MODULE xmlns:module="http://www.logismata.ch/module">
>> <module:PROJECT_GROUP>
>> </module:PROJECT_GROUP>
>> </module:MODULE>
>>
>> Any idea how I get the first behavior?
> Is PROJECT_GROUP a global element declaration? To get the first
> behavior, you'd need it to be a local element declaration.
>>
>> Regards, Philipp


--------------000405060305080402040702
Content-Type: application/x-zip-compressed;
name="testLocalQualification.zip"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="testLocalQualification.zip"

UEsDBBQACAAIABqFijoAAAAAAAAAAAAAAAAhAAAAdGVzdExvY2FsUXVhbGlm aWNhdGlvbi8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bi9tb2RlbC9tb2R1bGUueHNkUEsFBgAAAAAG AAYA+wEAAJsK
AAAAAA==
--------------000405060305080402040702--
Re: Avoid qualification of XML-tags in nested elements [message #429159 is a reply to message #429158] Fri, 10 April 2009 15:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Philipp,

Ditch the form="qualified" and you should get what you want.


Philipp Kutter wrote:
> Hi, Ed.
> As far as I can judge, it is local. The only global element is MODULE:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:module="http://www.gugus.ch/module"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> ecore:nsPrefix="module" ecore:package="ch.gugus.module"
> targetNamespace="http://www.gugus.ch/module">
> <xsd:element name="MODULE" type="module:Module" />
> <xsd:complexType name="Module">
> <xsd:sequence>
> <xsd:element ecore:name="projectGroup" form="qualified"
> maxOccurs="unbounded" minOccurs="0" name="PROJECT_GROUP"
> type="module:ProjectGroup"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="ProjectGroup">
> <xsd:attribute ecore:name="name" name="NAME"
> type="xsd:anySimpleType" use="required"/>
> </xsd:complexType>
> </xsd:schema>
>
> But the generated Editor writes the second behavior, not the second:
> <?xml version="1.0" encoding="UTF-8"?>
> <module:MODULE xmlns:module="http://www.gugus.ch/module">
> <module:PROJECT_GROUP NAME="xyz"/>
> </module:MODULE>
>
> The ready to generate project is attached.
>
> How do I get the inner "module:" qualification removed?
>
> As well, I thought because I did set a targetNamespace, all elements
> from that namespace do not need to be qualified. Is this not the case?
>
> If so, how do I get all qualifications away?
>
> Regards, Philipp
>
> PS: I read the long thread with Waqas Ilyas, and I almost do not dare
> to repeat the question he repeated again and again:
> "I can solve this problem if I add an ExtendedMetaData to the
> packages with qualified->false entity. But I want to control
> everything from schema and not touch the intermediate Ecore models.
> Is this possible?"
>
> Would the answer to this question solve my problem?
>
> Regards, Philipp
>
> Ed Merks wrote:
>> Philipp,
>>
>> Comments below.
>>
>>
>> Philipp Kutter wrote:
>>> Hi.
>>> I have a Schema:
>>>
>>> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>> xmlns:module="http://www.logismata.ch/module"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="module"
>>> ecore:package="ch.logismata.module"
>>> targetNamespace="http://www.logismata.ch/module">
>>> <xsd:element name="MODULE" type="module:Module"/>
>>> ...
>>> <xsd:complexType name="ProjectGroup">
>>> <xsd:attribute ecore:name="name" name="NAME"
>>> type="xsd:anySimpleType" use="required"/>
>>> ...
>>>
>>> And expected the generted editor could read/write files like:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <module:MODULE xmlns:module="http://www.logismata.ch/module">
>>> <PROJECT_GROUP>
>>> </PROJECT_GROUP>
>>> </module:MODULE>
>>>
>>> Instead it can only read files like:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <module:MODULE xmlns:module="http://www.logismata.ch/module">
>>> <module:PROJECT_GROUP>
>>> </module:PROJECT_GROUP>
>>> </module:MODULE>
>>>
>>> Any idea how I get the first behavior?
>> Is PROJECT_GROUP a global element declaration? To get the first
>> behavior, you'd need it to be a local element declaration.
>>>
>>> Regards, Philipp
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Avoid qualification of XML-tags in nested elements [message #429179 is a reply to message #429159] Sat, 11 April 2009 17:02 Go to previous messageGo to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Hi, Ed.
Removing the form="qualified" attribute from "element" tags of the XSD
Schema solved the problem.

Interestingly, in the .ecore version, the form="qualified" was
translated into an EAnnotation namespace->##targetNamespace

Is this the way to force a form="qualified" if I come from the ECore side?

Regards and all the best,
Philipp



Ed Merks wrote:
> Philipp,
>
> Ditch the form="qualified" and you should get what you want.
>
Re: Avoid qualification of XML-tags in nested elements [message #429180 is a reply to message #429179] Sat, 11 April 2009 17:48 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Philipp,

Comments below.


Philipp Kutter wrote:
> Hi, Ed.
> Removing the form="qualified" attribute from "element" tags of the XSD
> Schema solved the problem.
Can't say I'm surprised. :-P
>
> Interestingly, in the .ecore version, the form="qualified" was
> translated into an EAnnotation namespace->##targetNamespace
Yes, that's what I'd expect.
>
> Is this the way to force a form="qualified" if I come from the ECore
> side?
Yes, by setting the namespace to the namespace of the package exactly
like you see.
>
> Regards and all the best,
> Philipp
>
>
>
> Ed Merks wrote:
>> Philipp,
>>
>> Ditch the form="qualified" and you should get what you want.
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:NPE when using EcoreUtil.Copier and then copyReferences()
Next Topic:How to add validation button on my own EMF project
Goto Forum:
  


Current Time: Thu Sep 26 01:46:13 GMT 2024

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

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

Back to the top