Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » facets
facets [message #34687] Mon, 05 January 2004 15:41 Go to next message
Eclipse User
Originally posted by: crscca.bol.net.in

Hi,

Suppose after loading a schema I am examining the different element and
attribute declarations and trying to record the facets against them.

1. ---> I have with me (XSDElementDeclaration) or
(XSDAttributeDeclaration) instances as starting points (and they are not
refernces and if they are they have been resolved).

2. ----> On either of these declarations I can invoke the following to
obtain typedenitions

XSDTypeDefinition typeDef1= decl .getTypeDefinition() //decl is either
(XSDElementDeclaration) or (XSDAttributeDeclaration)
or
XSDTypeDefinition typeDef2= decl.getAnonymousTypeDefinition() //decl is
either (XSDElementDeclaration) or (XSDAttributeDeclaration)

//here using getAnonymousTypeDefinition()

3.---> If a typeDefinition is an instance of XSDSimpleTypeDefinition they are
usable for obtaining facets.

4.---> I can obtain further XSDSimpleTypeDefinitions by invoking
getSimpleType() on these typedefs.

XSDSimpleTypeDefinition typeDef3= typeDef.getSimpleType() //typeDef can be
typeDef1 or typeDef2

5.---> I can have another typedef from this typedef

XSDTypeDefinition typeDef4 = typeDef3.getBaseType(); //lets assume this
base type is the last base.

6.----> All of these typeDefinitions are simpleTypeDefinitions- typeDef1,
typeDef2, typeDef3, typeDef4 and more than one m ay be not null.

----------------------> Q) Which typedef do I use to obtain the facets-
enumeration, min, max, pattern etc. for
----------------------> a)Elem ents
----------------------> b)Attributes
---------------------->---------------------->???????

(Do I simply try to obtain facets from all of them and if the facets are
not null record them ? Has someone documented some guidelines?)

Thank you.

[I repeated the posting with a mior corection. Hope you dont mind!!!!]
Re: facets [message #34756 is a reply to message #34687] Mon, 05 January 2004 16:09 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

Hi,

If you do xsdSimpleTypeDefinition.getFacets() you'll get all the facets that are
in effect for that type, whether they be inherited or declared locally; the
getEffectiveXyzFacet methods return the facet from this list or null. You
shouldn't have to walk through base type hierarchies since the information has
already be gathered for you. Note that if you do
xsdSimpleTypeDefinition.getFacetContents(), you'll get precisely those facets
actually declared in the type and the getXyzFacet methods return the facet from
this list or null. Also note that you shouldn't need to access the anonymous
type directly, since getTypeDefinition will return the anonymous type or the
named type as appropriate.


raster wrote:

> Hi,
>
> Suppose after loading a schema I am examining the different element and
> attribute declarations and trying to record the facets against them.
>
> 1. ---> I have with me (XSDElementDeclaration) or
> (XSDAttributeDeclaration) instances as starting points (and they are not
> refernces and if they are they have been resolved).
>
> 2. ----> On either of these declarations I can invoke the following to
> obtain typedenitions
>
> XSDTypeDefinition typeDef1= decl .getTypeDefinition() //decl is either
> (XSDElementDeclaration) or (XSDAttributeDeclaration)
> or
> XSDTypeDefinition typeDef2= decl.getAnonymousTypeDefinition() //decl is
> either (XSDElementDeclaration) or (XSDAttributeDeclaration)
>
> //here using getAnonymousTypeDefinition()
>
> 3.---> If a typeDefinition is an instance of XSDSimpleTypeDefinition they are
> usable for obtaining facets.
>
> 4.---> I can obtain further XSDSimpleTypeDefinitions by invoking
> getSimpleType() on these typedefs.
>
> XSDSimpleTypeDefinition typeDef3= typeDef.getSimpleType() //typeDef can be
> typeDef1 or typeDef2
>
> 5.---> I can have another typedef from this typedef
>
> XSDTypeDefinition typeDef4 = typeDef3.getBaseType(); //lets assume this
> base type is the last base.
>
> 6.----> All of these typeDefinitions are simpleTypeDefinitions- typeDef1,
> typeDef2, typeDef3, typeDef4 and more than one m ay be not null.
>
> ----------------------> Q) Which typedef do I use to obtain the facets-
> enumeration, min, max, pattern etc. for
> ----------------------> a)Elem ents
> ----------------------> b)Attributes
> ---------------------->---------------------->???????
>
> (Do I simply try to obtain facets from all of them and if the facets are
> not null record them ? Has someone documented some guidelines?)
>
> Thank you.
>
> [I repeated the posting with a mior corection. Hope you dont mind!!!!]
Re: facets [message #582085 is a reply to message #34687] Mon, 05 January 2004 16:09 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26046
Registered: July 2009
Senior Member
Hi,

If you do xsdSimpleTypeDefinition.getFacets() you'll get all the facets that are
in effect for that type, whether they be inherited or declared locally; the
getEffectiveXyzFacet methods return the facet from this list or null. You
shouldn't have to walk through base type hierarchies since the information has
already be gathered for you. Note that if you do
xsdSimpleTypeDefinition.getFacetContents(), you'll get precisely those facets
actually declared in the type and the getXyzFacet methods return the facet from
this list or null. Also note that you shouldn't need to access the anonymous
type directly, since getTypeDefinition will return the anonymous type or the
named type as appropriate.


raster wrote:

> Hi,
>
> Suppose after loading a schema I am examining the different element and
> attribute declarations and trying to record the facets against them.
>
> 1. ---> I have with me (XSDElementDeclaration) or
> (XSDAttributeDeclaration) instances as starting points (and they are not
> refernces and if they are they have been resolved).
>
> 2. ----> On either of these declarations I can invoke the following to
> obtain typedenitions
>
> XSDTypeDefinition typeDef1= decl .getTypeDefinition() //decl is either
> (XSDElementDeclaration) or (XSDAttributeDeclaration)
> or
> XSDTypeDefinition typeDef2= decl.getAnonymousTypeDefinition() //decl is
> either (XSDElementDeclaration) or (XSDAttributeDeclaration)
>
> //here using getAnonymousTypeDefinition()
>
> 3.---> If a typeDefinition is an instance of XSDSimpleTypeDefinition they are
> usable for obtaining facets.
>
> 4.---> I can obtain further XSDSimpleTypeDefinitions by invoking
> getSimpleType() on these typedefs.
>
> XSDSimpleTypeDefinition typeDef3= typeDef.getSimpleType() //typeDef can be
> typeDef1 or typeDef2
>
> 5.---> I can have another typedef from this typedef
>
> XSDTypeDefinition typeDef4 = typeDef3.getBaseType(); //lets assume this
> base type is the last base.
>
> 6.----> All of these typeDefinitions are simpleTypeDefinitions- typeDef1,
> typeDef2, typeDef3, typeDef4 and more than one m ay be not null.
>
> ----------------------> Q) Which typedef do I use to obtain the facets-
> enumeration, min, max, pattern etc. for
> ----------------------> a)Elem ents
> ----------------------> b)Attributes
> ---------------------->---------------------->???????
>
> (Do I simply try to obtain facets from all of them and if the facets are
> not null record them ? Has someone documented some guidelines?)
>
> Thank you.
>
> [I repeated the posting with a mior corection. Hope you dont mind!!!!]
Previous Topic:href help
Next Topic:href help
Goto Forum:
  


Current Time: Tue Sep 16 13:36:29 GMT 2014

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

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