Hi Pragya,

MarkLogic Server needs to know which xsd file needs to be used for which 
namespace. You can specify schema mappings in the admin configuration, but you 
can also use import schema statements. Something like:

        import schema namespace ls = "http://www.marklogic.com/ls"; at 
"validSchema.xsd";

Kind regards,
Geert

>


drs. G.P.H. (Geert) Josten
Consultant

Daidalos BV
Hoekeindsehof 1-4
2665 JZ Bleiswijk

T +31 (0)10 850 1200
F +31 (0)10 850 1199

mailto:[email protected]
http://www.daidalos.nl/

KvK 27164984


De informatie - verzonden in of met dit e-mailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Pragya Kapoor
> Sent: dinsdag 20 juli 2010 10:16
> To: [email protected]
> Subject: [MarkLogic Dev General] Validate XML file against Schema
>
> Hi
>
>
>
> I am trying to validate the following XML file against the
> below mentioned xsd which is inserted in schema DB with uri
> validSchema.xsd
>
>
>
> ------------XSD------------
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
> elementFormDefault="qualified" attributeFormDefault="unqualified"
>
>         targetNamespace="http://www.marklogic.com/ls";
>
>         xmlns:ls=" http://www.marklogic.com/ls";
>
>         xmlns:xml="http://www.w3.org/XML/1998/namespace";>
>
>
>
>
>
>         <xs:import
> namespace="http://www.w3.org/XML/1998/namespace";
> schemaLocation="xml.xsd"/>
>
>
>
>
>
>
>
>         <xs:element name="list">
>
>                <xs:complexType>
>
>                        <xs:sequence>
>
>                                <xs:element ref="ls:head"/>
>
>                                <xs:element ref="ls:body"/>
>
>                        </xs:sequence>
>
>
>
>                        <xs:attribute name="id" use="optional"
> type="xs:string"/>
>
>                        <xs:attribute ref="xml:lang" use="optional"/>
>
>                </xs:complexType>
>
>         </xs:element>
>
>         ......
>
>
>
> ---XML ,I m trying to insert in Document DB------
>
>
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://www.marklogic.com/ls validSchema.xsd "
>
> xmlns=" http://www.marklogic.com/ls
>
> xmlns:ls=" http://www.marklogic.com/ls " id="1234" language="EN" >
>
> <ls:head>.
>
> <ls:body>.
>
> ...
>
>
>
> </list>
>
>
>
> Using :
>
> xquery version "1.0-ml";
>
>
>
> let $path := "C:\validate.xml"
>
> let $node := xdmp:document-get($path)
>
> return
>
> try { xdmp:document-insert("validate.xml",
>
>     validate strict { $node } )
>
>
>
> }
>
> catch ($e) { "Validation failed: ",
>
> $e/error:format-string/text() }
>
>
>
> I am receiving the following error
>
> Validation failed:
>
> XDMP-VALIDATENODECL: (err:XQDY0084) validate strict { $node }
> -- Missing element declaration: Expected declaration for node
> fn:doc("C:\validate.xml")/*:list in non-lax mode using schema ""
>
>
>
> Let me know if I am missing anything.
>
> Moreover , I tried to put the ns with list also
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <ls:list
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://www.marklogic.com/ls validSchema.xsd "
>
> xmlns=" http://www.marklogic.com/ls
>
> xmlns:ls=" http://www.marklogic.com/ls " id="1234" language="EN" >
>
> <ls:head>.
>
> <ls:body>.
>
> ...
>
>
>
> </ls:list>
>
>
>
> But this is also giving the same error.
>
>
>
> Thanks,
>
> Pragya
>
>
>
>
>
> **************** CAUTION - Disclaimer ***************** This
> e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION
> intended solely for the use of the addressee(s). If you are
> not the intended recipient, please notify the sender by
> e-mail and delete the original message. Further, you are not
> to copy, disclose, or distribute this e-mail or its contents
> to any other person and any such actions are unlawful. This
> e-mail may contain viruses. Infosys has taken every
> reasonable precaution to minimize this risk, but is not
> liable for any damage you may sustain as a result of any
> virus in this e-mail. You should carry out your own virus
> checks before opening the e-mail or attachment. Infosys
> reserves the right to monitor and review the content of all
> messages sent to or from this e-mail address. Messages sent
> to or from this e-mail address may be stored on the Infosys
> e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to