Attribute vs element in XML serialization [message #597353] |
Fri, 16 December 2005 18:23 |
henry Messages: 1 Registered: July 2009 |
Junior Member |
|
|
I started my EMF models using XSD, whose elements do not have any
attributes, but nested elements. When I use XMLResource to serialize the
models, the result XML instance document switchs all simple elements into
attributes. Is there any simple way to let the instance document confirm
to the original XSD, i.e, the simple nested element is serialized as
simple nested element? I did the following, but it does not help. I had to
find each attribute contained in the document (recursively), and set the
XML representation to ELEMENT using XMLInfo (for each simple attribute) to
make it work.
Is there any simpler and natural way to achieve this? Thanks!!!
XMLResource res = new XMLResourceImpl(uri);
XMLMap map = new XMLMapImpl();
res.getDefaultSaveOptions().put(XMLResource.OPTION_XML_MAP, map);
....
res.save();
Henry
|
|
|
Powered by
FUDForum. Page generated in 0.02965 seconds