|
Re: When can XSDElementDeclaration.getTypeDefinition return null? [message #40331 is a reply to message #40299] |
Sat, 03 April 2004 17:21 |
Eclipse User |
|
|
|
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 #40484 is a reply to message #40392] |
Mon, 05 April 2004 10:35 |
Eclipse User |
|
|
|
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 #585080 is a reply to message #40392] |
Mon, 05 April 2004 10:35 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
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
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03943 seconds