#define QX_ALLOC_MAX (100*1024)
/**
- * It is judged whether it is the first byte of Japanese Shift_JIS "ZENKAKU KANJI".
+ * It is judged whether it is the first byte of Japanese Shift_JIS
+ * "ZENKAKU KANJI".
*/
-#define is_sjis_kanji(c) ((0x81 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0x9f) \
- || (0xe0 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xfc))
+#define is_sjis_kanji(c) ((0x81 <= (unsigned char)(c&0xff) && \
+ (unsigned char)(c&0xff) <= 0x9f) \
+ || (0xe0 <= (unsigned char)(c&0xff) && \
+ (unsigned char)(c&0xff) <= 0xfc))
/**
* It is judged whether it is a byte of Japanese Shift_JIS "HANKAKU KANA".
*/
&& (strcasecmp(c, "?xml" ) != 0) \
&& (strcasecmp(c, "!doctype" ) != 0) \
&& (strcasecmp(c, "link" ) != 0) \
- && (strcasecmp(c, "!--" ) != 0))
+ && (strcasecmp(c, "!--" ) != 0) \
+ && (strncasecmp(c, "![CDATA[",8) != 0))
/**
* It is judged whether the tag of the object has the child element.
case 'c':
case 'C':
- /*------------------------------------------------------------------------*/
- /* <CENTER> */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* <CENTER> */
+ /*----------------------------------------------------------------------*/
if (strcasecmp(name, "center") == 0) {
if (handlers[tagCENTER].start_tag_handler)
handlers[tagCENTER].start_tag_handler(pdoc, child);
if (handlers[tagCENTER].end_tag_handler)
handlers[tagCENTER].end_tag_handler(pdoc, child);
}
- /*------------------------------------------------------------------------*/
- /* <CHXJ:IF> */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* <CHXJ:IF> */
+ /*----------------------------------------------------------------------*/
else
if (strcasecmp(name, "chxj:if") == 0) {
if (chxj_chxjif_is_mine(spec, doc, child)) {
if (handlers[tagTITLE].end_tag_handler)
handlers[tagTITLE].end_tag_handler(pdoc, child);
}
- /*------------------------------------------------------------------------*/
- /* <TABLE> */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* <TABLE> */
+ /*----------------------------------------------------------------------*/
else
if (strcasecmp(name, "table") == 0) {
if (handlers[tagTABLE].start_tag_handler)
if (handlers[tagTABLE].end_tag_handler)
handlers[tagTABLE].end_tag_handler(pdoc, child);
}
- /*------------------------------------------------------------------------*/
- /* <TBODY> */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* <TBODY> */
+ /*----------------------------------------------------------------------*/
else
if (strcasecmp(name, "tbody") == 0) {
if (handlers[tagTBODY].start_tag_handler)
if (handlers[tagTBODY].end_tag_handler)
handlers[tagTBODY].end_tag_handler(pdoc, child);
}
- /*------------------------------------------------------------------------*/
- /* <TH> */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* <TH> */
+ /*----------------------------------------------------------------------*/
else
if (strcasecmp(name, "th") == 0) {
if (handlers[tagTH].start_tag_handler)
if (handlers[tagTH].end_tag_handler)
handlers[tagTH].end_tag_handler(pdoc, child);
}
- /*------------------------------------------------------------------------*/
- /* <TR> */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* <TR> */
+ /*----------------------------------------------------------------------*/
else
if (strcasecmp(name, "tr") == 0) {
if (handlers[tagTR].start_tag_handler)
if (handlers[tagTR].end_tag_handler)
handlers[tagTR].end_tag_handler(pdoc, child);
}
- /*------------------------------------------------------------------------*/
- /* <TD> */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* <TD> */
+ /*----------------------------------------------------------------------*/
else
if (strcasecmp(name, "td") == 0) {
if (handlers[tagTD].start_tag_handler)
if (handlers[tagTD].end_tag_handler)
handlers[tagTD].end_tag_handler(pdoc, child);
}
- /*------------------------------------------------------------------------*/
- /* NORMAL TEXT */
- /*------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------*/
+ /* NORMAL TEXT */
+ /*----------------------------------------------------------------------*/
else
- if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
+ if (strcasecmp(name, "text") == 0) {
if (handlers[tagTEXT].start_tag_handler)
handlers[tagTEXT].start_tag_handler(pdoc, child);
}
ii += endpoint;
if (node->name[0] == '/' ) {
-
- if ((doc->parse_mode == PARSE_MODE_CHTML && has_child(&(node->name[1])))
- || (doc->parse_mode == PARSE_MODE_NO_PARSE
- && (node->name[1] == 'c' || node->name[1] == 'C')
- && strcasecmp(&node->name[1], "chxj:if") == 0)) {
- if (doc->now_parent_node->parent != NULL) {
- doc->now_parent_node = doc->now_parent_node->parent;
- doc->parse_mode = PARSE_MODE_CHTML;
+ if (doc->parse_mode == PARSE_MODE_CHTML) {
+ if (has_child(&(node->name[1]))) {
+ if (doc->now_parent_node->parent != NULL) {
+ doc->now_parent_node = doc->now_parent_node->parent;
+ doc->parse_mode = PARSE_MODE_CHTML;
+ }
+ }
+ else {
+ continue;
+ }
+ }
+ else
+ if (doc->parse_mode == PARSE_MODE_NO_PARSE) {
+ if ((node->name[1] == 'c' || node->name[1] == 'C')
+ && strcasecmp(&node->name[1], "chxj:if") == 0) {
+ if (doc->now_parent_node->parent != NULL) {
+ doc->now_parent_node = doc->now_parent_node->parent;
+ doc->parse_mode = PARSE_MODE_CHTML;
+ }
}
}