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")
This topic has been locked.
2 replies Latest Post - 2012-02-23T15:45:28Z by VV4H_mario_fernandes
Pinned topic xmlvalidate
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-02-23T15:45:28Z at 2012-02-23T15:45:28Z by VV4H_mario_fernandes
MatthiasNicola 120000E28R321 PostsACCEPTED ANSWER
Re: xmlvalidate2012-02-22T20:07:01Z in response to VV4H_mario_fernandesHere 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.