How can I use xmlvalidate on the result xml_client column in the query below.
select xml_client from KASPER.XML_CLIENT
XMLEXISTS('$d/kasperSchema/TDSClient/kasperClient/client' passing xml_client as "d")
MatthiasNicola 120000E28R322 Posts
Re: xmlvalidate2012-02-22T20:07:01ZThis is the accepted answer. This is the accepted answer.Here is an example:
SELECT XMLVALIDATE(xml_client ACCORDING TO XMLSCHEMA ID kasper.myxmlschema) FROM KASPER.XML_CLIENT WHERE XMLEXISTS( '$d/kasperSchema/TDSClient/kasperClient/client' passing xml_client as "d")
Note that this query fails at runtime as soon as one document is retrieved that is not valid for the specified schema.
If a query retrieves multiple documents and you need to validate them all, you can write a stored procedure that loops over the result set of the document, validates one document at a time, and uses an exception handler do deal with the documents that fail the validation.
Let me know if you need help with coding such a procedure. I might be able to dig up an example if I have time.