* xmlParseCharDataComplex: * @ctxt: an XML parser context * @cdata: int indicating whether we are within a CDATA section * * Always makes progress if the first char isn't '<' or '&'. * * parse a CharData section.this is the fallback function * of xmlParseCharData() when the parsing requires handling * of non-ASCII characters. */
| 4921 | * of non-ASCII characters. |
| 4922 | */ |
| 4923 | static void |
| 4924 | xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int partial) { |
| 4925 | xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5]; |
| 4926 | int nbchar = 0; |
| 4927 | int cur, l; |
| 4928 | |
| 4929 | cur = CUR_CHAR(l); |
| 4930 | while ((cur != '<') && /* checked */ |
| 4931 | (cur != '&') && |
| 4932 | (IS_CHAR(cur))) { |
| 4933 | if ((cur == ']') && (NXT(1) == ']') && (NXT(2) == '>')) { |
| 4934 | xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL); |
| 4935 | } |
| 4936 | COPY_BUF(buf, nbchar, cur); |
| 4937 | /* move current position before possible calling of ctxt->sax->characters */ |
| 4938 | NEXTL(l); |
| 4939 | if (nbchar >= XML_PARSER_BIG_BUFFER_SIZE) { |
| 4940 | buf[nbchar] = 0; |
| 4941 | |
| 4942 | /* |
| 4943 | * OK the segment is to be consumed as chars. |
| 4944 | */ |
| 4945 | if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { |
| 4946 | if (areBlanks(ctxt, buf, nbchar, 0)) { |
| 4947 | if (ctxt->sax->ignorableWhitespace != NULL) |
| 4948 | ctxt->sax->ignorableWhitespace(ctxt->userData, |
| 4949 | buf, nbchar); |
| 4950 | } else { |
| 4951 | if (ctxt->sax->characters != NULL) |
| 4952 | ctxt->sax->characters(ctxt->userData, buf, nbchar); |
| 4953 | if ((ctxt->sax->characters != |
| 4954 | ctxt->sax->ignorableWhitespace) && |
| 4955 | (*ctxt->space == -1)) |
| 4956 | *ctxt->space = -2; |
| 4957 | } |
| 4958 | } |
| 4959 | nbchar = 0; |
| 4960 | SHRINK; |
| 4961 | } |
| 4962 | cur = CUR_CHAR(l); |
| 4963 | } |
| 4964 | if (nbchar != 0) { |
| 4965 | buf[nbchar] = 0; |
| 4966 | /* |
| 4967 | * OK the segment is to be consumed as chars. |
| 4968 | */ |
| 4969 | if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { |
| 4970 | if (areBlanks(ctxt, buf, nbchar, 0)) { |
| 4971 | if (ctxt->sax->ignorableWhitespace != NULL) |
| 4972 | ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); |
| 4973 | } else { |
| 4974 | if (ctxt->sax->characters != NULL) |
| 4975 | ctxt->sax->characters(ctxt->userData, buf, nbchar); |
| 4976 | if ((ctxt->sax->characters != ctxt->sax->ignorableWhitespace) && |
| 4977 | (*ctxt->space == -1)) |
| 4978 | *ctxt->space = -2; |
| 4979 | } |
| 4980 | } |
no test coverage detected