|
Re: EMF XMl save config [message #1088151 is a reply to message #1087762] |
Fri, 16 August 2013 17:08 |
Ed Merks Messages: 33224 Registered: July 2009 |
Senior Member |
|
|
I can't reproduce this. I can read files that look like this:
<workingsets:WorkingSetGroup xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:workingsets="http://www.eclipse.org/CDO/releng/workingsets/1.0">
<workingSets name="/>"/>
</workingsets:WorkingSetGroup>
But your first case looks wrong and is serialized like this when I test.
<workingsets:WorkingSetGroup xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:workingsets="http://www.eclipse.org/CDO/releng/workingsets/1.0">
<workingSets name="/<"/>
</workingsets:WorkingSetGroup>
So I expect the first one of fail (though EMF will not to produce that
when I test) and the second one looks fine and works for me.
On 16/08/2013 3:50 PM, vetrivendhan rajamanoharan wrote:
> We are using org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl for saving
> some configurations of our application to XML
>
> Resource classResource = resourceSet.createResource(classURI);
> classResource.getContents().add(cfg);
> HashMap options = new HashMap();
> options.put(XMLResource.OPTION_DECLARE_XML, Boolean.FALSE);
> ByteArrayOutputStream bout = new ByteArrayOutputStream();
> classResource.save(bout, options);
> bout.flush();
>
> Consider the following scenarios :
> Scenario 1 :
> Configuration in UI : /<
> XML Store format :
> <flavor name="Flavor 1" index="149" flavorType="HTTP_URL">
> <httpUrl uriPrefix="/<"/>
> </flavor>
>
> If reopen the above file, its opening fine
> Scenario 2 :
> Configuration in UI : />
> <flavor name="Flavor 1" index="149" flavorType="HTTP_URL">
> <httpUrl uriPrefix="/>"/>
> </flavor>
>
> Reopens with following exception:
> An internal error occurred during: "Opening Service Configuration File".
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: XML
> document structures must start and end within the same entity.
>
> How can i make the above condition to write in the XML as <flavor
> name="Flavor 1" index="149" flavorType="HTTP_URL">
> <httpUrl uriPrefix="/>"/>
> </flavor>
>
> Looking for your advice.
>
> Thanks,
> Vetri
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03389 seconds