* xmlRelaxNGValidateDoc: * @ctxt: a Relax-NG validation context * @doc: a parsed document tree * * Validate a document tree in memory. * * Returns 0 if the document is valid, a positive error code * number otherwise and -1 in case of internal or API error. */
| 10813 | * number otherwise and -1 in case of internal or API error. |
| 10814 | */ |
| 10815 | int |
| 10816 | xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc) |
| 10817 | { |
| 10818 | int ret; |
| 10819 | |
| 10820 | if ((ctxt == NULL) || (doc == NULL)) |
| 10821 | return (-1); |
| 10822 | |
| 10823 | ctxt->doc = doc; |
| 10824 | |
| 10825 | ret = xmlRelaxNGValidateDocument(ctxt, doc); |
| 10826 | /* |
| 10827 | * Remove all left PSVI |
| 10828 | */ |
| 10829 | xmlRelaxNGCleanPSVI((xmlNodePtr) doc); |
| 10830 | |
| 10831 | /* |
| 10832 | * TODO: build error codes |
| 10833 | */ |
| 10834 | if (ret == -1) |
| 10835 | return (1); |
| 10836 | return (ret); |
| 10837 | } |
| 10838 | |
| 10839 | #endif /* LIBXML_SCHEMAS_ENABLED */ |