copy xsd type definition from one schema to another [message #603660] |
Wed, 18 February 2009 17:08 |
Jacek Pospychala Messages: 159 Registered: July 2009 |
Senior Member |
|
|
hi,
I'm trying to copy a XSDTypeDefinition from one schema to another with
following code:
XSDSchema dstSchema = // destination schema
XSDSchema srcSchema = // source schema
XSDTypeDefinition srcType = srcSchema.getTypeDefinitions().get(0);
// 1. copy schema element
XSDTypeDefinition dstType = (XSDTypeDefinition)
srcType.cloneConcreteComponent(true, true);
// 2. copy DOM element
Element dstElement = (Element)
dstSchema.getDocument().importNode(newType.getElement(), true);
dstType.setElement(dstElement);
// 3. put copied element to new schema
srcSchema.getContents().add(dstType);
But this way I seem to loose sync between schema model and DOM model of
copied XSDTypeDefinition.
When I do only 1., then some DOM elements are missing.
What's the correct way to do the copy?
THanks in advance!
Jacek
|
|
|
Powered by
FUDForum. Page generated in 0.04034 seconds