Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XMLResource serialization of cross-resource references vs. schema conformity(Why 'href' attribute and not a compliant anyURI element?)
XMLResource serialization of cross-resource references vs. schema conformity [message #554182] Fri, 20 August 2010 12:59 Go to next message
Ben Tenne is currently offline Ben TenneFriend
Messages: 50
Registered: October 2009
Member
I have EMF models produced from XMLSchema and construct my schema appropriately to prompt non-containment references in the Ecore (i.e. by use of xsd:anyURI elements decorated with appropriate attributes from the ecore namespace)

I'm wondering why XMLResource writes cross-resource references (whether that's cross-document or between heterogenous resources) in a way that mismatches the original schema.

e.g. If my schema contained something like

 <xsd:element ecore:reference="ordermodel:Briefcase" name="briefcase" type="xsd:anyURI"/>


then why does serialization produce things like

<briefcase href="fakeuri://value-appropriate-for-my-special-resource"/>


when it could write it as

<briefcase>fakeuri://value-appropriate-for-my-special-resource</briefcase>


which would be a legal xsd:anyURI typed element?

Many thanks for any explanation.

Regards,
Ben.
Re: XMLResource serialization of cross-resource references vs. schema conformity [message #554207 is a reply to message #554182] Fri, 20 August 2010 13:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ben,

Comments below.


Ben Tenne wrote:
> I have EMF models produced from XMLSchema and construct my schema
> appropriately to prompt non-containment references in the Ecore (i.e.
> by use of xsd:anyURI elements decorated with appropriate attributes
> from the ecore namespace)
>
> I'm wondering why XMLResource writes cross-resource references
> (whether that's cross-document or between heterogenous resources) in a
> way that mismatches the original schema.
>
> e.g. If my schema contained something like
>
> <xsd:element ecore:reference="ordermodel:Briefcase" name="briefcase"
> type="xsd:anyURI"/>
>
>
> then why does serialization produce things like
>
>
> <briefcase href="fakeuri://value-appropriate-for-my-special-resource"/>
Because you're using XMIResourceImpl not the XMLResourceImpl configured
by the resource factory that's been generate for you.
>
>
> when it could write it as
>
>
> <briefcase>fakeuri://value-appropriate-for-my-special-resource</briefcase>
>
>
>
> which would be a legal xsd:anyURI typed element?
>
> Many thanks for any explanation.
Try invoking Generate Test Code and look at the generated
XyzExample.java which should work correctly (and shows how to ensure
that your generated resource factory is used).
>
> Regards,
> Ben.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[JET] The code of constructor Editor() is exceeding the 65535 bytes limit
Next Topic:EMF model live OCL constraints
Goto Forum:
  


Current Time: Thu Mar 28 15:05:44 GMT 2024

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

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

Back to the top