[xml] Realx NG support with libxml2

Hi guys,

I've been playing around with libxml2 and its Relax NG support and I've been really pleased it worked so nicely :)

But (yes there is a but) it looks like if I use xmlRelaxNGValidateDoc to validate my document against my Relax NG schema, I can only get "0 if the document is valid, a positive error code number otherwise and -1 in case of internal or API error".

Then I can report to xmlRelaxNGValidErr and have a better understanding of the meaning of the returned code.

It s nice but it is not enough sadly.

I mean, basically it tells me that my XML document is or not valid, it even tells me why but it doesn't tell me WHERE.

Which means that I cannot report that error at a higher level saying for instance "on that particular node your document was not correct". I can only say "we detected an error".

I don't know if I'm clear. Anyhow, I have erad the doc, searched on google but couldn't found anything to help me out.

Eventually I found the function xmlRelaxNGValidateFullElement and I though I could then read my XML document node by node and use that function to test each node. So I would be able to find which node is corrupted.

Would it be the correct way to do it?

Thanks for any help.
- Sylvain

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]