Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » "fixed" and "default" and "groups"
"fixed" and "default" and "groups" [message #34893] Tue, 06 January 2004 14:54 Go to next message
Eclipse UserFriend
Originally posted by: crscca.bol.net.in

Hi Eddie!
Based on your reply I could figure out where I was going wrong on the
facet question. Thanks.

Two new questions-
1. In a simpleElem ent and a Attribute how do I obtain the values
specified as "fixed" and "default"
2. In the following xsd I have shown maxOccurs in four places. Would all
the four maxOccurs be indicated or is any particular occurence redundant
and left out when I use the api.

Thank you.
Ras


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

<xs:group name="persongroup">
<xs:choice maxOccurs="5">
<xs:element name="firstname" type="xs:string" maxOccurs="4"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="birthday" type="xs:date"/>
</xs:choice>
</xs:group>

<xs:element name="person" type="personinfo"/>
<xs:complexType name="personinfo">
<xs:sequence maxOccurs="2">
<xs:group ref="persongroup" maxOccurs="3"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>


</xs:schema>
Re: "fixed" and "default" and "groups" [message #34940 is a reply to message #34893] Tue, 06 January 2004 15:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: crscca.bol.net.in

(Afterthought: Also maybe the <xs:choice...> does not m ake m uch sense
make it sequence or whatever.)

Raster wrote:

> Hi Eddie!
> Based on your reply I could figure out where I was going wrong on the
> facet question. Thanks.

> Two new questions-
> 1. In a simpleElem ent and a Attribute how do I obtain the values
> specified as "fixed" and "default"
> 2. In the following xsd I have shown maxOccurs in four places. Would all
> the four maxOccurs be indicated or is any particular occurence redundant
> and left out when I use the api.

> Thank you.
> Ras


> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

> <xs:group name="persongroup">
> <xs:choice maxOccurs="5">
> <xs:element name="firstname" type="xs:string" maxOccurs="4"/>
> <xs:element name="lastname" type="xs:string"/>
> <xs:element name="birthday" type="xs:date"/>
> </xs:choice>
> </xs:group>

> <xs:element name="person" type="personinfo"/>
> <xs:complexType name="personinfo">
> <xs:sequence maxOccurs="2">
> <xs:group ref="persongroup" maxOccurs="3"/>
> <xs:element name="country" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>


> </xs:schema>
Re: "fixed" and "default" and "groups" [message #35009 is a reply to message #34893] Tue, 06 January 2004 22:53 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Hi Ras,

Ed's on vacation right now, so let me try to answer your questions...

Raster wrote:
> 1. In a simpleElem ent and a Attribute how do I obtain the values
> specified as "fixed" and "default"

XSDFeature is a common base class for XSDElementDeclaration and
XSDAttributeDeclaration that provides two applicable attributes:
lexicalValue and value. The getLexicalValue() method will give you the
string literal, and getValue() makes the value available as an object.

> 2. In the following xsd I have shown maxOccurs in four places. Would all
> the four maxOccurs be indicated or is any particular occurence redundant
> and left out when I use the api.

Each XSDModelGroup, XSDElementDeclaration and XSDWildcard is contained by an
XSDParticle, which provides the minOccurs and maxOccurs attributes you're
looking for. All but your first maxOccurs are available from the appropriate
XSDParticles. That first maxOccurs is not permitted (whether that model
group is a sequence or a choice).

Let me suggest that you try loading examples like this in the Sample XML
Schema Editor. It will flag any errors, and probably give you some insight
into the model (although, admittedly, it does do things like presenting a
particle and its contents as a single object, in order to match the XML
Schema syntax).

Hope that helps.

Cheers,
Dave
Re: "fixed" and "default" and "groups" [message #35043 is a reply to message #35009] Tue, 06 January 2004 23:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: crscca.bol.net.in

Hi Dave,

Lets hope Ed's enjoying his vacation.

1. Yeah it helped. I also figured out that the getConstraint() method
tels one whether its "fixed" or "default".
2. About the maxOccurs I was using the api and not able to get access to
one of the maxOccurs-namely the first so I suspected that one of those
maxOccurs is not available. I was actually getting the last maxOccurs
twice [also in place of the m axOccurs for the choice(first maxOccurs)].
It must be a bug in my code I guess. I have to clean up my code and sort
that out later. I dont suppose we would get the last maxOccurs in place of
the first maxOccurs. Would we?
3. You mentioned the "Sample XML Schema Editor". Is that something
different from the "Extension Point Schema Editor"? If so where do I get
it?

Thank you.




Dave Steinberg wrote:

> Hi Ras,

> Ed's on vacation right now, so let me try to answer your questions...

> Raster wrote:
> > 1. In a simpleElem ent and a Attribute how do I obtain the values
> > specified as "fixed" and "default"

> XSDFeature is a common base class for XSDElementDeclaration and
> XSDAttributeDeclaration that provides two applicable attributes:
> lexicalValue and value. The getLexicalValue() method will give you the
> string literal, and getValue() makes the value available as an object.

> > 2. In the following xsd I have shown maxOccurs in four places. Would all
> > the four maxOccurs be indicated or is any particular occurence redundant
> > and left out when I use the api.

> Each XSDModelGroup, XSDElementDeclaration and XSDWildcard is contained by an
> XSDParticle, which provides the minOccurs and maxOccurs attributes you're
> looking for. All but your first maxOccurs are available from the appropriate
> XSDParticles. That first maxOccurs is not permitted (whether that model
> group is a sequence or a choice).

> Let me suggest that you try loading examples like this in the Sample XML
> Schema Editor. It will flag any errors, and probably give you some insight
> into the model (although, admittedly, it does do things like presenting a
> particle and its contents as a single object, in order to match the XML
> Schema syntax).

> Hope that helps.

> Cheers,
> Dave
Re: "fixed" and "default" and "groups" [message #35076 is a reply to message #35043] Wed, 07 January 2004 16:28 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Raster wrote:
> 2. About the maxOccurs I was using the api and not able to get access to
> one of the maxOccurs-namely the first so I suspected that one of those
> maxOccurs is not available. I was actually getting the last maxOccurs
> twice [also in place of the m axOccurs for the choice(first maxOccurs)].
> It must be a bug in my code I guess. I have to clean up my code and sort
> that out later. I dont suppose we would get the last maxOccurs in place of
> the first maxOccurs. Would we?

Ras,

I'm not exactly sure what you mean here. The first maxOccurs is invalid
because there's nowhere to put it, so I'm not sure what you mean by getting
it "in place of" the first. If I may, here's the concrete, containment model
for your schema (pardon the ASCII art):

XSDSchema
|
+- XSDModelGroupDefinition ("persongroup")
| |
| +- XSDModelGroup (sequence)
| |
| +- XSDParticle [1,4]
| | |
| | + XSDElementDeclaration ("firstname")
| |
| +- XSDParticle [1,1]
| | |
| | + XSDElementDeclaration ("lastname")
| |
| +- XSDParticle [1,1]
| |
| +- XSDElementDeclaration ("birthday")
|
+- XSDElementDeclaration ("person")
|
+- XSDComplexType ("personinfo")
|
+- XSDParticle [1,2]
|
+- XSDModelGroup (sequence)
|
+- XSDParticle [1,3]
| |
| +- XSDModelGroupDefinition
|
+- XSDParticle [1,1]
|
+- XSDElementDeclaration ("country")

Now, because that last XSDModelGroupDefinition is a reference to
"persongroup", its resolvedModelGroupDefinition reference points back to the
first XSDModelGroupDefinition (whose modelGroup is also pointed at directly
by the containing XSDParticle's term reference).

Notice, then, that the maxOccurs values of 4, 2, and 3 are placed in the
particles containing "firstname", the model group in "personinfo", and the
model group reference, respectively. There is no particle for the top-level
model group definition, so there's nowhere to put a maxOccurs value.

> 3. You mentioned the "Sample XML Schema Editor". Is that something
> different from the "Extension Point Schema Editor"? If so where do I get
> it?

Yes. The Extension Point Schema Editor is part of the Eclipse PDE, and it
only supports the subset of XML Schema allowed in defining extension points.
The Sample XML Schema Editor is built on XSD, and included in the XSD
Runtime package. No one has had the time to make it perfect as an editor
(that's why it's called a sample), but it's the best way to see what's going
on in XSD, and it's excellent at catching errors in your schemas.

In Eclipse, right-click a schema file and select Open With -> Sample XML
Schema Editor. Unfortunately, the Extension Point Schema Editor is the
default for .xsd files in Eclipse, but you can change that via Preferences
-> Workbench -> File Associations.

Cheers,
Dave
Re: "fixed" and "default" and "groups" [message #35350 is a reply to message #35076] Sat, 10 January 2004 14:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: crscca.bol.net.in

Hi Dave,
You really took some pains. Its much appreciated.
Me and a friend are working on a project that involves amongst other
things xsd handling. Our project uses eclipse and tries to extend it for
certain specific purposes. We would be through with the core xsd portion
in a few days. That would be only one file a simple Java class for the
core xsd thingy. Would it be okay if we posted the code (the one java
class) for code-review by you or Ed or anyone who can do that from ibm or
eclipse?

I know how hard it is to look at other peoples code. So we wont feel too
disappointed if you dont.

Ras

Dave Steinberg wrote:

> Raster wrote:
> > 2. About the maxOccurs I was using the api and not able to get access to
> > one of the maxOccurs-namely the first so I suspected that one of those
> > maxOccurs is not available. I was actually getting the last maxOccurs
> > twice [also in place of the m axOccurs for the choice(first maxOccurs)].
> > It must be a bug in my code I guess. I have to clean up my code and sort
> > that out later. I dont suppose we would get the last maxOccurs in place of
> > the first maxOccurs. Would we?

> Ras,

> I'm not exactly sure what you mean here. The first maxOccurs is invalid
> because there's nowhere to put it, so I'm not sure what you mean by getting
> it "in place of" the first. If I may, here's the concrete, containment model
> for your schema (pardon the ASCII art):

> XSDSchema
> |
> +- XSDModelGroupDefinition ("persongroup")
> | |
> | +- XSDModelGroup (sequence)
> | |
> | +- XSDParticle [1,4]
> | | |
> | | + XSDElementDeclaration ("firstname")
> | |
> | +- XSDParticle [1,1]
> | | |
> | | + XSDElementDeclaration ("lastname")
> | |
> | +- XSDParticle [1,1]
> | |
> | +- XSDElementDeclaration ("birthday")
> |
> +- XSDElementDeclaration ("person")
> |
> +- XSDComplexType ("personinfo")
> |
> +- XSDParticle [1,2]
> |
> +- XSDModelGroup (sequence)
> |
> +- XSDParticle [1,3]
> | |
> | +- XSDModelGroupDefinition
> |
> +- XSDParticle [1,1]
> |
> +- XSDElementDeclaration ("country")

> Now, because that last XSDModelGroupDefinition is a reference to
> "persongroup", its resolvedModelGroupDefinition reference points back to the
> first XSDModelGroupDefinition (whose modelGroup is also pointed at directly
> by the containing XSDParticle's term reference).

> Notice, then, that the maxOccurs values of 4, 2, and 3 are placed in the
> particles containing "firstname", the model group in "personinfo", and the
> model group reference, respectively. There is no particle for the top-level
> model group definition, so there's nowhere to put a maxOccurs value.

> > 3. You mentioned the "Sample XML Schema Editor". Is that something
> > different from the "Extension Point Schema Editor"? If so where do I get
> > it?

> Yes. The Extension Point Schema Editor is part of the Eclipse PDE, and it
> only supports the subset of XML Schema allowed in defining extension points.
> The Sample XML Schema Editor is built on XSD, and included in the XSD
> Runtime package. No one has had the time to make it perfect as an editor
> (that's why it's called a sample), but it's the best way to see what's going
> on in XSD, and it's excellent at catching errors in your schemas.

> In Eclipse, right-click a schema file and select Open With -> Sample XML
> Schema Editor. Unfortunately, the Extension Point Schema Editor is the
> default for .xsd files in Eclipse, but you can change that via Preferences
> -> Workbench -> File Associations.

> Cheers,
> Dave
Re: "fixed" and "default" and "groups" [message #35384 is a reply to message #35350] Mon, 12 January 2004 12:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: crscca.bol.net.in

Hi,
having spent some time this weekend we are clearer on the api and so we
dont need the code-review.

A few doubts exist which we shall clarify with you any way later.

Thanks.


Raster wrote:

> Hi Dave,
> You really took some pains. Its much appreciated.
> Me and a friend are working on a project that involves amongst other
> things xsd handling. Our project uses eclipse and tries to extend it for
> certain specific purposes. We would be through with the core xsd portion
> in a few days. That would be only one file a simple Java class for the
> core xsd thingy. Would it be okay if we posted the code (the one java
> class) for code-review by you or Ed or anyone who can do that from ibm or
> eclipse?

> I know how hard it is to look at other peoples code. So we wont feel too
> disappointed if you dont.

> Ras

> Dave Steinberg wrote:

> > Raster wrote:
> > > 2. About the maxOccurs I was using the api and not able to get access
to
> > > one of the maxOccurs-namely the first so I suspected that one of those
> > > maxOccurs is not available. I was actually getting the last maxOccurs
> > > twice [also in place of the m axOccurs for the choice(first maxOccurs)].
> > > It must be a bug in my code I guess. I have to clean up my code and sort
> > > that out later. I dont suppose we would get the last maxOccurs in place
of
> > > the first maxOccurs. Would we?

> > Ras,

> > I'm not exactly sure what you mean here. The first maxOccurs is invalid
> > because there's nowhere to put it, so I'm not sure what you mean by
getting
> > it "in place of" the first. If I may, here's the concrete, containment
model
> > for your schema (pardon the ASCII art):

> > XSDSchema
> > |
> > +- XSDModelGroupDefinition ("persongroup")
> > | |
> > | +- XSDModelGroup (sequence)
> > | |
> > | +- XSDParticle [1,4]
> > | | |
> > | | + XSDElementDeclaration ("firstname")
> > | |
> > | +- XSDParticle [1,1]
> > | | |
> > | | + XSDElementDeclaration ("lastname")
> > | |
> > | +- XSDParticle [1,1]
> > | |
> > | +- XSDElementDeclaration ("birthday")
> > |
> > +- XSDElementDeclaration ("person")
> > |
> > +- XSDComplexType ("personinfo")
> > |
> > +- XSDParticle [1,2]
> > |
> > +- XSDModelGroup (sequence)
> > |
> > +- XSDParticle [1,3]
> > | |
> > | +- XSDModelGroupDefinition
> > |
> > +- XSDParticle [1,1]
> > |
> > +- XSDElementDeclaration ("country")

> > Now, because that last XSDModelGroupDefinition is a reference to
> > "persongroup", its resolvedModelGroupDefinition reference points back to
the
> > first XSDModelGroupDefinition (whose modelGroup is also pointed at
directly
> > by the containing XSDParticle's term reference).

> > Notice, then, that the maxOccurs values of 4, 2, and 3 are placed in the
> > particles containing "firstname", the model group in "personinfo", and the
> > model group reference, respectively. There is no particle for the
top-level
> > model group definition, so there's nowhere to put a maxOccurs value.

> > > 3. You mentioned the "Sample XML Schema Editor". Is that something
> > > different from the "Extension Point Schema Editor"? If so where do I get
> > > it?

> > Yes. The Extension Point Schema Editor is part of the Eclipse PDE, and it
> > only supports the subset of XML Schema allowed in defining extension
points.
> > The Sample XML Schema Editor is built on XSD, and included in the XSD
> > Runtime package. No one has had the time to make it perfect as an editor
> > (that's why it's called a sample), but it's the best way to see what's
going
> > on in XSD, and it's excellent at catching errors in your schemas.

> > In Eclipse, right-click a schema file and select Open With -> Sample XML
> > Schema Editor. Unfortunately, the Extension Point Schema Editor is the
> > default for .xsd files in Eclipse, but you can change that via Preferences
> > -> Workbench -> File Associations.

> > Cheers,
> > Dave
Re: "fixed" and "default" and "groups" [message #35418 is a reply to message #35384] Mon, 12 January 2004 14:06 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Raster wrote:

> having spent some time this weekend we are clearer on the api and so we
> dont need the code-review.
>
> A few doubts exist which we shall clarify with you any way later.

Hi Ras,

I'm glad to hear that you're starting to grok the model. It's not a simple
or small thing to get your head around.

We're happy to help with whatever doubts still exist. Ask away! :)

Cheers,
Dave
Re: "fixed" and "default" and "groups" [message #582217 is a reply to message #34893] Tue, 06 January 2004 15:02 Go to previous message
Raster Mising name is currently offline Raster Mising nameFriend
Messages: 75
Registered: July 2009
Member
(Afterthought: Also maybe the <xs:choice...> does not m ake m uch sense
make it sequence or whatever.)

Raster wrote:

> Hi Eddie!
> Based on your reply I could figure out where I was going wrong on the
> facet question. Thanks.

> Two new questions-
> 1. In a simpleElem ent and a Attribute how do I obtain the values
> specified as "fixed" and "default"
> 2. In the following xsd I have shown maxOccurs in four places. Would all
> the four maxOccurs be indicated or is any particular occurence redundant
> and left out when I use the api.

> Thank you.
> Ras


> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

> <xs:group name="persongroup">
> <xs:choice maxOccurs="5">
> <xs:element name="firstname" type="xs:string" maxOccurs="4"/>
> <xs:element name="lastname" type="xs:string"/>
> <xs:element name="birthday" type="xs:date"/>
> </xs:choice>
> </xs:group>

> <xs:element name="person" type="personinfo"/>
> <xs:complexType name="personinfo">
> <xs:sequence maxOccurs="2">
> <xs:group ref="persongroup" maxOccurs="3"/>
> <xs:element name="country" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>


> </xs:schema>
Re: "fixed" and "default" and "groups" [message #582257 is a reply to message #34893] Tue, 06 January 2004 22:53 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Hi Ras,

Ed's on vacation right now, so let me try to answer your questions...

Raster wrote:
> 1. In a simpleElem ent and a Attribute how do I obtain the values
> specified as "fixed" and "default"

XSDFeature is a common base class for XSDElementDeclaration and
XSDAttributeDeclaration that provides two applicable attributes:
lexicalValue and value. The getLexicalValue() method will give you the
string literal, and getValue() makes the value available as an object.

> 2. In the following xsd I have shown maxOccurs in four places. Would all
> the four maxOccurs be indicated or is any particular occurence redundant
> and left out when I use the api.

Each XSDModelGroup, XSDElementDeclaration and XSDWildcard is contained by an
XSDParticle, which provides the minOccurs and maxOccurs attributes you're
looking for. All but your first maxOccurs are available from the appropriate
XSDParticles. That first maxOccurs is not permitted (whether that model
group is a sequence or a choice).

Let me suggest that you try loading examples like this in the Sample XML
Schema Editor. It will flag any errors, and probably give you some insight
into the model (although, admittedly, it does do things like presenting a
particle and its contents as a single object, in order to match the XML
Schema syntax).

Hope that helps.

Cheers,
Dave
Re: "fixed" and "default" and "groups" [message #582273 is a reply to message #35009] Tue, 06 January 2004 23:58 Go to previous message
Raster Mising name is currently offline Raster Mising nameFriend
Messages: 75
Registered: July 2009
Member
Hi Dave,

Lets hope Ed's enjoying his vacation.

1. Yeah it helped. I also figured out that the getConstraint() method
tels one whether its "fixed" or "default".
2. About the maxOccurs I was using the api and not able to get access to
one of the maxOccurs-namely the first so I suspected that one of those
maxOccurs is not available. I was actually getting the last maxOccurs
twice [also in place of the m axOccurs for the choice(first maxOccurs)].
It must be a bug in my code I guess. I have to clean up my code and sort
that out later. I dont suppose we would get the last maxOccurs in place of
the first maxOccurs. Would we?
3. You mentioned the "Sample XML Schema Editor". Is that something
different from the "Extension Point Schema Editor"? If so where do I get
it?

Thank you.




Dave Steinberg wrote:

> Hi Ras,

> Ed's on vacation right now, so let me try to answer your questions...

> Raster wrote:
> > 1. In a simpleElem ent and a Attribute how do I obtain the values
> > specified as "fixed" and "default"

> XSDFeature is a common base class for XSDElementDeclaration and
> XSDAttributeDeclaration that provides two applicable attributes:
> lexicalValue and value. The getLexicalValue() method will give you the
> string literal, and getValue() makes the value available as an object.

> > 2. In the following xsd I have shown maxOccurs in four places. Would all
> > the four maxOccurs be indicated or is any particular occurence redundant
> > and left out when I use the api.

> Each XSDModelGroup, XSDElementDeclaration and XSDWildcard is contained by an
> XSDParticle, which provides the minOccurs and maxOccurs attributes you're
> looking for. All but your first maxOccurs are available from the appropriate
> XSDParticles. That first maxOccurs is not permitted (whether that model
> group is a sequence or a choice).

> Let me suggest that you try loading examples like this in the Sample XML
> Schema Editor. It will flag any errors, and probably give you some insight
> into the model (although, admittedly, it does do things like presenting a
> particle and its contents as a single object, in order to match the XML
> Schema syntax).

> Hope that helps.

> Cheers,
> Dave
Re: "fixed" and "default" and "groups" [message #582284 is a reply to message #35043] Wed, 07 January 2004 16:28 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Raster wrote:
> 2. About the maxOccurs I was using the api and not able to get access to
> one of the maxOccurs-namely the first so I suspected that one of those
> maxOccurs is not available. I was actually getting the last maxOccurs
> twice [also in place of the m axOccurs for the choice(first maxOccurs)].
> It must be a bug in my code I guess. I have to clean up my code and sort
> that out later. I dont suppose we would get the last maxOccurs in place of
> the first maxOccurs. Would we?

Ras,

I'm not exactly sure what you mean here. The first maxOccurs is invalid
because there's nowhere to put it, so I'm not sure what you mean by getting
it "in place of" the first. If I may, here's the concrete, containment model
for your schema (pardon the ASCII art):

XSDSchema
|
+- XSDModelGroupDefinition ("persongroup")
| |
| +- XSDModelGroup (sequence)
| |
| +- XSDParticle [1,4]
| | |
| | + XSDElementDeclaration ("firstname")
| |
| +- XSDParticle [1,1]
| | |
| | + XSDElementDeclaration ("lastname")
| |
| +- XSDParticle [1,1]
| |
| +- XSDElementDeclaration ("birthday")
|
+- XSDElementDeclaration ("person")
|
+- XSDComplexType ("personinfo")
|
+- XSDParticle [1,2]
|
+- XSDModelGroup (sequence)
|
+- XSDParticle [1,3]
| |
| +- XSDModelGroupDefinition
|
+- XSDParticle [1,1]
|
+- XSDElementDeclaration ("country")

Now, because that last XSDModelGroupDefinition is a reference to
"persongroup", its resolvedModelGroupDefinition reference points back to the
first XSDModelGroupDefinition (whose modelGroup is also pointed at directly
by the containing XSDParticle's term reference).

Notice, then, that the maxOccurs values of 4, 2, and 3 are placed in the
particles containing "firstname", the model group in "personinfo", and the
model group reference, respectively. There is no particle for the top-level
model group definition, so there's nowhere to put a maxOccurs value.

> 3. You mentioned the "Sample XML Schema Editor". Is that something
> different from the "Extension Point Schema Editor"? If so where do I get
> it?

Yes. The Extension Point Schema Editor is part of the Eclipse PDE, and it
only supports the subset of XML Schema allowed in defining extension points.
The Sample XML Schema Editor is built on XSD, and included in the XSD
Runtime package. No one has had the time to make it perfect as an editor
(that's why it's called a sample), but it's the best way to see what's going
on in XSD, and it's excellent at catching errors in your schemas.

In Eclipse, right-click a schema file and select Open With -> Sample XML
Schema Editor. Unfortunately, the Extension Point Schema Editor is the
default for .xsd files in Eclipse, but you can change that via Preferences
-> Workbench -> File Associations.

Cheers,
Dave
Re: "fixed" and "default" and "groups" [message #582426 is a reply to message #35076] Sat, 10 January 2004 14:59 Go to previous message
Raster Mising name is currently offline Raster Mising nameFriend
Messages: 75
Registered: July 2009
Member
Hi Dave,
You really took some pains. Its much appreciated.
Me and a friend are working on a project that involves amongst other
things xsd handling. Our project uses eclipse and tries to extend it for
certain specific purposes. We would be through with the core xsd portion
in a few days. That would be only one file a simple Java class for the
core xsd thingy. Would it be okay if we posted the code (the one java
class) for code-review by you or Ed or anyone who can do that from ibm or
eclipse?

I know how hard it is to look at other peoples code. So we wont feel too
disappointed if you dont.

Ras

Dave Steinberg wrote:

> Raster wrote:
> > 2. About the maxOccurs I was using the api and not able to get access to
> > one of the maxOccurs-namely the first so I suspected that one of those
> > maxOccurs is not available. I was actually getting the last maxOccurs
> > twice [also in place of the m axOccurs for the choice(first maxOccurs)].
> > It must be a bug in my code I guess. I have to clean up my code and sort
> > that out later. I dont suppose we would get the last maxOccurs in place of
> > the first maxOccurs. Would we?

> Ras,

> I'm not exactly sure what you mean here. The first maxOccurs is invalid
> because there's nowhere to put it, so I'm not sure what you mean by getting
> it "in place of" the first. If I may, here's the concrete, containment model
> for your schema (pardon the ASCII art):

> XSDSchema
> |
> +- XSDModelGroupDefinition ("persongroup")
> | |
> | +- XSDModelGroup (sequence)
> | |
> | +- XSDParticle [1,4]
> | | |
> | | + XSDElementDeclaration ("firstname")
> | |
> | +- XSDParticle [1,1]
> | | |
> | | + XSDElementDeclaration ("lastname")
> | |
> | +- XSDParticle [1,1]
> | |
> | +- XSDElementDeclaration ("birthday")
> |
> +- XSDElementDeclaration ("person")
> |
> +- XSDComplexType ("personinfo")
> |
> +- XSDParticle [1,2]
> |
> +- XSDModelGroup (sequence)
> |
> +- XSDParticle [1,3]
> | |
> | +- XSDModelGroupDefinition
> |
> +- XSDParticle [1,1]
> |
> +- XSDElementDeclaration ("country")

> Now, because that last XSDModelGroupDefinition is a reference to
> "persongroup", its resolvedModelGroupDefinition reference points back to the
> first XSDModelGroupDefinition (whose modelGroup is also pointed at directly
> by the containing XSDParticle's term reference).

> Notice, then, that the maxOccurs values of 4, 2, and 3 are placed in the
> particles containing "firstname", the model group in "personinfo", and the
> model group reference, respectively. There is no particle for the top-level
> model group definition, so there's nowhere to put a maxOccurs value.

> > 3. You mentioned the "Sample XML Schema Editor". Is that something
> > different from the "Extension Point Schema Editor"? If so where do I get
> > it?

> Yes. The Extension Point Schema Editor is part of the Eclipse PDE, and it
> only supports the subset of XML Schema allowed in defining extension points.
> The Sample XML Schema Editor is built on XSD, and included in the XSD
> Runtime package. No one has had the time to make it perfect as an editor
> (that's why it's called a sample), but it's the best way to see what's going
> on in XSD, and it's excellent at catching errors in your schemas.

> In Eclipse, right-click a schema file and select Open With -> Sample XML
> Schema Editor. Unfortunately, the Extension Point Schema Editor is the
> default for .xsd files in Eclipse, but you can change that via Preferences
> -> Workbench -> File Associations.

> Cheers,
> Dave
Re: "fixed" and "default" and "groups" [message #582459 is a reply to message #35350] Mon, 12 January 2004 12:30 Go to previous message
Raster Mising name is currently offline Raster Mising nameFriend
Messages: 75
Registered: July 2009
Member
Hi,
having spent some time this weekend we are clearer on the api and so we
dont need the code-review.

A few doubts exist which we shall clarify with you any way later.

Thanks.


Raster wrote:

> Hi Dave,
> You really took some pains. Its much appreciated.
> Me and a friend are working on a project that involves amongst other
> things xsd handling. Our project uses eclipse and tries to extend it for
> certain specific purposes. We would be through with the core xsd portion
> in a few days. That would be only one file a simple Java class for the
> core xsd thingy. Would it be okay if we posted the code (the one java
> class) for code-review by you or Ed or anyone who can do that from ibm or
> eclipse?

> I know how hard it is to look at other peoples code. So we wont feel too
> disappointed if you dont.

> Ras

> Dave Steinberg wrote:

> > Raster wrote:
> > > 2. About the maxOccurs I was using the api and not able to get access
to
> > > one of the maxOccurs-namely the first so I suspected that one of those
> > > maxOccurs is not available. I was actually getting the last maxOccurs
> > > twice [also in place of the m axOccurs for the choice(first maxOccurs)].
> > > It must be a bug in my code I guess. I have to clean up my code and sort
> > > that out later. I dont suppose we would get the last maxOccurs in place
of
> > > the first maxOccurs. Would we?

> > Ras,

> > I'm not exactly sure what you mean here. The first maxOccurs is invalid
> > because there's nowhere to put it, so I'm not sure what you mean by
getting
> > it "in place of" the first. If I may, here's the concrete, containment
model
> > for your schema (pardon the ASCII art):

> > XSDSchema
> > |
> > +- XSDModelGroupDefinition ("persongroup")
> > | |
> > | +- XSDModelGroup (sequence)
> > | |
> > | +- XSDParticle [1,4]
> > | | |
> > | | + XSDElementDeclaration ("firstname")
> > | |
> > | +- XSDParticle [1,1]
> > | | |
> > | | + XSDElementDeclaration ("lastname")
> > | |
> > | +- XSDParticle [1,1]
> > | |
> > | +- XSDElementDeclaration ("birthday")
> > |
> > +- XSDElementDeclaration ("person")
> > |
> > +- XSDComplexType ("personinfo")
> > |
> > +- XSDParticle [1,2]
> > |
> > +- XSDModelGroup (sequence)
> > |
> > +- XSDParticle [1,3]
> > | |
> > | +- XSDModelGroupDefinition
> > |
> > +- XSDParticle [1,1]
> > |
> > +- XSDElementDeclaration ("country")

> > Now, because that last XSDModelGroupDefinition is a reference to
> > "persongroup", its resolvedModelGroupDefinition reference points back to
the
> > first XSDModelGroupDefinition (whose modelGroup is also pointed at
directly
> > by the containing XSDParticle's term reference).

> > Notice, then, that the maxOccurs values of 4, 2, and 3 are placed in the
> > particles containing "firstname", the model group in "personinfo", and the
> > model group reference, respectively. There is no particle for the
top-level
> > model group definition, so there's nowhere to put a maxOccurs value.

> > > 3. You mentioned the "Sample XML Schema Editor". Is that something
> > > different from the "Extension Point Schema Editor"? If so where do I get
> > > it?

> > Yes. The Extension Point Schema Editor is part of the Eclipse PDE, and it
> > only supports the subset of XML Schema allowed in defining extension
points.
> > The Sample XML Schema Editor is built on XSD, and included in the XSD
> > Runtime package. No one has had the time to make it perfect as an editor
> > (that's why it's called a sample), but it's the best way to see what's
going
> > on in XSD, and it's excellent at catching errors in your schemas.

> > In Eclipse, right-click a schema file and select Open With -> Sample XML
> > Schema Editor. Unfortunately, the Extension Point Schema Editor is the
> > default for .xsd files in Eclipse, but you can change that via Preferences
> > -> Workbench -> File Associations.

> > Cheers,
> > Dave
Re: "fixed" and "default" and "groups" [message #582471 is a reply to message #35384] Mon, 12 January 2004 14:06 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Raster wrote:

> having spent some time this weekend we are clearer on the api and so we
> dont need the code-review.
>
> A few doubts exist which we shall clarify with you any way later.

Hi Ras,

I'm glad to hear that you're starting to grok the model. It's not a simple
or small thing to get your head around.

We're happy to help with whatever doubts still exist. Ask away! :)

Cheers,
Dave
Previous Topic:problem with headless xml schema -> genmodel
Next Topic:use="required"/use="optional"
Goto Forum:
  


Current Time: Wed Aug 12 21:08:35 GMT 2020

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

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

Back to the top