Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Copying/Cloning Annotations
Copying/Cloning Annotations [message #597133] Tue, 08 November 2005 10:06
David Carver is currently offline 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.
Previous Topic:Copy Schema item
Next Topic:Copying/Cloning Annotations
Goto Forum:
  


Current Time: Thu Aug 21 22:06:24 EDT 2014

Powered by FUDForum. Page generated in 0.01505 seconds