MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlShellValidate

Function xmlShellValidate

ThirdParty/libxml2/vtklibxml2/debugXML.c:2627–2654  ·  view source on GitHub ↗

* xmlShellValidate: * @ctxt: the shell context * @dtd: the DTD URI (optional) * @node: unused * @node2: unused * * Implements the XML shell function "validate" * Validate the document, if a DTD path is provided, then the validation * is done against the given DTD. * * Returns 0 or -1 in case of error */

Source from the content-addressed store, hash-verified

2625 * Returns 0 or -1 in case of error
2626 */
2627int
2628xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
2629 xmlNodePtr node ATTRIBUTE_UNUSED,
2630 xmlNodePtr node2 ATTRIBUTE_UNUSED)
2631{
2632 xmlValidCtxt vctxt;
2633 int res = -1;
2634
2635 if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1);
2636 memset(&vctxt, 0, sizeof(vctxt));
2637 vctxt.error = xmlShellPrintf;
2638 vctxt.warning = xmlShellPrintf;
2639 vctxt.userData = ctxt;
2640
2641 if ((dtd == NULL) || (dtd[0] == 0)) {
2642 res = xmlValidateDocument(&vctxt, ctxt->doc);
2643 } else {
2644 xmlDtdPtr subset;
2645
2646 subset = xmlParseDTD(NULL, (xmlChar *) dtd);
2647 if (subset != NULL) {
2648 res = xmlValidateDtd(&vctxt, ctxt->doc, subset);
2649
2650 xmlFreeDtd(subset);
2651 }
2652 }
2653 return (res);
2654}
2655#endif /* LIBXML_VALID_ENABLED */
2656
2657/**

Callers 1

xmlShellFunction · 0.85

Calls 4

xmlValidateDocumentFunction · 0.85
xmlParseDTDFunction · 0.85
xmlValidateDtdFunction · 0.85
xmlFreeDtdFunction · 0.85

Tested by

no test coverage detected