Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Problems copying an XSDSchema
Problems copying an XSDSchema [message #42314] Tue, 27 April 2004 22:13 Go to next message
Dennis Fuglsang is currently offline Dennis FuglsangFriend
Messages: 77
Registered: July 2009
Member
For the purpose of performing a "save as" type operation on an XSDResource I
create a new resource instance and then attempt to copy the root EObjects
and then add the copies to the new resource's contents. When executing the
copy on a XSDResource composed of XSDSimpleTypeDefinition instances I
encounter an IllegalArgumentException. It appears that the
XSDSimpleTypeDefinition.patch code is attempting to set a member type
definition that already exists in the list. My question is should I be able
to copy a XSDSchema instance and paste it into a new XSDResource ? Are
there special considerations that need to be taken into account when copying
an XSDSchema instance?

Thread [main] (Suspended (exception IllegalArgumentException))
EObjectEList(BasicEList).set(int, Object) line: 543
BasicEList$EListIterator.set(Object) line: 1398
XSDSimpleTypeDefinitionImpl.patch() line: 680
XSDSchemaImpl(XSDConcreteComponentImpl).patch() line: 513
XSDSchemaImpl.patch() line: 1494
XSDSchemaImpl.traverseToRootForPatching() line: 1468
XSDSchemaImpl.adoptContent(EReference, XSDConcreteComponent) line: 1767
XSDSchemaImpl(XSDConcreteComponentImpl).eNotify(Notification ) line: 1133
NotificationChainImpl.dispatch(Notification) line: 115
NotificationChainImpl.dispatch() line: 103
EObjectContainmentEList(NotifyingListImpl).addAllUnique(int, Collection)
line: 342
EObjectContainmentEList(NotifyingListImpl).addAllUnique(Coll ection) line:
294
EObjectContainmentEList(BasicEList).addAll(Collection) line: 675
EcoreUtil$Copier.copyContainment(EReference, EObject, EObject) line: 387
EcoreUtil$Copier.copy(EObject) line: 365
EcoreUtil$Copier.copyAll(Collection) line: 336
EcoreUtil.copyAll(Collection) line: 300

Thanks in advance,

Dennis Fuglsang
Re: Problems copying an XSDSchema [message #42345 is a reply to message #42314] Tue, 27 April 2004 22:34 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Dennis,

The XSD model doesn't have all the right features set to be derived to avoid
generically copying things that should not be copied because they are computed.
Use cloneConcreteComponent if you need to do a copy. But you probably want to
copy the DOM itself anyway. And why not use Resource.save with an output stream
for where you want to save?

Dennis Fuglsang wrote:

> For the purpose of performing a "save as" type operation on an XSDResource I
> create a new resource instance and then attempt to copy the root EObjects
> and then add the copies to the new resource's contents. When executing the
> copy on a XSDResource composed of XSDSimpleTypeDefinition instances I
> encounter an IllegalArgumentException. It appears that the
> XSDSimpleTypeDefinition.patch code is attempting to set a member type
> definition that already exists in the list. My question is should I be able
> to copy a XSDSchema instance and paste it into a new XSDResource ? Are
> there special considerations that need to be taken into account when copying
> an XSDSchema instance?
>
> Thread [main] (Suspended (exception IllegalArgumentException))
> EObjectEList(BasicEList).set(int, Object) line: 543
> BasicEList$EListIterator.set(Object) line: 1398
> XSDSimpleTypeDefinitionImpl.patch() line: 680
> XSDSchemaImpl(XSDConcreteComponentImpl).patch() line: 513
> XSDSchemaImpl.patch() line: 1494
> XSDSchemaImpl.traverseToRootForPatching() line: 1468
> XSDSchemaImpl.adoptContent(EReference, XSDConcreteComponent) line: 1767
> XSDSchemaImpl(XSDConcreteComponentImpl).eNotify(Notification ) line: 1133
> NotificationChainImpl.dispatch(Notification) line: 115
> NotificationChainImpl.dispatch() line: 103
> EObjectContainmentEList(NotifyingListImpl).addAllUnique(int, Collection)
> line: 342
> EObjectContainmentEList(NotifyingListImpl).addAllUnique(Coll ection) line:
> 294
> EObjectContainmentEList(BasicEList).addAll(Collection) line: 675
> EcoreUtil$Copier.copyContainment(EReference, EObject, EObject) line: 387
> EcoreUtil$Copier.copy(EObject) line: 365
> EcoreUtil$Copier.copyAll(Collection) line: 336
> EcoreUtil.copyAll(Collection) line: 300
>
> Thanks in advance,
>
> Dennis Fuglsang
Re: Problems copying an XSDSchema [message #586101 is a reply to message #42314] Tue, 27 April 2004 22:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Dennis,

The XSD model doesn't have all the right features set to be derived to avoid
generically copying things that should not be copied because they are computed.
Use cloneConcreteComponent if you need to do a copy. But you probably want to
copy the DOM itself anyway. And why not use Resource.save with an output stream
for where you want to save?

Dennis Fuglsang wrote:

> For the purpose of performing a "save as" type operation on an XSDResource I
> create a new resource instance and then attempt to copy the root EObjects
> and then add the copies to the new resource's contents. When executing the
> copy on a XSDResource composed of XSDSimpleTypeDefinition instances I
> encounter an IllegalArgumentException. It appears that the
> XSDSimpleTypeDefinition.patch code is attempting to set a member type
> definition that already exists in the list. My question is should I be able
> to copy a XSDSchema instance and paste it into a new XSDResource ? Are
> there special considerations that need to be taken into account when copying
> an XSDSchema instance?
>
> Thread [main] (Suspended (exception IllegalArgumentException))
> EObjectEList(BasicEList).set(int, Object) line: 543
> BasicEList$EListIterator.set(Object) line: 1398
> XSDSimpleTypeDefinitionImpl.patch() line: 680
> XSDSchemaImpl(XSDConcreteComponentImpl).patch() line: 513
> XSDSchemaImpl.patch() line: 1494
> XSDSchemaImpl.traverseToRootForPatching() line: 1468
> XSDSchemaImpl.adoptContent(EReference, XSDConcreteComponent) line: 1767
> XSDSchemaImpl(XSDConcreteComponentImpl).eNotify(Notification ) line: 1133
> NotificationChainImpl.dispatch(Notification) line: 115
> NotificationChainImpl.dispatch() line: 103
> EObjectContainmentEList(NotifyingListImpl).addAllUnique(int, Collection)
> line: 342
> EObjectContainmentEList(NotifyingListImpl).addAllUnique(Coll ection) line:
> 294
> EObjectContainmentEList(BasicEList).addAll(Collection) line: 675
> EcoreUtil$Copier.copyContainment(EReference, EObject, EObject) line: 387
> EcoreUtil$Copier.copy(EObject) line: 365
> EcoreUtil$Copier.copyAll(Collection) line: 336
> EcoreUtil.copyAll(Collection) line: 300
>
> Thanks in advance,
>
> Dennis Fuglsang


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Problems copying an XSDSchema
Next Topic:Annotation appinfo troubles
Goto Forum:
  


Current Time: Fri Apr 19 20:58:31 GMT 2024

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

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

Back to the top