* xmlSchemaValidateStreamInternal: * @ctxt: a schema validation context * @pctxt: a parser context * * Returns 0 if the document is schemas valid, a positive error code * number otherwise and -1 in case of internal or API error. */
| 28690 | * number otherwise and -1 in case of internal or API error. |
| 28691 | */ |
| 28692 | static int |
| 28693 | xmlSchemaValidateStreamInternal(xmlSchemaValidCtxtPtr ctxt, |
| 28694 | xmlParserCtxtPtr pctxt) { |
| 28695 | xmlSchemaSAXPlugPtr plug = NULL; |
| 28696 | int ret; |
| 28697 | |
| 28698 | pctxt->linenumbers = 1; |
| 28699 | xmlSchemaValidateSetLocator(ctxt, xmlSchemaValidateStreamLocator, pctxt); |
| 28700 | |
| 28701 | ctxt->parserCtxt = pctxt; |
| 28702 | ctxt->input = pctxt->input->buf; |
| 28703 | |
| 28704 | /* |
| 28705 | * Plug the validation and launch the parsing |
| 28706 | */ |
| 28707 | plug = xmlSchemaSAXPlug(ctxt, &(pctxt->sax), &(pctxt->userData)); |
| 28708 | if (plug == NULL) { |
| 28709 | ret = -1; |
| 28710 | goto done; |
| 28711 | } |
| 28712 | ctxt->input = pctxt->input->buf; |
| 28713 | ctxt->sax = pctxt->sax; |
| 28714 | ctxt->flags |= XML_SCHEMA_VALID_CTXT_FLAG_STREAM; |
| 28715 | ret = xmlSchemaVStart(ctxt); |
| 28716 | |
| 28717 | if ((ret == 0) && (! ctxt->parserCtxt->wellFormed)) { |
| 28718 | ret = ctxt->parserCtxt->errNo; |
| 28719 | if (ret == 0) |
| 28720 | ret = 1; |
| 28721 | } |
| 28722 | |
| 28723 | done: |
| 28724 | ctxt->parserCtxt = NULL; |
| 28725 | ctxt->sax = NULL; |
| 28726 | ctxt->input = NULL; |
| 28727 | if (plug != NULL) { |
| 28728 | xmlSchemaSAXUnplug(plug); |
| 28729 | } |
| 28730 | return (ret); |
| 28731 | } |
| 28732 | |
| 28733 | /** |
| 28734 | * xmlSchemaValidateStream: |
no test coverage detected