Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Cannot set content of XSD Particle
Cannot set content of XSD Particle [message #602828] Thu, 21 February 2008 19:39
Michael is currently offline Michael
Messages: 43
Registered: July 2009
Member
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
Previous Topic:xml editor content assist
Next Topic:Cannot set content of XSD Particle
Goto Forum:
  


Current Time: Thu Aug 21 02:24:57 EDT 2014

Powered by FUDForum. Page generated in 0.01642 seconds