Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Predicates in xs:alternative and xs:assert (WAS: Re: optional, but at least one required)

From: "Pete Cordell" <petexmldev@--------------.--->
To: "Michael Kay" <mike@--------.--->
Date: 10/12/2007 6:46:00 PM
- Original Message From: "Michael Kay"
>>
>> Our problem with the xpath stuff is that we unmarshal into
>> strongly typed C++ objects.
>
> Products with that kind of architecture already seem to struggle with many
> aspects of XML Schema conformance, for example some of them have great
> trouble with mixed content. That suggests to me that if you're aiming for
> complete support of XML Schema validation rules, you've got the wrong
> architecture.

I think the majority of views about what databinding can do are out of date. 
I think you said that the complexity of Saxon's schema processor was awe 
inspiring to behold (or something to that effect), and our code is no 
different.  While we're still not perfect, I was of the opinion that bit by 
bit we would be able to support all schema features in time (well almost all 
anyway).

You could argue that we shouldn't release a tool until it was perfect.  But 
then I'm a customer of the XSD spec, and I find in far from perfect, so I 
don't think we're unique in that.

I think one of the reasons there are a lot of incomplete databinding tools 
around is that the people developing them develop them as far as they need 
for their particular project(s) needs, and then the motivation to develop 
them further isn't there.

> Or perhaps it suggests that there might be a need for an XML
> Schema profile for data binding.

Possibly more work for the databinding group.  (I must get our results into 
the soon!)

> Certainly I don't think one can define a
> mechanism for integrity constraints using general predicates (which is
> certainly needed) without making some assumptions about the data model, 
> and
> it's going to be difficult to apply those predicates after converting the
> data into a model that is significantly different from the original.

I would have thought that a number of the problems we have are similar to 
those of a validating SAX parser.  Is there any guidance on how they should 
work under with all these constraints?

>> I've also just noticed the xs:alternative construct.  I
>> haven't had a chance to digest it yet, but it doesn't seem
>> great to me!  It might be helpful in a document oriented
>> world, but in a data oriented world, I'd rather have a
>> simpler language, and modify the schema accordingly, so that
>> you get something like:
>>
>>     <message><messageTypeBase64>jkhgkjh</messageTypeBase64></message>
>>
>
> Actually I think the use cases for conditional type assignment come as 
> much
> or more from the "data" world as the document world. The overwhelming
> experience is that people aren't prepared to design their XML instances to
> fit within the constraints imposed by XML Schema, they want to write 
> schemas
> that describe the data as they have designed it.

As I say, I haven't digested it all yet, but my main concern is schemas that 
are like this:

<xs:element name="message" type="messageType">
  <xs:alternative test=".//type='request'" type="messageTypeRequest"/>
  <xs:alternative test=".//type='response'" type="messageTypeResponse"/>
</xs:element>

and corresponding instances like this:

<message>
    <header>
        <type>request</header>
    </header>
    <body>
        more
    </body>
</message>

If the predicates were limited to attributes of the element, then there 
would be less of a problem.

On a separate note, is it possible to declare something like:

<xs:element name="message">
  <xs:alternative test=".//type='request'" type="messageTypeRequest"/>
  <xs:alternative test=".//type='response'" type="messageTypeResponse"/>
</xs:element>

where it is an error if one of the tests does not match?  Would you set 
type="xsd:error"?  xsd:error is only a simpleType though.  Is that a clue or 
an issue - or irrelevant?

>> I'm going to find something else to do, because this is
>> depressing me
>
> Please, first, submit your comments on the spec where they will receive
> attention!

I'll try and log something in the Bugzilla database - I believe that's the 
right place.

(Trouble is, I'm already perceived as Mr. Whingy Whiner who's on the wrong 
page to everyone else, so I doubt it's going to do me any favours!)

Pete.
=============================================
Pete Cordell
Codalogic
for XML Schema to C++ data binding visit
 http://www.codalogic.com/lmx/
=============================================



From philippe.poulard@s... Fri Oct 12 17:05:30 2007
Received: from aji.w3.org ([133.27.228.225])
	by frink.w3.org with esmtp (Exim 4.63)
	(envelope-f


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent