[xml] How to validate?

I have some questions about validation document against DTD (or
Relax NG in the future):

1. Is any way how to detect where is non-valid element or
attribute in document? I have parsed XML document (using
xmlParseFile) and DTD in file and I need obtain something
like xmlNodePtr.
I tried xmlReader interface - this is possible there, but
not usable for me, because xmlReader uses their own xmlDoc
instance and I don't obtain link to my parsed document.
I tried xmlValidateDocument, but there is possible only
to redefine warning and error functions where is only
textual error message.

2. So I tried validate elements itself. But if I try to validate
some element using xmlValidateElement, it returns always errors
to standart error output that every element in document is not
defined. Why?
If I validated the same docunet using xmlValidateDocument, it
were ok. Document were valid (tested by xmllint).

I'm using libxml2-2.6.0.

Thank you wery much for any advice.



Petr Novak, Liberouter Project (www.liberouter.org)
E-mail: novak merlot ics muni cz
        novak liberouter org

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