Home » Archived » XML Schema Definition (XSD) » Facets retrieving - getFacetContents
Facets retrieving - getFacetContents [message #75338] |
Mon, 25 August 2008 02:11  |
Eclipse User |
|
|
|
Hi Ed and all,
I would like to know, what's the best way in retrieving facets. I noticed
a thread saying that we should use getFacetContents but which one should I
use in order to easily retrieve the facets, faster and better. Is it using
SimpleTypeDefinition or TypeDefinition directly?
I have something like this:
<!-- xsd snippet starts here -->
<xsd:complexType name="orderType">
<xsd:sequence>
<xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
<!-- xsd snippet ends here -->
//java code starts here
XSDParticle particle = (XSDParticle)obj;
XSDElementDeclaration element = (XSDElementDeclaration)
particle.getContent();
if(null != element.getTypeDefinition()) {
XSDTypeDefinition typeDef = element.getTypeDefinition();
XSDSimpleTypeDefinition simpleTypeDef = null;
if(null != typeDef.getSimpleType()) {
simpleTypeDef = typeDef.getSimpleType();
// this is the question:
//should I use this simpleTypeDef here???? or is there any simpler
solution
}
}
Thanks.
~Nazir~
|
|
|
Re: Facets retrieving - getFacetContents [message #75366 is a reply to message #75338] |
Mon, 25 August 2008 02:32   |
Eclipse User |
|
|
|
Nazir,
Comments below.
Muhamad Nazir Samsudin wrote:
> Hi Ed and all,
>
> I would like to know, what's the best way in retrieving facets. I
> noticed a thread saying that we should use getFacetContents but which
> one should I use in order to easily retrieve the facets, faster and
> better. Is it using SimpleTypeDefinition or TypeDefinition directly?
It really comes down to what you want them for... More likely you want
to use getFacets to get all the facets of all the type hierarchy merged
nicely to give the ones that are applicable...
>
> I have something like this:
> <!-- xsd snippet starts here -->
> <xsd:complexType name="orderType">
> <xsd:sequence>
> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
> </xsd:sequence>
> </xsd:complexType>
> <!-- xsd snippet ends here -->
>
> //java code starts here
> XSDParticle particle = (XSDParticle)obj;
> XSDElementDeclaration element = (XSDElementDeclaration)
> particle.getContent();
>
> if(null != element.getTypeDefinition()) {
> XSDTypeDefinition typeDef = element.getTypeDefinition();
> XSDSimpleTypeDefinition simpleTypeDef = null;
>
> if(null != typeDef.getSimpleType()) {
> simpleTypeDef = typeDef.getSimpleType();
> // this is the question:
> //should I use this simpleTypeDef here???? or is there any simpler
> solution
Yes, you should use the simple type definition. They're the only things
with facets.
> }
> }
>
> Thanks.
> ~Nazir~
>
>
|
|
|
Re: Facets retrieving - getFacetContents [message #75381 is a reply to message #75366] |
Mon, 25 August 2008 06:41   |
Eclipse User |
|
|
|
Thanks for the quick response, Ed.
Just another one, I noticed that when I was trying to get this using
simpleType:
<xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
it kinda gave me these facets:
fractionDigits='0', pattern='[\-+]?[0-9]+'
Any idea why I got these facets?
Thanks again.
~Nazir~
Ed Merks wrote:
> Nazir,
> Comments below.
> Muhamad Nazir Samsudin wrote:
>> Hi Ed and all,
>>
>> I would like to know, what's the best way in retrieving facets. I
>> noticed a thread saying that we should use getFacetContents but which
>> one should I use in order to easily retrieve the facets, faster and
>> better. Is it using SimpleTypeDefinition or TypeDefinition directly?
> It really comes down to what you want them for... More likely you want
> to use getFacets to get all the facets of all the type hierarchy merged
> nicely to give the ones that are applicable...
>>
>> I have something like this:
>> <!-- xsd snippet starts here -->
>> <xsd:complexType name="orderType">
>> <xsd:sequence>
>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> <!-- xsd snippet ends here -->
>>
>> //java code starts here
>> XSDParticle particle = (XSDParticle)obj;
>> XSDElementDeclaration element = (XSDElementDeclaration)
>> particle.getContent();
>>
>> if(null != element.getTypeDefinition()) {
>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>
>> if(null != typeDef.getSimpleType()) {
>> simpleTypeDef = typeDef.getSimpleType();
>> // this is the question:
>> //should I use this simpleTypeDef here???? or is there any simpler
>> solution
> Yes, you should use the simple type definition. They're the only things
> with facets.
>> }
>> }
>>
>> Thanks.
>> ~Nazir~
>>
>>
|
|
|
Re: Facets retrieving - getFacetContents [message #75399 is a reply to message #75381] |
Mon, 25 August 2008 13:25   |
Eclipse User |
|
|
|
Nazir,
Comments below.
Muhamad Nazir Samsudin wrote:
> Thanks for the quick response, Ed.
>
> Just another one, I noticed that when I was trying to get this using
> simpleType:
> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
> it kinda gave me these facets:
> fractionDigits='0', pattern='[\-+]?[0-9]+'
>
> Any idea why I got these facets?
Yes. The xsd:integer type is defined in the XMLSchema.xsd and it's
definition there, along with the definitions of the rest of the type up
its type hierarchy define these facets.
> Thanks again.
> ~Nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> Comments below.
>
>> Muhamad Nazir Samsudin wrote:
>>> Hi Ed and all,
>>>
>>> I would like to know, what's the best way in retrieving facets. I
>>> noticed a thread saying that we should use getFacetContents but
>>> which one should I use in order to easily retrieve the facets,
>>> faster and better. Is it using SimpleTypeDefinition or
>>> TypeDefinition directly?
>> It really comes down to what you want them for... More likely you
>> want to use getFacets to get all the facets of all the type hierarchy
>> merged nicely to give the ones that are applicable...
>>>
>>> I have something like this:
>>> <!-- xsd snippet starts here -->
>>> <xsd:complexType name="orderType">
>>> <xsd:sequence>
>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> <!-- xsd snippet ends here -->
>>>
>>> //java code starts here
>>> XSDParticle particle = (XSDParticle)obj;
>>> XSDElementDeclaration element = (XSDElementDeclaration)
>>> particle.getContent();
>>>
>>> if(null != element.getTypeDefinition()) {
>>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>>
>>> if(null != typeDef.getSimpleType()) {
>>> simpleTypeDef = typeDef.getSimpleType();
>>> // this is the question:
>>> //should I use this simpleTypeDef here???? or is there any
>>> simpler solution
>> Yes, you should use the simple type definition. They're the only
>> things with facets.
>>> }
>>> }
>>>
>>> Thanks.
>>> ~Nazir~
>>>
>>>
>
>
|
|
|
Re: Facets retrieving - getFacetContents [message #75417 is a reply to message #75399] |
Mon, 25 August 2008 23:52   |
Eclipse User |
|
|
|
Ed,
In this case, even though I didn't specify any of my facets related to
this integer, getFacetContents will always get the defined facets in
XMLSchema.xsd? I bet other types too right?
Zillion thanks again,
~Nazir~
Ed Merks wrote:
> Nazir,
> Comments below.
> Muhamad Nazir Samsudin wrote:
>> Thanks for the quick response, Ed.
>>
>> Just another one, I noticed that when I was trying to get this using
>> simpleType:
>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>> it kinda gave me these facets:
>> fractionDigits='0', pattern='[-+]?[0-9]+'
>>
>> Any idea why I got these facets?
> Yes. The xsd:integer type is defined in the XMLSchema.xsd and it's
> definition there, along with the definitions of the rest of the type up
> its type hierarchy define these facets.
>> Thanks again.
>> ~Nazir~
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> Comments below.
>>
>>> Muhamad Nazir Samsudin wrote:
>>>> Hi Ed and all,
>>>>
>>>> I would like to know, what's the best way in retrieving facets. I
>>>> noticed a thread saying that we should use getFacetContents but
>>>> which one should I use in order to easily retrieve the facets,
>>>> faster and better. Is it using SimpleTypeDefinition or
>>>> TypeDefinition directly?
>>> It really comes down to what you want them for... More likely you
>>> want to use getFacets to get all the facets of all the type hierarchy
>>> merged nicely to give the ones that are applicable...
>>>>
>>>> I have something like this:
>>>> <!-- xsd snippet starts here -->
>>>> <xsd:complexType name="orderType">
>>>> <xsd:sequence>
>>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> <!-- xsd snippet ends here -->
>>>>
>>>> //java code starts here
>>>> XSDParticle particle = (XSDParticle)obj;
>>>> XSDElementDeclaration element = (XSDElementDeclaration)
>>>> particle.getContent();
>>>>
>>>> if(null != element.getTypeDefinition()) {
>>>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>>>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>>>
>>>> if(null != typeDef.getSimpleType()) {
>>>> simpleTypeDef = typeDef.getSimpleType();
>>>> // this is the question:
>>>> //should I use this simpleTypeDef here???? or is there any
>>>> simpler solution
>>> Yes, you should use the simple type definition. They're the only
>>> things with facets.
>>>> }
>>>> }
>>>>
>>>> Thanks.
>>>> ~Nazir~
>>>>
>>>>
>>
>>
|
|
|
Re: Facets retrieving - getFacetContents [message #75434 is a reply to message #75417] |
Tue, 26 August 2008 06:03  |
Eclipse User |
|
|
|
Nazir,
The getFacets method returns the facets accumulated from the entire type
hierarchy including the part that's in the XMLSchema.xsd; these are the
facets that apply for any instance of that type. The getFacetContents
returns only the facets defined exactly on the specific type you're on.
Muhamad Nazir Samsudin wrote:
> Ed,
> In this case, even though I didn't specify any of my facets related to
> this integer, getFacetContents will always get the defined facets in
> XMLSchema.xsd? I bet other types too right?
>
> Zillion thanks again,
> ~Nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> Comments below.
>
>> Muhamad Nazir Samsudin wrote:
>>> Thanks for the quick response, Ed.
>>>
>>> Just another one, I noticed that when I was trying to get this using
>>> simpleType:
>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>> it kinda gave me these facets:
>>> fractionDigits='0', pattern='[-+]?[0-9]+'
>>>
>>> Any idea why I got these facets?
>> Yes. The xsd:integer type is defined in the XMLSchema.xsd and it's
>> definition there, along with the definitions of the rest of the type
>> up its type hierarchy define these facets.
>>> Thanks again.
>>> ~Nazir~
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> Comments below.
>>>
>>>> Muhamad Nazir Samsudin wrote:
>>>>> Hi Ed and all,
>>>>>
>>>>> I would like to know, what's the best way in retrieving facets. I
>>>>> noticed a thread saying that we should use getFacetContents but
>>>>> which one should I use in order to easily retrieve the facets,
>>>>> faster and better. Is it using SimpleTypeDefinition or
>>>>> TypeDefinition directly?
>>>> It really comes down to what you want them for... More likely you
>>>> want to use getFacets to get all the facets of all the type
>>>> hierarchy merged nicely to give the ones that are applicable...
>>>>>
>>>>> I have something like this:
>>>>> <!-- xsd snippet starts here -->
>>>>> <xsd:complexType name="orderType">
>>>>> <xsd:sequence>
>>>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>>>> </xsd:sequence>
>>>>> </xsd:complexType>
>>>>> <!-- xsd snippet ends here -->
>>>>>
>>>>> //java code starts here
>>>>> XSDParticle particle = (XSDParticle)obj;
>>>>> XSDElementDeclaration element = (XSDElementDeclaration)
>>>>> particle.getContent();
>>>>>
>>>>> if(null != element.getTypeDefinition()) {
>>>>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>>>>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>>>>
>>>>> if(null != typeDef.getSimpleType()) {
>>>>> simpleTypeDef = typeDef.getSimpleType();
>>>>> // this is the question:
>>>>> //should I use this simpleTypeDef here???? or is there any
>>>>> simpler solution
>>>> Yes, you should use the simple type definition. They're the only
>>>> things with facets.
>>>>> }
>>>>> }
>>>>>
>>>>> Thanks.
>>>>> ~Nazir~
>>>>>
>>>>>
>>>
>>>
>
>
|
|
|
Re: Facets retrieving - getFacetContents [message #603241 is a reply to message #75338] |
Mon, 25 August 2008 02:32  |
Eclipse User |
|
|
|
Nazir,
Comments below.
Muhamad Nazir Samsudin wrote:
> Hi Ed and all,
>
> I would like to know, what's the best way in retrieving facets. I
> noticed a thread saying that we should use getFacetContents but which
> one should I use in order to easily retrieve the facets, faster and
> better. Is it using SimpleTypeDefinition or TypeDefinition directly?
It really comes down to what you want them for... More likely you want
to use getFacets to get all the facets of all the type hierarchy merged
nicely to give the ones that are applicable...
>
> I have something like this:
> <!-- xsd snippet starts here -->
> <xsd:complexType name="orderType">
> <xsd:sequence>
> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
> </xsd:sequence>
> </xsd:complexType>
> <!-- xsd snippet ends here -->
>
> //java code starts here
> XSDParticle particle = (XSDParticle)obj;
> XSDElementDeclaration element = (XSDElementDeclaration)
> particle.getContent();
>
> if(null != element.getTypeDefinition()) {
> XSDTypeDefinition typeDef = element.getTypeDefinition();
> XSDSimpleTypeDefinition simpleTypeDef = null;
>
> if(null != typeDef.getSimpleType()) {
> simpleTypeDef = typeDef.getSimpleType();
> // this is the question:
> //should I use this simpleTypeDef here???? or is there any simpler
> solution
Yes, you should use the simple type definition. They're the only things
with facets.
> }
> }
>
> Thanks.
> ~Nazir~
>
>
|
|
|
Re: Facets retrieving - getFacetContents [message #603247 is a reply to message #75366] |
Mon, 25 August 2008 06:41  |
Eclipse User |
|
|
|
Thanks for the quick response, Ed.
Just another one, I noticed that when I was trying to get this using
simpleType:
<xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
it kinda gave me these facets:
fractionDigits='0', pattern='[\-+]?[0-9]+'
Any idea why I got these facets?
Thanks again.
~Nazir~
Ed Merks wrote:
> Nazir,
> Comments below.
> Muhamad Nazir Samsudin wrote:
>> Hi Ed and all,
>>
>> I would like to know, what's the best way in retrieving facets. I
>> noticed a thread saying that we should use getFacetContents but which
>> one should I use in order to easily retrieve the facets, faster and
>> better. Is it using SimpleTypeDefinition or TypeDefinition directly?
> It really comes down to what you want them for... More likely you want
> to use getFacets to get all the facets of all the type hierarchy merged
> nicely to give the ones that are applicable...
>>
>> I have something like this:
>> <!-- xsd snippet starts here -->
>> <xsd:complexType name="orderType">
>> <xsd:sequence>
>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> <!-- xsd snippet ends here -->
>>
>> //java code starts here
>> XSDParticle particle = (XSDParticle)obj;
>> XSDElementDeclaration element = (XSDElementDeclaration)
>> particle.getContent();
>>
>> if(null != element.getTypeDefinition()) {
>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>
>> if(null != typeDef.getSimpleType()) {
>> simpleTypeDef = typeDef.getSimpleType();
>> // this is the question:
>> //should I use this simpleTypeDef here???? or is there any simpler
>> solution
> Yes, you should use the simple type definition. They're the only things
> with facets.
>> }
>> }
>>
>> Thanks.
>> ~Nazir~
>>
>>
|
|
|
Re: Facets retrieving - getFacetContents [message #603249 is a reply to message #75381] |
Mon, 25 August 2008 13:25  |
Eclipse User |
|
|
|
Nazir,
Comments below.
Muhamad Nazir Samsudin wrote:
> Thanks for the quick response, Ed.
>
> Just another one, I noticed that when I was trying to get this using
> simpleType:
> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
> it kinda gave me these facets:
> fractionDigits='0', pattern='[\-+]?[0-9]+'
>
> Any idea why I got these facets?
Yes. The xsd:integer type is defined in the XMLSchema.xsd and it's
definition there, along with the definitions of the rest of the type up
its type hierarchy define these facets.
> Thanks again.
> ~Nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> Comments below.
>
>> Muhamad Nazir Samsudin wrote:
>>> Hi Ed and all,
>>>
>>> I would like to know, what's the best way in retrieving facets. I
>>> noticed a thread saying that we should use getFacetContents but
>>> which one should I use in order to easily retrieve the facets,
>>> faster and better. Is it using SimpleTypeDefinition or
>>> TypeDefinition directly?
>> It really comes down to what you want them for... More likely you
>> want to use getFacets to get all the facets of all the type hierarchy
>> merged nicely to give the ones that are applicable...
>>>
>>> I have something like this:
>>> <!-- xsd snippet starts here -->
>>> <xsd:complexType name="orderType">
>>> <xsd:sequence>
>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> <!-- xsd snippet ends here -->
>>>
>>> //java code starts here
>>> XSDParticle particle = (XSDParticle)obj;
>>> XSDElementDeclaration element = (XSDElementDeclaration)
>>> particle.getContent();
>>>
>>> if(null != element.getTypeDefinition()) {
>>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>>
>>> if(null != typeDef.getSimpleType()) {
>>> simpleTypeDef = typeDef.getSimpleType();
>>> // this is the question:
>>> //should I use this simpleTypeDef here???? or is there any
>>> simpler solution
>> Yes, you should use the simple type definition. They're the only
>> things with facets.
>>> }
>>> }
>>>
>>> Thanks.
>>> ~Nazir~
>>>
>>>
>
>
|
|
|
Re: Facets retrieving - getFacetContents [message #603251 is a reply to message #75399] |
Mon, 25 August 2008 23:52  |
Eclipse User |
|
|
|
Ed,
In this case, even though I didn't specify any of my facets related to
this integer, getFacetContents will always get the defined facets in
XMLSchema.xsd? I bet other types too right?
Zillion thanks again,
~Nazir~
Ed Merks wrote:
> Nazir,
> Comments below.
> Muhamad Nazir Samsudin wrote:
>> Thanks for the quick response, Ed.
>>
>> Just another one, I noticed that when I was trying to get this using
>> simpleType:
>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>> it kinda gave me these facets:
>> fractionDigits='0', pattern='[-+]?[0-9]+'
>>
>> Any idea why I got these facets?
> Yes. The xsd:integer type is defined in the XMLSchema.xsd and it's
> definition there, along with the definitions of the rest of the type up
> its type hierarchy define these facets.
>> Thanks again.
>> ~Nazir~
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> Comments below.
>>
>>> Muhamad Nazir Samsudin wrote:
>>>> Hi Ed and all,
>>>>
>>>> I would like to know, what's the best way in retrieving facets. I
>>>> noticed a thread saying that we should use getFacetContents but
>>>> which one should I use in order to easily retrieve the facets,
>>>> faster and better. Is it using SimpleTypeDefinition or
>>>> TypeDefinition directly?
>>> It really comes down to what you want them for... More likely you
>>> want to use getFacets to get all the facets of all the type hierarchy
>>> merged nicely to give the ones that are applicable...
>>>>
>>>> I have something like this:
>>>> <!-- xsd snippet starts here -->
>>>> <xsd:complexType name="orderType">
>>>> <xsd:sequence>
>>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> <!-- xsd snippet ends here -->
>>>>
>>>> //java code starts here
>>>> XSDParticle particle = (XSDParticle)obj;
>>>> XSDElementDeclaration element = (XSDElementDeclaration)
>>>> particle.getContent();
>>>>
>>>> if(null != element.getTypeDefinition()) {
>>>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>>>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>>>
>>>> if(null != typeDef.getSimpleType()) {
>>>> simpleTypeDef = typeDef.getSimpleType();
>>>> // this is the question:
>>>> //should I use this simpleTypeDef here???? or is there any
>>>> simpler solution
>>> Yes, you should use the simple type definition. They're the only
>>> things with facets.
>>>> }
>>>> }
>>>>
>>>> Thanks.
>>>> ~Nazir~
>>>>
>>>>
>>
>>
|
|
|
Re: Facets retrieving - getFacetContents [message #603253 is a reply to message #75417] |
Tue, 26 August 2008 06:03  |
Eclipse User |
|
|
|
Nazir,
The getFacets method returns the facets accumulated from the entire type
hierarchy including the part that's in the XMLSchema.xsd; these are the
facets that apply for any instance of that type. The getFacetContents
returns only the facets defined exactly on the specific type you're on.
Muhamad Nazir Samsudin wrote:
> Ed,
> In this case, even though I didn't specify any of my facets related to
> this integer, getFacetContents will always get the defined facets in
> XMLSchema.xsd? I bet other types too right?
>
> Zillion thanks again,
> ~Nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> Comments below.
>
>> Muhamad Nazir Samsudin wrote:
>>> Thanks for the quick response, Ed.
>>>
>>> Just another one, I noticed that when I was trying to get this using
>>> simpleType:
>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>> it kinda gave me these facets:
>>> fractionDigits='0', pattern='[-+]?[0-9]+'
>>>
>>> Any idea why I got these facets?
>> Yes. The xsd:integer type is defined in the XMLSchema.xsd and it's
>> definition there, along with the definitions of the rest of the type
>> up its type hierarchy define these facets.
>>> Thanks again.
>>> ~Nazir~
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> Comments below.
>>>
>>>> Muhamad Nazir Samsudin wrote:
>>>>> Hi Ed and all,
>>>>>
>>>>> I would like to know, what's the best way in retrieving facets. I
>>>>> noticed a thread saying that we should use getFacetContents but
>>>>> which one should I use in order to easily retrieve the facets,
>>>>> faster and better. Is it using SimpleTypeDefinition or
>>>>> TypeDefinition directly?
>>>> It really comes down to what you want them for... More likely you
>>>> want to use getFacets to get all the facets of all the type
>>>> hierarchy merged nicely to give the ones that are applicable...
>>>>>
>>>>> I have something like this:
>>>>> <!-- xsd snippet starts here -->
>>>>> <xsd:complexType name="orderType">
>>>>> <xsd:sequence>
>>>>> <xsd:element name="noOfOrder" minOccurs="0" type="xsd:integer"/>
>>>>> </xsd:sequence>
>>>>> </xsd:complexType>
>>>>> <!-- xsd snippet ends here -->
>>>>>
>>>>> //java code starts here
>>>>> XSDParticle particle = (XSDParticle)obj;
>>>>> XSDElementDeclaration element = (XSDElementDeclaration)
>>>>> particle.getContent();
>>>>>
>>>>> if(null != element.getTypeDefinition()) {
>>>>> XSDTypeDefinition typeDef = element.getTypeDefinition();
>>>>> XSDSimpleTypeDefinition simpleTypeDef = null;
>>>>>
>>>>> if(null != typeDef.getSimpleType()) {
>>>>> simpleTypeDef = typeDef.getSimpleType();
>>>>> // this is the question:
>>>>> //should I use this simpleTypeDef here???? or is there any
>>>>> simpler solution
>>>> Yes, you should use the simple type definition. They're the only
>>>> things with facets.
>>>>> }
>>>>> }
>>>>>
>>>>> Thanks.
>>>>> ~Nazir~
>>>>>
>>>>>
>>>
>>>
>
>
|
|
|
Goto Forum:
Current Time: Mon Feb 17 18:53:44 GMT 2025
Powered by FUDForum. Page generated in 0.04925 seconds
|