Hi all,

        I have created a library.xsd file and a library.xml file which 
will use that library.xsd file.

I have loaded the library.xsd file into my schema database.

Then I loaded library.xml file into my Documents database  In  Marklogic 
server.

When I fire the following query:

declare namespace bk = "http://www.harmony.com";;
doc("library.xml")//bk:book[1]/descendant::element(*,xs:string)

It gives the correct answer.  i.e It returns the descendant element of 
first book whose element type is xs:string.

This implies that the xml is refering to that xsd.So it is populating the 
the element matching the datatype xs:string which is specified in the xsd.

But when i try to update the xml using xdmp:node-insert-child() it is not 
validating the content with the xsd. Even though if i add an extra element 
which is not present in the xsd it is adding to the xml.  What is the 
problem? Is there any option to specify the xml to validate against xsd.

When i try it , it is still adding to the xml. But actually it should not.

declare namespace bk = "http://www.harmony.com";;
for $b in doc("library.xml")//bk:books
return
xdmp:node-insert-child($b,<bk:book>
    <bk:title>Arts</bk:title>
    <bk:price>200</bk:price>
    <bk:author>Santhosh </bk:author> 
  </bk:book>)

In this example    <bk:author>Santhosh </bk:author>  Element is not 
present in the xsd, but still it is adding to the xml.

What should be done to achieve this.(validating the xml against the xsd)

I am attaching the xml and xsd for your reference.



Thanks and Regards,
Santhosh Rajasekaran
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


Attachment: library.xsd
Description: Binary data

Attachment: library.xml
Description: Binary data

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

Reply via email to