Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to define xml name and plural name of a TAG(EMF ecore: defining xml.name and xml.pluralname)
How to define xml name and plural name of a TAG [message #1766407] Wed, 21 June 2017 07:59 Go to next message
Salvador Ruiz Cabrera is currently offline Salvador Ruiz CabreraFriend
Messages: 2
Registered: June 2017
Junior Member
Hi everyone,

I am working with the generation of XML files using a schema, the ecore and genmodel; and the edit and editor plugins. But I cannot manage to "auto"-generate plural tags when I insert an object.

For example, if I add a "BOOK" object to my "LIBRARY", I would need to have the following structure:

<LIBRARY>
<BOOKS>
<BOOK>....</BOOK>
</BOOKS
</LIBRARY>

But till now, I cannot manage to create the <BOOKS> and </BOOKS> tags. I treid already to define the xml.name and xml.pluralName in the "TaggedValues" and in the "ExtendedMetaData" (as EAnnotations). But nothing works.

For any help I would be very gratefull.

Have a nice day,

Salvador
Re: How to define xml name and plural name of a TAG [message #1766412 is a reply to message #1766407] Wed, 21 June 2017 08:49 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

There is generally a dilemma. In XML you usually want a singular since it is repeated for each element. In modeling languages you usually want the plural since you are dealing with the collection. But since XML is for computers not humans, define your plural properties with plural names.

In your case you seem to want a 'spurious' wrapper, so I think you need your model to have a spurious BOOKS class if you really want the spurious XML element.

Regards

Ed Willink
Previous Topic:Default value literal
Next Topic:Code generation: dirtying (@generated) JavaDoc of interfaces, in order to keep handwritten "ext
Goto Forum:
  


Current Time: Thu Apr 25 15:23:34 GMT 2024

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

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

Back to the top