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

Function xmlValidatePushCData

ThirdParty/libxml2/vtklibxml2/valid.c:5675–5735  ·  view source on GitHub ↗

* xmlValidatePushCData: * @ctxt: the validation context * @data: some character data read * @len: the length of the data * * DEPRECATED: Internal function, don't use. * * check the CData parsed for validation in the current stack * * returns 1 if no validation problem was found or 0 otherwise */

Source from the content-addressed store, hash-verified

5673 * returns 1 if no validation problem was found or 0 otherwise
5674 */
5675int
5676xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
5677 int ret = 1;
5678
5679/* printf("CDATA %s %d\n", data, len); */
5680 if (ctxt == NULL)
5681 return(0);
5682 if (len <= 0)
5683 return(ret);
5684 if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) {
5685 xmlValidStatePtr state = ctxt->vstate;
5686 xmlElementPtr elemDecl;
5687
5688 /*
5689 * Check the new element against the content model of the new elem.
5690 */
5691 if (state->elemDecl != NULL) {
5692 elemDecl = state->elemDecl;
5693
5694 switch(elemDecl->etype) {
5695 case XML_ELEMENT_TYPE_UNDEFINED:
5696 ret = 0;
5697 break;
5698 case XML_ELEMENT_TYPE_EMPTY:
5699 xmlErrValidNode(ctxt, state->node,
5700 XML_DTD_NOT_EMPTY,
5701 "Element %s was declared EMPTY this one has content\n",
5702 state->node->name, NULL, NULL);
5703 ret = 0;
5704 break;
5705 case XML_ELEMENT_TYPE_ANY:
5706 break;
5707 case XML_ELEMENT_TYPE_MIXED:
5708 break;
5709 case XML_ELEMENT_TYPE_ELEMENT: {
5710 int i;
5711
5712 for (i = 0;i < len;i++) {
5713 if (!IS_BLANK_CH(data[i])) {
5714 xmlErrValidNode(ctxt, state->node,
5715 XML_DTD_CONTENT_MODEL,
5716 "Element %s content does not follow the DTD, Text not allowed\n",
5717 state->node->name, NULL, NULL);
5718 ret = 0;
5719 goto done;
5720 }
5721 }
5722 /*
5723 * TODO:
5724 * VC: Standalone Document Declaration
5725 * element types with element content, if white space
5726 * occurs directly within any instance of those types.
5727 */
5728 break;
5729 }
5730 }
5731 }
5732 }

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected