Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Serializing EAttribute from Dynamic Model
Serializing EAttribute from Dynamic Model [message #203710] Thu, 24 November 2005 16:55 Go to next message
Eclipse UserFriend
Originally posted by: fwalsh.tssg.org

Hi,


I'm dynamically creating new non-generated class which I want to seralize
to an XML file. The serialization is working however want the EAttributes
for this class to be serialized as XML elements, not as attributes. Is
there an easy way to do this?? Here is the main parts of the code.The
EAttribute is created as follows:

EAttribute serviceUsageAttr = EcoreFactory.eINSTANCE.createEAttribute();
serviceUsageAttr.setName("numOfNights");
serviceUsageAttr.setEType(EcorePackage.eINSTANCE.getEString( ));

Then I add it into an existing EClass:

subIpdr.getEStructuralFeatures().add(serviceUsageAttr);

Which is then added to a resource and saved:

XMLResourceImpl ipdrXML = new XMLResourceImpl(fileURI);
ipdrXML.getContents().add(ipdr);
options.put(XMLResource.OPTION_EXTENDED_META_DATA,
ExtendedMetaData.INSTANCE);
ipdrXML.save(options);

The XML that is saved:

<?xml version="1.0" encoding="ASCII"?>
<ipdr:DBEIpdrType xmlns:ipdr="http://www.ipdr.org/namespaces/ipdr"
numOfNights="2"/>


The XML that I want:

<?xml version="1.0" encoding="ASCII"?>
<ipdr:DBEIpdrType xmlns:ipdr="http://www.ipdr.org/namespaces/ipdr">
<ipdr:numOfNights>2</ipdr:numOfNights>
</ipdr:DBEIpdrType>


Any help would be greatly appreciated. I can supply the full code if
required.

Thanks,

Frank.
Re: Serializing EAttribute from Dynamic Model [message #203713 is a reply to message #203710] Thu, 24 November 2005 16:57 Go to previous message
Eclipse UserFriend
Originally posted by: fwalsh.tssg.org

Oops!
Sorry folks - wrong newsgroup!
Please Ignore last post - it belongs in EMF.
Previous Topic:Plugin developement and deployment.
Next Topic:Drag and Drop
Goto Forum:
  


Current Time: Thu Dec 26 13:56:02 GMT 2024

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

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

Back to the top