Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Copying/Cloning Annotations
Copying/Cloning Annotations [message #597133] Tue, 08 November 2005 15:06
David Carver is currently offline David CarverFriend
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: Wed Sep 25 16:04:50 GMT 2024

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

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

Back to the top