Hi Bharathi,

It's not a solution but will help in getting around a solution.
I think proper understanding of lax and Strict will help here. I think for any 
new element (in your case its <br>)
Validation will obviously fail if it doesn't comply with XSDs.

https://msdn.microsoft.com/en-us/library/dd297062.aspx


Thanks and Regards,
Abhishek Jain

From: [email protected] 
[mailto:[email protected]] On Behalf Of Karunanithi, 
Bharathi
Sent: Wednesday, May 24, 2017 4:58 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Schema validation fails for certain XMLs

Can I please get any help on the below issue?

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Karunanithi, 
Bharathi
Sent: Tuesday, May 23, 2017 5:20 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Schema validation fails for certain XMLs

Hi Team,

I am getting the following validation error in MarkLogic 8.0-6.4 hosted on a 
AWS EC2 instance. But certain xml files fails the validation against the Schema 
particularly in this environment alone.
Same XML passes the validation in other ML environments and also from other 
standalone validation tools using Schemas.

The used Schema files are attached in Zip format. Major Schema file being 
pam.xsd from the zip.
Sample XML for which the error is occurring and the error are also attached 
with this email.

Error: Please note that this error only occurs for a xml with a line break 
tags(<br/> or <br></br>). XML files without any line breaks are passing the 
Schema Validation.
XDMP-VALIDATEUNEXPECTED: (err:XQDY0027) validate lax { $n } -- Invalid node: 
Found @clear but expected (@title? & @class? & @id?) at 
fn:doc("//swcnpny048/2017/Print/Lucky/20170306/XML/GW201703_11_11.xml")/pam:message/pam:article/pam-xhtml:body/pam-xhtml:h1/pam-xhtml:br/@clear
 using schema "pam.xsd"

Script:
import module namespace validate = 
"http://condenast.com/dam/2.0/lib/validation"; at 
"/application/lib/validation-lib.xqy";

import module namespace mapping = "http://condenast.com/dam/2.0/lib/mapping"; at 
"/application/lib/mapping-lib.xqy";
import module namespace util = 
"http://condenast.com/dam/2.0/lib/validation-utils"; at 
"/application/lib/validation-utils.xqy";

declare namespace cndam = "http://condenast.com/dam/2.0";;

let $path:= "//swcnpny048/2017/Print/Lucky/20170306/XML/GW201703_11_11.xml"
let $assetType:= mapping:get-asset-type-by-extension($path)
let $content := xdmp:document-get($path)
let $schema := validate:get-schema-from-asset-type($assetType)
let $results := util:validate-with-schema(
             $content,
             $schema/cndam:namespace/text(),
             $schema/cndam:schemaLocation/text()
            )

            return $results

Please tell me if I am missing any configurations? Or any?

Thanks,
Bharathi K


This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to