Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » XSDWildcard distingishing between an actual xs:any and an implied any
XSDWildcard distingishing between an actual xs:any and an implied any [message #65587] Wed, 28 December 2005 23:15 Go to next message
Francis Upton IV is currently offline Francis Upton IV
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
The XSDWildcard seems to be emitted in the case where an element has no
type information; and it is also emitted in response to an actual xs:any
element appearing in the schema.

In both cases, the XSDWildcard appears the same (surprisingly it refers
to a DOM element from Xerces of xs:any).

I'm doing an implementation where I create a tree of elements, and I
need to distinguish these two cases. In the case of an explicit xs:any
element appearing in a schema, I need to take a different action from
the case where an element is simply untyped.

Right now, I determine the difference by seeing if the parent of the
enclosing particle is an XSDModelGroup which has more than one child.
In this case, I assume I'm working with an explicit xs:any.

Does this seem right? Is there a better way to go?

Thanks,

Francis


Re: XSDWildcard distingishing between an actual xs:any and an implied any [message #65608 is a reply to message #65587] Thu, 29 December 2005 06:17 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Francis,

No this doesn't seem right. I think there is confusion here between
elements of type anyType, i..e., <xsd:element name="x"
type=xsd:anyType"/> verses element wildcards <xsd:any>. When matching
element content using the DFA returned by XSDParticle, each element will
match either an element declaration or a wildcard, which you can tell
apart easily by whether you've matched an XSDElementDeclaration or an
XSDWildcard. In the first case, you can look at the type definition of
the element declaration and determine if it is the anyType using
XSDConstants.isURType. In the second case, depending on the processing
kind of the wildcard, it will either require a strict match to some
global element declaration, or in lax or skip mode, it will treat the
element as implicitly being of type anyType. Looking directly at the
particle or the particle's parent will not provide any useful
information in this regard since a model group can contain many wildcards.


Francis Upton wrote:

> The XSDWildcard seems to be emitted in the case where an element has
> no type information; and it is also emitted in response to an actual
> xs:any element appearing in the schema.
>
> In both cases, the XSDWildcard appears the same (surprisingly it
> refers to a DOM element from Xerces of xs:any).
>
> I'm doing an implementation where I create a tree of elements, and I
> need to distinguish these two cases. In the case of an explicit
> xs:any element appearing in a schema, I need to take a different
> action from the case where an element is simply untyped.
>
> Right now, I determine the difference by seeing if the parent of the
> enclosing particle is an XSDModelGroup which has more than one child.
> In this case, I assume I'm working with an explicit xs:any.
>
> Does this seem right? Is there a better way to go?
>
> Thanks,
>
> Francis
Re: XSDWildcard distingishing between an actual xs:any and an implied any [message #65629 is a reply to message #65608] Thu, 29 December 2005 16:00 Go to previous message
Francis Upton IV is currently offline Francis Upton IV
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Thanks Ed, what you describe is exactly how I thought it should work. I
found the problem, I took a left turn in my code which did not allow
me to see what was really going on.

Happy new year to you!

Francis

Ed Merks wrote:
> Francis,
>
> No this doesn't seem right. I think there is confusion here between
> elements of type anyType, i..e., <xsd:element name="x"
> type=xsd:anyType"/> verses element wildcards <xsd:any>. When matching
> element content using the DFA returned by XSDParticle, each element will
> match either an element declaration or a wildcard, which you can tell
> apart easily by whether you've matched an XSDElementDeclaration or an
> XSDWildcard. In the first case, you can look at the type definition of
> the element declaration and determine if it is the anyType using
> XSDConstants.isURType. In the second case, depending on the processing
> kind of the wildcard, it will either require a strict match to some
> global element declaration, or in lax or skip mode, it will treat the
> element as implicitly being of type anyType. Looking directly at the
> particle or the particle's parent will not provide any useful
> information in this regard since a model group can contain many wildcards.
>
>
> Francis Upton wrote:
>
>> The XSDWildcard seems to be emitted in the case where an element has
>> no type information; and it is also emitted in response to an actual
>> xs:any element appearing in the schema.
>>
>> In both cases, the XSDWildcard appears the same (surprisingly it
>> refers to a DOM element from Xerces of xs:any).
>>
>> I'm doing an implementation where I create a tree of elements, and I
>> need to distinguish these two cases. In the case of an explicit
>> xs:any element appearing in a schema, I need to take a different
>> action from the case where an element is simply untyped.
>>
>> Right now, I determine the difference by seeing if the parent of the
>> enclosing particle is an XSDModelGroup which has more than one child.
>> In this case, I assume I'm working with an explicit xs:any.
>>
>> Does this seem right? Is there a better way to go?
>>
>> Thanks,
>>
>> Francis
>


Re: XSDWildcard distingishing between an actual xs:any and an implied any [message #597412 is a reply to message #65587] Thu, 29 December 2005 06:17 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26014
Registered: July 2009
Senior Member
Francis,

No this doesn't seem right. I think there is confusion here between
elements of type anyType, i..e., <xsd:element name="x"
type=xsd:anyType"/> verses element wildcards <xsd:any>. When matching
element content using the DFA returned by XSDParticle, each element will
match either an element declaration or a wildcard, which you can tell
apart easily by whether you've matched an XSDElementDeclaration or an
XSDWildcard. In the first case, you can look at the type definition of
the element declaration and determine if it is the anyType using
XSDConstants.isURType. In the second case, depending on the processing
kind of the wildcard, it will either require a strict match to some
global element declaration, or in lax or skip mode, it will treat the
element as implicitly being of type anyType. Looking directly at the
particle or the particle's parent will not provide any useful
information in this regard since a model group can contain many wildcards.


Francis Upton wrote:

> The XSDWildcard seems to be emitted in the case where an element has
> no type information; and it is also emitted in response to an actual
> xs:any element appearing in the schema.
>
> In both cases, the XSDWildcard appears the same (surprisingly it
> refers to a DOM element from Xerces of xs:any).
>
> I'm doing an implementation where I create a tree of elements, and I
> need to distinguish these two cases. In the case of an explicit
> xs:any element appearing in a schema, I need to take a different
> action from the case where an element is simply untyped.
>
> Right now, I determine the difference by seeing if the parent of the
> enclosing particle is an XSDModelGroup which has more than one child.
> In this case, I assume I'm working with an explicit xs:any.
>
> Does this seem right? Is there a better way to go?
>
> Thanks,
>
> Francis
Re: XSDWildcard distingishing between an actual xs:any and an implied any [message #597419 is a reply to message #65608] Thu, 29 December 2005 16:00 Go to previous message
Francis Upton IV is currently offline Francis Upton IV
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Thanks Ed, what you describe is exactly how I thought it should work. I
found the problem, I took a left turn in my code which did not allow
me to see what was really going on.

Happy new year to you!

Francis

Ed Merks wrote:
> Francis,
>
> No this doesn't seem right. I think there is confusion here between
> elements of type anyType, i..e., <xsd:element name="x"
> type=xsd:anyType"/> verses element wildcards <xsd:any>. When matching
> element content using the DFA returned by XSDParticle, each element will
> match either an element declaration or a wildcard, which you can tell
> apart easily by whether you've matched an XSDElementDeclaration or an
> XSDWildcard. In the first case, you can look at the type definition of
> the element declaration and determine if it is the anyType using
> XSDConstants.isURType. In the second case, depending on the processing
> kind of the wildcard, it will either require a strict match to some
> global element declaration, or in lax or skip mode, it will treat the
> element as implicitly being of type anyType. Looking directly at the
> particle or the particle's parent will not provide any useful
> information in this regard since a model group can contain many wildcards.
>
>
> Francis Upton wrote:
>
>> The XSDWildcard seems to be emitted in the case where an element has
>> no type information; and it is also emitted in response to an actual
>> xs:any element appearing in the schema.
>>
>> In both cases, the XSDWildcard appears the same (surprisingly it
>> refers to a DOM element from Xerces of xs:any).
>>
>> I'm doing an implementation where I create a tree of elements, and I
>> need to distinguish these two cases. In the case of an explicit
>> xs:any element appearing in a schema, I need to take a different
>> action from the case where an element is simply untyped.
>>
>> Right now, I determine the difference by seeing if the parent of the
>> enclosing particle is an XSDModelGroup which has more than one child.
>> In this case, I assume I'm working with an explicit xs:any.
>>
>> Does this seem right? Is there a better way to go?
>>
>> Thanks,
>>
>> Francis
>


Previous Topic:XSDWildcard distingishing between an actual xs:any and an implied any
Next Topic:XSD:How to extract xsd:simpleContent ?
Goto Forum:
  


Current Time: Sun Aug 31 00:40:50 EDT 2014

Powered by FUDForum. Page generated in 0.11622 seconds