Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XML Schema Operations and default namespace
XML Schema Operations and default namespace [message #518762] Thu, 04 March 2010 22:18 Go to next message
Eclipse UserFriend
Originally posted by: jconlon.apache.org

Modeling the OSGi Metatype Services Schema in order to utilize the
generated models for ui tooling and to use parts of it in my other
models. (I think this maybe the key to a EMF based ConfigAdmin along
with some other cools stuff...)

Here is where the schema lives.

http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd

Am annotating it prior to generation and want to have it implement the
two main interfaces in the OSGi service: AttributeDefinition and
ObjectClassDefinition

The OSGi metatype.xsd schema uses the default namespace:
xmlns="http://www.w3.org/2001/XMLSchema"
for all references to xml schema 'stuff'. Unfortunately using a default
namespace like this schema does seems to break the ability to use
annotated Operations in the schema and have them show up as GenModel
EAnnotations.

Here is an example of a more simple schema that does create:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
targetNamespace="http://www.osgi.org/xmlns/metatype/v1.1.0"
version="1.1.0"
ecore:package="com.verticon.osgi.metatype" ecore:nsPrefix="metatype">

<xs:complexType abstract="true" name="AbstractMapping">
<xs:annotation>
<xs:appinfo ecore:key="operations"
source="http://www.eclipse.org/emf/2002/Ecore">
<none:operation name="foobar" />
</xs:appinfo>
</xs:annotation>

</xs:complexType>
</xs:schema>

but if I add a default namespace of
xmlns="http://www.w3.org/2001/XMLSchema" then I can no longer import my
operations.

So is there a workaround outside of removing the default namespace
declaration and editing the entire schema to add all those prefixes to
my schema 'stuff'?

thanks for any insight,
John
Re: XML Schema Operations and default namespace [message #518779 is a reply to message #518762] Thu, 04 March 2010 23:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010009020709070809010305
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

John,

Comments below.

John E. Conlon wrote:
> Modeling the OSGi Metatype Services Schema in order to utilize the
> generated models for ui tooling and to use parts of it in my other
> models. (I think this maybe the key to a EMF based ConfigAdmin along
> with some other cools stuff...)
>
> Here is where the schema lives.
>
> http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd
>
> Am annotating it prior to generation and want to have it implement the
> two main interfaces in the OSGi service: AttributeDefinition and
> ObjectClassDefinition
>
> The OSGi metatype.xsd schema uses the default namespace:
> xmlns="http://www.w3.org/2001/XMLSchema"
> for all references to xml schema 'stuff'. Unfortunately using a
> default namespace like this schema does seems to break the ability to
> use annotated Operations in the schema and have them show up as
> GenModel EAnnotations.
Really? That sucks but I don't quite believe it. :-P
>
> Here is an example of a more simple schema that does create:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> targetNamespace="http://www.osgi.org/xmlns/metatype/v1.1.0"
> version="1.1.0"
> ecore:package="com.verticon.osgi.metatype" ecore:nsPrefix="metatype">
>
> <xs:complexType abstract="true" name="AbstractMapping">
> <xs:annotation>
> <xs:appinfo ecore:key="operations"
> source="http://www.eclipse.org/emf/2002/Ecore">
> <none:operation name="foobar" />
> </xs:appinfo>
> </xs:annotation>
>
> </xs:complexType>
> </xs:schema>
>
> but if I add a default namespace of
> xmlns="http://www.w3.org/2001/XMLSchema" then I can no longer import
> my operations.
All nested elements that are unqualified will then be implicitly
qualified. Hmmm. Didn't I rant just yesterday about how confusing XML
namespaces are to most people? Oh yes, I did! I rest my case!!
>
> So is there a workaround outside of removing the default namespace
> declaration and editing the entire schema to add all those prefixes to
> my schema 'stuff'?
There is this magical thing! It looks like this:

xmlns="""

If you do that on an element, that element and every element below it,
will behave as if xmlns="..." never appeared anywhere above it.
>
> thanks for any insight,
Sorry for teasing. One would hope that namespace qualification in XML
would be a simple thing, but it's far trickier than one might hope.
That being said, the rules are very simple and very consistent.
> John
>

--------------010009020709070809010305
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">
John,<br>
<br>
Comments below.<br>
<br>
John E. Conlon wrote:
<blockquote cite="mid:hmpbjn$npj$1@build.eclipse.org" type="cite">Modeling
the OSGi Metatype Services Schema in order to utilize the generated
models for ui tooling and to use parts of it in my other models. (I
think this maybe the key to a EMF based ConfigAdmin along with some
other cools stuff...)
<br>
<br>
Here is where the schema lives.
<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd">http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd</a>
<br>
<br>
Am annotating it prior to generation and want to have it implement the
two main interfaces in the OSGi service: AttributeDefinition and
ObjectClassDefinition
<br>
<br>
The OSGi metatype.xsd schema uses the default namespace:
<br>
xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
<br>
for all references to xml schema 'stuff'.&nbsp; Unfortunately using a
default namespace like this schema does seems to break the ability to
use annotated Operations in the schema and have them show up as
GenModel EAnnotations.
<br>
</blockquote>
Really?&nbsp; That sucks but I don't quite believe it. :-P<br>
<blockquote cite="mid:hmpbjn$npj$1@build.eclipse.org" type="cite"><br>
Here is an example of a more simple schema that does create:
<br>
<br>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<br>
&lt;xs:schema
<br>
&nbsp;&nbsp;&nbsp; xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;xmlns:metatype=<a class="moz-txt-link-rfc2396E" href="http://www.osgi.org/xmlns/metatype/v1.1.0">"http://www.osgi.org/xmlns/metatype/v1.1.0"</a>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;xmlns:ecore=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;targetNamespace=<a class="moz-txt-link-rfc2396E" href="http://www.osgi.org/xmlns/metatype/v1.1.0">"http://www.osgi.org/xmlns/metatype/v1.1.0"</a>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;version="1.1.0"
<br>
&nbsp;&nbsp;&nbsp;&nbsp;ecore:package="com.verticon.osgi.metatype "
ecore:nsPrefix="metatype"&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;xs:complexTy pe abstract="true" name="AbstractMapping"&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;xs:annotation&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xs:appinfo ecore:key="operations"
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; source=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a>&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;none:operation name="foobar" /&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xs:appinfo&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;/xs:annotation&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xs:complexT ype&gt;
<br>
&lt;/xs:schema&gt;
<br>
<br>
but if I add a default namespace of
xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a> then I can no longer import my
operations.
<br>
</blockquote>
All nested elements that are unqualified will then be implicitly
qualified.&nbsp; Hmmm.&nbsp; Didn't I rant just yesterday about how confusing XML
namespaces are to most people?&nbsp; Oh yes, I did! I rest my case!!<br>
<blockquote cite="mid:hmpbjn$npj$1@build.eclipse.org" type="cite"><br>
So is there a workaround outside of removing the default namespace
declaration and editing the entire schema to add all those prefixes to
my schema 'stuff'?
<br>
</blockquote>
There is this magical thing!&nbsp; It looks like this: <br>
<blockquote>xmlns="""<br>
</blockquote>
If you do that on an element, that element and every element below it,
will behave as if xmlns="..." never appeared anywhere above it.<br>
<blockquote cite="mid:hmpbjn$npj$1@build.eclipse.org" type="cite"><br>
thanks for any insight,
<br>
</blockquote>
Sorry for teasing.&nbsp; One would hope that namespace qualification in XML
would be a simple thing, but it's far trickier than one might hope.&nbsp;
That being said, the rules are very simple and very consistent.<br>
<blockquote cite="mid:hmpbjn$npj$1@build.eclipse.org" type="cite">John
<br>
<br>
</blockquote>
</body>
</html>

--------------010009020709070809010305--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XML Schema Operations and default namespace [message #518795 is a reply to message #518779] Thu, 04 March 2010 21:22 Go to previous message
Eclipse UserFriend
Originally posted by: jconlon.apache.org

Hi Ed,

see mea culpa below...

Ed Merks wrote:
> John,
>
> Comments below.
>
> John E. Conlon wrote:
>> Modeling the OSGi Metatype Services Schema in order to utilize the
>> generated models for ui tooling and to use parts of it in my other
>> models. (I think this maybe the key to a EMF based ConfigAdmin along
>> with some other cools stuff...)
>>
>> Here is where the schema lives.
>>
>> http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd
>>
>> Am annotating it prior to generation and want to have it implement the
>> two main interfaces in the OSGi service: AttributeDefinition and
>> ObjectClassDefinition
>>
>> The OSGi metatype.xsd schema uses the default namespace:
>> xmlns="http://www.w3.org/2001/XMLSchema"
>> for all references to xml schema 'stuff'. Unfortunately using a
>> default namespace like this schema does seems to break the ability to
>> use annotated Operations in the schema and have them show up as
>> GenModel EAnnotations.
> Really? That sucks but I don't quite believe it. :-P

Glad reality doesn't suck. (At least not in this regard.)

>>
>> Here is an example of a more simple schema that does create:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xs:schema
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> targetNamespace="http://www.osgi.org/xmlns/metatype/v1.1.0"
>> version="1.1.0"
>> ecore:package="com.verticon.osgi.metatype" ecore:nsPrefix="metatype">
>>
>> <xs:complexType abstract="true" name="AbstractMapping">
>> <xs:annotation>
>> <xs:appinfo ecore:key="operations"
>> source="http://www.eclipse.org/emf/2002/Ecore">
>> <none:operation name="foobar" />
>> </xs:appinfo>
>> </xs:annotation>
>>
>> </xs:complexType>
>> </xs:schema>
>>
>> but if I add a default namespace of
>> xmlns="http://www.w3.org/2001/XMLSchema" then I can no longer import
>> my operations.
> All nested elements that are unqualified will then be implicitly
> qualified. Hmmm. Didn't I rant just yesterday about how confusing XML
> namespaces are to most people? Oh yes, I did! I rest my case!!
>>
>> So is there a workaround outside of removing the default namespace
>> declaration and editing the entire schema to add all those prefixes to
>> my schema 'stuff'?
> There is this magical thing! It looks like this:
>
> xmlns="""

More than magic - it's a negated existentialism! DUH. No wonder I
couldn't figure it out;-)
>
> If you do that on an element, that element and every element below it,
> will behave as if xmlns="..." never appeared anywhere above it.
>>
>> thanks for any insight,
> Sorry for teasing.
I deserve it. I will don the barrel for a fortnight
http://www.occasionalhell.com/infdevice/detail.php?recordID= Drunkard%27s%20Cloak

One would hope that namespace qualification in XML
> would be a simple thing, but it's far trickier than one might hope.
> That being said, the rules are very simple and very consistent.
Yes, I think I have learned, forgot and relearned schema/namespaces 3.5
times in the past 6 years. If I would have RTFM a bit more I could
incremented it to 3.75 times and maybe would have seen it without bother
you on this...

thanks again,
John
Previous Topic:XML attributes and EMF editor
Next Topic:[Teneo] EObjectValidator rev 1.15
Goto Forum:
  


Current Time: Thu Sep 19 10:57:16 GMT 2024

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

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

Back to the top