Hi Balvinder,

Lax versus strict mostly concerns whether the top node passed into the validate 
has to be a top level element (strict) or can be a sub-level element as well 
(lax).

The validation error itself is telling you that according to the definition of 
'simple-para', a child element named 'italic' is either not allowed at all, or 
not at the position it was found. I suggest comparing the schema definition 
with the actual contents of that particular node..

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

P Please consider the environment before printing this mail.
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
> SinghDang, Balvinder (ELS-OXF)
> Sent: dinsdag 18 mei 2010 17:22
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General]
> [MarkLogicDevGeneral]Probleminsertingdefaultnamespaceincreated
>  XMLdocumentfixed, but validation fails
>
> Hi All,
>
> I am facing an issue in validating XML against the schema,
> the error is as follows
>
> Validation failed:
> XDMP-VALIDATEUNEXPECTED: (err:XQDY0027) validate strict
> {<document>} -- Invalid node: Found
> {http://www.elsevier.com/xml/common/schema}italic but
> expected
> ((((({http://www.elsevier.com/xml/common/schema}glyph|{http://
> www.elsevier.com/xml/common/schema}text-effect|{http://www.els
> evier.com/xml/common/schema}inline-figure)?)|{http://www.w3.or
> g/1998/Math/MathML}math)|(({http://www.elsevier.com/xml/common
> /schema}cross-ref|{http://www.elsevier.com/xml/common/schema}i
> ntra-ref)|({http://www.elsevier.com/xml/common/schema}cross-re
> fs|{http://www.elsevier.com/xml/common/schema}intra-refs))|{ht
> tp://www.elsevier.com/xml/common/schema}inter-ref-s)|({http://
> www.elsevier.com/xml/common/schema}display|{http://www.elsevie
> r.com/xml/common/schema}displayed-quote|{http://www.elsevier.c
> om/xml/common/schema}enunciation)|{http://www.elsevier.com/xml
> /common/schema}lists|{http://www.elsevier.com/xml/common/schem
> a}footnote|{http://www.elsevier.com/xml/common/schema}text-obj
> ects|{http://www.elsevier.com/xml/common/schema}index-flag)*
> at
> /*:document/*:article/*:floats/*:figure[1]/*:caption/*:simple-
> para[2]/*:italic using schema "/EW2ConSyn/enhancedSchema/document.xsd"
>
> I have a root schema (document.xsd) which is importing other
> child schema's, I have loaded all of them to the same
> location "/EW2ConSyn/enhancedSchema/" in the repository.
>
> I am trying to validate at insertion by using the following code try {
>
>  xdmp:document-insert("/EW2ConSyn/enhancedSchema/15556824.xml"
>  , validate strict {<doc:document ... </doc:document> } ,
> (xdmp:permission("consyn-default-role", "read"),
> xdmp:permission("consyn-app-role", "update"),
> xdmp:permission("consyn-admin-role", "insert")) , () , 0 ,
> xdmp:database-forests(xdmp:database()))
> }catch ($e) {
>      "Validation failed: ", $e/error:format-string/text() }
>
> The "italic" element on which this error is coming is defined
> in one of the imported schemas (common.xsd), even if I try
> with validate lax it fails with same error.
>
> Thanks,
> Balvinder
>
> ________________________________
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Tim Meagher
> Sent: Friday, March 12, 2010 1:56 PM
> To: 'General Mark Logic Developer Discussion'
> Subject: [MarkLogic Dev General] RE:
> [MarkLogicDevGeneral]Probleminsertingdefaultnamespaceincreated
>  XMLdocumentfixed, but validation fails
>
>
>
> Thank you all for your input - it did the trick - way cool!
>
>
>
> Tim
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Lee, David
> Sent: Friday, March 12, 2010 12:30 AM
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic
> DevGeneral]Probleminsertingdefaultnamespaceincreated XML
> documentfixed, but validation fails
>
>
>
> wow thanks ! I didnt know you could do that.
>
> Declare a prefix for a namespace to query  a non-prefixed
> document without changing the document.
>
>
>
> I had to try it to prove to myself it worked.
>
> Does.
>
> extra cool.
>
>
>
>
>
>
>
>
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Keith L. Breinholt
> Sent: Thursday, March 11, 2010 11:48 PM
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev
> General]Probleminsertingdefaultnamespaceincreated XML
> document fixed,but validation fails
>
>
>
> You can declare a prefix for a namespace and use it in XQuery
> or XPath like this:
>
>
>
> declare namespace mystuff = "http://mystuff.com/schema";;
>
>
>
> $record//mystuff:list
>
> Try it out.
>
>
>
> Keith L. Breinholt
>
> [email protected]
>
>
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Lee, David
> Sent: Thursday, March 11, 2010 9:36 PM
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General]
> Probleminsertingdefaultnamespaceincreated XML document fixed,
> but validation fails
>
>
>
> This is a problem with xpath more then xquery really ...
> xpath doesn't work so great with non-prefixed namespaces.
>
> In any case the solution is
>
>
>
>                 return $record//*:list
>
>
>
> Note that this will match ANY namespace list element, which
> in your case is fine, but in the general case is not.
>
> I dont know of a way in xpath to match "the non prefixed
> namespace" without pulling in ALL namespaces
>
>
>
>
>
> -David
>
>
>
> ----------------------------------------
>
> David A. Lee
>
> Senior Principal Software Engineer
>
> Epocrates, Inc.
>
> [email protected]
>
> 812-482-5224
>
>
>
>
>
>
>
>
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Tim Meagher
> Sent: Thursday, March 11, 2010 10:17 PM
> To: 'General Mark Logic Developer Discussion'
> Subject: RE: [MarkLogic Dev General]
> Probleminsertingdefaultnamespaceincreated XML document
> fixed,but validation fails
>
>
>
> Hi Geert, et al,
>
>
>
> I'm still having a little problem.  I can construct the new
> document node so that the default namespace is appropriately
> applied to the root element, e.g.
>
> For example, the contents of the newly created $record
> variable include the following:
>
>
>
>   <record xmlns="http://mystuff.com/schema";>
>
>     <list>
>
>       <item>shoes</item>
>
>     </list>
>
>   </record>
>
>
>
> So if I write the xquery expression:
>
>
>
>    return $record
>
>
>
> it will return the contents above, but if I write the xquery
> expression:
>
>
>
>     return $record//list
>
>
>
> it will return nothing.  I think this is because it needs to
> be aware of the namespace, but I cannot declare the default
> element namespace without confusing the construction of the
> $record node. How do I go about referencing the list element
> within $record node without declaring the default element namespace?
>
>
>
> Thank you!
>
>
>
> Tim Meagher
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Tim Meagher
> Sent: Saturday, March 06, 2010 7:26 PM
> To: 'General Mark Logic Developer Discussion'
> Subject: RE: [MarkLogic Dev General] Problem
> insertingdefaultnamespaceincreated XML document fixed, but
> validation fails
>
>
>
> Hi Geert,
>
>
>
> I was receiving neither of these errors.  As it turns out, I
> had neglected to use the QName to create the root element (I
> was fashioning it separately from the rest of the nodeset in
> my code), even though one of the attributes was the xmlns
> reference (which is why I thought it wouldn't have a problem).
>
>
>
> Thank you for your help!
>
>
>
> Tim
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Geert Josten
> Sent: Thursday, March 04, 2010 2:39 PM
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] Problem inserting
> defaultnamespaceincreated XML document fixed, but validation fails
>
>
>
> Hi Tim,
>
>
>
> If the schema is not found, an XDMP-UNDSCHMAT will be thrown.
> If the namespace doesn't match the one in the schema, an
> XDMP-SCHMNSMISMATCH is thrown.
>
>
>
> What result are you expecting and what are you getting?
>
>
>
> Kind regards,
>
> Geert
>
>
>
> > -----Original Message-----
>
> > From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of
>
> > Tim Meagher
>
> > Sent: donderdag 4 maart 2010 19:10
>
> > To: 'General Mark Logic Developer Discussion'
>
> > Subject: RE: [MarkLogic Dev General] Problem inserting
>
> > default namespaceincreated XML document fixed, but validation fails
>
> >
>
> > Tried it with no success.  I'm not sure if it is adequately
>
> > locating the schema.
>
> >
>
> >
>
> >
>
> > ________________________________
>
> >
>
> > From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of
>
> > Geert Josten
>
> > Sent: Thursday, March 04, 2010 1:01 PM
>
> > To: General Mark Logic Developer Discussion
>
> > Subject: RE: [MarkLogic Dev General] Problem inserting
>
> > default namespaceincreated XML document fixed, but validation fails
>
> >
>
> >
>
> >
>
> > Hi Tim,
>
> >
>
> >
>
> >
>
> > Just add the following:
>
> >
>
> >
>
> >
>
> > import schema "http://mystuff.com/schema"; at "/the-schema.xsd";
>
> >
>
> >
>
> >
>
> > Kind regards,
>
> >
>
> > Geert
>
> >
>
> >
>
> >
>
> >
>
> > ________________________________
>
> >
>
> >
>
> >     From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of
>
> > Tim Meagher
>
> >     Sent: donderdag 4 maart 2010 18:49
>
> >     To: 'General Mark Logic Developer Discussion'
>
> >     Subject: RE: [MarkLogic Dev General] Problem inserting
>
> > default namespace increated XML document fixed, but validation fails
>
> >
>
> >     Hi Geert,
>
> >
>
> >
>
> >
>
> >     This time I'm actually specifying a namespace as in the
>
> > XML that gets created in the example below, e.g.
>
> >
>
> >
>
> >
>
> >     <record xsi:schemaLocation="/the-schema.xsd" id="1001"
>
> >
>
> >          xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
>
> >
>
> >          xmlns="http://mystuff.com/schema";>
>
> >
>
> >       <list>
>
> >
>
> >          <item>
>
> >
>
> >            ...
>
> >
>
> >
>
> >
>
> >     Where "the-schema.xsd" is loaded in the root of the
>
> > Schemas database.
>
> >
>
> >
>
> >
>
> >     I'm looking for validation syntax and trying to see if
>
> > I need to declare the targetNamespace in the schema.  I just
>
> > can't get this puppy to validate!
>
> >
>
> >
>
> >
>
> >     Thanks!
>
> >
>
> >
>
> >
>
> >     Tim
>
> >
>
> >
>
> >
>
> >     -----Original Message-----
>
> >     From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of
>
> > Geert Josten
>
> >     Sent: Thursday, March 04, 2010 12:21 PM
>
> >     To: General Mark Logic Developer Discussion
>
> >     Subject: RE: [MarkLogic Dev General] Problem inserting
>
> > default namespace increated XML document fixed, but validation fails
>
> >
>
> >
>
> >
>
> >     Hi Tim,
>
> >
>
> >
>
> >
>
> >     I looked into that earlier. To summarize this is what you need:
>
> >
>
> >
>
> >
>
> >           declare default element namespace "";
>
> >
>
> >           import schema "" at "/my-schema.xsd";
>
> >
>
> >
>
> >
>
> >           validate strict {
>
> >
>
> >                 $mydoc
>
> >
>
> >           }
>
> >
>
> >
>
> >
>
> >     More details can be found here
>
> > http://markmail.org/message/qauezioxxmyp64kd, comments from
>
> > Mary on the same thread may also interest you..
>
> >
>
> >
>
> >
>
> >     Kind regards,
>
> >
>
> >     Geert
>
> >
>
> >
>
> >
>
> >     > -----Original Message-----
>
> >
>
> >     > From: [email protected]
>
> >
>
> >     > [mailto:[email protected]] On Behalf Of
>
> >
>
> >     > Tim Meagher
>
> >
>
> >     > Sent: donderdag 4 maart 2010 18:12
>
> >
>
> >     > To: 'General Mark Logic Developer Discussion'
>
> >
>
> >     > Subject: RE: [MarkLogic Dev General] Problem inserting
>
> >
>
> >     > default namespace in created XML document fixed, but
>
> > validation fails
>
> >
>
> >     >
>
> >
>
> >     > Hi Geert,
>
> >
>
> >     >
>
> >
>
> >     >
>
> >
>
> >     >
>
> >
>
> >     > Thanks for the info.  The thing that helped me most was using
>
> >
>
> >     > the QName function when creating the elements.  I thought
>
> >
>
> >     > this would fix a problem I'm having with validating content
>
> >
>
> >     > using a default namespace and schema location, but that's not
>
> >
>
> >     > the case.  I could use an example of using marklogic to
>
> >
>
> >     > validate an xml file against a schema where the xml document
>
> >
>
> >     > only contains the default namespace declaration.  That
>
> >
>
> >     > includes making sure the schema is configured correctly and
>
> >
>
> >     > that the appropriate declarations exists in the xquery code.
>
> >
>
> >     > The schema is loaded in the Schemas database.
>
> >
>
>
>
> NOTICE: This email message is for the sole use of the
> intended recipient(s) and may contain confidential and
> privileged information. Any unauthorized review, use,
> disclosure or distribution is prohibited. If you are not the
> intended recipient, please contact the sender by reply email
> and destroy all copies of the original message.
>
>
>
> Elsevier Limited. Registered Office: The Boulevard, Langford
> Lane, Kidlington, Oxford, OX5 1GB, United Kingdom,
> Registration No. 1982084 (England and Wales).
>
>

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

Reply via email to