The validation succeeds as lonng as i don't use elements in body with a xsi:type attribute!
The Problem is that foo:person is an abstract type and foo:driver is dervived from it. So using a foo:person is not allowed until specifing the type of person per xsi:type. The below example demonstrates this problem. When i try to validate this with the saxonica validator following error occurs
Validation error on line 6 column 60 of test xml:
Unknown type {foo:driver} specified in xsi:type attribute SAXON 8.9.0.3 from Saxonica validate complete
So when elements from other namespacas are found, try to find a schema defintion otherwise don't care
In my example there is no schema defintion for "foo:driver" because the soap schema can not know about the schema where "foo:driver" is defined! I have no possibility at this stage of validation to include the schema defintion for those types. I need the xsi:type attribute coz the sopa body elements will be validatet at later stage. Dont specfifing the xsi:type attribute whill pass the soap envelope validation but not thr later body elements validation! How can i solve this
Thanks fot this fast reply, seems there is no simple solution out there right now! But this problem must be present in every wbeservice implementation that validates against the soap body. Its not only the saxon processor that complains, also xerces and many others.
I think the simplest solution would be creating a qualified attribute
abstract:type with a user defined ns of "http://xsd/abstract"
and after soap envelope validation succeeded replaceing the "abstract:type" with xsi:type. Maybe this is not the most beautiful solution but it continues my workflow in the current project.
Thanks a lot, really
PS: Saxon rulez :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One feels the outcome ought to be "validity not known". Because the Saxon schema validator is designed primarily to meet the needs of schema-aware XSLT and XQuery processing, it tends to treat this as equivalent to "invalid". If it's confirmed that "not known" is the correct answer, then this is probably an area where the product needs to be improved, so that this outcome can be reported to the application.
Hello
I have a big Problem with validating a Soap Envelope. I have downloaded the xsd for a soap envelope from http://schemas.xmlsoap.org/soap/envelope/
The validation succeeds as lonng as i don't use elements in body with a xsi:type attribute!
The Problem is that foo:person is an abstract type and foo:driver is dervived from it. So using a foo:person is not allowed until specifing the type of person per xsi:type. The below example demonstrates this problem. When i try to validate this with the saxonica validator following error occurs
Validation error on line 6 column 60 of test xml:
Unknown type {foo:driver} specified in xsi:type attribute SAXON 8.9.0.3 from Saxonica validate complete
The definition of of sopa body says
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
So when elements from other namespacas are found, try to find a schema defintion otherwise don't care
In my example there is no schema defintion for "foo:driver" because the soap schema can not know about the schema where "foo:driver" is defined! I have no possibility at this stage of validation to include the schema defintion for those types. I need the xsi:type attribute coz the sopa body elements will be validatet at later stage. Dont specfifing the xsi:type attribute whill pass the soap envelope validation but not thr later body elements validation! How can i solve this
My Sample Soap Request
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ envelope11.xsd">
<env:Header/>
<env:Body>
<foo:person xmlns:foo="http://foo" xsi:type="foo:driver">
</foo:person>
</env:Body>
</env:Envelope>
Thanks fot this fast reply, seems there is no simple solution out there right now! But this problem must be present in every wbeservice implementation that validates against the soap body. Its not only the saxon processor that complains, also xerces and many others.
I think the simplest solution would be creating a qualified attribute
abstract:type with a user defined ns of "http://xsd/abstract"
<foo:person
xmlns:abstract="http://xsd/abstract"
xmlns:foo="http://foo"
abstract:type="foo:driver">
</foo:person>
and after soap envelope validation succeeded replaceing the "abstract:type" with xsi:type. Maybe this is not the most beautiful solution but it continues my workflow in the current project.
Thanks a lot, really
PS: Saxon rulez :)
It's very hard to decipher what the spec says about this case, so I've raised a query on xmlschema-dev.
http://lists.w3.org/Archives/Public/xmlschema-dev/2007Oct/0037.html
One feels the outcome ought to be "validity not known". Because the Saxon schema validator is designed primarily to meet the needs of schema-aware XSLT and XQuery processing, it tends to treat this as equivalent to "invalid". If it's confirmed that "not known" is the correct answer, then this is probably an area where the product needs to be improved, so that this outcome can be reported to the application.
Michael Kay
http://www.saxonica.com/