On 06/25/2012 10:07 AM, Seenivasan Gunabalan wrote:
Hi all, I am trying to validate an incoming xml post message against an xsd stored inside the basex. But I am getting this error [FODC0002] Resource 'sampledb/xsd/match.xsd' does not exist. I am sure the path is correct and the xsd file exists there. May I know where I am going wrong?
try { let $doc := |<simple:||root| |xmlns:simple=||'http://basex.org/simple%27%7C%7C/%3E%7C return validate:xsd($doc,'sampledb/xsd/match.xsd')
} catch BXVA0001 { 'Validation failed.' }
Thanks in advance.
I found one mistake at my side. I stored .xsd file as of RAW format type. It worked, when I changed it in to .XML format type and restructured my code like this
try { let $doc := |<simple:||root| |xmlns:simple=||'http://basex.org/simple%27%7C%7C/%3E%7C let $schema := fn:doc('sampledb/xsd/match.xsd') return validate:xsd($doc,$schema) } catch BXVA0001 { 'Validation failed.' }
But still my question is, how to validate by just passing the path of .xsd rather than fetching using fn:doc() and passing it as an parameter of type node()?.
Thanks.