Anonymous types [message #44381] |
Thu, 13 May 2004 11:28 |
Eclipse User |
|
|
|
Originally posted by: invalid.soft-gems.net
Hi,
It looks like XSSchema.getTypeDefinitions does not return anonymous types.
This is a little problem for me because I collect all types into an own
list where I have wrapped them in an own class. Later I also collect all
elements and want to give them my already created wrapper class for its
type. So what I'm doing is to iterate through my types list trying to find
the type given from XSDElementDeclaration.getTypeDefinition(). If the
element contains an anonymous type definition then nothing is found. Is
there a way to get anonymous types from the schema too?
Mike
--
www.sof-gems.net
|
|
|
Re: Anonymous types [message #44411 is a reply to message #44381] |
Thu, 13 May 2004 11:56 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Mike,
XSDSchema.getTypeDefinitions returns exactly what's defined by the XML Schema
spec. Similarly, XSDSchema.getElementDeclarations doesn't return local
element declarations either. In the XSDEcoreBuilder, I create "wrappers" for
types on demand and then cache them once they are created so that the wrapper
is reused for any other use of the type. This might be a better approach than
to find all the types first. The EObject.eAllContents' tree iterator can be
used to walk the containment tree of any object, so you could use it for each
component in getElementDeclarations, getAttributeDeclarations,
getAttributeGroupDefinitions, getTypeDefinitions, and getModelGroupDefinitions
to look for nested types.
Mike Lischke wrote:
> Hi,
>
> It looks like XSSchema.getTypeDefinitions does not return anonymous types.
> This is a little problem for me because I collect all types into an own
> list where I have wrapped them in an own class. Later I also collect all
> elements and want to give them my already created wrapper class for its
> type. So what I'm doing is to iterate through my types list trying to find
> the type given from XSDElementDeclaration.getTypeDefinition(). If the
> element contains an anonymous type definition then nothing is found. Is
> there a way to get anonymous types from the schema too?
>
> Mike
> --
> www.sof-gems.net
|
|
|
Re: Anonymous types [message #44442 is a reply to message #44411] |
Thu, 13 May 2004 12:31 |
Eclipse User |
|
|
|
Originally posted by: invalid.soft-gems.net
Ed Merks wrote:
> The EObject.eAllContents' tree iterator can be
> used to walk the containment tree of any object, so you could use it for each
> component in getElementDeclarations, getAttributeDeclarations,
> getAttributeGroupDefinitions, getTypeDefinitions, and
getModelGroupDefinitions
> to look for nested types.
Thank you Ed. Yes, I saw another posting from you mentioning this global
list, so I thought about a similar approach. But I'm afraid iterating the
big collection so often will use a significant amount of time, so I
started to go another way. Now when my lookup does not turn out a type I
check the element for an anonymous type definition and create a new type
class on the fly. Seems to work fine so far, but I have to test the other
code parts too.
Mike
--
www.soft-gems.net
|
|
|
Re: Anonymous types [message #587067 is a reply to message #44381] |
Thu, 13 May 2004 11:56 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
Mike,
XSDSchema.getTypeDefinitions returns exactly what's defined by the XML Schema
spec. Similarly, XSDSchema.getElementDeclarations doesn't return local
element declarations either. In the XSDEcoreBuilder, I create "wrappers" for
types on demand and then cache them once they are created so that the wrapper
is reused for any other use of the type. This might be a better approach than
to find all the types first. The EObject.eAllContents' tree iterator can be
used to walk the containment tree of any object, so you could use it for each
component in getElementDeclarations, getAttributeDeclarations,
getAttributeGroupDefinitions, getTypeDefinitions, and getModelGroupDefinitions
to look for nested types.
Mike Lischke wrote:
> Hi,
>
> It looks like XSSchema.getTypeDefinitions does not return anonymous types.
> This is a little problem for me because I collect all types into an own
> list where I have wrapped them in an own class. Later I also collect all
> elements and want to give them my already created wrapper class for its
> type. So what I'm doing is to iterate through my types list trying to find
> the type given from XSDElementDeclaration.getTypeDefinition(). If the
> element contains an anonymous type definition then nothing is found. Is
> there a way to get anonymous types from the schema too?
>
> Mike
> --
> www.sof-gems.net
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Anonymous types [message #587079 is a reply to message #44411] |
Thu, 13 May 2004 12:31 |
Mike Lischke Messages: 78 Registered: July 2009 |
Member |
|
|
Ed Merks wrote:
> The EObject.eAllContents' tree iterator can be
> used to walk the containment tree of any object, so you could use it for each
> component in getElementDeclarations, getAttributeDeclarations,
> getAttributeGroupDefinitions, getTypeDefinitions, and
getModelGroupDefinitions
> to look for nested types.
Thank you Ed. Yes, I saw another posting from you mentioning this global
list, so I thought about a similar approach. But I'm afraid iterating the
big collection so often will use a significant amount of time, so I
started to go another way. Now when my lookup does not turn out a type I
check the element for an anonymous type definition and create a new type
class on the fly. Seems to work fine so far, but I have to test the other
code parts too.
Mike
--
www.soft-gems.net
|
|
|
Powered by
FUDForum. Page generated in 0.03020 seconds