Hi,

  While validating an element against a schema, I get an error
whilst I think it should pass.  I might have missed something
here, but it looks like a bug to me (besides it works on Saxon).
The simplest case I could come up with is the following:

  - /tmp/top.xsd declares element t:top of type i:type
  - /tmp/included.xsd declares type i:type
  - i:type has a single child, called i:child (of type string)

  When I try to validate the following, it passes (when evaluated
in a database with a schema database containing both schemas):

    validate {
      <top xmlns="urn:top" xmlns:i="urn:included">
    <i:child>hello</i:child>
      </top>
    }

but when I try to validate the following instead, it fails:

    validate {
      <data>
    <top xmlns="urn:top" xmlns:i="urn:included">
      <i:child>hello</i:child>
    </top>
      </data>/*
    }

  The error message:

    [1.0-ml] XDMP-VALIDATENODECL: (err:XQDY0084) validate { <data><top 
xmlns="urn:top" xmlns:i="urn:included"><i:child>hello</i:child></top></data>/* 
} -- Missing element declaration: Expected declaration for node 
/data/t:top/*:child in non-lax mode using schema "/tmp/top.xsd"

  The schemas are the following (wrapped in the corresponding
xdmp:document-insert so you can directly evaluate them):

    xdmp:document-insert(
    '/tmp/top.xsd',
    <xs:schema elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema";
           targetNamespace="urn:top"
           xmlns:i="urn:included">
      <xs:import namespace="urn:included"
                   schemaLocation="included.xsd"/>
      <xs:element name="top" type="i:type"/>
    </xs:schema>
    )

    xdmp:document-insert(
    '/tmp/included.xsd',
    <xs:schema elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema";
           targetNamespace="urn:included">
      <xs:complexType name="type">
    <xs:sequence>
      <xs:element name="child" type="xs:string"/>
    </xs:sequence>
      </xs:complexType>
    </xs:schema>
    )

  By the way, the following passes, so it really looks like it is
related to validating an element embedded in another element:

    validate {
      <data>
    <top xmlns="urn:top" xmlns:i="urn:included">
      <i:child>hello</i:child>
    </top>
      </data>/document { * }
    }

  Did I miss something or is it a bug?  If it is a bug, is there
any workaround other than copying the whole element? (the
validation is done on every children of a wrapper element, there
can be a lot of them and they are not tiny...)

  Regards,


-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to