Cannot set content of XSD Particle [message #602828] |
Fri, 22 February 2008 00:39 |
Eclipse User |
|
|
|
Hi,
I am using the eclipse XSD API to rewrite schemas. I am trying to add
particles to a model group. The added particles should be based on an
existing particle in the model group, but with a different element
content. Hence, I clone a particle, using
particle.cloneConcreteComponent(true, true). I set an existing element as
the content of this particle. However, when I do this, I get the following
exception:
java.lang.NullPointerException
at
org.eclipse.xsd.impl.XSDConcreteComponentImpl.forceNiceRemov eChild(XSDConcreteComponentImpl.java:1696)
at
org.eclipse.xsd.impl.XSDConcreteComponentImpl.niceRemoveChil d(XSDConcreteComponentImpl.java:1609)
at
org.eclipse.xsd.impl.XSDConcreteComponentImpl.orphanContent( XSDConcreteComponentImpl.java:1449)
at
org.eclipse.xsd.impl.XSDParticleImpl.orphanContent(XSDPartic leImpl.java:715)
at
org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDCon creteComponentImpl.java:1199)
at
org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1030)
at
org.eclipse.xsd.impl.XSDParticleImpl.setContent(XSDParticleI mpl.java:324)
at
com.galdosinc.smt.rewriter.SchemaRewriter.processModelGroup( SchemaRewriter.java:462)
at
com.galdosinc.smt.rewriter.SchemaRewriter.processElementGrou p(SchemaRewriter.java:586)
at
com.galdosinc.smt.rewriter.SchemaRewriter.processElementGrou pList(SchemaRewriter.java:411)
at
com.galdosinc.smt.rewriter.SchemaRewriter.processSchema(Sche maRewriter.java:275)
at
com.galdosinc.smt.rewriter.SchemaRewriter.rewriteSchema(Sche maRewriter.java:202)
at
com.galdosinc.smt.rewriter.SchemaRewriter.main(SchemaRewrite r.java:104)
The following is an example of my code:
XSDParticle particleClone =
(XSDParticle)particle.cloneConcreteComponent(true, true);
particleClone.setContent(modelGrpSubstitutableElement); //This is where
the error occurs
Am I using the cloneConcreteComponent method correctly. Is there something
else I need to call after particle.setContent?
Also, are there any code-examples on using the Eclipse XSD API to edit
schemas?
Any help is greatly appreciated!
Thanks,
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.03353 seconds