| 1668 | ************************************************************************/ |
| 1669 | #ifdef LIBXML_READER_ENABLED |
| 1670 | static void processNode(xmlTextReaderPtr reader) { |
| 1671 | const xmlChar *name, *value; |
| 1672 | int type, empty; |
| 1673 | |
| 1674 | type = xmlTextReaderNodeType(reader); |
| 1675 | empty = xmlTextReaderIsEmptyElement(reader); |
| 1676 | |
| 1677 | if (debug) { |
| 1678 | name = xmlTextReaderConstName(reader); |
| 1679 | if (name == NULL) |
| 1680 | name = BAD_CAST "--"; |
| 1681 | |
| 1682 | value = xmlTextReaderConstValue(reader); |
| 1683 | |
| 1684 | |
| 1685 | printf("%d %d %s %d %d", |
| 1686 | xmlTextReaderDepth(reader), |
| 1687 | type, |
| 1688 | name, |
| 1689 | empty, |
| 1690 | xmlTextReaderHasValue(reader)); |
| 1691 | if (value == NULL) |
| 1692 | printf("\n"); |
| 1693 | else { |
| 1694 | printf(" %s\n", value); |
| 1695 | } |
| 1696 | } |
| 1697 | #ifdef LIBXML_PATTERN_ENABLED |
| 1698 | if (patternc) { |
| 1699 | xmlChar *path = NULL; |
| 1700 | int match = -1; |
| 1701 | |
| 1702 | if (type == XML_READER_TYPE_ELEMENT) { |
| 1703 | /* do the check only on element start */ |
| 1704 | match = xmlPatternMatch(patternc, xmlTextReaderCurrentNode(reader)); |
| 1705 | |
| 1706 | if (match) { |
| 1707 | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) |
| 1708 | path = xmlGetNodePath(xmlTextReaderCurrentNode(reader)); |
| 1709 | printf("Node %s matches pattern %s\n", path, pattern); |
| 1710 | #else |
| 1711 | printf("Node %s matches pattern %s\n", |
| 1712 | xmlTextReaderConstName(reader), pattern); |
| 1713 | #endif |
| 1714 | } |
| 1715 | } |
| 1716 | if (patstream != NULL) { |
| 1717 | int ret; |
| 1718 | |
| 1719 | if (type == XML_READER_TYPE_ELEMENT) { |
| 1720 | ret = xmlStreamPush(patstream, |
| 1721 | xmlTextReaderConstLocalName(reader), |
| 1722 | xmlTextReaderConstNamespaceUri(reader)); |
| 1723 | if (ret < 0) { |
| 1724 | fprintf(ERR_STREAM, "xmlStreamPush() failure\n"); |
| 1725 | xmlFreeStreamCtxt(patstream); |
| 1726 | patstream = NULL; |
| 1727 | } else if (ret != match) { |
no test coverage detected