Skip to main content



      Home
Home » Archived » XML Schema Definition (XSD) » When can XSDElementDeclaration.getTypeDefinition return null?
When can XSDElementDeclaration.getTypeDefinition return null? [message #40299] Sat, 03 April 2004 12:15 Go to next message
Eclipse UserFriend
Originally posted by: stibrany.tenax.sk

Hello.

XSDElementDeclaration.getTypeDefinitions returns null sometimes, and I'd
like
to know in which situations can this happen.

-Peter Stibrany
Re: When can XSDElementDeclaration.getTypeDefinition return null? [message #40331 is a reply to message #40299] Sat, 03 April 2004 12:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stibrany.tenax.sk

Peter Stibrany wrote:

> Hello.

> XSDElementDeclaration.getTypeDefinitions returns null sometimes, and I'd
> like
> to know in which situations can this happen.

> -Peter Stibrany

I add example, where I get null. Consider this part of schema:
...
<xs:element name="schema" id="schema">
<xs:annotation>
<xs:documentation
source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="xs:openAttrs">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
(!) <xs:element ref="xs:include"/>
<xs:element ref="xs:import"/>
<xs:element ref="xs:redefine"/>
<xs:element ref="xs:annotation"/>
...

taken from Schema for Schemas xml document. When I get to
ElementDeclaration of marked element <xs:element ref="xs:include" />, then
calling getTypeDefinition gives me null. There is ref attribute pointing
to xs:include, so I would expect to get typeDefinition from xs:include
element declaration.

Thank you for explanation.
-Peter Stibrany
Re: When can XSDElementDeclaration.getTypeDefinition return null? [message #40392 is a reply to message #40331] Sat, 03 April 2004 12:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stibrany.tenax.sk

I just found XSDElementDeclaration.getResolvedElementDeclaration() method.
Resolved ED gives me correct type definition. Should I always call
getResolvedElementDeclaration() if type definition is what I need?

Thank you for answering.
-Peter Stibrany
Re: When can XSDElementDeclaration.getTypeDefinition return null? [message #40484 is a reply to message #40392] Mon, 05 April 2004 06:35 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Peter,

When in doubt, calling getResolvedElementDeclaration() is always safe since
if it's already resolved, it will return itself. Note that depending on how
you traverse the model, you may not need to do this. For example, if you have
an XSDParticle and call getContent, you may get an XSDElementDeclaration
reference that needs to be resolved, but if you call getTerm, you'll get the
resolved result directly. If you are simply analysing the model, you probably
want to stick to traversing the abstract "infoset properties," and avoid the
concrete references.


Peter Stibrany wrote:

> I just found XSDElementDeclaration.getResolvedElementDeclaration() method.
> Resolved ED gives me correct type definition. Should I always call
> getResolvedElementDeclaration() if type definition is what I need?
>
> Thank you for answering.
> -Peter Stibrany
Re: When can XSDElementDeclaration.getTypeDefinition return null? [message #585001 is a reply to message #40299] Sat, 03 April 2004 12:21 Go to previous message
Eclipse UserFriend
Peter Stibrany wrote:

> Hello.

> XSDElementDeclaration.getTypeDefinitions returns null sometimes, and I'd
> like
> to know in which situations can this happen.

> -Peter Stibrany

I add example, where I get null. Consider this part of schema:
...
<xs:element name="schema" id="schema">
<xs:annotation>
<xs:documentation
source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="xs:openAttrs">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
(!) <xs:element ref="xs:include"/>
<xs:element ref="xs:import"/>
<xs:element ref="xs:redefine"/>
<xs:element ref="xs:annotation"/>
...

taken from Schema for Schemas xml document. When I get to
ElementDeclaration of marked element <xs:element ref="xs:include" />, then
calling getTypeDefinition gives me null. There is ref attribute pointing
to xs:include, so I would expect to get typeDefinition from xs:include
element declaration.

Thank you for explanation.
-Peter Stibrany
Re: When can XSDElementDeclaration.getTypeDefinition return null? [message #585024 is a reply to message #40331] Sat, 03 April 2004 12:33 Go to previous message
Eclipse UserFriend
I just found XSDElementDeclaration.getResolvedElementDeclaration() method.
Resolved ED gives me correct type definition. Should I always call
getResolvedElementDeclaration() if type definition is what I need?

Thank you for answering.
-Peter Stibrany
Re: When can XSDElementDeclaration.getTypeDefinition return null? [message #585080 is a reply to message #40392] Mon, 05 April 2004 06:35 Go to previous message
Eclipse UserFriend
Peter,

When in doubt, calling getResolvedElementDeclaration() is always safe since
if it's already resolved, it will return itself. Note that depending on how
you traverse the model, you may not need to do this. For example, if you have
an XSDParticle and call getContent, you may get an XSDElementDeclaration
reference that needs to be resolved, but if you call getTerm, you'll get the
resolved result directly. If you are simply analysing the model, you probably
want to stick to traversing the abstract "infoset properties," and avoid the
concrete references.


Peter Stibrany wrote:

> I just found XSDElementDeclaration.getResolvedElementDeclaration() method.
> Resolved ED gives me correct type definition. Should I always call
> getResolvedElementDeclaration() if type definition is what I need?
>
> Thank you for answering.
> -Peter Stibrany
Previous Topic:[xsd.resources.jar] Cache listing
Next Topic:referenced schema feature/reference
Goto Forum:
  


Current Time: Tue Jul 08 11:12:15 EDT 2025

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

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

Back to the top