Hi ..!

I am trying to validate the following XML file against the below mentioned xsd

--------------------------------  XML File --------------------------------
<book xsi:schemaLocation="http://marklogic.com/ls";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<title>Booktitle</title>
<chapter><title>Chaptertitle</title></chapter>
</book>

--------------------------------  xsd  --------------------------------
<xs:schema targetNamespace="http://marklogic.com/ls";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
  <xs:element name="title">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="BookTitle"/>
        <xs:enumeration value="ChapterTitle"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <xs:element name="chapter">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="book">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:element ref="chapter"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

using   validate {doc("/testabc.xml")}  I am receiving the following error

[1.0-ml] XDMP-VALIDATENODECL: (err:XQDY0084) validate {
fn:doc("/testabc.xml") } -- Missing element declaration: Expected
declaration for node fn:doc("/testabc.xml")/book in non-lax mode using
schema ""

But when I use a name space prefix "ls" to all xml elements as shown
below the validation passes. Is it mandatory to have a namespace as
prefix to validate an XMl against a schema?

<ls:book xsi:schemaLocation="http://marklogic.com/ls";
xmlns:ls="http://marklogic.com/ls";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <ls:title>BookTitle</ls:title>
  <ls:chapter>
    <ls:title>ChapterTitle</ls:title>
  </ls:chapter>
</ls:book>

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

Reply via email to