|
|
Re: Choice within a sequence [message #68970 is a reply to message #68927] |
Wed, 26 July 2006 17:21 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------070401030901040001060606
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Stuart,
If, after this line in
XSDPrototypicalSchema.initializeSimpleRecursiveModelGroupDef inition,
// Add the wildcard particle to the model group.
//
modelGroup.getContents().add(wildcardParticle);
I add the following:
XSDParticle choiceParticle = xsdFactory.createXSDParticle();
XSDModelGroup choiceGroup = xsdFactory.createXSDModelGroup();
choiceGroup.setCompositor(XSDCompositor.CHOICE_LITERAL);
choiceParticle.setContent(choiceGroup);
modelGroup.getContents().add(choiceParticle);
this result is produced:
<xsd:group name="simpleRecursiveModelGroupDefinition">
<xsd:annotation/>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
ref="PTS:simpleRecursiveElementDeclaration"/>
<xsd:any namespace="##other" processContents="lax"/>
<xsd:choice/>
</xsd:sequence>
</xsd:group>
Stuart Stephen wrote:
> Hi,
>
> I am trying to work out how I can use emf xsd to create the following
> snippet of XML. I just cannot work it out at the moment.
>
> <xs:element name="itemName">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="ref"/>
> <xs:choice>
> <xs:element name="a"/>
> <xs:element name="b"/>
> </xs:choice>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> Everything is fine until I try to create choice part. How can I add a
> choice to the sequence using the Java API?
>
> Thanks,
> Stuart
>
--------------070401030901040001060606
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Stuart,<br>
<br>
If, after this line in
XSDPrototypicalSchema.initializeSimpleRecursiveModelGroupDef inition, <br>
<blockquote>
|
|
|
Re: Choice within a sequence [message #68991 is a reply to message #68949] |
Wed, 26 July 2006 17:37 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Stuart,
This discussion was related to mapping XML Schema to Ecore. The XSD
model has always supported being able to produce any syntactically valid
XML Schema instance.
Stuart Stephen wrote:
> I see that "choice within a sequence" should have been supported in
> EMF 2.0.
>
> http://www.codegeneration.net/tiki-read_article.php?articleI d=38
>
> The immortal words of Dave Steinberg were:
>
> "Work on EMF 2.0 is progressing, and we should start making builds
> available in the near future. The biggest improvement will be in the
> Ecore representation of models described using XML Schema, which will
> be able to represent mixed content and more complex model groups, like
> a choice within a sequence. The goal is to fully support all features
> of XML Schema."
>
> I am assuming that since I am now using EMF 2.2.0 this should be
> available to me?
>
> I would be very thankful for any help on this matter.
>
> Thanks,
> Stuart
>
|
|
|
|
|
|
Re: Choice within a sequence [message #69116 is a reply to message #69073] |
Thu, 27 July 2006 10:53 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Stuart,
Please open a bugzilla and I'll make that change.
Stuart Stephen wrote:
> In XSDSchemaBuildingTools.addModelGroupDefinition(..) I have put the
> code:
>
> else if(component instanceof XSDModelGroup)
> {
> XSDParticle particle = xsdFactory.createXSDParticle();
> particle.setContent(modelGroup);
> ((XSDModelGroup)component).getContents().add(particle);
> }
>
> This works fine. Perhaps I could suggest it as a change to
> XSDSchemaBuildingTools.java.
>
> Thanks,
> Stuart
>
|
|
|
|
Re: Choice within a sequence [message #598473 is a reply to message #68927] |
Wed, 26 July 2006 17:21 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------070401030901040001060606
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Stuart,
If, after this line in
XSDPrototypicalSchema.initializeSimpleRecursiveModelGroupDef inition,
// Add the wildcard particle to the model group.
//
modelGroup.getContents().add(wildcardParticle);
I add the following:
XSDParticle choiceParticle = xsdFactory.createXSDParticle();
XSDModelGroup choiceGroup = xsdFactory.createXSDModelGroup();
choiceGroup.setCompositor(XSDCompositor.CHOICE_LITERAL);
choiceParticle.setContent(choiceGroup);
modelGroup.getContents().add(choiceParticle);
this result is produced:
<xsd:group name="simpleRecursiveModelGroupDefinition">
<xsd:annotation/>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
ref="PTS:simpleRecursiveElementDeclaration"/>
<xsd:any namespace="##other" processContents="lax"/>
<xsd:choice/>
</xsd:sequence>
</xsd:group>
Stuart Stephen wrote:
> Hi,
>
> I am trying to work out how I can use emf xsd to create the following
> snippet of XML. I just cannot work it out at the moment.
>
> <xs:element name="itemName">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="ref"/>
> <xs:choice>
> <xs:element name="a"/>
> <xs:element name="b"/>
> </xs:choice>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> Everything is fine until I try to create choice part. How can I add a
> choice to the sequence using the Java API?
>
> Thanks,
> Stuart
>
--------------070401030901040001060606
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Stuart,<br>
<br>
If, after this line in
XSDPrototypicalSchema.initializeSimpleRecursiveModelGroupDef inition, <br>
<blockquote>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Choice within a sequence [message #598480 is a reply to message #68949] |
Wed, 26 July 2006 17:37 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Stuart,
This discussion was related to mapping XML Schema to Ecore. The XSD
model has always supported being able to produce any syntactically valid
XML Schema instance.
Stuart Stephen wrote:
> I see that "choice within a sequence" should have been supported in
> EMF 2.0.
>
> http://www.codegeneration.net/tiki-read_article.php?articleI d=38
>
> The immortal words of Dave Steinberg were:
>
> "Work on EMF 2.0 is progressing, and we should start making builds
> available in the near future. The biggest improvement will be in the
> Ecore representation of models described using XML Schema, which will
> be able to represent mixed content and more complex model groups, like
> a choice within a sequence. The goal is to fully support all features
> of XML Schema."
>
> I am assuming that since I am now using EMF 2.2.0 this should be
> available to me?
>
> I would be very thankful for any help on this matter.
>
> Thanks,
> Stuart
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Re: Choice within a sequence [message #598517 is a reply to message #69073] |
Thu, 27 July 2006 10:53 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Stuart,
Please open a bugzilla and I'll make that change.
Stuart Stephen wrote:
> In XSDSchemaBuildingTools.addModelGroupDefinition(..) I have put the
> code:
>
> else if(component instanceof XSDModelGroup)
> {
> XSDParticle particle = xsdFactory.createXSDParticle();
> particle.setContent(modelGroup);
> ((XSDModelGroup)component).getContents().add(particle);
> }
>
> This works fine. Perhaps I could suggest it as a change to
> XSDSchemaBuildingTools.java.
>
> Thanks,
> Stuart
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.06339 seconds