Copying/Cloning Annotations [message #597133] |
Tue, 08 November 2005 15:06 |
David Carver Messages: 174 Registered: July 2009 |
Senior Member |
|
|
When I'm serliazing the new schema, none of the annotations that I'm
setting are showing up. I realize when you clone ConcreteComponent that
the new component will not contain any of the annotations and you have to
create those. However, the following code adds the annotations to the
cloned node, but for some reason they aren't serialized. Here is the
corresponding code:
XSDComplexTypeDefinition clonedType =
(XSDComplexTypeDefinition)component.cloneConcreteComponent(t rue, false);
XSDComplexTypeDefinition type = (XSDComplexTypeDefinition) component;
XSDAnnotation annotation = type.getAnnotation();
if (annotation != null) {
XSDAnnotation clonedAnno = XSDFactory.eINSTANCE.createXSDAnnotation();
clonedType.setAnnotation(clonedAnno);
for (Iterator it = annotation.getUserInformation().iterator();
it.hasNext();) {
Element docuElements = (Element) it.next();
Element docCloned = (Element)docuElements.cloneNode(true);
clonedType.getAnnotation().setElement(docCloned);
}
}
This looks like it should work, any idea why the annotations aren't
serialized with the rest of the schema.
|
|
|
Powered by
FUDForum. Page generated in 0.03330 seconds