Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » DocumentRoot
DocumentRoot [message #68552] Thu, 06 July 2006 19:13 Go to next message
Eclipse UserFriend
Originally posted by: gui.le.conquerant.com

Hiya group,

I am using XSD along with EMF to generate a java-based model, latekly
used in a GEF-based tool.

Is there a way to tell, in the XML Schema, which element is the document
root? What I need, is to make an 'existing' element the document root.

"ecore:documentRoot" seems to be the solution except that it creates an
extra class in the model. I have tried to make ecore:documentRoot point
to an exising xsd element, but a new class gets generated as well.

Thanks in advance,

Gui
Re: DocumentRoot [message #68562 is a reply to message #68552] Thu, 06 July 2006 20:08 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Gui,

All global elements are mapped to features of the special document root
EClass and any such global element can be the root of an XML instance.
The ecore:documentRoot annotation only lets you specify a name other
than "DocumentRoot" for this special EClass. For a serialization to
conform to a schema, the DocumentRoot instance with an appropriate
element-derived feature set must be at the root of the resource. So if
your model allows only a single thing to be a root, you should have a
single element of that type...


Gui wrote:
> Hiya group,
>
> I am using XSD along with EMF to generate a java-based model, latekly
> used in a GEF-based tool.
>
> Is there a way to tell, in the XML Schema, which element is the
> document root? What I need, is to make an 'existing' element the
> document root.
>
> "ecore:documentRoot" seems to be the solution except that it creates
> an extra class in the model. I have tried to make ecore:documentRoot
> point to an exising xsd element, but a new class gets generated as well.
>
> Thanks in advance,
>
> Gui
>
>
Re: DocumentRoot [message #598327 is a reply to message #68552] Thu, 06 July 2006 20:08 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Gui,

All global elements are mapped to features of the special document root
EClass and any such global element can be the root of an XML instance.
The ecore:documentRoot annotation only lets you specify a name other
than "DocumentRoot" for this special EClass. For a serialization to
conform to a schema, the DocumentRoot instance with an appropriate
element-derived feature set must be at the root of the resource. So if
your model allows only a single thing to be a root, you should have a
single element of that type...


Gui wrote:
> Hiya group,
>
> I am using XSD along with EMF to generate a java-based model, latekly
> used in a GEF-based tool.
>
> Is there a way to tell, in the XML Schema, which element is the
> document root? What I need, is to make an 'existing' element the
> document root.
>
> "ecore:documentRoot" seems to be the solution except that it creates
> an extra class in the model. I have tried to make ecore:documentRoot
> point to an exising xsd element, but a new class gets generated as well.
>
> Thanks in advance,
>
> Gui
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:DocumentRoot
Next Topic:XSD features restricting base class
Goto Forum:
  


Current Time: Thu Apr 25 12:54:51 GMT 2024

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

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

Back to the top