|
Re: Copy Schema item [message #64910 is a reply to message #64888] |
Fri, 04 November 2005 21:37 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Dave,
I'm not sure of the context of the lines below, but you need to remember
that each XSDSchema will wrap a different DOM Document and you can't add
an element from one document to another document. Calling setElement
on a detached XSDElementDeclaration isn't going to be able to create a
nice tree either; the element needs to be attached for that. You've
tried xsdItem.cloneConcreteComponent(true, false) to produce a copy you
can insert elsewhere? This won't copy the DOM fragment over verbatim
and will lose the contents of annotations, which are representable only
in the DOM. You could use
mergedSchema.getDocument().cloneNode(xsdItem.getElement()) to copy the
fragment itself and then insert it into the mergedSchema.getElement.
Dave Carver wrote:
> I'm running into an issue with the XSD API from eclipse. I'm trying
> to copy an XSD artifact from one XSDSchema to another.
>
> Basically, I want to take elements, complexTypes, and simpleTypes and
> copy them exactly into another schema. If I go through programmicly
> and create each type, they appear when I serialize them. However if I
> do something like the following:
>
> XSDElementDeclaration element =
> XSDFactory.eINSTANCE.createXSDElementDeclaration();
> element.setElement(xsdItem.getElement());
> newMergedSchema.getContents().add(element);
>
> They appear in the newMergedSchemas.getContents() when I examine it
> with the debugger, but when I serialize the newMergeSchema, the items
> do not show up in the serialization. I've tried doing an
> element.updateElement(), but that didn't have any affect. I've also
> tried a clone, but it doesn't do anything different.
>
> Any ideas?
>
> Dave
|
|
|
|
|
Re: Copy Schema item [message #597114 is a reply to message #64888] |
Fri, 04 November 2005 21:37 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Dave,
I'm not sure of the context of the lines below, but you need to remember
that each XSDSchema will wrap a different DOM Document and you can't add
an element from one document to another document. Calling setElement
on a detached XSDElementDeclaration isn't going to be able to create a
nice tree either; the element needs to be attached for that. You've
tried xsdItem.cloneConcreteComponent(true, false) to produce a copy you
can insert elsewhere? This won't copy the DOM fragment over verbatim
and will lose the contents of annotations, which are representable only
in the DOM. You could use
mergedSchema.getDocument().cloneNode(xsdItem.getElement()) to copy the
fragment itself and then insert it into the mergedSchema.getElement.
Dave Carver wrote:
> I'm running into an issue with the XSD API from eclipse. I'm trying
> to copy an XSD artifact from one XSDSchema to another.
>
> Basically, I want to take elements, complexTypes, and simpleTypes and
> copy them exactly into another schema. If I go through programmicly
> and create each type, they appear when I serialize them. However if I
> do something like the following:
>
> XSDElementDeclaration element =
> XSDFactory.eINSTANCE.createXSDElementDeclaration();
> element.setElement(xsdItem.getElement());
> newMergedSchema.getContents().add(element);
>
> They appear in the newMergedSchemas.getContents() when I examine it
> with the debugger, but when I serialize the newMergeSchema, the items
> do not show up in the serialization. I've tried doing an
> element.updateElement(), but that didn't have any affect. I've also
> tried a clone, but it doesn't do anything different.
>
> Any ideas?
>
> Dave
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04039 seconds