how to find the element that is refered using ref attribute. [message #35560] |
Tue, 13 January 2004 07:36 |
Eclipse User |
|
|
|
Originally posted by: mmahesh.firstam.com
in the following XSD how to get the element that are refered in the
REQUEST_GROUP in the complex type element as ref.
<xsd:element name="REQUEST_GROUP">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="REQUESTING_PARTY" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element ref="RECEIVING_PARTY" minOccurs="0"/>
<xsd:element ref="SUBMITTING_PARTY" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element ref="REQUEST" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="MISMOVersionID" type="xsd:string" fixed="2.3"/>
<xsd:attribute name="BundleProductIdentifier_Extension"
type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="REQUEST">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="KEY" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="REQUEST_DATA" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="RequestDatetime" type="xsd:string" use="optional"/>
<xsd:attribute name="InternalAccountIdentifier" type="xsd:string"
use="optional"/>
<xsd:attribute name="LoginAccountIdentifier" type="xsd:string"
use="optional"/>
<xsd:attribute name="LoginAccountPassword" type="xsd:string"
use="optional"/>
<xsd:attribute name="RequestingPartyBranchIdentifier" type="xsd:string"
use="optional"/>
</xsd:complexType>
</xsd:element>
|
|
|
Re: how to find the element that is refered using ref attribute. [message #35627 is a reply to message #35560] |
Tue, 13 January 2004 13:24 |
Eclipse User |
|
|
|
Originally posted by: crscca.bol.net.in
I use the following techniques shown in some of my code. It should solve
your problem I think.
boolean isRef = elementDec.isElementDeclarationReference();
private static XSDElementDeclaration
resolveElementDeclaration(XSDElementDeclaration elementDec)
{
if (elementDec.isElementDeclarationReference())
{
elementDec = elementDec.getResolvedElementDeclaration();
if (elementDec.isElementDeclarationReference())
elementDec = resolveElementDeclaration(elementDec);
}
return elementDec;
}
Raster
mahesh wrote:
> in the following XSD how to get the element that are refered in the
> REQUEST_GROUP in the complex type element as ref.
> <xsd:element name="REQUEST_GROUP">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="REQUESTING_PARTY" minOccurs="0"
> maxOccurs="unbounded"/>
> <xsd:element ref="RECEIVING_PARTY" minOccurs="0"/>
> <xsd:element ref="SUBMITTING_PARTY" minOccurs="0"
> maxOccurs="unbounded"/>
> <xsd:element ref="REQUEST" minOccurs="0" maxOccurs="unbounded"/>
> </xsd:sequence>
> <xsd:attribute name="MISMOVersionID" type="xsd:string" fixed="2.3"/>
> <xsd:attribute name="BundleProductIdentifier_Extension"
> type="xsd:string" use="optional"/>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="REQUEST">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="KEY" minOccurs="0" maxOccurs="unbounded"/>
> <xsd:element ref="REQUEST_DATA" minOccurs="0" maxOccurs="unbounded"/>
> </xsd:sequence>
> <xsd:attribute name="RequestDatetime" type="xsd:string" use="optional"/>
> <xsd:attribute name="InternalAccountIdentifier" type="xsd:string"
> use="optional"/>
> <xsd:attribute name="LoginAccountIdentifier" type="xsd:string"
> use="optional"/>
> <xsd:attribute name="LoginAccountPassword" type="xsd:string"
> use="optional"/>
> <xsd:attribute name="RequestingPartyBranchIdentifier" type="xsd:string"
> use="optional"/>
> </xsd:complexType>
> </xsd:element>
|
|
|
Re: how to find the element that is refered using ref attribute. [message #35830 is a reply to message #35627] |
Wed, 14 January 2004 14:30 |
David Steinberg Messages: 489 Registered: July 2009 |
Senior Member |
|
|
Raster wrote:
> private static XSDElementDeclaration
> resolveElementDeclaration(XSDElementDeclaration elementDec)
> {
> if (elementDec.isElementDeclarationReference())
> {
> elementDec = elementDec.getResolvedElementDeclaration();
> if (elementDec.isElementDeclarationReference())
> elementDec = resolveElementDeclaration(elementDec);
> }
> return elementDec;
> }
Hi Raster,
If an XSDElementDeclaration represents a real declaration, and not a
reference (i.e. if isElementDeclarationReference() is false), then
getReslvedElementDeclaration() will simply return the object itself.
Moreover, the object returned by getResolvedElementDeclaration() always
represents a real declaration (i.e. isElementDeclarationReference() is
false). So, any use of this resolveElementDeclaration(elementDec) method
could simply be replaced by elementDec.getResolvedElementDeclaration().
Also, note that XSDAttributeDeclaration.getResolvedAttributeDeclaration(),
XSDAttributeGroupDefinition.getResolvedAttributeGroupDefinit ion, and
XSDModelGroupDefinition.getResolvedModelGroupDefinition() work the same way.
Cheers,
Dave
|
|
|
Re: how to find the element that is refered using ref attribute. [message #35929 is a reply to message #35830] |
Thu, 15 January 2004 13:25 |
Eclipse User |
|
|
|
Originally posted by: crscca.bol.net.in
I thought so myself but was playing safe hence the recursive method. In
any case I was sure you would react if I was wrong which you did. Thanks
for correcting me.
Thanks.
Dave Steinberg wrote:
> Raster wrote:
> > private static XSDElementDeclaration
> > resolveElementDeclaration(XSDElementDeclaration elementDec)
> > {
> > if (elementDec.isElementDeclarationReference())
> > {
> > elementDec = elementDec.getResolvedElementDeclaration();
> > if (elementDec.isElementDeclarationReference())
> > elementDec = resolveElementDeclaration(elementDec);
> > }
> > return elementDec;
> > }
> Hi Raster,
> If an XSDElementDeclaration represents a real declaration, and not a
> reference (i.e. if isElementDeclarationReference() is false), then
> getReslvedElementDeclaration() will simply return the object itself.
> Moreover, the object returned by getResolvedElementDeclaration() always
> represents a real declaration (i.e. isElementDeclarationReference() is
> false). So, any use of this resolveElementDeclaration(elementDec) method
> could simply be replaced by elementDec.getResolvedElementDeclaration().
> Also, note that XSDAttributeDeclaration.getResolvedAttributeDeclaration(),
> XSDAttributeGroupDefinition.getResolvedAttributeGroupDefinit ion, and
> XSDModelGroupDefinition.getResolvedModelGroupDefinition() work the same way.
> Cheers,
> Dave
|
|
|
|
Re: how to find the element that is refered using ref attribute. [message #582717 is a reply to message #35627] |
Wed, 14 January 2004 14:30 |
David Steinberg Messages: 489 Registered: July 2009 |
Senior Member |
|
|
Raster wrote:
> private static XSDElementDeclaration
> resolveElementDeclaration(XSDElementDeclaration elementDec)
> {
> if (elementDec.isElementDeclarationReference())
> {
> elementDec = elementDec.getResolvedElementDeclaration();
> if (elementDec.isElementDeclarationReference())
> elementDec = resolveElementDeclaration(elementDec);
> }
> return elementDec;
> }
Hi Raster,
If an XSDElementDeclaration represents a real declaration, and not a
reference (i.e. if isElementDeclarationReference() is false), then
getReslvedElementDeclaration() will simply return the object itself.
Moreover, the object returned by getResolvedElementDeclaration() always
represents a real declaration (i.e. isElementDeclarationReference() is
false). So, any use of this resolveElementDeclaration(elementDec) method
could simply be replaced by elementDec.getResolvedElementDeclaration().
Also, note that XSDAttributeDeclaration.getResolvedAttributeDeclaration(),
XSDAttributeGroupDefinition.getResolvedAttributeGroupDefinit ion, and
XSDModelGroupDefinition.getResolvedModelGroupDefinition() work the same way.
Cheers,
Dave
|
|
|
Re: how to find the element that is refered using ref attribute. [message #582760 is a reply to message #35830] |
Thu, 15 January 2004 13:25 |
Raster R Messages: 77 Registered: July 2009 |
Member |
|
|
I thought so myself but was playing safe hence the recursive method. In
any case I was sure you would react if I was wrong which you did. Thanks
for correcting me.
Thanks.
Dave Steinberg wrote:
> Raster wrote:
> > private static XSDElementDeclaration
> > resolveElementDeclaration(XSDElementDeclaration elementDec)
> > {
> > if (elementDec.isElementDeclarationReference())
> > {
> > elementDec = elementDec.getResolvedElementDeclaration();
> > if (elementDec.isElementDeclarationReference())
> > elementDec = resolveElementDeclaration(elementDec);
> > }
> > return elementDec;
> > }
> Hi Raster,
> If an XSDElementDeclaration represents a real declaration, and not a
> reference (i.e. if isElementDeclarationReference() is false), then
> getReslvedElementDeclaration() will simply return the object itself.
> Moreover, the object returned by getResolvedElementDeclaration() always
> represents a real declaration (i.e. isElementDeclarationReference() is
> false). So, any use of this resolveElementDeclaration(elementDec) method
> could simply be replaced by elementDec.getResolvedElementDeclaration().
> Also, note that XSDAttributeDeclaration.getResolvedAttributeDeclaration(),
> XSDAttributeGroupDefinition.getResolvedAttributeGroupDefinit ion, and
> XSDModelGroupDefinition.getResolvedModelGroupDefinition() work the same way.
> Cheers,
> Dave
|
|
|
Powered by
FUDForum. Page generated in 0.17629 seconds