Well it is not clear to me what should be expected to work when some XML is provided as a schema that has no clear location but contains relative uri references. It looks like in Hans-Juegen's case just supplying $xsdURI instead of doc( $xsdURI) would work. (or base-uri(doc( $xsdURI)) )
I think one could avoid the temporary file all together and use a resourceResolver [1] /Andy
[1] http://docs.oracle.com/javase/7/docs/api/javax/xml/validation/Validator.html...)
On 16 September 2014 16:29, Christian Grün christian.gruen@gmail.com wrote:
It looks to me that in the case where the schema is presented as XML it
is
written to a temporary file [1] so relative includes/imports will not be resolved.
Thanks, and yes, this seems to be the problem. We could think about writing the temporary file to the query directory, but this may cause problems in certain environments.
C.
/Andy
[1]
https://github.com/BaseXdb/basex/blob/7e7aad58feae2f7e36bb1bcad9641cbf944f45...
On 12 September 2014 17:03, Andy Bunce bunce.andy@gmail.com wrote:
I think I have had this problem, and my recollection is
let $xsd:=doc( $xsdURI) validate:xsd-info($doc1, $xsd)
does not work, but
validate:xsd-info($doc1, $xsdURI)
does. I guess the problem with the first case is that the base-uri info
is
not getting though to the validation component. The bigger problem of includes in XSLT or XSD not working for sources in the database would seem to require a custom resolver class. Something like those discussed [1] and [2]
/Andy
[1]
http://stackoverflow.com/questions/7236291/saxon-error-with-xslt-import-stat...
[2]
http://stackoverflow.com/questions/22538071/java-xml-schema-validator-with-c...
On 12 September 2014 16:31, Christian Grün christian.gruen@gmail.com wrote:
It would be wonderful if imports/includes could be automatically resolved - the "validate" module could then be extremely useful!
As we use external code for processing XSD, I'm not quite sure if we can do something about this. - Could you possibly provide us with a self-contained example that we can use for testing?
Thanks, Christian
Best regards, Hans-Juegen
PS: My experiment:
====================================================== let $docURI := '... a document URI ...' let $xsdURI := '... the corresponding schema URI ...'
let $xsd := doc($xsdURI) let $tns := $xsd/xs:schema/@targetNamespace let $doc1 := doc($docURI) let $doc2 := document { element {node-name($doc1/*)} { attribute xsi:schemaLocation {concat($tns, ' ',
$xsdURI)},
$doc1/*/(@*, node()) } }
return <results>{ <result1>{validate:xsd-info($doc1, $xsd)}</result1>, <result2>{validate:xsd-info($doc2)}</result2> }</results> ======================================================
=>
<results> <result1>Fatal:src-resolve: Name
"communication:ShoppingCartFetchRS"
kann nicht als "type definition"-Komponente aufgelöst werden.</result1>
<result2/> </results>