On Mon, 01 Feb 2010 15:14:11 -0800, Tim Meagher <[email protected]> wrote:

xquery version "1.0-ml";
import schema "" at "/my-schema.xsd";
declare default element namespace "";
let $node := fn:doc("/A/B/my-doc.xml")
return validate strict { $node }


where the namespace is defined in my-doc.xml as follows:

<root xsi:noNamespaceSchemaLocation="/my-schema.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>


Note that the schema is located in the root of the Schema database.

The exception is that if the schema name lacks the forward slash in the xml document as follows:

<root xsi:noNamespaceSchemaLocation="my-schema.xsd"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

What this is saying is that the schema for this document is
at "/A/B/my-schema.xsd" (given that the document is at
"/A/B/my-doc.xml") in the Schemas database.  No such schema
exists (I presume), so you should get the XDMP-VALIDATENODECL error
with strict validation or just the document back with lax validation.

then the validation proceeds without any errors being thrown but returns no document (so I don't think validation is working in this case).

This is some kind of bug: you should either get the error or the document.
What version is this?  I didn't see this in a quick check of the latest,
but it could be something that got fixed recently.

 I don't
know if it needs the "/" because the document is not located in the root
path of its database or if the path is required to find the schema in the
Schema database. The documents I am trying to validate do not include the "/" path. I can always revise them, but I'm looking for a quick fix.


Thank you!


Tim Meagher


//Mary
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to