/usr/lib/python2.7/dist-packages/libxml2.py is in python-libxml2 2.9.4+dfsg1-6.1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 | import libxml2mod
import types
import sys
# The root of all libxml2 errors.
class libxmlError(Exception): pass
# Type of the wrapper class for the C objects wrappers
def checkWrapper(obj):
try:
n = type(_obj).__name__
if n != 'PyCObject' and n != 'PyCapsule':
return 1
except:
return 0
return 0
#
# id() is sometimes negative ...
#
def pos_id(o):
i = id(o)
if (i < 0):
return (sys.maxsize - i)
return i
#
# Errors raised by the wrappers when some tree handling failed.
#
class treeError(libxmlError):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class parserError(libxmlError):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class uriError(libxmlError):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class xpathError(libxmlError):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class ioWrapper:
def __init__(self, _obj):
self.__io = _obj
self._o = None
def io_close(self):
if self.__io == None:
return(-1)
self.__io.close()
self.__io = None
return(0)
def io_flush(self):
if self.__io == None:
return(-1)
self.__io.flush()
return(0)
def io_read(self, len = -1):
if self.__io == None:
return(-1)
try:
if len < 0:
ret = self.__io.read()
else:
ret = self.__io.read(len)
except Exception:
import sys
e = sys.exc_info()[1]
print("failed to read from Python:", type(e))
print("on IO:", self.__io)
self.__io == None
return(-1)
return(ret)
def io_write(self, str, len = -1):
if self.__io == None:
return(-1)
if len < 0:
return(self.__io.write(str))
return(self.__io.write(str, len))
class ioReadWrapper(ioWrapper):
def __init__(self, _obj, enc = ""):
ioWrapper.__init__(self, _obj)
self._o = libxml2mod.xmlCreateInputBuffer(self, enc)
def __del__(self):
print("__del__")
self.io_close()
if self._o != None:
libxml2mod.xmlFreeParserInputBuffer(self._o)
self._o = None
def close(self):
self.io_close()
if self._o != None:
libxml2mod.xmlFreeParserInputBuffer(self._o)
self._o = None
class ioWriteWrapper(ioWrapper):
def __init__(self, _obj, enc = ""):
# print "ioWriteWrapper.__init__", _obj
if type(_obj) == type(''):
print("write io from a string")
self.o = None
elif type(_obj).__name__ == 'PyCapsule':
file = libxml2mod.outputBufferGetPythonFile(_obj)
if file != None:
ioWrapper.__init__(self, file)
else:
ioWrapper.__init__(self, _obj)
self._o = _obj
# elif type(_obj) == types.InstanceType:
# print(("write io from instance of %s" % (_obj.__class__)))
# ioWrapper.__init__(self, _obj)
# self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
else:
file = libxml2mod.outputBufferGetPythonFile(_obj)
if file != None:
ioWrapper.__init__(self, file)
else:
ioWrapper.__init__(self, _obj)
self._o = _obj
def __del__(self):
# print "__del__"
self.io_close()
if self._o != None:
libxml2mod.xmlOutputBufferClose(self._o)
self._o = None
def flush(self):
self.io_flush()
if self._o != None:
libxml2mod.xmlOutputBufferClose(self._o)
self._o = None
def close(self):
self.io_flush()
if self._o != None:
libxml2mod.xmlOutputBufferClose(self._o)
self._o = None
#
# Example of a class to handle SAX events
#
class SAXCallback:
"""Base class for SAX handlers"""
def startDocument(self):
"""called at the start of the document"""
pass
def endDocument(self):
"""called at the end of the document"""
pass
def startElement(self, tag, attrs):
"""called at the start of every element, tag is the name of
the element, attrs is a dictionary of the element's attributes"""
pass
def endElement(self, tag):
"""called at the start of every element, tag is the name of
the element"""
pass
def characters(self, data):
"""called when character data have been read, data is the string
containing the data, multiple consecutive characters() callback
are possible."""
pass
def cdataBlock(self, data):
"""called when CDATA section have been read, data is the string
containing the data, multiple consecutive cdataBlock() callback
are possible."""
pass
def reference(self, name):
"""called when an entity reference has been found"""
pass
def ignorableWhitespace(self, data):
"""called when potentially ignorable white spaces have been found"""
pass
def processingInstruction(self, target, data):
"""called when a PI has been found, target contains the PI name and
data is the associated data in the PI"""
pass
def comment(self, content):
"""called when a comment has been found, content contains the comment"""
pass
def externalSubset(self, name, externalID, systemID):
"""called when a DOCTYPE declaration has been found, name is the
DTD name and externalID, systemID are the DTD public and system
identifier for that DTd if available"""
pass
def internalSubset(self, name, externalID, systemID):
"""called when a DOCTYPE declaration has been found, name is the
DTD name and externalID, systemID are the DTD public and system
identifier for that DTD if available"""
pass
def entityDecl(self, name, type, externalID, systemID, content):
"""called when an ENTITY declaration has been found, name is the
entity name and externalID, systemID are the entity public and
system identifier for that entity if available, type indicates
the entity type, and content reports it's string content"""
pass
def notationDecl(self, name, externalID, systemID):
"""called when an NOTATION declaration has been found, name is the
notation name and externalID, systemID are the notation public and
system identifier for that notation if available"""
pass
def attributeDecl(self, elem, name, type, defi, defaultValue, nameList):
"""called when an ATTRIBUTE definition has been found"""
pass
def elementDecl(self, name, type, content):
"""called when an ELEMENT definition has been found"""
pass
def entityDecl(self, name, publicId, systemID, notationName):
"""called when an unparsed ENTITY declaration has been found,
name is the entity name and publicId,, systemID are the entity
public and system identifier for that entity if available,
and notationName indicate the associated NOTATION"""
pass
def warning(self, msg):
#print msg
pass
def error(self, msg):
raise parserError(msg)
def fatalError(self, msg):
raise parserError(msg)
#
# This class is the ancestor of all the Node classes. It provides
# the basic functionalities shared by all nodes (and handle
# gracefylly the exception), like name, navigation in the tree,
# doc reference, content access and serializing to a string or URI
#
class xmlCore:
def __init__(self, _obj=None):
if _obj != None:
self._o = _obj;
return
self._o = None
def __eq__(self, other):
if other == None:
return False
ret = libxml2mod.compareNodesEqual(self._o, other._o)
if ret == None:
return False
return ret == True
def __ne__(self, other):
if other == None:
return True
ret = libxml2mod.compareNodesEqual(self._o, other._o)
return not ret
def __hash__(self):
ret = libxml2mod.nodeHash(self._o)
return ret
def __str__(self):
return self.serialize()
def get_parent(self):
ret = libxml2mod.parent(self._o)
if ret == None:
return None
return nodeWrap(ret)
def get_children(self):
ret = libxml2mod.children(self._o)
if ret == None:
return None
return nodeWrap(ret)
def get_last(self):
ret = libxml2mod.last(self._o)
if ret == None:
return None
return nodeWrap(ret)
def get_next(self):
ret = libxml2mod.next(self._o)
if ret == None:
return None
return nodeWrap(ret)
def get_properties(self):
ret = libxml2mod.properties(self._o)
if ret == None:
return None
return xmlAttr(_obj=ret)
def get_prev(self):
ret = libxml2mod.prev(self._o)
if ret == None:
return None
return nodeWrap(ret)
def get_content(self):
return libxml2mod.xmlNodeGetContent(self._o)
getContent = get_content # why is this duplicate naming needed ?
def get_name(self):
return libxml2mod.name(self._o)
def get_type(self):
return libxml2mod.type(self._o)
def get_doc(self):
ret = libxml2mod.doc(self._o)
if ret == None:
if self.type in ["document_xml", "document_html"]:
return xmlDoc(_obj=self._o)
else:
return None
return xmlDoc(_obj=ret)
#
# Those are common attributes to nearly all type of nodes
# defined as python2 properties
#
import sys
if float(sys.version[0:3]) < 2.2:
def __getattr__(self, attr):
if attr == "parent":
ret = libxml2mod.parent(self._o)
if ret == None:
return None
return nodeWrap(ret)
elif attr == "properties":
ret = libxml2mod.properties(self._o)
if ret == None:
return None
return xmlAttr(_obj=ret)
elif attr == "children":
ret = libxml2mod.children(self._o)
if ret == None:
return None
return nodeWrap(ret)
elif attr == "last":
ret = libxml2mod.last(self._o)
if ret == None:
return None
return nodeWrap(ret)
elif attr == "next":
ret = libxml2mod.next(self._o)
if ret == None:
return None
return nodeWrap(ret)
elif attr == "prev":
ret = libxml2mod.prev(self._o)
if ret == None:
return None
return nodeWrap(ret)
elif attr == "content":
return libxml2mod.xmlNodeGetContent(self._o)
elif attr == "name":
return libxml2mod.name(self._o)
elif attr == "type":
return libxml2mod.type(self._o)
elif attr == "doc":
ret = libxml2mod.doc(self._o)
if ret == None:
if self.type == "document_xml" or self.type == "document_html":
return xmlDoc(_obj=self._o)
else:
return None
return xmlDoc(_obj=ret)
raise AttributeError(attr)
else:
parent = property(get_parent, None, None, "Parent node")
children = property(get_children, None, None, "First child node")
last = property(get_last, None, None, "Last sibling node")
next = property(get_next, None, None, "Next sibling node")
prev = property(get_prev, None, None, "Previous sibling node")
properties = property(get_properties, None, None, "List of properies")
content = property(get_content, None, None, "Content of this node")
name = property(get_name, None, None, "Node name")
type = property(get_type, None, None, "Node type")
doc = property(get_doc, None, None, "The document this node belongs to")
#
# Serialization routines, the optional arguments have the following
# meaning:
# encoding: string to ask saving in a specific encoding
# indent: if 1 the serializer is asked to indent the output
#
def serialize(self, encoding = None, format = 0):
return libxml2mod.serializeNode(self._o, encoding, format)
def saveTo(self, file, encoding = None, format = 0):
return libxml2mod.saveNodeTo(self._o, file, encoding, format)
#
# Canonicalization routines:
#
# nodes: the node set (tuple or list) to be included in the
# canonized image or None if all document nodes should be
# included.
# exclusive: the exclusive flag (0 - non-exclusive
# canonicalization; otherwise - exclusive canonicalization)
# prefixes: the list of inclusive namespace prefixes (strings),
# or None if there is no inclusive namespaces (only for
# exclusive canonicalization, ignored otherwise)
# with_comments: include comments in the result (!=0) or not
# (==0)
def c14nMemory(self,
nodes=None,
exclusive=0,
prefixes=None,
with_comments=0):
if nodes:
nodes = [n._o for n in nodes]
return libxml2mod.xmlC14NDocDumpMemory(
self.get_doc()._o,
nodes,
exclusive != 0,
prefixes,
with_comments != 0)
def c14nSaveTo(self,
file,
nodes=None,
exclusive=0,
prefixes=None,
with_comments=0):
if nodes:
nodes = [n._o for n in nodes]
return libxml2mod.xmlC14NDocSaveTo(
self.get_doc()._o,
nodes,
exclusive != 0,
prefixes,
with_comments != 0,
file)
#
# Selecting nodes using XPath, a bit slow because the context
# is allocated/freed every time but convenient.
#
def xpathEval(self, expr):
doc = self.doc
if doc == None:
return None
ctxt = doc.xpathNewContext()
ctxt.setContextNode(self)
res = ctxt.xpathEval(expr)
ctxt.xpathFreeContext()
return res
# #
# # Selecting nodes using XPath, faster because the context
# # is allocated just once per xmlDoc.
# #
# # Removed: DV memleaks c.f. #126735
# #
# def xpathEval2(self, expr):
# doc = self.doc
# if doc == None:
# return None
# try:
# doc._ctxt.setContextNode(self)
# except:
# doc._ctxt = doc.xpathNewContext()
# doc._ctxt.setContextNode(self)
# res = doc._ctxt.xpathEval(expr)
# return res
def xpathEval2(self, expr):
return self.xpathEval(expr)
# Remove namespaces
def removeNsDef(self, href):
"""
Remove a namespace definition from a node. If href is None,
remove all of the ns definitions on that node. The removed
namespaces are returned as a linked list.
Note: If any child nodes referred to the removed namespaces,
they will be left with dangling links. You should call
renconciliateNs() to fix those pointers.
Note: This method does not free memory taken by the ns
definitions. You will need to free it manually with the
freeNsList() method on the returns xmlNs object.
"""
ret = libxml2mod.xmlNodeRemoveNsDef(self._o, href)
if ret is None:return None
__tmp = xmlNs(_obj=ret)
return __tmp
# support for python2 iterators
def walk_depth_first(self):
return xmlCoreDepthFirstItertor(self)
def walk_breadth_first(self):
return xmlCoreBreadthFirstItertor(self)
__iter__ = walk_depth_first
def free(self):
try:
self.doc._ctxt.xpathFreeContext()
except:
pass
libxml2mod.xmlFreeDoc(self._o)
#
# implements the depth-first iterator for libxml2 DOM tree
#
class xmlCoreDepthFirstItertor:
def __init__(self, node):
self.node = node
self.parents = []
def __iter__(self):
return self
def __next__(self):
while 1:
if self.node:
ret = self.node
self.parents.append(self.node)
self.node = self.node.children
return ret
try:
parent = self.parents.pop()
except IndexError:
raise StopIteration
self.node = parent.next
next = __next__
#
# implements the breadth-first iterator for libxml2 DOM tree
#
class xmlCoreBreadthFirstItertor:
def __init__(self, node):
self.node = node
self.parents = []
def __iter__(self):
return self
def __next__(self):
while 1:
if self.node:
ret = self.node
self.parents.append(self.node)
self.node = self.node.next
return ret
try:
parent = self.parents.pop()
except IndexError:
raise StopIteration
self.node = parent.children
next = __next__
#
# converters to present a nicer view of the XPath returns
#
def nodeWrap(o):
# TODO try to cast to the most appropriate node class
name = libxml2mod.type(o)
if name == "element" or name == "text":
return xmlNode(_obj=o)
if name == "attribute":
return xmlAttr(_obj=o)
if name[0:8] == "document":
return xmlDoc(_obj=o)
if name == "namespace":
return xmlNs(_obj=o)
if name == "elem_decl":
return xmlElement(_obj=o)
if name == "attribute_decl":
return xmlAttribute(_obj=o)
if name == "entity_decl":
return xmlEntity(_obj=o)
if name == "dtd":
return xmlDtd(_obj=o)
return xmlNode(_obj=o)
def xpathObjectRet(o):
otype = type(o)
if otype == type([]):
ret = list(map(xpathObjectRet, o))
return ret
elif otype == type(()):
ret = list(map(xpathObjectRet, o))
return tuple(ret)
elif otype == type('') or otype == type(0) or otype == type(0.0):
return o
else:
return nodeWrap(o)
#
# register an XPath function
#
def registerXPathFunction(ctxt, name, ns_uri, f):
ret = libxml2mod.xmlRegisterXPathFunction(ctxt, name, ns_uri, f)
#
# For the xmlTextReader parser configuration
#
PARSER_LOADDTD=1
PARSER_DEFAULTATTRS=2
PARSER_VALIDATE=3
PARSER_SUBST_ENTITIES=4
#
# For the error callback severities
#
PARSER_SEVERITY_VALIDITY_WARNING=1
PARSER_SEVERITY_VALIDITY_ERROR=2
PARSER_SEVERITY_WARNING=3
PARSER_SEVERITY_ERROR=4
#
# register the libxml2 error handler
#
def registerErrorHandler(f, ctx):
"""Register a Python written function to for error reporting.
The function is called back as f(ctx, error). """
import sys
if 'libxslt' not in sys.modules:
# normal behaviour when libxslt is not imported
ret = libxml2mod.xmlRegisterErrorHandler(f,ctx)
else:
# when libxslt is already imported, one must
# use libxst's error handler instead
import libxslt
ret = libxslt.registerErrorHandler(f,ctx)
return ret
class parserCtxtCore:
def __init__(self, _obj=None):
if _obj != None:
self._o = _obj;
return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeParserCtxt(self._o)
self._o = None
def setErrorHandler(self,f,arg):
"""Register an error handler that will be called back as
f(arg,msg,severity,reserved).
@reserved is currently always None."""
libxml2mod.xmlParserCtxtSetErrorHandler(self._o,f,arg)
def getErrorHandler(self):
"""Return (f,arg) as previously registered with setErrorHandler
or (None,None)."""
return libxml2mod.xmlParserCtxtGetErrorHandler(self._o)
def addLocalCatalog(self, uri):
"""Register a local catalog with the parser"""
return libxml2mod.addLocalCatalog(self._o, uri)
class ValidCtxtCore:
def __init__(self, *args, **kw):
pass
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
"""
Register error and warning handlers for DTD validation.
These will be called back as f(msg,arg)
"""
libxml2mod.xmlSetValidErrors(self._o, err_func, warn_func, arg)
class SchemaValidCtxtCore:
def __init__(self, *args, **kw):
pass
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
"""
Register error and warning handlers for Schema validation.
These will be called back as f(msg,arg)
"""
libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)
class relaxNgValidCtxtCore:
def __init__(self, *args, **kw):
pass
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
"""
Register error and warning handlers for RelaxNG validation.
These will be called back as f(msg,arg)
"""
libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
def _xmlTextReaderErrorFunc(xxx_todo_changeme,msg,severity,locator):
"""Intermediate callback to wrap the locator"""
(f,arg) = xxx_todo_changeme
return f(arg,msg,severity,xmlTextReaderLocator(locator))
class xmlTextReaderCore:
def __init__(self, _obj=None):
self.input = None
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeTextReader(self._o)
self._o = None
def SetErrorHandler(self,f,arg):
"""Register an error handler that will be called back as
f(arg,msg,severity,locator)."""
if f is None:
libxml2mod.xmlTextReaderSetErrorHandler(\
self._o,None,None)
else:
libxml2mod.xmlTextReaderSetErrorHandler(\
self._o,_xmlTextReaderErrorFunc,(f,arg))
def GetErrorHandler(self):
"""Return (f,arg) as previously registered with setErrorHandler
or (None,None)."""
f,arg = libxml2mod.xmlTextReaderGetErrorHandler(self._o)
if f is None:
return None,None
else:
# assert f is _xmlTextReaderErrorFunc
return arg
#
# The cleanup now goes though a wrapper in libxml.c
#
def cleanupParser():
libxml2mod.xmlPythonCleanupParser()
#
# The interface to xmlRegisterInputCallbacks.
# Since this API does not allow to pass a data object along with
# match/open callbacks, it is necessary to maintain a list of all
# Python callbacks.
#
__input_callbacks = []
def registerInputCallback(func):
def findOpenCallback(URI):
for cb in reversed(__input_callbacks):
o = cb(URI)
if o is not None:
return o
libxml2mod.xmlRegisterInputCallback(findOpenCallback)
__input_callbacks.append(func)
def popInputCallbacks():
# First pop python-level callbacks, when no more available - start
# popping built-in ones.
if len(__input_callbacks) > 0:
__input_callbacks.pop()
if len(__input_callbacks) == 0:
libxml2mod.xmlUnregisterInputCallback()
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# Everything before this line comes from libxml.py
# Everything after this line is automatically generated
#
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# Functions from module HTMLparser
#
def htmlCreateMemoryParserCtxt(buffer, size):
"""Create a parser context for an HTML in-memory document. """
ret = libxml2mod.htmlCreateMemoryParserCtxt(buffer, size)
if ret is None:raise parserError('htmlCreateMemoryParserCtxt() failed')
return parserCtxt(_obj=ret)
def htmlHandleOmittedElem(val):
"""Set and return the previous value for handling HTML omitted
tags. """
ret = libxml2mod.htmlHandleOmittedElem(val)
return ret
def htmlIsScriptAttribute(name):
"""Check if an attribute is of content type Script """
ret = libxml2mod.htmlIsScriptAttribute(name)
return ret
def htmlNewParserCtxt():
"""Allocate and initialize a new parser context. """
ret = libxml2mod.htmlNewParserCtxt()
if ret is None:raise parserError('htmlNewParserCtxt() failed')
return parserCtxt(_obj=ret)
def htmlParseDoc(cur, encoding):
"""parse an HTML in-memory document and build a tree. """
ret = libxml2mod.htmlParseDoc(cur, encoding)
if ret is None:raise parserError('htmlParseDoc() failed')
return xmlDoc(_obj=ret)
def htmlParseFile(filename, encoding):
"""parse an HTML file and build a tree. Automatic support for
ZLIB/Compress compressed document is provided by default if
found at compile-time. """
ret = libxml2mod.htmlParseFile(filename, encoding)
if ret is None:raise parserError('htmlParseFile() failed')
return xmlDoc(_obj=ret)
def htmlReadDoc(cur, URL, encoding, options):
"""parse an XML in-memory document and build a tree. """
ret = libxml2mod.htmlReadDoc(cur, URL, encoding, options)
if ret is None:raise treeError('htmlReadDoc() failed')
return xmlDoc(_obj=ret)
def htmlReadFd(fd, URL, encoding, options):
"""parse an XML from a file descriptor and build a tree. """
ret = libxml2mod.htmlReadFd(fd, URL, encoding, options)
if ret is None:raise treeError('htmlReadFd() failed')
return xmlDoc(_obj=ret)
def htmlReadFile(filename, encoding, options):
"""parse an XML file from the filesystem or the network. """
ret = libxml2mod.htmlReadFile(filename, encoding, options)
if ret is None:raise treeError('htmlReadFile() failed')
return xmlDoc(_obj=ret)
def htmlReadMemory(buffer, size, URL, encoding, options):
"""parse an XML in-memory document and build a tree. """
ret = libxml2mod.htmlReadMemory(buffer, size, URL, encoding, options)
if ret is None:raise treeError('htmlReadMemory() failed')
return xmlDoc(_obj=ret)
#
# Functions from module HTMLtree
#
def htmlIsBooleanAttr(name):
"""Determine if a given attribute is a boolean attribute. """
ret = libxml2mod.htmlIsBooleanAttr(name)
return ret
def htmlNewDoc(URI, ExternalID):
"""Creates a new HTML document """
ret = libxml2mod.htmlNewDoc(URI, ExternalID)
if ret is None:raise treeError('htmlNewDoc() failed')
return xmlDoc(_obj=ret)
def htmlNewDocNoDtD(URI, ExternalID):
"""Creates a new HTML document without a DTD node if @URI and
@ExternalID are None """
ret = libxml2mod.htmlNewDocNoDtD(URI, ExternalID)
if ret is None:raise treeError('htmlNewDocNoDtD() failed')
return xmlDoc(_obj=ret)
#
# Functions from module SAX2
#
def SAXDefaultVersion(version):
"""Set the default version of SAX used globally by the
library. By default, during initialization the default is
set to 2. Note that it is generally a better coding style
to use xmlSAXVersion() to set up the version explicitly for
a given parsing context. """
ret = libxml2mod.xmlSAXDefaultVersion(version)
return ret
def defaultSAXHandlerInit():
"""Initialize the default SAX2 handler """
libxml2mod.xmlDefaultSAXHandlerInit()
def docbDefaultSAXHandlerInit():
"""Initialize the default SAX handler """
libxml2mod.docbDefaultSAXHandlerInit()
def htmlDefaultSAXHandlerInit():
"""Initialize the default SAX handler """
libxml2mod.htmlDefaultSAXHandlerInit()
#
# Functions from module catalog
#
def catalogAdd(type, orig, replace):
"""Add an entry in the catalog, it may overwrite existing but
different entries. If called before any other catalog
routine, allows to override the default shared catalog put
in place by xmlInitializeCatalog(); """
ret = libxml2mod.xmlCatalogAdd(type, orig, replace)
return ret
def catalogCleanup():
"""Free up all the memory associated with catalogs """
libxml2mod.xmlCatalogCleanup()
def catalogConvert():
"""Convert all the SGML catalog entries as XML ones """
ret = libxml2mod.xmlCatalogConvert()
return ret
def catalogDump(out):
"""Dump all the global catalog content to the given file. """
if out is not None: out.flush()
libxml2mod.xmlCatalogDump(out)
def catalogGetPublic(pubID):
"""Try to lookup the catalog reference associated to a public
ID DEPRECATED, use xmlCatalogResolvePublic() """
ret = libxml2mod.xmlCatalogGetPublic(pubID)
return ret
def catalogGetSystem(sysID):
"""Try to lookup the catalog reference associated to a system
ID DEPRECATED, use xmlCatalogResolveSystem() """
ret = libxml2mod.xmlCatalogGetSystem(sysID)
return ret
def catalogRemove(value):
"""Remove an entry from the catalog """
ret = libxml2mod.xmlCatalogRemove(value)
return ret
def catalogResolve(pubID, sysID):
"""Do a complete resolution lookup of an External Identifier """
ret = libxml2mod.xmlCatalogResolve(pubID, sysID)
return ret
def catalogResolvePublic(pubID):
"""Try to lookup the catalog reference associated to a public
ID """
ret = libxml2mod.xmlCatalogResolvePublic(pubID)
return ret
def catalogResolveSystem(sysID):
"""Try to lookup the catalog resource for a system ID """
ret = libxml2mod.xmlCatalogResolveSystem(sysID)
return ret
def catalogResolveURI(URI):
"""Do a complete resolution lookup of an URI """
ret = libxml2mod.xmlCatalogResolveURI(URI)
return ret
def catalogSetDebug(level):
"""Used to set the debug level for catalog operation, 0
disable debugging, 1 enable it """
ret = libxml2mod.xmlCatalogSetDebug(level)
return ret
def initializeCatalog():
"""Do the catalog initialization. this function is not thread
safe, catalog initialization should preferably be done once
at startup """
libxml2mod.xmlInitializeCatalog()
def loadACatalog(filename):
"""Load the catalog and build the associated data structures.
This can be either an XML Catalog or an SGML Catalog It
will recurse in SGML CATALOG entries. On the other hand XML
Catalogs are not handled recursively. """
ret = libxml2mod.xmlLoadACatalog(filename)
if ret is None:raise treeError('xmlLoadACatalog() failed')
return catalog(_obj=ret)
def loadCatalog(filename):
"""Load the catalog and makes its definitions effective for
the default external entity loader. It will recurse in SGML
CATALOG entries. this function is not thread safe, catalog
initialization should preferably be done once at startup """
ret = libxml2mod.xmlLoadCatalog(filename)
return ret
def loadCatalogs(pathss):
"""Load the catalogs and makes their definitions effective for
the default external entity loader. this function is not
thread safe, catalog initialization should preferably be
done once at startup """
libxml2mod.xmlLoadCatalogs(pathss)
def loadSGMLSuperCatalog(filename):
"""Load an SGML super catalog. It won't expand CATALOG or
DELEGATE references. This is only needed for manipulating
SGML Super Catalogs like adding and removing CATALOG or
DELEGATE entries. """
ret = libxml2mod.xmlLoadSGMLSuperCatalog(filename)
if ret is None:raise treeError('xmlLoadSGMLSuperCatalog() failed')
return catalog(_obj=ret)
def newCatalog(sgml):
"""create a new Catalog. """
ret = libxml2mod.xmlNewCatalog(sgml)
if ret is None:raise treeError('xmlNewCatalog() failed')
return catalog(_obj=ret)
def parseCatalogFile(filename):
"""parse an XML file and build a tree. It's like
xmlParseFile() except it bypass all catalog lookups. """
ret = libxml2mod.xmlParseCatalogFile(filename)
if ret is None:raise parserError('xmlParseCatalogFile() failed')
return xmlDoc(_obj=ret)
#
# Functions from module chvalid
#
def isBaseChar(ch):
"""This function is DEPRECATED. Use xmlIsBaseChar_ch or
xmlIsBaseCharQ instead """
ret = libxml2mod.xmlIsBaseChar(ch)
return ret
def isBlank(ch):
"""This function is DEPRECATED. Use xmlIsBlank_ch or
xmlIsBlankQ instead """
ret = libxml2mod.xmlIsBlank(ch)
return ret
def isChar(ch):
"""This function is DEPRECATED. Use xmlIsChar_ch or xmlIsCharQ
instead """
ret = libxml2mod.xmlIsChar(ch)
return ret
def isCombining(ch):
"""This function is DEPRECATED. Use xmlIsCombiningQ instead """
ret = libxml2mod.xmlIsCombining(ch)
return ret
def isDigit(ch):
"""This function is DEPRECATED. Use xmlIsDigit_ch or
xmlIsDigitQ instead """
ret = libxml2mod.xmlIsDigit(ch)
return ret
def isExtender(ch):
"""This function is DEPRECATED. Use xmlIsExtender_ch or
xmlIsExtenderQ instead """
ret = libxml2mod.xmlIsExtender(ch)
return ret
def isIdeographic(ch):
"""This function is DEPRECATED. Use xmlIsIdeographicQ instead """
ret = libxml2mod.xmlIsIdeographic(ch)
return ret
def isPubidChar(ch):
"""This function is DEPRECATED. Use xmlIsPubidChar_ch or
xmlIsPubidCharQ instead """
ret = libxml2mod.xmlIsPubidChar(ch)
return ret
#
# Functions from module debugXML
#
def boolToText(boolval):
"""Convenient way to turn bool into text """
ret = libxml2mod.xmlBoolToText(boolval)
return ret
def debugDumpString(output, str):
"""Dumps informations about the string, shorten it if necessary """
if output is not None: output.flush()
libxml2mod.xmlDebugDumpString(output, str)
def shellPrintXPathError(errorType, arg):
"""Print the xpath error to libxml default error channel """
libxml2mod.xmlShellPrintXPathError(errorType, arg)
#
# Functions from module dict
#
def dictCleanup():
"""Free the dictionary mutex. Do not call unless sure the
library is not in use anymore ! """
libxml2mod.xmlDictCleanup()
def initializeDict():
"""Do the dictionary mutex initialization. this function is
deprecated """
ret = libxml2mod.xmlInitializeDict()
return ret
#
# Functions from module encoding
#
def addEncodingAlias(name, alias):
"""Registers an alias @alias for an encoding named @name.
Existing alias will be overwritten. """
ret = libxml2mod.xmlAddEncodingAlias(name, alias)
return ret
def cleanupCharEncodingHandlers():
"""Cleanup the memory allocated for the char encoding support,
it unregisters all the encoding handlers and the aliases. """
libxml2mod.xmlCleanupCharEncodingHandlers()
def cleanupEncodingAliases():
"""Unregisters all aliases """
libxml2mod.xmlCleanupEncodingAliases()
def delEncodingAlias(alias):
"""Unregisters an encoding alias @alias """
ret = libxml2mod.xmlDelEncodingAlias(alias)
return ret
def encodingAlias(alias):
"""Lookup an encoding name for the given alias. """
ret = libxml2mod.xmlGetEncodingAlias(alias)
return ret
def initCharEncodingHandlers():
"""Initialize the char encoding support, it registers the
default encoding supported. NOTE: while public, this
function usually doesn't need to be called in normal
processing. """
libxml2mod.xmlInitCharEncodingHandlers()
#
# Functions from module entities
#
def cleanupPredefinedEntities():
"""Cleanup up the predefined entities table. Deprecated call """
libxml2mod.xmlCleanupPredefinedEntities()
def initializePredefinedEntities():
"""Set up the predefined entities. Deprecated call """
libxml2mod.xmlInitializePredefinedEntities()
def predefinedEntity(name):
"""Check whether this name is an predefined entity. """
ret = libxml2mod.xmlGetPredefinedEntity(name)
if ret is None:raise treeError('xmlGetPredefinedEntity() failed')
return xmlEntity(_obj=ret)
#
# Functions from module globals
#
def cleanupGlobals():
"""Additional cleanup for multi-threading """
libxml2mod.xmlCleanupGlobals()
def initGlobals():
"""Additional initialisation for multi-threading """
libxml2mod.xmlInitGlobals()
def thrDefDefaultBufferSize(v):
ret = libxml2mod.xmlThrDefDefaultBufferSize(v)
return ret
def thrDefDoValidityCheckingDefaultValue(v):
ret = libxml2mod.xmlThrDefDoValidityCheckingDefaultValue(v)
return ret
def thrDefGetWarningsDefaultValue(v):
ret = libxml2mod.xmlThrDefGetWarningsDefaultValue(v)
return ret
def thrDefIndentTreeOutput(v):
ret = libxml2mod.xmlThrDefIndentTreeOutput(v)
return ret
def thrDefKeepBlanksDefaultValue(v):
ret = libxml2mod.xmlThrDefKeepBlanksDefaultValue(v)
return ret
def thrDefLineNumbersDefaultValue(v):
ret = libxml2mod.xmlThrDefLineNumbersDefaultValue(v)
return ret
def thrDefLoadExtDtdDefaultValue(v):
ret = libxml2mod.xmlThrDefLoadExtDtdDefaultValue(v)
return ret
def thrDefParserDebugEntities(v):
ret = libxml2mod.xmlThrDefParserDebugEntities(v)
return ret
def thrDefPedanticParserDefaultValue(v):
ret = libxml2mod.xmlThrDefPedanticParserDefaultValue(v)
return ret
def thrDefSaveNoEmptyTags(v):
ret = libxml2mod.xmlThrDefSaveNoEmptyTags(v)
return ret
def thrDefSubstituteEntitiesDefaultValue(v):
ret = libxml2mod.xmlThrDefSubstituteEntitiesDefaultValue(v)
return ret
def thrDefTreeIndentString(v):
ret = libxml2mod.xmlThrDefTreeIndentString(v)
return ret
#
# Functions from module nanoftp
#
def nanoFTPCleanup():
"""Cleanup the FTP protocol layer. This cleanup proxy
informations. """
libxml2mod.xmlNanoFTPCleanup()
def nanoFTPInit():
"""Initialize the FTP protocol layer. Currently it just checks
for proxy informations, and get the hostname """
libxml2mod.xmlNanoFTPInit()
def nanoFTPProxy(host, port, user, passwd, type):
"""Setup the FTP proxy informations. This can also be done by
using ftp_proxy ftp_proxy_user and ftp_proxy_password
environment variables. """
libxml2mod.xmlNanoFTPProxy(host, port, user, passwd, type)
def nanoFTPScanProxy(URL):
"""(Re)Initialize the FTP Proxy context by parsing the URL and
finding the protocol host port it indicates. Should be like
ftp://myproxy/ or ftp://myproxy:3128/ A None URL cleans up
proxy informations. """
libxml2mod.xmlNanoFTPScanProxy(URL)
#
# Functions from module nanohttp
#
def nanoHTTPCleanup():
"""Cleanup the HTTP protocol layer. """
libxml2mod.xmlNanoHTTPCleanup()
def nanoHTTPInit():
"""Initialize the HTTP protocol layer. Currently it just
checks for proxy informations """
libxml2mod.xmlNanoHTTPInit()
def nanoHTTPScanProxy(URL):
"""(Re)Initialize the HTTP Proxy context by parsing the URL
and finding the protocol host port it indicates. Should be
like http://myproxy/ or http://myproxy:3128/ A None URL
cleans up proxy informations. """
libxml2mod.xmlNanoHTTPScanProxy(URL)
#
# Functions from module parser
#
def createDocParserCtxt(cur):
"""Creates a parser context for an XML in-memory document. """
ret = libxml2mod.xmlCreateDocParserCtxt(cur)
if ret is None:raise parserError('xmlCreateDocParserCtxt() failed')
return parserCtxt(_obj=ret)
def initParser():
"""Initialization function for the XML parser. This is not
reentrant. Call once before processing in case of use in
multithreaded programs. """
libxml2mod.xmlInitParser()
def keepBlanksDefault(val):
"""Set and return the previous value for default blanks text
nodes support. The 1.x version of the parser used an
heuristic to try to detect ignorable white spaces. As a
result the SAX callback was generating
xmlSAX2IgnorableWhitespace() callbacks instead of
characters() one, and when using the DOM output text nodes
containing those blanks were not generated. The 2.x and
later version will switch to the XML standard way and
ignorableWhitespace() are only generated when running the
parser in validating mode and when the current element
doesn't allow CDATA or mixed content. This function is
provided as a way to force the standard behavior on 1.X
libs and to switch back to the old mode for compatibility
when running 1.X client code on 2.X . Upgrade of 1.X code
should be done by using xmlIsBlankNode() commodity function
to detect the "empty" nodes generated. This value also
affect autogeneration of indentation when saving code if
blanks sections are kept, indentation is not generated. """
ret = libxml2mod.xmlKeepBlanksDefault(val)
return ret
def lineNumbersDefault(val):
"""Set and return the previous value for enabling line numbers
in elements contents. This may break on old application and
is turned off by default. """
ret = libxml2mod.xmlLineNumbersDefault(val)
return ret
def newParserCtxt():
"""Allocate and initialize a new parser context. """
ret = libxml2mod.xmlNewParserCtxt()
if ret is None:raise parserError('xmlNewParserCtxt() failed')
return parserCtxt(_obj=ret)
def parseDTD(ExternalID, SystemID):
"""Load and parse an external subset. """
ret = libxml2mod.xmlParseDTD(ExternalID, SystemID)
if ret is None:raise parserError('xmlParseDTD() failed')
return xmlDtd(_obj=ret)
def parseDoc(cur):
"""parse an XML in-memory document and build a tree. """
ret = libxml2mod.xmlParseDoc(cur)
if ret is None:raise parserError('xmlParseDoc() failed')
return xmlDoc(_obj=ret)
def parseEntity(filename):
"""parse an XML external entity out of context and build a
tree. [78] extParsedEnt ::= TextDecl? content This
correspond to a "Well Balanced" chunk """
ret = libxml2mod.xmlParseEntity(filename)
if ret is None:raise parserError('xmlParseEntity() failed')
return xmlDoc(_obj=ret)
def parseFile(filename):
"""parse an XML file and build a tree. Automatic support for
ZLIB/Compress compressed document is provided by default if
found at compile-time. """
ret = libxml2mod.xmlParseFile(filename)
if ret is None:raise parserError('xmlParseFile() failed')
return xmlDoc(_obj=ret)
def parseMemory(buffer, size):
"""parse an XML in-memory block and build a tree. """
ret = libxml2mod.xmlParseMemory(buffer, size)
if ret is None:raise parserError('xmlParseMemory() failed')
return xmlDoc(_obj=ret)
def pedanticParserDefault(val):
"""Set and return the previous value for enabling pedantic
warnings. """
ret = libxml2mod.xmlPedanticParserDefault(val)
return ret
def readDoc(cur, URL, encoding, options):
"""parse an XML in-memory document and build a tree. """
ret = libxml2mod.xmlReadDoc(cur, URL, encoding, options)
if ret is None:raise treeError('xmlReadDoc() failed')
return xmlDoc(_obj=ret)
def readFd(fd, URL, encoding, options):
"""parse an XML from a file descriptor and build a tree. NOTE
that the file descriptor will not be closed when the reader
is closed or reset. """
ret = libxml2mod.xmlReadFd(fd, URL, encoding, options)
if ret is None:raise treeError('xmlReadFd() failed')
return xmlDoc(_obj=ret)
def readFile(filename, encoding, options):
"""parse an XML file from the filesystem or the network. """
ret = libxml2mod.xmlReadFile(filename, encoding, options)
if ret is None:raise treeError('xmlReadFile() failed')
return xmlDoc(_obj=ret)
def readMemory(buffer, size, URL, encoding, options):
"""parse an XML in-memory document and build a tree. """
ret = libxml2mod.xmlReadMemory(buffer, size, URL, encoding, options)
if ret is None:raise treeError('xmlReadMemory() failed')
return xmlDoc(_obj=ret)
def recoverDoc(cur):
"""parse an XML in-memory document and build a tree. In the
case the document is not Well Formed, a attempt to build a
tree is tried anyway """
ret = libxml2mod.xmlRecoverDoc(cur)
if ret is None:raise treeError('xmlRecoverDoc() failed')
return xmlDoc(_obj=ret)
def recoverFile(filename):
"""parse an XML file and build a tree. Automatic support for
ZLIB/Compress compressed document is provided by default if
found at compile-time. In the case the document is not Well
Formed, it attempts to build a tree anyway """
ret = libxml2mod.xmlRecoverFile(filename)
if ret is None:raise treeError('xmlRecoverFile() failed')
return xmlDoc(_obj=ret)
def recoverMemory(buffer, size):
"""parse an XML in-memory block and build a tree. In the case
the document is not Well Formed, an attempt to build a tree
is tried anyway """
ret = libxml2mod.xmlRecoverMemory(buffer, size)
if ret is None:raise treeError('xmlRecoverMemory() failed')
return xmlDoc(_obj=ret)
def substituteEntitiesDefault(val):
"""Set and return the previous value for default entity
support. Initially the parser always keep entity references
instead of substituting entity values in the output. This
function has to be used to change the default parser
behavior SAX::substituteEntities() has to be used for
changing that on a file by file basis. """
ret = libxml2mod.xmlSubstituteEntitiesDefault(val)
return ret
#
# Functions from module parserInternals
#
def checkLanguageID(lang):
"""Checks that the value conforms to the LanguageID
production: NOTE: this is somewhat deprecated, those
productions were removed from the XML Second edition. [33]
LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::=
ISO639Code | IanaCode | UserCode [35] ISO639Code ::=
([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' |
'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-'
([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+ The
current REC reference the sucessors of RFC 1766, currently
5646 http://www.rfc-editor.org/rfc/rfc5646.txt langtag
= language ["-" script] ["-" region] *("-" variant) *("-"
extension) ["-" privateuse] language = 2*3ALPHA
; shortest ISO 639 code ["-" extlang] ; sometimes
followed by ; extended language subtags / 4ALPHA
; or reserved for future use / 5*8ALPHA ; or
registered language subtag extlang = 3ALPHA
; selected ISO 639 codes *2("-" 3ALPHA) ; permanently
reserved script = 4ALPHA ; ISO 15924
code region = 2ALPHA ; ISO 3166-1 code
/ 3DIGIT ; UN M.49 code variant =
5*8alphanum ; registered variants / (DIGIT
3alphanum) extension = singleton 1*("-" (2*8alphanum))
; Single alphanumerics ; "x" reserved for private use
singleton = DIGIT ; 0 - 9 / %x41-57
; A - W / %x59-5A ; Y - Z / %x61-77
; a - w / %x79-7A ; y - z it sounds right to
still allow Irregular i-xxx IANA and user codes too The
parser below doesn't try to cope with extension or
privateuse that could be added but that's not interoperable
anyway """
ret = libxml2mod.xmlCheckLanguageID(lang)
return ret
def copyChar(len, out, val):
"""append the char value in the array """
ret = libxml2mod.xmlCopyChar(len, out, val)
return ret
def copyCharMultiByte(out, val):
"""append the char value in the array """
ret = libxml2mod.xmlCopyCharMultiByte(out, val)
return ret
def createEntityParserCtxt(URL, ID, base):
"""Create a parser context for an external entity Automatic
support for ZLIB/Compress compressed document is provided
by default if found at compile-time. """
ret = libxml2mod.xmlCreateEntityParserCtxt(URL, ID, base)
if ret is None:raise parserError('xmlCreateEntityParserCtxt() failed')
return parserCtxt(_obj=ret)
def createFileParserCtxt(filename):
"""Create a parser context for a file content. Automatic
support for ZLIB/Compress compressed document is provided
by default if found at compile-time. """
ret = libxml2mod.xmlCreateFileParserCtxt(filename)
if ret is None:raise parserError('xmlCreateFileParserCtxt() failed')
return parserCtxt(_obj=ret)
def createMemoryParserCtxt(buffer, size):
"""Create a parser context for an XML in-memory document. """
ret = libxml2mod.xmlCreateMemoryParserCtxt(buffer, size)
if ret is None:raise parserError('xmlCreateMemoryParserCtxt() failed')
return parserCtxt(_obj=ret)
def createURLParserCtxt(filename, options):
"""Create a parser context for a file or URL content.
Automatic support for ZLIB/Compress compressed document is
provided by default if found at compile-time and for file
accesses """
ret = libxml2mod.xmlCreateURLParserCtxt(filename, options)
if ret is None:raise parserError('xmlCreateURLParserCtxt() failed')
return parserCtxt(_obj=ret)
def htmlCreateFileParserCtxt(filename, encoding):
"""Create a parser context for a file content. Automatic
support for ZLIB/Compress compressed document is provided
by default if found at compile-time. """
ret = libxml2mod.htmlCreateFileParserCtxt(filename, encoding)
if ret is None:raise parserError('htmlCreateFileParserCtxt() failed')
return parserCtxt(_obj=ret)
def htmlInitAutoClose():
"""Initialize the htmlStartCloseIndex for fast lookup of
closing tags names. This is not reentrant. Call
xmlInitParser() once before processing in case of use in
multithreaded programs. """
libxml2mod.htmlInitAutoClose()
def isLetter(c):
"""Check whether the character is allowed by the production
[84] Letter ::= BaseChar | Ideographic """
ret = libxml2mod.xmlIsLetter(c)
return ret
def namePop(ctxt):
"""Pops the top element name from the name stack """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.namePop(ctxt__o)
return ret
def namePush(ctxt, value):
"""Pushes a new element name on top of the name stack """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.namePush(ctxt__o, value)
return ret
def nodePop(ctxt):
"""Pops the top element node from the node stack """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.nodePop(ctxt__o)
if ret is None:raise treeError('nodePop() failed')
return xmlNode(_obj=ret)
def nodePush(ctxt, value):
"""Pushes a new element node on top of the node stack """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if value is None: value__o = None
else: value__o = value._o
ret = libxml2mod.nodePush(ctxt__o, value__o)
return ret
#
# Functions from module python
#
def SAXParseFile(SAX, URI, recover):
"""Interface to parse an XML file or resource pointed by an
URI to build an event flow to the SAX object """
libxml2mod.xmlSAXParseFile(SAX, URI, recover)
def createInputBuffer(file, encoding):
"""Create a libxml2 input buffer from a Python file """
ret = libxml2mod.xmlCreateInputBuffer(file, encoding)
if ret is None:raise treeError('xmlCreateInputBuffer() failed')
return inputBuffer(_obj=ret)
def createOutputBuffer(file, encoding):
"""Create a libxml2 output buffer from a Python file """
ret = libxml2mod.xmlCreateOutputBuffer(file, encoding)
if ret is None:raise treeError('xmlCreateOutputBuffer() failed')
return outputBuffer(_obj=ret)
def createPushParser(SAX, chunk, size, URI):
"""Create a progressive XML parser context to build either an
event flow if the SAX object is not None, or a DOM tree
otherwise. """
ret = libxml2mod.xmlCreatePushParser(SAX, chunk, size, URI)
if ret is None:raise parserError('xmlCreatePushParser() failed')
return parserCtxt(_obj=ret)
def debugMemory(activate):
"""Switch on the generation of line number for elements nodes.
Also returns the number of bytes allocated and not freed by
libxml2 since memory debugging was switched on. """
ret = libxml2mod.xmlDebugMemory(activate)
return ret
def dumpMemory():
"""dump the memory allocated in the file .memdump """
libxml2mod.xmlDumpMemory()
def htmlCreatePushParser(SAX, chunk, size, URI):
"""Create a progressive HTML parser context to build either an
event flow if the SAX object is not None, or a DOM tree
otherwise. """
ret = libxml2mod.htmlCreatePushParser(SAX, chunk, size, URI)
if ret is None:raise parserError('htmlCreatePushParser() failed')
return parserCtxt(_obj=ret)
def htmlSAXParseFile(SAX, URI, encoding):
"""Interface to parse an HTML file or resource pointed by an
URI to build an event flow to the SAX object """
libxml2mod.htmlSAXParseFile(SAX, URI, encoding)
def memoryUsed():
"""Returns the total amount of memory allocated by libxml2 """
ret = libxml2mod.xmlMemoryUsed()
return ret
def newNode(name):
"""Create a new Node """
ret = libxml2mod.xmlNewNode(name)
if ret is None:raise treeError('xmlNewNode() failed')
return xmlNode(_obj=ret)
def pythonCleanupParser():
"""Cleanup function for the XML library. It tries to reclaim
all parsing related global memory allocated for the library
processing. It doesn't deallocate any document related
memory. Calling this function should not prevent reusing
the library but one should call xmlCleanupParser() only
when the process has finished using the library or XML
document built with it. """
libxml2mod.xmlPythonCleanupParser()
def setEntityLoader(resolver):
"""Set the entity resolver as a python function """
ret = libxml2mod.xmlSetEntityLoader(resolver)
return ret
#
# Functions from module relaxng
#
def relaxNGCleanupTypes():
"""Cleanup the default Schemas type library associated to
RelaxNG """
libxml2mod.xmlRelaxNGCleanupTypes()
def relaxNGInitTypes():
"""Initilize the default type libraries. """
ret = libxml2mod.xmlRelaxNGInitTypes()
return ret
def relaxNGNewMemParserCtxt(buffer, size):
"""Create an XML RelaxNGs parse context for that memory buffer
expected to contain an XML RelaxNGs file. """
ret = libxml2mod.xmlRelaxNGNewMemParserCtxt(buffer, size)
if ret is None:raise parserError('xmlRelaxNGNewMemParserCtxt() failed')
return relaxNgParserCtxt(_obj=ret)
def relaxNGNewParserCtxt(URL):
"""Create an XML RelaxNGs parse context for that file/resource
expected to contain an XML RelaxNGs file. """
ret = libxml2mod.xmlRelaxNGNewParserCtxt(URL)
if ret is None:raise parserError('xmlRelaxNGNewParserCtxt() failed')
return relaxNgParserCtxt(_obj=ret)
#
# Functions from module tree
#
def buildQName(ncname, prefix, memory, len):
"""Builds the QName @prefix:@ncname in @memory if there is
enough space and prefix is not None nor empty, otherwise
allocate a new string. If prefix is None or empty it
returns ncname. """
ret = libxml2mod.xmlBuildQName(ncname, prefix, memory, len)
return ret
def compressMode():
"""get the default compression mode used, ZLIB based. """
ret = libxml2mod.xmlGetCompressMode()
return ret
def isXHTML(systemID, publicID):
"""Try to find if the document correspond to an XHTML DTD """
ret = libxml2mod.xmlIsXHTML(systemID, publicID)
return ret
def newComment(content):
"""Creation of a new node containing a comment. """
ret = libxml2mod.xmlNewComment(content)
if ret is None:raise treeError('xmlNewComment() failed')
return xmlNode(_obj=ret)
def newDoc(version):
"""Creates a new XML document """
ret = libxml2mod.xmlNewDoc(version)
if ret is None:raise treeError('xmlNewDoc() failed')
return xmlDoc(_obj=ret)
def newPI(name, content):
"""Creation of a processing instruction element. Use
xmlDocNewPI preferably to get string interning """
ret = libxml2mod.xmlNewPI(name, content)
if ret is None:raise treeError('xmlNewPI() failed')
return xmlNode(_obj=ret)
def newText(content):
"""Creation of a new text node. """
ret = libxml2mod.xmlNewText(content)
if ret is None:raise treeError('xmlNewText() failed')
return xmlNode(_obj=ret)
def newTextLen(content, len):
"""Creation of a new text node with an extra parameter for the
content's length """
ret = libxml2mod.xmlNewTextLen(content, len)
if ret is None:raise treeError('xmlNewTextLen() failed')
return xmlNode(_obj=ret)
def setCompressMode(mode):
"""set the default compression mode used, ZLIB based Correct
values: 0 (uncompressed) to 9 (max compression) """
libxml2mod.xmlSetCompressMode(mode)
def validateNCName(value, space):
"""Check that a value conforms to the lexical space of NCName """
ret = libxml2mod.xmlValidateNCName(value, space)
return ret
def validateNMToken(value, space):
"""Check that a value conforms to the lexical space of NMToken """
ret = libxml2mod.xmlValidateNMToken(value, space)
return ret
def validateName(value, space):
"""Check that a value conforms to the lexical space of Name """
ret = libxml2mod.xmlValidateName(value, space)
return ret
def validateQName(value, space):
"""Check that a value conforms to the lexical space of QName """
ret = libxml2mod.xmlValidateQName(value, space)
return ret
#
# Functions from module uri
#
def URIEscape(str):
"""Escaping routine, does not do validity checks ! It will try
to escape the chars needing this, but this is heuristic
based it's impossible to be sure. """
ret = libxml2mod.xmlURIEscape(str)
return ret
def URIEscapeStr(str, list):
"""This routine escapes a string to hex, ignoring reserved
characters (a-z) and the characters in the exception list. """
ret = libxml2mod.xmlURIEscapeStr(str, list)
return ret
def URIUnescapeString(str, len, target):
"""Unescaping routine, but does not check that the string is
an URI. The output is a direct unsigned char translation of
%XX values (no encoding) Note that the length of the result
can only be smaller or same size as the input string. """
ret = libxml2mod.xmlURIUnescapeString(str, len, target)
return ret
def buildRelativeURI(URI, base):
"""Expresses the URI of the reference in terms relative to the
base. Some examples of this operation include: base =
"http://site1.com/docs/book1.html" URI input
URI returned docs/pic1.gif pic1.gif
docs/img/pic1.gif img/pic1.gif img/pic1.gif
../img/pic1.gif http://site1.com/docs/pic1.gif pic1.gif
http://site2.com/docs/pic1.gif
http://site2.com/docs/pic1.gif base = "docs/book1.html"
URI input URI returned docs/pic1.gif
pic1.gif docs/img/pic1.gif img/pic1.gif
img/pic1.gif ../img/pic1.gif
http://site1.com/docs/pic1.gif
http://site1.com/docs/pic1.gif Note: if the URI reference
is really wierd or complicated, it may be worthwhile to
first convert it into a "nice" one by calling xmlBuildURI
(using 'base') before calling this routine, since this
routine (for reasonable efficiency) assumes URI has already
been through some validation. """
ret = libxml2mod.xmlBuildRelativeURI(URI, base)
return ret
def buildURI(URI, base):
"""Computes he final URI of the reference done by checking
that the given URI is valid, and building the final URI
using the base URI. This is processed according to section
5.2 of the RFC 2396 5.2. Resolving Relative References to
Absolute Form """
ret = libxml2mod.xmlBuildURI(URI, base)
return ret
def canonicPath(path):
"""Constructs a canonic path from the specified path. """
ret = libxml2mod.xmlCanonicPath(path)
return ret
def createURI():
"""Simply creates an empty xmlURI """
ret = libxml2mod.xmlCreateURI()
if ret is None:raise uriError('xmlCreateURI() failed')
return URI(_obj=ret)
def normalizeURIPath(path):
"""Applies the 5 normalization steps to a path string--that
is, RFC 2396 Section 5.2, steps 6.c through 6.g.
Normalization occurs directly on the string, no new
allocation is done """
ret = libxml2mod.xmlNormalizeURIPath(path)
return ret
def parseURI(str):
"""Parse an URI based on RFC 3986 URI-reference = [
absoluteURI | relativeURI ] [ "#" fragment ] """
ret = libxml2mod.xmlParseURI(str)
if ret is None:raise uriError('xmlParseURI() failed')
return URI(_obj=ret)
def parseURIRaw(str, raw):
"""Parse an URI but allows to keep intact the original
fragments. URI-reference = URI / relative-ref """
ret = libxml2mod.xmlParseURIRaw(str, raw)
if ret is None:raise uriError('xmlParseURIRaw() failed')
return URI(_obj=ret)
def pathToURI(path):
"""Constructs an URI expressing the existing path """
ret = libxml2mod.xmlPathToURI(path)
return ret
#
# Functions from module valid
#
def newValidCtxt():
"""Allocate a validation context structure. """
ret = libxml2mod.xmlNewValidCtxt()
if ret is None:raise treeError('xmlNewValidCtxt() failed')
return ValidCtxt(_obj=ret)
def validateNameValue(value):
"""Validate that the given value match Name production """
ret = libxml2mod.xmlValidateNameValue(value)
return ret
def validateNamesValue(value):
"""Validate that the given value match Names production """
ret = libxml2mod.xmlValidateNamesValue(value)
return ret
def validateNmtokenValue(value):
"""Validate that the given value match Nmtoken production [
VC: Name Token ] """
ret = libxml2mod.xmlValidateNmtokenValue(value)
return ret
def validateNmtokensValue(value):
"""Validate that the given value match Nmtokens production [
VC: Name Token ] """
ret = libxml2mod.xmlValidateNmtokensValue(value)
return ret
#
# Functions from module xmlIO
#
def checkFilename(path):
"""function checks to see if @path is a valid source (file,
socket...) for XML. if stat is not available on the target
machine, """
ret = libxml2mod.xmlCheckFilename(path)
return ret
def cleanupInputCallbacks():
"""clears the entire input callback table. this includes the
compiled-in I/O. """
libxml2mod.xmlCleanupInputCallbacks()
def cleanupOutputCallbacks():
"""clears the entire output callback table. this includes the
compiled-in I/O callbacks. """
libxml2mod.xmlCleanupOutputCallbacks()
def fileMatch(filename):
"""input from FILE * """
ret = libxml2mod.xmlFileMatch(filename)
return ret
def iOFTPMatch(filename):
"""check if the URI matches an FTP one """
ret = libxml2mod.xmlIOFTPMatch(filename)
return ret
def iOHTTPMatch(filename):
"""check if the URI matches an HTTP one """
ret = libxml2mod.xmlIOHTTPMatch(filename)
return ret
def normalizeWindowsPath(path):
"""This function is obsolete. Please see xmlURIFromPath in
uri.c for a better solution. """
ret = libxml2mod.xmlNormalizeWindowsPath(path)
return ret
def parserGetDirectory(filename):
"""lookup the directory for that file """
ret = libxml2mod.xmlParserGetDirectory(filename)
return ret
def registerDefaultInputCallbacks():
"""Registers the default compiled-in I/O handlers. """
libxml2mod.xmlRegisterDefaultInputCallbacks()
def registerDefaultOutputCallbacks():
"""Registers the default compiled-in I/O handlers. """
libxml2mod.xmlRegisterDefaultOutputCallbacks()
def registerHTTPPostCallbacks():
"""By default, libxml submits HTTP output requests using the
"PUT" method. Calling this method changes the HTTP output
method to use the "POST" method instead. """
libxml2mod.xmlRegisterHTTPPostCallbacks()
#
# Functions from module xmlerror
#
def lastError():
"""Get the last global error registered. This is per thread if
compiled with thread support. """
ret = libxml2mod.xmlGetLastError()
if ret is None:raise treeError('xmlGetLastError() failed')
return Error(_obj=ret)
def resetLastError():
"""Cleanup the last global error registered. For parsing error
this does not change the well-formedness result. """
libxml2mod.xmlResetLastError()
#
# Functions from module xmlreader
#
def newTextReaderFilename(URI):
"""Create an xmlTextReader structure fed with the resource at
@URI """
ret = libxml2mod.xmlNewTextReaderFilename(URI)
if ret is None:raise treeError('xmlNewTextReaderFilename() failed')
return xmlTextReader(_obj=ret)
def readerForDoc(cur, URL, encoding, options):
"""Create an xmltextReader for an XML in-memory document. The
parsing flags @options are a combination of xmlParserOption. """
ret = libxml2mod.xmlReaderForDoc(cur, URL, encoding, options)
if ret is None:raise treeError('xmlReaderForDoc() failed')
return xmlTextReader(_obj=ret)
def readerForFd(fd, URL, encoding, options):
"""Create an xmltextReader for an XML from a file descriptor.
The parsing flags @options are a combination of
xmlParserOption. NOTE that the file descriptor will not be
closed when the reader is closed or reset. """
ret = libxml2mod.xmlReaderForFd(fd, URL, encoding, options)
if ret is None:raise treeError('xmlReaderForFd() failed')
return xmlTextReader(_obj=ret)
def readerForFile(filename, encoding, options):
"""parse an XML file from the filesystem or the network. The
parsing flags @options are a combination of xmlParserOption. """
ret = libxml2mod.xmlReaderForFile(filename, encoding, options)
if ret is None:raise treeError('xmlReaderForFile() failed')
return xmlTextReader(_obj=ret)
def readerForMemory(buffer, size, URL, encoding, options):
"""Create an xmltextReader for an XML in-memory document. The
parsing flags @options are a combination of xmlParserOption. """
ret = libxml2mod.xmlReaderForMemory(buffer, size, URL, encoding, options)
if ret is None:raise treeError('xmlReaderForMemory() failed')
return xmlTextReader(_obj=ret)
#
# Functions from module xmlregexp
#
def regexpCompile(regexp):
"""Parses a regular expression conforming to XML Schemas Part
2 Datatype Appendix F and builds an automata suitable for
testing strings against that regular expression """
ret = libxml2mod.xmlRegexpCompile(regexp)
if ret is None:raise treeError('xmlRegexpCompile() failed')
return xmlReg(_obj=ret)
#
# Functions from module xmlschemas
#
def schemaNewMemParserCtxt(buffer, size):
"""Create an XML Schemas parse context for that memory buffer
expected to contain an XML Schemas file. """
ret = libxml2mod.xmlSchemaNewMemParserCtxt(buffer, size)
if ret is None:raise parserError('xmlSchemaNewMemParserCtxt() failed')
return SchemaParserCtxt(_obj=ret)
def schemaNewParserCtxt(URL):
"""Create an XML Schemas parse context for that file/resource
expected to contain an XML Schemas file. """
ret = libxml2mod.xmlSchemaNewParserCtxt(URL)
if ret is None:raise parserError('xmlSchemaNewParserCtxt() failed')
return SchemaParserCtxt(_obj=ret)
#
# Functions from module xmlschemastypes
#
def schemaCleanupTypes():
"""Cleanup the default XML Schemas type library """
libxml2mod.xmlSchemaCleanupTypes()
def schemaCollapseString(value):
"""Removes and normalize white spaces in the string """
ret = libxml2mod.xmlSchemaCollapseString(value)
return ret
def schemaInitTypes():
"""Initialize the default XML Schemas type library """
libxml2mod.xmlSchemaInitTypes()
def schemaWhiteSpaceReplace(value):
"""Replaces 0xd, 0x9 and 0xa with a space. """
ret = libxml2mod.xmlSchemaWhiteSpaceReplace(value)
return ret
#
# Functions from module xmlstring
#
def UTF8Charcmp(utf1, utf2):
"""compares the two UCS4 values """
ret = libxml2mod.xmlUTF8Charcmp(utf1, utf2)
return ret
def UTF8Size(utf):
"""calculates the internal size of a UTF8 character """
ret = libxml2mod.xmlUTF8Size(utf)
return ret
def UTF8Strlen(utf):
"""compute the length of an UTF8 string, it doesn't do a full
UTF8 checking of the content of the string. """
ret = libxml2mod.xmlUTF8Strlen(utf)
return ret
def UTF8Strloc(utf, utfchar):
"""a function to provide the relative location of a UTF8 char """
ret = libxml2mod.xmlUTF8Strloc(utf, utfchar)
return ret
def UTF8Strndup(utf, len):
"""a strndup for array of UTF8's """
ret = libxml2mod.xmlUTF8Strndup(utf, len)
return ret
def UTF8Strpos(utf, pos):
"""a function to provide the equivalent of fetching a
character from a string array """
ret = libxml2mod.xmlUTF8Strpos(utf, pos)
return ret
def UTF8Strsize(utf, len):
"""storage size of an UTF8 string the behaviour is not
garanteed if the input string is not UTF-8 """
ret = libxml2mod.xmlUTF8Strsize(utf, len)
return ret
def UTF8Strsub(utf, start, len):
"""Create a substring from a given UTF-8 string Note:
positions are given in units of UTF-8 chars """
ret = libxml2mod.xmlUTF8Strsub(utf, start, len)
return ret
def checkUTF8(utf):
"""Checks @utf for being valid UTF-8. @utf is assumed to be
null-terminated. This function is not super-strict, as it
will allow longer UTF-8 sequences than necessary. Note that
Java is capable of producing these sequences if provoked.
Also note, this routine checks for the 4-byte maximum size,
but does not check for 0x10ffff maximum value. """
ret = libxml2mod.xmlCheckUTF8(utf)
return ret
#
# Functions from module xmlunicode
#
def uCSIsAegeanNumbers(code):
"""Check whether the character is part of AegeanNumbers UCS
Block """
ret = libxml2mod.xmlUCSIsAegeanNumbers(code)
return ret
def uCSIsAlphabeticPresentationForms(code):
"""Check whether the character is part of
AlphabeticPresentationForms UCS Block """
ret = libxml2mod.xmlUCSIsAlphabeticPresentationForms(code)
return ret
def uCSIsArabic(code):
"""Check whether the character is part of Arabic UCS Block """
ret = libxml2mod.xmlUCSIsArabic(code)
return ret
def uCSIsArabicPresentationFormsA(code):
"""Check whether the character is part of
ArabicPresentationForms-A UCS Block """
ret = libxml2mod.xmlUCSIsArabicPresentationFormsA(code)
return ret
def uCSIsArabicPresentationFormsB(code):
"""Check whether the character is part of
ArabicPresentationForms-B UCS Block """
ret = libxml2mod.xmlUCSIsArabicPresentationFormsB(code)
return ret
def uCSIsArmenian(code):
"""Check whether the character is part of Armenian UCS Block """
ret = libxml2mod.xmlUCSIsArmenian(code)
return ret
def uCSIsArrows(code):
"""Check whether the character is part of Arrows UCS Block """
ret = libxml2mod.xmlUCSIsArrows(code)
return ret
def uCSIsBasicLatin(code):
"""Check whether the character is part of BasicLatin UCS Block """
ret = libxml2mod.xmlUCSIsBasicLatin(code)
return ret
def uCSIsBengali(code):
"""Check whether the character is part of Bengali UCS Block """
ret = libxml2mod.xmlUCSIsBengali(code)
return ret
def uCSIsBlock(code, block):
"""Check whether the character is part of the UCS Block """
ret = libxml2mod.xmlUCSIsBlock(code, block)
return ret
def uCSIsBlockElements(code):
"""Check whether the character is part of BlockElements UCS
Block """
ret = libxml2mod.xmlUCSIsBlockElements(code)
return ret
def uCSIsBopomofo(code):
"""Check whether the character is part of Bopomofo UCS Block """
ret = libxml2mod.xmlUCSIsBopomofo(code)
return ret
def uCSIsBopomofoExtended(code):
"""Check whether the character is part of BopomofoExtended UCS
Block """
ret = libxml2mod.xmlUCSIsBopomofoExtended(code)
return ret
def uCSIsBoxDrawing(code):
"""Check whether the character is part of BoxDrawing UCS Block """
ret = libxml2mod.xmlUCSIsBoxDrawing(code)
return ret
def uCSIsBraillePatterns(code):
"""Check whether the character is part of BraillePatterns UCS
Block """
ret = libxml2mod.xmlUCSIsBraillePatterns(code)
return ret
def uCSIsBuhid(code):
"""Check whether the character is part of Buhid UCS Block """
ret = libxml2mod.xmlUCSIsBuhid(code)
return ret
def uCSIsByzantineMusicalSymbols(code):
"""Check whether the character is part of
ByzantineMusicalSymbols UCS Block """
ret = libxml2mod.xmlUCSIsByzantineMusicalSymbols(code)
return ret
def uCSIsCJKCompatibility(code):
"""Check whether the character is part of CJKCompatibility UCS
Block """
ret = libxml2mod.xmlUCSIsCJKCompatibility(code)
return ret
def uCSIsCJKCompatibilityForms(code):
"""Check whether the character is part of
CJKCompatibilityForms UCS Block """
ret = libxml2mod.xmlUCSIsCJKCompatibilityForms(code)
return ret
def uCSIsCJKCompatibilityIdeographs(code):
"""Check whether the character is part of
CJKCompatibilityIdeographs UCS Block """
ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographs(code)
return ret
def uCSIsCJKCompatibilityIdeographsSupplement(code):
"""Check whether the character is part of
CJKCompatibilityIdeographsSupplement UCS Block """
ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographsSupplement(code)
return ret
def uCSIsCJKRadicalsSupplement(code):
"""Check whether the character is part of
CJKRadicalsSupplement UCS Block """
ret = libxml2mod.xmlUCSIsCJKRadicalsSupplement(code)
return ret
def uCSIsCJKSymbolsandPunctuation(code):
"""Check whether the character is part of
CJKSymbolsandPunctuation UCS Block """
ret = libxml2mod.xmlUCSIsCJKSymbolsandPunctuation(code)
return ret
def uCSIsCJKUnifiedIdeographs(code):
"""Check whether the character is part of CJKUnifiedIdeographs
UCS Block """
ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographs(code)
return ret
def uCSIsCJKUnifiedIdeographsExtensionA(code):
"""Check whether the character is part of
CJKUnifiedIdeographsExtensionA UCS Block """
ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionA(code)
return ret
def uCSIsCJKUnifiedIdeographsExtensionB(code):
"""Check whether the character is part of
CJKUnifiedIdeographsExtensionB UCS Block """
ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionB(code)
return ret
def uCSIsCat(code, cat):
"""Check whether the character is part of the UCS Category """
ret = libxml2mod.xmlUCSIsCat(code, cat)
return ret
def uCSIsCatC(code):
"""Check whether the character is part of C UCS Category """
ret = libxml2mod.xmlUCSIsCatC(code)
return ret
def uCSIsCatCc(code):
"""Check whether the character is part of Cc UCS Category """
ret = libxml2mod.xmlUCSIsCatCc(code)
return ret
def uCSIsCatCf(code):
"""Check whether the character is part of Cf UCS Category """
ret = libxml2mod.xmlUCSIsCatCf(code)
return ret
def uCSIsCatCo(code):
"""Check whether the character is part of Co UCS Category """
ret = libxml2mod.xmlUCSIsCatCo(code)
return ret
def uCSIsCatCs(code):
"""Check whether the character is part of Cs UCS Category """
ret = libxml2mod.xmlUCSIsCatCs(code)
return ret
def uCSIsCatL(code):
"""Check whether the character is part of L UCS Category """
ret = libxml2mod.xmlUCSIsCatL(code)
return ret
def uCSIsCatLl(code):
"""Check whether the character is part of Ll UCS Category """
ret = libxml2mod.xmlUCSIsCatLl(code)
return ret
def uCSIsCatLm(code):
"""Check whether the character is part of Lm UCS Category """
ret = libxml2mod.xmlUCSIsCatLm(code)
return ret
def uCSIsCatLo(code):
"""Check whether the character is part of Lo UCS Category """
ret = libxml2mod.xmlUCSIsCatLo(code)
return ret
def uCSIsCatLt(code):
"""Check whether the character is part of Lt UCS Category """
ret = libxml2mod.xmlUCSIsCatLt(code)
return ret
def uCSIsCatLu(code):
"""Check whether the character is part of Lu UCS Category """
ret = libxml2mod.xmlUCSIsCatLu(code)
return ret
def uCSIsCatM(code):
"""Check whether the character is part of M UCS Category """
ret = libxml2mod.xmlUCSIsCatM(code)
return ret
def uCSIsCatMc(code):
"""Check whether the character is part of Mc UCS Category """
ret = libxml2mod.xmlUCSIsCatMc(code)
return ret
def uCSIsCatMe(code):
"""Check whether the character is part of Me UCS Category """
ret = libxml2mod.xmlUCSIsCatMe(code)
return ret
def uCSIsCatMn(code):
"""Check whether the character is part of Mn UCS Category """
ret = libxml2mod.xmlUCSIsCatMn(code)
return ret
def uCSIsCatN(code):
"""Check whether the character is part of N UCS Category """
ret = libxml2mod.xmlUCSIsCatN(code)
return ret
def uCSIsCatNd(code):
"""Check whether the character is part of Nd UCS Category """
ret = libxml2mod.xmlUCSIsCatNd(code)
return ret
def uCSIsCatNl(code):
"""Check whether the character is part of Nl UCS Category """
ret = libxml2mod.xmlUCSIsCatNl(code)
return ret
def uCSIsCatNo(code):
"""Check whether the character is part of No UCS Category """
ret = libxml2mod.xmlUCSIsCatNo(code)
return ret
def uCSIsCatP(code):
"""Check whether the character is part of P UCS Category """
ret = libxml2mod.xmlUCSIsCatP(code)
return ret
def uCSIsCatPc(code):
"""Check whether the character is part of Pc UCS Category """
ret = libxml2mod.xmlUCSIsCatPc(code)
return ret
def uCSIsCatPd(code):
"""Check whether the character is part of Pd UCS Category """
ret = libxml2mod.xmlUCSIsCatPd(code)
return ret
def uCSIsCatPe(code):
"""Check whether the character is part of Pe UCS Category """
ret = libxml2mod.xmlUCSIsCatPe(code)
return ret
def uCSIsCatPf(code):
"""Check whether the character is part of Pf UCS Category """
ret = libxml2mod.xmlUCSIsCatPf(code)
return ret
def uCSIsCatPi(code):
"""Check whether the character is part of Pi UCS Category """
ret = libxml2mod.xmlUCSIsCatPi(code)
return ret
def uCSIsCatPo(code):
"""Check whether the character is part of Po UCS Category """
ret = libxml2mod.xmlUCSIsCatPo(code)
return ret
def uCSIsCatPs(code):
"""Check whether the character is part of Ps UCS Category """
ret = libxml2mod.xmlUCSIsCatPs(code)
return ret
def uCSIsCatS(code):
"""Check whether the character is part of S UCS Category """
ret = libxml2mod.xmlUCSIsCatS(code)
return ret
def uCSIsCatSc(code):
"""Check whether the character is part of Sc UCS Category """
ret = libxml2mod.xmlUCSIsCatSc(code)
return ret
def uCSIsCatSk(code):
"""Check whether the character is part of Sk UCS Category """
ret = libxml2mod.xmlUCSIsCatSk(code)
return ret
def uCSIsCatSm(code):
"""Check whether the character is part of Sm UCS Category """
ret = libxml2mod.xmlUCSIsCatSm(code)
return ret
def uCSIsCatSo(code):
"""Check whether the character is part of So UCS Category """
ret = libxml2mod.xmlUCSIsCatSo(code)
return ret
def uCSIsCatZ(code):
"""Check whether the character is part of Z UCS Category """
ret = libxml2mod.xmlUCSIsCatZ(code)
return ret
def uCSIsCatZl(code):
"""Check whether the character is part of Zl UCS Category """
ret = libxml2mod.xmlUCSIsCatZl(code)
return ret
def uCSIsCatZp(code):
"""Check whether the character is part of Zp UCS Category """
ret = libxml2mod.xmlUCSIsCatZp(code)
return ret
def uCSIsCatZs(code):
"""Check whether the character is part of Zs UCS Category """
ret = libxml2mod.xmlUCSIsCatZs(code)
return ret
def uCSIsCherokee(code):
"""Check whether the character is part of Cherokee UCS Block """
ret = libxml2mod.xmlUCSIsCherokee(code)
return ret
def uCSIsCombiningDiacriticalMarks(code):
"""Check whether the character is part of
CombiningDiacriticalMarks UCS Block """
ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarks(code)
return ret
def uCSIsCombiningDiacriticalMarksforSymbols(code):
"""Check whether the character is part of
CombiningDiacriticalMarksforSymbols UCS Block """
ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarksforSymbols(code)
return ret
def uCSIsCombiningHalfMarks(code):
"""Check whether the character is part of CombiningHalfMarks
UCS Block """
ret = libxml2mod.xmlUCSIsCombiningHalfMarks(code)
return ret
def uCSIsCombiningMarksforSymbols(code):
"""Check whether the character is part of
CombiningMarksforSymbols UCS Block """
ret = libxml2mod.xmlUCSIsCombiningMarksforSymbols(code)
return ret
def uCSIsControlPictures(code):
"""Check whether the character is part of ControlPictures UCS
Block """
ret = libxml2mod.xmlUCSIsControlPictures(code)
return ret
def uCSIsCurrencySymbols(code):
"""Check whether the character is part of CurrencySymbols UCS
Block """
ret = libxml2mod.xmlUCSIsCurrencySymbols(code)
return ret
def uCSIsCypriotSyllabary(code):
"""Check whether the character is part of CypriotSyllabary UCS
Block """
ret = libxml2mod.xmlUCSIsCypriotSyllabary(code)
return ret
def uCSIsCyrillic(code):
"""Check whether the character is part of Cyrillic UCS Block """
ret = libxml2mod.xmlUCSIsCyrillic(code)
return ret
def uCSIsCyrillicSupplement(code):
"""Check whether the character is part of CyrillicSupplement
UCS Block """
ret = libxml2mod.xmlUCSIsCyrillicSupplement(code)
return ret
def uCSIsDeseret(code):
"""Check whether the character is part of Deseret UCS Block """
ret = libxml2mod.xmlUCSIsDeseret(code)
return ret
def uCSIsDevanagari(code):
"""Check whether the character is part of Devanagari UCS Block """
ret = libxml2mod.xmlUCSIsDevanagari(code)
return ret
def uCSIsDingbats(code):
"""Check whether the character is part of Dingbats UCS Block """
ret = libxml2mod.xmlUCSIsDingbats(code)
return ret
def uCSIsEnclosedAlphanumerics(code):
"""Check whether the character is part of
EnclosedAlphanumerics UCS Block """
ret = libxml2mod.xmlUCSIsEnclosedAlphanumerics(code)
return ret
def uCSIsEnclosedCJKLettersandMonths(code):
"""Check whether the character is part of
EnclosedCJKLettersandMonths UCS Block """
ret = libxml2mod.xmlUCSIsEnclosedCJKLettersandMonths(code)
return ret
def uCSIsEthiopic(code):
"""Check whether the character is part of Ethiopic UCS Block """
ret = libxml2mod.xmlUCSIsEthiopic(code)
return ret
def uCSIsGeneralPunctuation(code):
"""Check whether the character is part of GeneralPunctuation
UCS Block """
ret = libxml2mod.xmlUCSIsGeneralPunctuation(code)
return ret
def uCSIsGeometricShapes(code):
"""Check whether the character is part of GeometricShapes UCS
Block """
ret = libxml2mod.xmlUCSIsGeometricShapes(code)
return ret
def uCSIsGeorgian(code):
"""Check whether the character is part of Georgian UCS Block """
ret = libxml2mod.xmlUCSIsGeorgian(code)
return ret
def uCSIsGothic(code):
"""Check whether the character is part of Gothic UCS Block """
ret = libxml2mod.xmlUCSIsGothic(code)
return ret
def uCSIsGreek(code):
"""Check whether the character is part of Greek UCS Block """
ret = libxml2mod.xmlUCSIsGreek(code)
return ret
def uCSIsGreekExtended(code):
"""Check whether the character is part of GreekExtended UCS
Block """
ret = libxml2mod.xmlUCSIsGreekExtended(code)
return ret
def uCSIsGreekandCoptic(code):
"""Check whether the character is part of GreekandCoptic UCS
Block """
ret = libxml2mod.xmlUCSIsGreekandCoptic(code)
return ret
def uCSIsGujarati(code):
"""Check whether the character is part of Gujarati UCS Block """
ret = libxml2mod.xmlUCSIsGujarati(code)
return ret
def uCSIsGurmukhi(code):
"""Check whether the character is part of Gurmukhi UCS Block """
ret = libxml2mod.xmlUCSIsGurmukhi(code)
return ret
def uCSIsHalfwidthandFullwidthForms(code):
"""Check whether the character is part of
HalfwidthandFullwidthForms UCS Block """
ret = libxml2mod.xmlUCSIsHalfwidthandFullwidthForms(code)
return ret
def uCSIsHangulCompatibilityJamo(code):
"""Check whether the character is part of
HangulCompatibilityJamo UCS Block """
ret = libxml2mod.xmlUCSIsHangulCompatibilityJamo(code)
return ret
def uCSIsHangulJamo(code):
"""Check whether the character is part of HangulJamo UCS Block """
ret = libxml2mod.xmlUCSIsHangulJamo(code)
return ret
def uCSIsHangulSyllables(code):
"""Check whether the character is part of HangulSyllables UCS
Block """
ret = libxml2mod.xmlUCSIsHangulSyllables(code)
return ret
def uCSIsHanunoo(code):
"""Check whether the character is part of Hanunoo UCS Block """
ret = libxml2mod.xmlUCSIsHanunoo(code)
return ret
def uCSIsHebrew(code):
"""Check whether the character is part of Hebrew UCS Block """
ret = libxml2mod.xmlUCSIsHebrew(code)
return ret
def uCSIsHighPrivateUseSurrogates(code):
"""Check whether the character is part of
HighPrivateUseSurrogates UCS Block """
ret = libxml2mod.xmlUCSIsHighPrivateUseSurrogates(code)
return ret
def uCSIsHighSurrogates(code):
"""Check whether the character is part of HighSurrogates UCS
Block """
ret = libxml2mod.xmlUCSIsHighSurrogates(code)
return ret
def uCSIsHiragana(code):
"""Check whether the character is part of Hiragana UCS Block """
ret = libxml2mod.xmlUCSIsHiragana(code)
return ret
def uCSIsIPAExtensions(code):
"""Check whether the character is part of IPAExtensions UCS
Block """
ret = libxml2mod.xmlUCSIsIPAExtensions(code)
return ret
def uCSIsIdeographicDescriptionCharacters(code):
"""Check whether the character is part of
IdeographicDescriptionCharacters UCS Block """
ret = libxml2mod.xmlUCSIsIdeographicDescriptionCharacters(code)
return ret
def uCSIsKanbun(code):
"""Check whether the character is part of Kanbun UCS Block """
ret = libxml2mod.xmlUCSIsKanbun(code)
return ret
def uCSIsKangxiRadicals(code):
"""Check whether the character is part of KangxiRadicals UCS
Block """
ret = libxml2mod.xmlUCSIsKangxiRadicals(code)
return ret
def uCSIsKannada(code):
"""Check whether the character is part of Kannada UCS Block """
ret = libxml2mod.xmlUCSIsKannada(code)
return ret
def uCSIsKatakana(code):
"""Check whether the character is part of Katakana UCS Block """
ret = libxml2mod.xmlUCSIsKatakana(code)
return ret
def uCSIsKatakanaPhoneticExtensions(code):
"""Check whether the character is part of
KatakanaPhoneticExtensions UCS Block """
ret = libxml2mod.xmlUCSIsKatakanaPhoneticExtensions(code)
return ret
def uCSIsKhmer(code):
"""Check whether the character is part of Khmer UCS Block """
ret = libxml2mod.xmlUCSIsKhmer(code)
return ret
def uCSIsKhmerSymbols(code):
"""Check whether the character is part of KhmerSymbols UCS
Block """
ret = libxml2mod.xmlUCSIsKhmerSymbols(code)
return ret
def uCSIsLao(code):
"""Check whether the character is part of Lao UCS Block """
ret = libxml2mod.xmlUCSIsLao(code)
return ret
def uCSIsLatin1Supplement(code):
"""Check whether the character is part of Latin-1Supplement
UCS Block """
ret = libxml2mod.xmlUCSIsLatin1Supplement(code)
return ret
def uCSIsLatinExtendedA(code):
"""Check whether the character is part of LatinExtended-A UCS
Block """
ret = libxml2mod.xmlUCSIsLatinExtendedA(code)
return ret
def uCSIsLatinExtendedAdditional(code):
"""Check whether the character is part of
LatinExtendedAdditional UCS Block """
ret = libxml2mod.xmlUCSIsLatinExtendedAdditional(code)
return ret
def uCSIsLatinExtendedB(code):
"""Check whether the character is part of LatinExtended-B UCS
Block """
ret = libxml2mod.xmlUCSIsLatinExtendedB(code)
return ret
def uCSIsLetterlikeSymbols(code):
"""Check whether the character is part of LetterlikeSymbols
UCS Block """
ret = libxml2mod.xmlUCSIsLetterlikeSymbols(code)
return ret
def uCSIsLimbu(code):
"""Check whether the character is part of Limbu UCS Block """
ret = libxml2mod.xmlUCSIsLimbu(code)
return ret
def uCSIsLinearBIdeograms(code):
"""Check whether the character is part of LinearBIdeograms UCS
Block """
ret = libxml2mod.xmlUCSIsLinearBIdeograms(code)
return ret
def uCSIsLinearBSyllabary(code):
"""Check whether the character is part of LinearBSyllabary UCS
Block """
ret = libxml2mod.xmlUCSIsLinearBSyllabary(code)
return ret
def uCSIsLowSurrogates(code):
"""Check whether the character is part of LowSurrogates UCS
Block """
ret = libxml2mod.xmlUCSIsLowSurrogates(code)
return ret
def uCSIsMalayalam(code):
"""Check whether the character is part of Malayalam UCS Block """
ret = libxml2mod.xmlUCSIsMalayalam(code)
return ret
def uCSIsMathematicalAlphanumericSymbols(code):
"""Check whether the character is part of
MathematicalAlphanumericSymbols UCS Block """
ret = libxml2mod.xmlUCSIsMathematicalAlphanumericSymbols(code)
return ret
def uCSIsMathematicalOperators(code):
"""Check whether the character is part of
MathematicalOperators UCS Block """
ret = libxml2mod.xmlUCSIsMathematicalOperators(code)
return ret
def uCSIsMiscellaneousMathematicalSymbolsA(code):
"""Check whether the character is part of
MiscellaneousMathematicalSymbols-A UCS Block """
ret = libxml2mod.xmlUCSIsMiscellaneousMathematicalSymbolsA(code)
return ret
def uCSIsMiscellaneousMathematicalSymbolsB(code):
"""Check whether the character is part of
MiscellaneousMathematicalSymbols-B UCS Block """
ret = libxml2mod.xmlUCSIsMiscellaneousMathematicalSymbolsB(code)
return ret
def uCSIsMiscellaneousSymbols(code):
"""Check whether the character is part of MiscellaneousSymbols
UCS Block """
ret = libxml2mod.xmlUCSIsMiscellaneousSymbols(code)
return ret
def uCSIsMiscellaneousSymbolsandArrows(code):
"""Check whether the character is part of
MiscellaneousSymbolsandArrows UCS Block """
ret = libxml2mod.xmlUCSIsMiscellaneousSymbolsandArrows(code)
return ret
def uCSIsMiscellaneousTechnical(code):
"""Check whether the character is part of
MiscellaneousTechnical UCS Block """
ret = libxml2mod.xmlUCSIsMiscellaneousTechnical(code)
return ret
def uCSIsMongolian(code):
"""Check whether the character is part of Mongolian UCS Block """
ret = libxml2mod.xmlUCSIsMongolian(code)
return ret
def uCSIsMusicalSymbols(code):
"""Check whether the character is part of MusicalSymbols UCS
Block """
ret = libxml2mod.xmlUCSIsMusicalSymbols(code)
return ret
def uCSIsMyanmar(code):
"""Check whether the character is part of Myanmar UCS Block """
ret = libxml2mod.xmlUCSIsMyanmar(code)
return ret
def uCSIsNumberForms(code):
"""Check whether the character is part of NumberForms UCS Block """
ret = libxml2mod.xmlUCSIsNumberForms(code)
return ret
def uCSIsOgham(code):
"""Check whether the character is part of Ogham UCS Block """
ret = libxml2mod.xmlUCSIsOgham(code)
return ret
def uCSIsOldItalic(code):
"""Check whether the character is part of OldItalic UCS Block """
ret = libxml2mod.xmlUCSIsOldItalic(code)
return ret
def uCSIsOpticalCharacterRecognition(code):
"""Check whether the character is part of
OpticalCharacterRecognition UCS Block """
ret = libxml2mod.xmlUCSIsOpticalCharacterRecognition(code)
return ret
def uCSIsOriya(code):
"""Check whether the character is part of Oriya UCS Block """
ret = libxml2mod.xmlUCSIsOriya(code)
return ret
def uCSIsOsmanya(code):
"""Check whether the character is part of Osmanya UCS Block """
ret = libxml2mod.xmlUCSIsOsmanya(code)
return ret
def uCSIsPhoneticExtensions(code):
"""Check whether the character is part of PhoneticExtensions
UCS Block """
ret = libxml2mod.xmlUCSIsPhoneticExtensions(code)
return ret
def uCSIsPrivateUse(code):
"""Check whether the character is part of PrivateUse UCS Block """
ret = libxml2mod.xmlUCSIsPrivateUse(code)
return ret
def uCSIsPrivateUseArea(code):
"""Check whether the character is part of PrivateUseArea UCS
Block """
ret = libxml2mod.xmlUCSIsPrivateUseArea(code)
return ret
def uCSIsRunic(code):
"""Check whether the character is part of Runic UCS Block """
ret = libxml2mod.xmlUCSIsRunic(code)
return ret
def uCSIsShavian(code):
"""Check whether the character is part of Shavian UCS Block """
ret = libxml2mod.xmlUCSIsShavian(code)
return ret
def uCSIsSinhala(code):
"""Check whether the character is part of Sinhala UCS Block """
ret = libxml2mod.xmlUCSIsSinhala(code)
return ret
def uCSIsSmallFormVariants(code):
"""Check whether the character is part of SmallFormVariants
UCS Block """
ret = libxml2mod.xmlUCSIsSmallFormVariants(code)
return ret
def uCSIsSpacingModifierLetters(code):
"""Check whether the character is part of
SpacingModifierLetters UCS Block """
ret = libxml2mod.xmlUCSIsSpacingModifierLetters(code)
return ret
def uCSIsSpecials(code):
"""Check whether the character is part of Specials UCS Block """
ret = libxml2mod.xmlUCSIsSpecials(code)
return ret
def uCSIsSuperscriptsandSubscripts(code):
"""Check whether the character is part of
SuperscriptsandSubscripts UCS Block """
ret = libxml2mod.xmlUCSIsSuperscriptsandSubscripts(code)
return ret
def uCSIsSupplementalArrowsA(code):
"""Check whether the character is part of SupplementalArrows-A
UCS Block """
ret = libxml2mod.xmlUCSIsSupplementalArrowsA(code)
return ret
def uCSIsSupplementalArrowsB(code):
"""Check whether the character is part of SupplementalArrows-B
UCS Block """
ret = libxml2mod.xmlUCSIsSupplementalArrowsB(code)
return ret
def uCSIsSupplementalMathematicalOperators(code):
"""Check whether the character is part of
SupplementalMathematicalOperators UCS Block """
ret = libxml2mod.xmlUCSIsSupplementalMathematicalOperators(code)
return ret
def uCSIsSupplementaryPrivateUseAreaA(code):
"""Check whether the character is part of
SupplementaryPrivateUseArea-A UCS Block """
ret = libxml2mod.xmlUCSIsSupplementaryPrivateUseAreaA(code)
return ret
def uCSIsSupplementaryPrivateUseAreaB(code):
"""Check whether the character is part of
SupplementaryPrivateUseArea-B UCS Block """
ret = libxml2mod.xmlUCSIsSupplementaryPrivateUseAreaB(code)
return ret
def uCSIsSyriac(code):
"""Check whether the character is part of Syriac UCS Block """
ret = libxml2mod.xmlUCSIsSyriac(code)
return ret
def uCSIsTagalog(code):
"""Check whether the character is part of Tagalog UCS Block """
ret = libxml2mod.xmlUCSIsTagalog(code)
return ret
def uCSIsTagbanwa(code):
"""Check whether the character is part of Tagbanwa UCS Block """
ret = libxml2mod.xmlUCSIsTagbanwa(code)
return ret
def uCSIsTags(code):
"""Check whether the character is part of Tags UCS Block """
ret = libxml2mod.xmlUCSIsTags(code)
return ret
def uCSIsTaiLe(code):
"""Check whether the character is part of TaiLe UCS Block """
ret = libxml2mod.xmlUCSIsTaiLe(code)
return ret
def uCSIsTaiXuanJingSymbols(code):
"""Check whether the character is part of TaiXuanJingSymbols
UCS Block """
ret = libxml2mod.xmlUCSIsTaiXuanJingSymbols(code)
return ret
def uCSIsTamil(code):
"""Check whether the character is part of Tamil UCS Block """
ret = libxml2mod.xmlUCSIsTamil(code)
return ret
def uCSIsTelugu(code):
"""Check whether the character is part of Telugu UCS Block """
ret = libxml2mod.xmlUCSIsTelugu(code)
return ret
def uCSIsThaana(code):
"""Check whether the character is part of Thaana UCS Block """
ret = libxml2mod.xmlUCSIsThaana(code)
return ret
def uCSIsThai(code):
"""Check whether the character is part of Thai UCS Block """
ret = libxml2mod.xmlUCSIsThai(code)
return ret
def uCSIsTibetan(code):
"""Check whether the character is part of Tibetan UCS Block """
ret = libxml2mod.xmlUCSIsTibetan(code)
return ret
def uCSIsUgaritic(code):
"""Check whether the character is part of Ugaritic UCS Block """
ret = libxml2mod.xmlUCSIsUgaritic(code)
return ret
def uCSIsUnifiedCanadianAboriginalSyllabics(code):
"""Check whether the character is part of
UnifiedCanadianAboriginalSyllabics UCS Block """
ret = libxml2mod.xmlUCSIsUnifiedCanadianAboriginalSyllabics(code)
return ret
def uCSIsVariationSelectors(code):
"""Check whether the character is part of VariationSelectors
UCS Block """
ret = libxml2mod.xmlUCSIsVariationSelectors(code)
return ret
def uCSIsVariationSelectorsSupplement(code):
"""Check whether the character is part of
VariationSelectorsSupplement UCS Block """
ret = libxml2mod.xmlUCSIsVariationSelectorsSupplement(code)
return ret
def uCSIsYiRadicals(code):
"""Check whether the character is part of YiRadicals UCS Block """
ret = libxml2mod.xmlUCSIsYiRadicals(code)
return ret
def uCSIsYiSyllables(code):
"""Check whether the character is part of YiSyllables UCS Block """
ret = libxml2mod.xmlUCSIsYiSyllables(code)
return ret
def uCSIsYijingHexagramSymbols(code):
"""Check whether the character is part of
YijingHexagramSymbols UCS Block """
ret = libxml2mod.xmlUCSIsYijingHexagramSymbols(code)
return ret
#
# Functions from module xmlversion
#
def checkVersion(version):
"""check the compiled lib version against the include one.
This can warn or immediately kill the application """
libxml2mod.xmlCheckVersion(version)
#
# Functions from module xpathInternals
#
def valuePop(ctxt):
"""Pops the top XPath object from the value stack """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.valuePop(ctxt__o)
return ret
class xmlNode(xmlCore):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlNode got a wrong wrapper object type')
self._o = _obj
xmlCore.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlNode (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
# accessors for xmlNode
def ns(self):
"""Get the namespace of a node """
ret = libxml2mod.xmlNodeGetNs(self._o)
if ret is None:return None
__tmp = xmlNs(_obj=ret)
return __tmp
def nsDefs(self):
"""Get the namespace of a node """
ret = libxml2mod.xmlNodeGetNsDefs(self._o)
if ret is None:return None
__tmp = xmlNs(_obj=ret)
return __tmp
#
# xmlNode functions from module debugXML
#
def debugDumpNode(self, output, depth):
"""Dumps debug information for the element node, it is
recursive """
libxml2mod.xmlDebugDumpNode(output, self._o, depth)
def debugDumpNodeList(self, output, depth):
"""Dumps debug information for the list of element node, it is
recursive """
libxml2mod.xmlDebugDumpNodeList(output, self._o, depth)
def debugDumpOneNode(self, output, depth):
"""Dumps debug information for the element node, it is not
recursive """
libxml2mod.xmlDebugDumpOneNode(output, self._o, depth)
def lsCountNode(self):
"""Count the children of @node. """
ret = libxml2mod.xmlLsCountNode(self._o)
return ret
def lsOneNode(self, output):
"""Dump to @output the type and name of @node. """
libxml2mod.xmlLsOneNode(output, self._o)
def shellPrintNode(self):
"""Print node to the output FILE """
libxml2mod.xmlShellPrintNode(self._o)
#
# xmlNode functions from module tree
#
def addChild(self, cur):
"""Add a new node to @parent, at the end of the child (or
property) list merging adjacent TEXT nodes (in which case
@cur is freed) If the new node is ATTRIBUTE, it is added
into properties instead of children. If there is an
attribute with equal name, it is first destroyed. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlAddChild(self._o, cur__o)
if ret is None:raise treeError('xmlAddChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def addChildList(self, cur):
"""Add a list of node at the end of the child list of the
parent merging adjacent TEXT nodes (@cur may be freed) """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlAddChildList(self._o, cur__o)
if ret is None:raise treeError('xmlAddChildList() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def addContent(self, content):
"""Append the extra substring to the node content. NOTE: In
contrast to xmlNodeSetContent(), @content is supposed to be
raw text, so unescaped XML special chars are allowed,
entity references are not supported. """
libxml2mod.xmlNodeAddContent(self._o, content)
def addContentLen(self, content, len):
"""Append the extra substring to the node content. NOTE: In
contrast to xmlNodeSetContentLen(), @content is supposed to
be raw text, so unescaped XML special chars are allowed,
entity references are not supported. """
libxml2mod.xmlNodeAddContentLen(self._o, content, len)
def addNextSibling(self, elem):
"""Add a new node @elem as the next sibling of @cur If the new
node was already inserted in a document it is first
unlinked from its existing context. As a result of text
merging @elem may be freed. If the new node is ATTRIBUTE,
it is added into properties instead of children. If there
is an attribute with equal name, it is first destroyed. """
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlAddNextSibling(self._o, elem__o)
if ret is None:raise treeError('xmlAddNextSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def addPrevSibling(self, elem):
"""Add a new node @elem as the previous sibling of @cur
merging adjacent TEXT nodes (@elem may be freed) If the new
node was already inserted in a document it is first
unlinked from its existing context. If the new node is
ATTRIBUTE, it is added into properties instead of children.
If there is an attribute with equal name, it is first
destroyed. """
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlAddPrevSibling(self._o, elem__o)
if ret is None:raise treeError('xmlAddPrevSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def addSibling(self, elem):
"""Add a new element @elem to the list of siblings of @cur
merging adjacent TEXT nodes (@elem may be freed) If the new
element was already inserted in a document it is first
unlinked from its existing context. """
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlAddSibling(self._o, elem__o)
if ret is None:raise treeError('xmlAddSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def copyNode(self, extended):
"""Do a copy of the node. """
ret = libxml2mod.xmlCopyNode(self._o, extended)
if ret is None:raise treeError('xmlCopyNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def copyNodeList(self):
"""Do a recursive copy of the node list. Use
xmlDocCopyNodeList() if possible to ensure string interning. """
ret = libxml2mod.xmlCopyNodeList(self._o)
if ret is None:raise treeError('xmlCopyNodeList() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def copyProp(self, cur):
"""Do a copy of the attribute. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlCopyProp(self._o, cur__o)
if ret is None:raise treeError('xmlCopyProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def copyPropList(self, cur):
"""Do a copy of an attribute list. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlCopyPropList(self._o, cur__o)
if ret is None:raise treeError('xmlCopyPropList() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def docCopyNode(self, doc, extended):
"""Do a copy of the node to a given document. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlDocCopyNode(self._o, doc__o, extended)
if ret is None:raise treeError('xmlDocCopyNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def docCopyNodeList(self, doc):
"""Do a recursive copy of the node list. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlDocCopyNodeList(doc__o, self._o)
if ret is None:raise treeError('xmlDocCopyNodeList() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def docSetRootElement(self, doc):
"""Set the root element of the document (doc->children is a
list containing possibly comments, PIs, etc ...). """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlDocSetRootElement(doc__o, self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp
def firstElementChild(self):
"""Finds the first child node of that element which is a
Element node Note the handling of entities references is
different than in the W3C DOM element traversal spec since
we don't have back reference from entities content to
entities references. """
ret = libxml2mod.xmlFirstElementChild(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp
def freeNode(self):
"""Free a node, this is a recursive behaviour, all the
children are freed too. This doesn't unlink the child from
the list, use xmlUnlinkNode() first. """
libxml2mod.xmlFreeNode(self._o)
def freeNodeList(self):
"""Free a node and all its siblings, this is a recursive
behaviour, all the children are freed too. """
libxml2mod.xmlFreeNodeList(self._o)
def getBase(self, doc):
"""Searches for the BASE URL. The code should work on both XML
and HTML document even if base mechanisms are completely
different. It returns the base as defined in RFC 2396
sections 5.1.1. Base URI within Document Content and 5.1.2.
Base URI from the Encapsulating Entity However it does not
return the document base (5.1.3), use doc->URL in this case """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlNodeGetBase(doc__o, self._o)
return ret
def getContent(self):
"""Read the value of a node, this can be either the text
carried directly by this node if it's a TEXT node or the
aggregate string of the values carried by this node child's
(TEXT and ENTITY_REF). Entity references are substituted. """
ret = libxml2mod.xmlNodeGetContent(self._o)
return ret
def getLang(self):
"""Searches the language of a node, i.e. the values of the
xml:lang attribute or the one carried by the nearest
ancestor. """
ret = libxml2mod.xmlNodeGetLang(self._o)
return ret
def getSpacePreserve(self):
"""Searches the space preserving behaviour of a node, i.e. the
values of the xml:space attribute or the one carried by the
nearest ancestor. """
ret = libxml2mod.xmlNodeGetSpacePreserve(self._o)
return ret
def hasNsProp(self, name, nameSpace):
"""Search for an attribute associated to a node This attribute
has to be anchored in the namespace specified. This does
the entity substitution. This function looks in DTD
attribute declaration for #FIXED or default declaration
values unless DTD use has been turned off. Note that a
namespace of None indicates to use the default namespace. """
ret = libxml2mod.xmlHasNsProp(self._o, name, nameSpace)
if ret is None:return None
__tmp = xmlAttr(_obj=ret)
return __tmp
def hasProp(self, name):
"""Search an attribute associated to a node This function also
looks in DTD attribute declaration for #FIXED or default
declaration values unless DTD use has been turned off. """
ret = libxml2mod.xmlHasProp(self._o, name)
if ret is None:return None
__tmp = xmlAttr(_obj=ret)
return __tmp
def isBlankNode(self):
"""Checks whether this node is an empty or whitespace only
(and possibly ignorable) text-node. """
ret = libxml2mod.xmlIsBlankNode(self._o)
return ret
def isText(self):
"""Is this node a Text node ? """
ret = libxml2mod.xmlNodeIsText(self._o)
return ret
def lastChild(self):
"""Search the last child of a node. """
ret = libxml2mod.xmlGetLastChild(self._o)
if ret is None:raise treeError('xmlGetLastChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def lastElementChild(self):
"""Finds the last child node of that element which is a
Element node Note the handling of entities references is
different than in the W3C DOM element traversal spec since
we don't have back reference from entities content to
entities references. """
ret = libxml2mod.xmlLastElementChild(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp
def lineNo(self):
"""Get line number of @node. Try to override the limitation of
lines being store in 16 bits ints if XML_PARSE_BIG_LINES
parser option was used """
ret = libxml2mod.xmlGetLineNo(self._o)
return ret
def listGetRawString(self, doc, inLine):
"""Builds the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs, contrary to
xmlNodeListGetString() this function doesn't do any
character encoding handling. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlNodeListGetRawString(doc__o, self._o, inLine)
return ret
def listGetString(self, doc, inLine):
"""Build the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlNodeListGetString(doc__o, self._o, inLine)
return ret
def newChild(self, ns, name, content):
"""Creation of a new child element, added at the end of
@parent children list. @ns and @content parameters are
optional (None). If @ns is None, the newly created element
inherits the namespace of @parent. If @content is non None,
a child list containing the TEXTs and ENTITY_REFs node will
be created. NOTE: @content is supposed to be a piece of XML
CDATA, so it allows entity references. XML special chars
must be escaped first by using
xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should
be used. """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlNewChild(self._o, ns__o, name, content)
if ret is None:raise treeError('xmlNewChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newNs(self, href, prefix):
"""Creation of a new Namespace. This function will refuse to
create a namespace with a similar prefix than an existing
one present on this node. Note that for a default
namespace, @prefix should be None. We use href==None in
the case of an element creation where the namespace was not
defined. """
ret = libxml2mod.xmlNewNs(self._o, href, prefix)
if ret is None:raise treeError('xmlNewNs() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def newNsProp(self, ns, name, value):
"""Create a new property tagged with a namespace and carried
by a node. """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlNewNsProp(self._o, ns__o, name, value)
if ret is None:raise treeError('xmlNewNsProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def newNsPropEatName(self, ns, name, value):
"""Create a new property tagged with a namespace and carried
by a node. """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlNewNsPropEatName(self._o, ns__o, name, value)
if ret is None:raise treeError('xmlNewNsPropEatName() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def newProp(self, name, value):
"""Create a new property carried by a node. """
ret = libxml2mod.xmlNewProp(self._o, name, value)
if ret is None:raise treeError('xmlNewProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def newTextChild(self, ns, name, content):
"""Creation of a new child element, added at the end of
@parent children list. @ns and @content parameters are
optional (None). If @ns is None, the newly created element
inherits the namespace of @parent. If @content is non None,
a child TEXT node will be created containing the string
@content. NOTE: Use xmlNewChild() if @content will contain
entities that need to be preserved. Use this function,
xmlNewTextChild(), if you need to ensure that reserved XML
chars that might appear in @content, such as the ampersand,
greater-than or less-than signs, are automatically replaced
by their XML escaped entity representations. """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlNewTextChild(self._o, ns__o, name, content)
if ret is None:raise treeError('xmlNewTextChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def nextElementSibling(self):
"""Finds the first closest next sibling of the node which is
an element node. Note the handling of entities references
is different than in the W3C DOM element traversal spec
since we don't have back reference from entities content to
entities references. """
ret = libxml2mod.xmlNextElementSibling(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp
def noNsProp(self, name):
"""Search and get the value of an attribute associated to a
node This does the entity substitution. This function looks
in DTD attribute declaration for #FIXED or default
declaration values unless DTD use has been turned off. This
function is similar to xmlGetProp except it will accept
only an attribute in no namespace. """
ret = libxml2mod.xmlGetNoNsProp(self._o, name)
return ret
def nodePath(self):
"""Build a structure based Path for the given node """
ret = libxml2mod.xmlGetNodePath(self._o)
return ret
def nsProp(self, name, nameSpace):
"""Search and get the value of an attribute associated to a
node This attribute has to be anchored in the namespace
specified. This does the entity substitution. This function
looks in DTD attribute declaration for #FIXED or default
declaration values unless DTD use has been turned off. """
ret = libxml2mod.xmlGetNsProp(self._o, name, nameSpace)
return ret
def previousElementSibling(self):
"""Finds the first closest previous sibling of the node which
is an element node. Note the handling of entities
references is different than in the W3C DOM element
traversal spec since we don't have back reference from
entities content to entities references. """
ret = libxml2mod.xmlPreviousElementSibling(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp
def prop(self, name):
"""Search and get the value of an attribute associated to a
node This does the entity substitution. This function looks
in DTD attribute declaration for #FIXED or default
declaration values unless DTD use has been turned off.
NOTE: this function acts independently of namespaces
associated to the attribute. Use xmlGetNsProp() or
xmlGetNoNsProp() for namespace aware processing. """
ret = libxml2mod.xmlGetProp(self._o, name)
return ret
def reconciliateNs(self, doc):
"""This function checks that all the namespaces declared
within the given tree are properly declared. This is needed
for example after Copy or Cut and then paste operations.
The subtree may still hold pointers to namespace
declarations outside the subtree or invalid/masked. As much
as possible the function try to reuse the existing
namespaces found in the new environment. If not possible
the new namespaces are redeclared on @tree at the top of
the given subtree. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlReconciliateNs(doc__o, self._o)
return ret
def replaceNode(self, cur):
"""Unlink the old node from its current context, prune the new
one at the same place. If @cur was already inserted in a
document it is first unlinked from its existing context. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlReplaceNode(self._o, cur__o)
if ret is None:raise treeError('xmlReplaceNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def searchNs(self, doc, nameSpace):
"""Search a Ns registered under a given name space for a
document. recurse on the parents until it finds the defined
namespace or return None otherwise. @nameSpace can be None,
this is a search for the default namespace. We don't allow
to cross entities boundaries. If you don't declare the
namespace within those you will be in troubles !!! A
warning is generated to cover this case. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlSearchNs(doc__o, self._o, nameSpace)
if ret is None:raise treeError('xmlSearchNs() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def searchNsByHref(self, doc, href):
"""Search a Ns aliasing a given URI. Recurse on the parents
until it finds the defined namespace or return None
otherwise. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlSearchNsByHref(doc__o, self._o, href)
if ret is None:raise treeError('xmlSearchNsByHref() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def setBase(self, uri):
"""Set (or reset) the base URI of a node, i.e. the value of
the xml:base attribute. """
libxml2mod.xmlNodeSetBase(self._o, uri)
def setContent(self, content):
"""Replace the content of a node. NOTE: @content is supposed
to be a piece of XML CDATA, so it allows entity references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """
libxml2mod.xmlNodeSetContent(self._o, content)
def setContentLen(self, content, len):
"""Replace the content of a node. NOTE: @content is supposed
to be a piece of XML CDATA, so it allows entity references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """
libxml2mod.xmlNodeSetContentLen(self._o, content, len)
def setLang(self, lang):
"""Set the language of a node, i.e. the values of the xml:lang
attribute. """
libxml2mod.xmlNodeSetLang(self._o, lang)
def setListDoc(self, doc):
"""update all nodes in the list to point to the right document """
if doc is None: doc__o = None
else: doc__o = doc._o
libxml2mod.xmlSetListDoc(self._o, doc__o)
def setName(self, name):
"""Set (or reset) the name of a node. """
libxml2mod.xmlNodeSetName(self._o, name)
def setNs(self, ns):
"""Associate a namespace to a node, a posteriori. """
if ns is None: ns__o = None
else: ns__o = ns._o
libxml2mod.xmlSetNs(self._o, ns__o)
def setNsProp(self, ns, name, value):
"""Set (or reset) an attribute carried by a node. The ns
structure must be in scope, this is not checked """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlSetNsProp(self._o, ns__o, name, value)
if ret is None:raise treeError('xmlSetNsProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def setProp(self, name, value):
"""Set (or reset) an attribute carried by a node. If @name has
a prefix, then the corresponding namespace-binding will be
used, if in scope; it is an error it there's no such
ns-binding for the prefix in scope. """
ret = libxml2mod.xmlSetProp(self._o, name, value)
if ret is None:raise treeError('xmlSetProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def setSpacePreserve(self, val):
"""Set (or reset) the space preserving behaviour of a node,
i.e. the value of the xml:space attribute. """
libxml2mod.xmlNodeSetSpacePreserve(self._o, val)
def setTreeDoc(self, doc):
"""update all nodes under the tree to point to the right
document """
if doc is None: doc__o = None
else: doc__o = doc._o
libxml2mod.xmlSetTreeDoc(self._o, doc__o)
def textConcat(self, content, len):
"""Concat the given string at the end of the existing node
content """
ret = libxml2mod.xmlTextConcat(self._o, content, len)
return ret
def textMerge(self, second):
"""Merge two text nodes into one """
if second is None: second__o = None
else: second__o = second._o
ret = libxml2mod.xmlTextMerge(self._o, second__o)
if ret is None:raise treeError('xmlTextMerge() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def unlinkNode(self):
"""Unlink a node from it's current context, the node is not
freed If one need to free the node, use xmlFreeNode()
routine after the unlink to discard it. Note that namespace
nodes can't be unlinked as they do not have pointer to
their parent. """
libxml2mod.xmlUnlinkNode(self._o)
def unsetNsProp(self, ns, name):
"""Remove an attribute carried by a node. """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlUnsetNsProp(self._o, ns__o, name)
return ret
def unsetProp(self, name):
"""Remove an attribute carried by a node. This handles only
attributes in no namespace. """
ret = libxml2mod.xmlUnsetProp(self._o, name)
return ret
#
# xmlNode functions from module valid
#
def isID(self, doc, attr):
"""Determine whether an attribute is of type ID. In case we
have DTD(s) then this is done if DTD loading has been
requested. In the case of HTML documents parsed with the
HTML parser, then ID detection is done systematically. """
if doc is None: doc__o = None
else: doc__o = doc._o
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlIsID(doc__o, self._o, attr__o)
return ret
def isRef(self, doc, attr):
"""Determine whether an attribute is of type Ref. In case we
have DTD(s) then this is simple, otherwise we use an
heuristic: name Ref (upper or lowercase). """
if doc is None: doc__o = None
else: doc__o = doc._o
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlIsRef(doc__o, self._o, attr__o)
return ret
def validNormalizeAttributeValue(self, doc, name, value):
"""Does the validation related extra step of the normalization
of attribute values: If the declared value is not CDATA,
then the XML processor must further process the normalized
attribute value by discarding any leading and trailing
space (#x20) characters, and by replacing sequences of
space (#x20) characters by single space (#x20) character. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlValidNormalizeAttributeValue(doc__o, self._o, name, value)
return ret
#
# xmlNode functions from module xinclude
#
def xincludeProcessTree(self):
"""Implement the XInclude substitution for the given subtree """
ret = libxml2mod.xmlXIncludeProcessTree(self._o)
return ret
def xincludeProcessTreeFlags(self, flags):
"""Implement the XInclude substitution for the given subtree """
ret = libxml2mod.xmlXIncludeProcessTreeFlags(self._o, flags)
return ret
#
# xmlNode functions from module xmlschemas
#
def schemaValidateOneElement(self, ctxt):
"""Validate a branch of a tree, starting with the given @elem. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlSchemaValidateOneElement(ctxt__o, self._o)
return ret
#
# xmlNode functions from module xpath
#
def xpathCastNodeToNumber(self):
"""Converts a node to its number value """
ret = libxml2mod.xmlXPathCastNodeToNumber(self._o)
return ret
def xpathCastNodeToString(self):
"""Converts a node to its string value. """
ret = libxml2mod.xmlXPathCastNodeToString(self._o)
return ret
def xpathCmpNodes(self, node2):
"""Compare two nodes w.r.t document order """
if node2 is None: node2__o = None
else: node2__o = node2._o
ret = libxml2mod.xmlXPathCmpNodes(self._o, node2__o)
return ret
def xpathNodeEval(self, str, ctx):
"""Evaluate the XPath Location Path in the given context. The
node 'node' is set as the context node. The context node is
not restored. """
if ctx is None: ctx__o = None
else: ctx__o = ctx._o
ret = libxml2mod.xmlXPathNodeEval(self._o, str, ctx__o)
if ret is None:raise xpathError('xmlXPathNodeEval() failed')
return xpathObjectRet(ret)
#
# xmlNode functions from module xpathInternals
#
def xpathNewNodeSet(self):
"""Create a new xmlXPathObjectPtr of type NodeSet and
initialize it with the single Node @val """
ret = libxml2mod.xmlXPathNewNodeSet(self._o)
if ret is None:raise xpathError('xmlXPathNewNodeSet() failed')
return xpathObjectRet(ret)
def xpathNewValueTree(self):
"""Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
and initialize it with the tree root @val """
ret = libxml2mod.xmlXPathNewValueTree(self._o)
if ret is None:raise xpathError('xmlXPathNewValueTree() failed')
return xpathObjectRet(ret)
def xpathNextAncestor(self, ctxt):
"""Traversal function for the "ancestor" direction the
ancestor axis contains the ancestors of the context node;
the ancestors of the context node consist of the parent of
context node and the parent's parent and so on; the nodes
are ordered in reverse document order; thus the parent is
the first node on the axis, and the parent's parent is the
second node on the axis """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextAncestor(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextAncestor() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextAncestorOrSelf(self, ctxt):
"""Traversal function for the "ancestor-or-self" direction he
ancestor-or-self axis contains the context node and
ancestors of the context node in reverse document order;
thus the context node is the first node on the axis, and
the context node's parent the second; parent here is
defined the same as with the parent axis. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextAncestorOrSelf(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextAncestorOrSelf() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextAttribute(self, ctxt):
"""Traversal function for the "attribute" direction TODO:
support DTD inherited default attributes """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextAttribute(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextChild(self, ctxt):
"""Traversal function for the "child" direction The child axis
contains the children of the context node in document order. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextChild(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextDescendant(self, ctxt):
"""Traversal function for the "descendant" direction the
descendant axis contains the descendants of the context
node in document order; a descendant is a child or a child
of a child and so on. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextDescendant(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextDescendant() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextDescendantOrSelf(self, ctxt):
"""Traversal function for the "descendant-or-self" direction
the descendant-or-self axis contains the context node and
the descendants of the context node in document order; thus
the context node is the first node on the axis, and the
first child of the context node is the second node on the
axis """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextDescendantOrSelf(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextDescendantOrSelf() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextFollowing(self, ctxt):
"""Traversal function for the "following" direction The
following axis contains all nodes in the same document as
the context node that are after the context node in
document order, excluding any descendants and excluding
attribute nodes and namespace nodes; the nodes are ordered
in document order """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextFollowing(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextFollowing() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextFollowingSibling(self, ctxt):
"""Traversal function for the "following-sibling" direction
The following-sibling axis contains the following siblings
of the context node in document order. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextFollowingSibling(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextNamespace(self, ctxt):
"""Traversal function for the "namespace" direction the
namespace axis contains the namespace nodes of the context
node; the order of nodes on this axis is
implementation-defined; the axis will be empty unless the
context node is an element We keep the XML namespace node
at the end of the list. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextNamespace(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextNamespace() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextParent(self, ctxt):
"""Traversal function for the "parent" direction The parent
axis contains the parent of the context node, if there is
one. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextParent(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextParent() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextPreceding(self, ctxt):
"""Traversal function for the "preceding" direction the
preceding axis contains all nodes in the same document as
the context node that are before the context node in
document order, excluding any ancestors and excluding
attribute nodes and namespace nodes; the nodes are ordered
in reverse document order """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextPreceding(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextPreceding() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextPrecedingSibling(self, ctxt):
"""Traversal function for the "preceding-sibling" direction
The preceding-sibling axis contains the preceding siblings
of the context node in reverse document order; the first
preceding sibling is first on the axis; the sibling
preceding that node is the second on the axis and so on. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextPrecedingSibling(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextPrecedingSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextSelf(self, ctxt):
"""Traversal function for the "self" direction The self axis
contains just the context node itself """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlXPathNextSelf(ctxt__o, self._o)
if ret is None:raise xpathError('xmlXPathNextSelf() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
#
# xmlNode functions from module xpointer
#
def xpointerNewCollapsedRange(self):
"""Create a new xmlXPathObjectPtr of type range using a single
nodes """
ret = libxml2mod.xmlXPtrNewCollapsedRange(self._o)
if ret is None:raise treeError('xmlXPtrNewCollapsedRange() failed')
return xpathObjectRet(ret)
def xpointerNewContext(self, doc, origin):
"""Create a new XPointer context """
if doc is None: doc__o = None
else: doc__o = doc._o
if origin is None: origin__o = None
else: origin__o = origin._o
ret = libxml2mod.xmlXPtrNewContext(doc__o, self._o, origin__o)
if ret is None:raise treeError('xmlXPtrNewContext() failed')
__tmp = xpathContext(_obj=ret)
return __tmp
def xpointerNewLocationSetNodes(self, end):
"""Create a new xmlXPathObjectPtr of type LocationSet and
initialize it with the single range made of the two nodes
@start and @end """
if end is None: end__o = None
else: end__o = end._o
ret = libxml2mod.xmlXPtrNewLocationSetNodes(self._o, end__o)
if ret is None:raise treeError('xmlXPtrNewLocationSetNodes() failed')
return xpathObjectRet(ret)
def xpointerNewRange(self, startindex, end, endindex):
"""Create a new xmlXPathObjectPtr of type range """
if end is None: end__o = None
else: end__o = end._o
ret = libxml2mod.xmlXPtrNewRange(self._o, startindex, end__o, endindex)
if ret is None:raise treeError('xmlXPtrNewRange() failed')
return xpathObjectRet(ret)
def xpointerNewRangeNodes(self, end):
"""Create a new xmlXPathObjectPtr of type range using 2 nodes """
if end is None: end__o = None
else: end__o = end._o
ret = libxml2mod.xmlXPtrNewRangeNodes(self._o, end__o)
if ret is None:raise treeError('xmlXPtrNewRangeNodes() failed')
return xpathObjectRet(ret)
class xmlDoc(xmlNode):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlDoc got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlDoc (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlDoc functions from module HTMLparser
#
def htmlAutoCloseTag(self, name, elem):
"""The HTML DTD allows a tag to implicitly close other tags.
The list is kept in htmlStartClose array. This function
checks if the element or one of it's children would
autoclose the given tag. """
ret = libxml2mod.htmlAutoCloseTag(self._o, name, elem)
return ret
def htmlIsAutoClosed(self, elem):
"""The HTML DTD allows a tag to implicitly close other tags.
The list is kept in htmlStartClose array. This function
checks if a tag is autoclosed by one of it's child """
ret = libxml2mod.htmlIsAutoClosed(self._o, elem)
return ret
#
# xmlDoc functions from module HTMLtree
#
def htmlDocContentDumpFormatOutput(self, buf, encoding, format):
"""Dump an HTML document. """
if buf is None: buf__o = None
else: buf__o = buf._o
libxml2mod.htmlDocContentDumpFormatOutput(buf__o, self._o, encoding, format)
def htmlDocContentDumpOutput(self, buf, encoding):
"""Dump an HTML document. Formating return/spaces are added. """
if buf is None: buf__o = None
else: buf__o = buf._o
libxml2mod.htmlDocContentDumpOutput(buf__o, self._o, encoding)
def htmlDocDump(self, f):
"""Dump an HTML document to an open FILE. """
ret = libxml2mod.htmlDocDump(f, self._o)
return ret
def htmlGetMetaEncoding(self):
"""Encoding definition lookup in the Meta tags """
ret = libxml2mod.htmlGetMetaEncoding(self._o)
return ret
def htmlNodeDumpFile(self, out, cur):
"""Dump an HTML node, recursive behaviour,children are printed
too, and formatting returns are added. """
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlNodeDumpFile(out, self._o, cur__o)
def htmlNodeDumpFileFormat(self, out, cur, encoding, format):
"""Dump an HTML node, recursive behaviour,children are printed
too. TODO: if encoding == None try to save in the doc
encoding """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.htmlNodeDumpFileFormat(out, self._o, cur__o, encoding, format)
return ret
def htmlNodeDumpFormatOutput(self, buf, cur, encoding, format):
"""Dump an HTML node, recursive behaviour,children are printed
too. """
if buf is None: buf__o = None
else: buf__o = buf._o
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlNodeDumpFormatOutput(buf__o, self._o, cur__o, encoding, format)
def htmlNodeDumpOutput(self, buf, cur, encoding):
"""Dump an HTML node, recursive behaviour,children are printed
too, and formatting returns/spaces are added. """
if buf is None: buf__o = None
else: buf__o = buf._o
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlNodeDumpOutput(buf__o, self._o, cur__o, encoding)
def htmlSaveFile(self, filename):
"""Dump an HTML document to a file. If @filename is "-" the
stdout file is used. """
ret = libxml2mod.htmlSaveFile(filename, self._o)
return ret
def htmlSaveFileEnc(self, filename, encoding):
"""Dump an HTML document to a file using a given encoding and
formatting returns/spaces are added. """
ret = libxml2mod.htmlSaveFileEnc(filename, self._o, encoding)
return ret
def htmlSaveFileFormat(self, filename, encoding, format):
"""Dump an HTML document to a file using a given encoding. """
ret = libxml2mod.htmlSaveFileFormat(filename, self._o, encoding, format)
return ret
def htmlSetMetaEncoding(self, encoding):
"""Sets the current encoding in the Meta tags NOTE: this will
not change the document content encoding, just the META
flag associated. """
ret = libxml2mod.htmlSetMetaEncoding(self._o, encoding)
return ret
#
# xmlDoc functions from module debugXML
#
def debugCheckDocument(self, output):
"""Check the document for potential content problems, and
output the errors to @output """
ret = libxml2mod.xmlDebugCheckDocument(output, self._o)
return ret
def debugDumpDocument(self, output):
"""Dumps debug information for the document, it's recursive """
libxml2mod.xmlDebugDumpDocument(output, self._o)
def debugDumpDocumentHead(self, output):
"""Dumps debug information cncerning the document, not
recursive """
libxml2mod.xmlDebugDumpDocumentHead(output, self._o)
def debugDumpEntities(self, output):
"""Dumps debug information for all the entities in use by the
document """
libxml2mod.xmlDebugDumpEntities(output, self._o)
#
# xmlDoc functions from module entities
#
def addDocEntity(self, name, type, ExternalID, SystemID, content):
"""Register a new entity for this document. """
ret = libxml2mod.xmlAddDocEntity(self._o, name, type, ExternalID, SystemID, content)
if ret is None:raise treeError('xmlAddDocEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp
def addDtdEntity(self, name, type, ExternalID, SystemID, content):
"""Register a new entity for this document DTD external subset. """
ret = libxml2mod.xmlAddDtdEntity(self._o, name, type, ExternalID, SystemID, content)
if ret is None:raise treeError('xmlAddDtdEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp
def docEntity(self, name):
"""Do an entity lookup in the document entity hash table and """
ret = libxml2mod.xmlGetDocEntity(self._o, name)
if ret is None:raise treeError('xmlGetDocEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp
def dtdEntity(self, name):
"""Do an entity lookup in the DTD entity hash table and """
ret = libxml2mod.xmlGetDtdEntity(self._o, name)
if ret is None:raise treeError('xmlGetDtdEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp
def encodeEntities(self, input):
"""TODO: remove xmlEncodeEntities, once we are not afraid of
breaking binary compatibility People must migrate their
code to xmlEncodeEntitiesReentrant ! This routine will
issue a warning when encountered. """
ret = libxml2mod.xmlEncodeEntities(self._o, input)
return ret
def encodeEntitiesReentrant(self, input):
"""Do a global encoding of a string, replacing the predefined
entities and non ASCII values with their entities and
CharRef counterparts. Contrary to xmlEncodeEntities, this
routine is reentrant, and result must be deallocated. """
ret = libxml2mod.xmlEncodeEntitiesReentrant(self._o, input)
return ret
def encodeSpecialChars(self, input):
"""Do a global encoding of a string, replacing the predefined
entities this routine is reentrant, and result must be
deallocated. """
ret = libxml2mod.xmlEncodeSpecialChars(self._o, input)
return ret
def newEntity(self, name, type, ExternalID, SystemID, content):
"""Create a new entity, this differs from xmlAddDocEntity()
that if the document is None or has no internal subset
defined, then an unlinked entity structure will be
returned, it is then the responsability of the caller to
link it to the document later or free it when not needed
anymore. """
ret = libxml2mod.xmlNewEntity(self._o, name, type, ExternalID, SystemID, content)
if ret is None:raise treeError('xmlNewEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp
def parameterEntity(self, name):
"""Do an entity lookup in the internal and external subsets and """
ret = libxml2mod.xmlGetParameterEntity(self._o, name)
if ret is None:raise treeError('xmlGetParameterEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp
#
# xmlDoc functions from module relaxng
#
def relaxNGNewDocParserCtxt(self):
"""Create an XML RelaxNGs parser context for that document.
Note: since the process of compiling a RelaxNG schemas
modifies the document, the @doc parameter is duplicated
internally. """
ret = libxml2mod.xmlRelaxNGNewDocParserCtxt(self._o)
if ret is None:raise parserError('xmlRelaxNGNewDocParserCtxt() failed')
__tmp = relaxNgParserCtxt(_obj=ret)
return __tmp
def relaxNGValidateDoc(self, ctxt):
"""Validate a document tree in memory. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlRelaxNGValidateDoc(ctxt__o, self._o)
return ret
def relaxNGValidateFullElement(self, ctxt, elem):
"""Validate a full subtree when
xmlRelaxNGValidatePushElement() returned 0 and the content
of the node has been expanded. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlRelaxNGValidateFullElement(ctxt__o, self._o, elem__o)
return ret
def relaxNGValidatePopElement(self, ctxt, elem):
"""Pop the element end from the RelaxNG validation stack. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlRelaxNGValidatePopElement(ctxt__o, self._o, elem__o)
return ret
def relaxNGValidatePushElement(self, ctxt, elem):
"""Push a new element start on the RelaxNG validation stack. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlRelaxNGValidatePushElement(ctxt__o, self._o, elem__o)
return ret
#
# xmlDoc functions from module tree
#
def copyDoc(self, recursive):
"""Do a copy of the document info. If recursive, the content
tree will be copied too as well as DTD, namespaces and
entities. """
ret = libxml2mod.xmlCopyDoc(self._o, recursive)
if ret is None:raise treeError('xmlCopyDoc() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def copyNode(self, node, extended):
"""Do a copy of the node to a given document. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlDocCopyNode(node__o, self._o, extended)
if ret is None:raise treeError('xmlDocCopyNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def copyNodeList(self, node):
"""Do a recursive copy of the node list. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlDocCopyNodeList(self._o, node__o)
if ret is None:raise treeError('xmlDocCopyNodeList() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def createIntSubset(self, name, ExternalID, SystemID):
"""Create the internal subset of a document """
ret = libxml2mod.xmlCreateIntSubset(self._o, name, ExternalID, SystemID)
if ret is None:raise treeError('xmlCreateIntSubset() failed')
__tmp = xmlDtd(_obj=ret)
return __tmp
def docCompressMode(self):
"""get the compression ratio for a document, ZLIB based """
ret = libxml2mod.xmlGetDocCompressMode(self._o)
return ret
def dump(self, f):
"""Dump an XML document to an open FILE. """
ret = libxml2mod.xmlDocDump(f, self._o)
return ret
def elemDump(self, f, cur):
"""Dump an XML/HTML node, recursive behaviour, children are
printed too. """
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.xmlElemDump(f, self._o, cur__o)
def formatDump(self, f, format):
"""Dump an XML document to an open FILE. """
ret = libxml2mod.xmlDocFormatDump(f, self._o, format)
return ret
def freeDoc(self):
"""Free up all the structures used by a document, tree
included. """
libxml2mod.xmlFreeDoc(self._o)
def getRootElement(self):
"""Get the root element of the document (doc->children is a
list containing possibly comments, PIs, etc ...). """
ret = libxml2mod.xmlDocGetRootElement(self._o)
if ret is None:raise treeError('xmlDocGetRootElement() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def intSubset(self):
"""Get the internal subset of a document """
ret = libxml2mod.xmlGetIntSubset(self._o)
if ret is None:raise treeError('xmlGetIntSubset() failed')
__tmp = xmlDtd(_obj=ret)
return __tmp
def newCDataBlock(self, content, len):
"""Creation of a new node containing a CDATA block. """
ret = libxml2mod.xmlNewCDataBlock(self._o, content, len)
if ret is None:raise treeError('xmlNewCDataBlock() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newCharRef(self, name):
"""Creation of a new character reference node. """
ret = libxml2mod.xmlNewCharRef(self._o, name)
if ret is None:raise treeError('xmlNewCharRef() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocComment(self, content):
"""Creation of a new node containing a comment within a
document. """
ret = libxml2mod.xmlNewDocComment(self._o, content)
if ret is None:raise treeError('xmlNewDocComment() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocFragment(self):
"""Creation of a new Fragment node. """
ret = libxml2mod.xmlNewDocFragment(self._o)
if ret is None:raise treeError('xmlNewDocFragment() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocNode(self, ns, name, content):
"""Creation of a new node element within a document. @ns and
@content are optional (None). NOTE: @content is supposed to
be a piece of XML CDATA, so it allow entities references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
don't need entities support. """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlNewDocNode(self._o, ns__o, name, content)
if ret is None:raise treeError('xmlNewDocNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocNodeEatName(self, ns, name, content):
"""Creation of a new node element within a document. @ns and
@content are optional (None). NOTE: @content is supposed to
be a piece of XML CDATA, so it allow entities references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
don't need entities support. """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlNewDocNodeEatName(self._o, ns__o, name, content)
if ret is None:raise treeError('xmlNewDocNodeEatName() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocPI(self, name, content):
"""Creation of a processing instruction element. """
ret = libxml2mod.xmlNewDocPI(self._o, name, content)
if ret is None:raise treeError('xmlNewDocPI() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocProp(self, name, value):
"""Create a new property carried by a document. """
ret = libxml2mod.xmlNewDocProp(self._o, name, value)
if ret is None:raise treeError('xmlNewDocProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def newDocRawNode(self, ns, name, content):
"""Creation of a new node element within a document. @ns and
@content are optional (None). """
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlNewDocRawNode(self._o, ns__o, name, content)
if ret is None:raise treeError('xmlNewDocRawNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocText(self, content):
"""Creation of a new text node within a document. """
ret = libxml2mod.xmlNewDocText(self._o, content)
if ret is None:raise treeError('xmlNewDocText() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocTextLen(self, content, len):
"""Creation of a new text node with an extra content length
parameter. The text node pertain to a given document. """
ret = libxml2mod.xmlNewDocTextLen(self._o, content, len)
if ret is None:raise treeError('xmlNewDocTextLen() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDtd(self, name, ExternalID, SystemID):
"""Creation of a new DTD for the external subset. To create an
internal subset, use xmlCreateIntSubset(). """
ret = libxml2mod.xmlNewDtd(self._o, name, ExternalID, SystemID)
if ret is None:raise treeError('xmlNewDtd() failed')
__tmp = xmlDtd(_obj=ret)
return __tmp
def newGlobalNs(self, href, prefix):
"""Creation of a Namespace, the old way using PI and without
scoping DEPRECATED !!! """
ret = libxml2mod.xmlNewGlobalNs(self._o, href, prefix)
if ret is None:raise treeError('xmlNewGlobalNs() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def newReference(self, name):
"""Creation of a new reference node. """
ret = libxml2mod.xmlNewReference(self._o, name)
if ret is None:raise treeError('xmlNewReference() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def nodeDumpOutput(self, buf, cur, level, format, encoding):
"""Dump an XML node, recursive behaviour, children are printed
too. Note that @format = 1 provide node indenting only if
xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
called """
if buf is None: buf__o = None
else: buf__o = buf._o
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.xmlNodeDumpOutput(buf__o, self._o, cur__o, level, format, encoding)
def nodeGetBase(self, cur):
"""Searches for the BASE URL. The code should work on both XML
and HTML document even if base mechanisms are completely
different. It returns the base as defined in RFC 2396
sections 5.1.1. Base URI within Document Content and 5.1.2.
Base URI from the Encapsulating Entity However it does not
return the document base (5.1.3), use doc->URL in this case """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlNodeGetBase(self._o, cur__o)
return ret
def nodeListGetRawString(self, list, inLine):
"""Builds the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs, contrary to
xmlNodeListGetString() this function doesn't do any
character encoding handling. """
if list is None: list__o = None
else: list__o = list._o
ret = libxml2mod.xmlNodeListGetRawString(self._o, list__o, inLine)
return ret
def nodeListGetString(self, list, inLine):
"""Build the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs """
if list is None: list__o = None
else: list__o = list._o
ret = libxml2mod.xmlNodeListGetString(self._o, list__o, inLine)
return ret
def reconciliateNs(self, tree):
"""This function checks that all the namespaces declared
within the given tree are properly declared. This is needed
for example after Copy or Cut and then paste operations.
The subtree may still hold pointers to namespace
declarations outside the subtree or invalid/masked. As much
as possible the function try to reuse the existing
namespaces found in the new environment. If not possible
the new namespaces are redeclared on @tree at the top of
the given subtree. """
if tree is None: tree__o = None
else: tree__o = tree._o
ret = libxml2mod.xmlReconciliateNs(self._o, tree__o)
return ret
def saveFile(self, filename):
"""Dump an XML document to a file. Will use compression if
compiled in and enabled. If @filename is "-" the stdout
file is used. """
ret = libxml2mod.xmlSaveFile(filename, self._o)
return ret
def saveFileEnc(self, filename, encoding):
"""Dump an XML document, converting it to the given encoding """
ret = libxml2mod.xmlSaveFileEnc(filename, self._o, encoding)
return ret
def saveFileTo(self, buf, encoding):
"""Dump an XML document to an I/O buffer. Warning ! This call
xmlOutputBufferClose() on buf which is not available after
this call. """
if buf is None: buf__o = None
else: buf__o = buf._o
ret = libxml2mod.xmlSaveFileTo(buf__o, self._o, encoding)
return ret
def saveFormatFile(self, filename, format):
"""Dump an XML document to a file. Will use compression if
compiled in and enabled. If @filename is "-" the stdout
file is used. If @format is set then the document will be
indented on output. Note that @format = 1 provide node
indenting only if xmlIndentTreeOutput = 1 or
xmlKeepBlanksDefault(0) was called """
ret = libxml2mod.xmlSaveFormatFile(filename, self._o, format)
return ret
def saveFormatFileEnc(self, filename, encoding, format):
"""Dump an XML document to a file or an URL. """
ret = libxml2mod.xmlSaveFormatFileEnc(filename, self._o, encoding, format)
return ret
def saveFormatFileTo(self, buf, encoding, format):
"""Dump an XML document to an I/O buffer. Warning ! This call
xmlOutputBufferClose() on buf which is not available after
this call. """
if buf is None: buf__o = None
else: buf__o = buf._o
ret = libxml2mod.xmlSaveFormatFileTo(buf__o, self._o, encoding, format)
return ret
def searchNs(self, node, nameSpace):
"""Search a Ns registered under a given name space for a
document. recurse on the parents until it finds the defined
namespace or return None otherwise. @nameSpace can be None,
this is a search for the default namespace. We don't allow
to cross entities boundaries. If you don't declare the
namespace within those you will be in troubles !!! A
warning is generated to cover this case. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlSearchNs(self._o, node__o, nameSpace)
if ret is None:raise treeError('xmlSearchNs() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def searchNsByHref(self, node, href):
"""Search a Ns aliasing a given URI. Recurse on the parents
until it finds the defined namespace or return None
otherwise. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlSearchNsByHref(self._o, node__o, href)
if ret is None:raise treeError('xmlSearchNsByHref() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def setDocCompressMode(self, mode):
"""set the compression ratio for a document, ZLIB based
Correct values: 0 (uncompressed) to 9 (max compression) """
libxml2mod.xmlSetDocCompressMode(self._o, mode)
def setListDoc(self, list):
"""update all nodes in the list to point to the right document """
if list is None: list__o = None
else: list__o = list._o
libxml2mod.xmlSetListDoc(list__o, self._o)
def setRootElement(self, root):
"""Set the root element of the document (doc->children is a
list containing possibly comments, PIs, etc ...). """
if root is None: root__o = None
else: root__o = root._o
ret = libxml2mod.xmlDocSetRootElement(self._o, root__o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp
def setTreeDoc(self, tree):
"""update all nodes under the tree to point to the right
document """
if tree is None: tree__o = None
else: tree__o = tree._o
libxml2mod.xmlSetTreeDoc(tree__o, self._o)
def stringGetNodeList(self, value):
"""Parse the value string and build the node list associated.
Should produce a flat tree with only TEXTs and ENTITY_REFs. """
ret = libxml2mod.xmlStringGetNodeList(self._o, value)
if ret is None:raise treeError('xmlStringGetNodeList() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def stringLenGetNodeList(self, value, len):
"""Parse the value string and build the node list associated.
Should produce a flat tree with only TEXTs and ENTITY_REFs. """
ret = libxml2mod.xmlStringLenGetNodeList(self._o, value, len)
if ret is None:raise treeError('xmlStringLenGetNodeList() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
#
# xmlDoc functions from module valid
#
def ID(self, ID):
"""Search the attribute declaring the given ID """
ret = libxml2mod.xmlGetID(self._o, ID)
if ret is None:raise treeError('xmlGetID() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def isID(self, elem, attr):
"""Determine whether an attribute is of type ID. In case we
have DTD(s) then this is done if DTD loading has been
requested. In the case of HTML documents parsed with the
HTML parser, then ID detection is done systematically. """
if elem is None: elem__o = None
else: elem__o = elem._o
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlIsID(self._o, elem__o, attr__o)
return ret
def isMixedElement(self, name):
"""Search in the DtDs whether an element accept Mixed content
(or ANY) basically if it is supposed to accept text childs """
ret = libxml2mod.xmlIsMixedElement(self._o, name)
return ret
def isRef(self, elem, attr):
"""Determine whether an attribute is of type Ref. In case we
have DTD(s) then this is simple, otherwise we use an
heuristic: name Ref (upper or lowercase). """
if elem is None: elem__o = None
else: elem__o = elem._o
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlIsRef(self._o, elem__o, attr__o)
return ret
def removeID(self, attr):
"""Remove the given attribute from the ID table maintained
internally. """
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlRemoveID(self._o, attr__o)
return ret
def removeRef(self, attr):
"""Remove the given attribute from the Ref table maintained
internally. """
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlRemoveRef(self._o, attr__o)
return ret
def validCtxtNormalizeAttributeValue(self, ctxt, elem, name, value):
"""Does the validation related extra step of the normalization
of attribute values: If the declared value is not CDATA,
then the XML processor must further process the normalized
attribute value by discarding any leading and trailing
space (#x20) characters, and by replacing sequences of
space (#x20) characters by single space (#x20) character.
Also check VC: Standalone Document Declaration in P32, and
update ctxt->valid accordingly """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidCtxtNormalizeAttributeValue(ctxt__o, self._o, elem__o, name, value)
return ret
def validNormalizeAttributeValue(self, elem, name, value):
"""Does the validation related extra step of the normalization
of attribute values: If the declared value is not CDATA,
then the XML processor must further process the normalized
attribute value by discarding any leading and trailing
space (#x20) characters, and by replacing sequences of
space (#x20) characters by single space (#x20) character. """
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidNormalizeAttributeValue(self._o, elem__o, name, value)
return ret
def validateDocument(self, ctxt):
"""Try to validate the document instance basically it does
the all the checks described by the XML Rec i.e. validates
the internal and external subset (if present) and validate
the document tree. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlValidateDocument(ctxt__o, self._o)
return ret
def validateDocumentFinal(self, ctxt):
"""Does the final step for the document validation once all
the incremental validation steps have been completed
basically it does the following checks described by the XML
Rec Check all the IDREF/IDREFS attributes definition for
validity """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlValidateDocumentFinal(ctxt__o, self._o)
return ret
def validateDtd(self, ctxt, dtd):
"""Try to validate the document against the dtd instance
Basically it does check all the definitions in the DtD.
Note the the internal subset (if present) is de-coupled
(i.e. not used), which could give problems if ID or IDREF
is present. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if dtd is None: dtd__o = None
else: dtd__o = dtd._o
ret = libxml2mod.xmlValidateDtd(ctxt__o, self._o, dtd__o)
return ret
def validateDtdFinal(self, ctxt):
"""Does the final step for the dtds validation once all the
subsets have been parsed basically it does the following
checks described by the XML Rec - check that ENTITY and
ENTITIES type attributes default or possible values matches
one of the defined entities. - check that NOTATION type
attributes default or possible values matches one of the
defined notations. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlValidateDtdFinal(ctxt__o, self._o)
return ret
def validateElement(self, ctxt, elem):
"""Try to validate the subtree under an element """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidateElement(ctxt__o, self._o, elem__o)
return ret
def validateNotationUse(self, ctxt, notationName):
"""Validate that the given name match a notation declaration.
- [ VC: Notation Declared ] """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlValidateNotationUse(ctxt__o, self._o, notationName)
return ret
def validateOneAttribute(self, ctxt, elem, attr, value):
"""Try to validate a single attribute for an element basically
it does the following checks as described by the XML-1.0
recommendation: - [ VC: Attribute Value Type ] - [ VC:
Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC:
Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity
Name ] - [ VC: Notation Attributes ] The ID/IDREF
uniqueness and matching are done separately """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlValidateOneAttribute(ctxt__o, self._o, elem__o, attr__o, value)
return ret
def validateOneElement(self, ctxt, elem):
"""Try to validate a single element and it's attributes,
basically it does the following checks as described by the
XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC:
Required Attribute ] Then call xmlValidateOneAttribute()
for each attribute present. The ID/IDREF checkings are
done separately """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidateOneElement(ctxt__o, self._o, elem__o)
return ret
def validateOneNamespace(self, ctxt, elem, prefix, ns, value):
"""Try to validate a single namespace declaration for an
element basically it does the following checks as described
by the XML-1.0 recommendation: - [ VC: Attribute Value Type
] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] -
[ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC:
Entity Name ] - [ VC: Notation Attributes ] The ID/IDREF
uniqueness and matching are done separately """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlValidateOneNamespace(ctxt__o, self._o, elem__o, prefix, ns__o, value)
return ret
def validatePopElement(self, ctxt, elem, qname):
"""Pop the element end from the validation stack. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidatePopElement(ctxt__o, self._o, elem__o, qname)
return ret
def validatePushElement(self, ctxt, elem, qname):
"""Push a new element start on the validation stack. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidatePushElement(ctxt__o, self._o, elem__o, qname)
return ret
def validateRoot(self, ctxt):
"""Try to validate a the root element basically it does the
following check as described by the XML-1.0 recommendation:
- [ VC: Root Element Type ] it doesn't try to recurse or
apply other check to the element """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlValidateRoot(ctxt__o, self._o)
return ret
#
# xmlDoc functions from module xinclude
#
def xincludeProcess(self):
"""Implement the XInclude substitution on the XML document @doc """
ret = libxml2mod.xmlXIncludeProcess(self._o)
return ret
def xincludeProcessFlags(self, flags):
"""Implement the XInclude substitution on the XML document @doc """
ret = libxml2mod.xmlXIncludeProcessFlags(self._o, flags)
return ret
#
# xmlDoc functions from module xmlreader
#
def NewWalker(self, reader):
"""Setup an xmltextReader to parse a preparsed XML document.
This reuses the existing @reader xmlTextReader. """
if reader is None: reader__o = None
else: reader__o = reader._o
ret = libxml2mod.xmlReaderNewWalker(reader__o, self._o)
return ret
def readerWalker(self):
"""Create an xmltextReader for a preparsed document. """
ret = libxml2mod.xmlReaderWalker(self._o)
if ret is None:raise treeError('xmlReaderWalker() failed')
__tmp = xmlTextReader(_obj=ret)
return __tmp
#
# xmlDoc functions from module xmlschemas
#
def schemaNewDocParserCtxt(self):
"""Create an XML Schemas parse context for that document. NB.
The document may be modified during the parsing process. """
ret = libxml2mod.xmlSchemaNewDocParserCtxt(self._o)
if ret is None:raise parserError('xmlSchemaNewDocParserCtxt() failed')
__tmp = SchemaParserCtxt(_obj=ret)
return __tmp
def schemaValidateDoc(self, ctxt):
"""Validate a document tree in memory. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlSchemaValidateDoc(ctxt__o, self._o)
return ret
#
# xmlDoc functions from module xpath
#
def xpathNewContext(self):
"""Create a new xmlXPathContext """
ret = libxml2mod.xmlXPathNewContext(self._o)
if ret is None:raise xpathError('xmlXPathNewContext() failed')
__tmp = xpathContext(_obj=ret)
return __tmp
def xpathOrderDocElems(self):
"""Call this routine to speed up XPath computation on static
documents. This stamps all the element nodes with the
document order Like for line information, the order is kept
in the element->content field, the value stored is actually
- the node number (starting at -1) to be able to
differentiate from line numbers. """
ret = libxml2mod.xmlXPathOrderDocElems(self._o)
return ret
#
# xmlDoc functions from module xpointer
#
def xpointerNewContext(self, here, origin):
"""Create a new XPointer context """
if here is None: here__o = None
else: here__o = here._o
if origin is None: origin__o = None
else: origin__o = origin._o
ret = libxml2mod.xmlXPtrNewContext(self._o, here__o, origin__o)
if ret is None:raise treeError('xmlXPtrNewContext() failed')
__tmp = xpathContext(_obj=ret)
return __tmp
class parserCtxt(parserCtxtCore):
def __init__(self, _obj=None):
self._o = _obj
parserCtxtCore.__init__(self, _obj=_obj)
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeParserCtxt(self._o)
self._o = None
# accessors for parserCtxt
def doc(self):
"""Get the document tree from a parser context. """
ret = libxml2mod.xmlParserGetDoc(self._o)
if ret is None:raise parserError('xmlParserGetDoc() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def isValid(self):
"""Get the validity information from a parser context. """
ret = libxml2mod.xmlParserGetIsValid(self._o)
return ret
def lineNumbers(self, linenumbers):
"""Switch on the generation of line number for elements nodes. """
libxml2mod.xmlParserSetLineNumbers(self._o, linenumbers)
def loadSubset(self, loadsubset):
"""Switch the parser to load the DTD without validating. """
libxml2mod.xmlParserSetLoadSubset(self._o, loadsubset)
def pedantic(self, pedantic):
"""Switch the parser to be pedantic. """
libxml2mod.xmlParserSetPedantic(self._o, pedantic)
def replaceEntities(self, replaceEntities):
"""Switch the parser to replace entities. """
libxml2mod.xmlParserSetReplaceEntities(self._o, replaceEntities)
def validate(self, validate):
"""Switch the parser to validation mode. """
libxml2mod.xmlParserSetValidate(self._o, validate)
def wellFormed(self):
"""Get the well formed information from a parser context. """
ret = libxml2mod.xmlParserGetWellFormed(self._o)
return ret
#
# parserCtxt functions from module HTMLparser
#
def htmlCtxtReadDoc(self, cur, URL, encoding, options):
"""parse an XML in-memory document and build a tree. This
reuses the existing @ctxt parser context """
ret = libxml2mod.htmlCtxtReadDoc(self._o, cur, URL, encoding, options)
if ret is None:raise treeError('htmlCtxtReadDoc() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def htmlCtxtReadFd(self, fd, URL, encoding, options):
"""parse an XML from a file descriptor and build a tree. This
reuses the existing @ctxt parser context """
ret = libxml2mod.htmlCtxtReadFd(self._o, fd, URL, encoding, options)
if ret is None:raise treeError('htmlCtxtReadFd() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def htmlCtxtReadFile(self, filename, encoding, options):
"""parse an XML file from the filesystem or the network. This
reuses the existing @ctxt parser context """
ret = libxml2mod.htmlCtxtReadFile(self._o, filename, encoding, options)
if ret is None:raise treeError('htmlCtxtReadFile() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def htmlCtxtReadMemory(self, buffer, size, URL, encoding, options):
"""parse an XML in-memory document and build a tree. This
reuses the existing @ctxt parser context """
ret = libxml2mod.htmlCtxtReadMemory(self._o, buffer, size, URL, encoding, options)
if ret is None:raise treeError('htmlCtxtReadMemory() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def htmlCtxtReset(self):
"""Reset a parser context """
libxml2mod.htmlCtxtReset(self._o)
def htmlCtxtUseOptions(self, options):
"""Applies the options to the parser context """
ret = libxml2mod.htmlCtxtUseOptions(self._o, options)
return ret
def htmlFreeParserCtxt(self):
"""Free all the memory used by a parser context. However the
parsed document in ctxt->myDoc is not freed. """
libxml2mod.htmlFreeParserCtxt(self._o)
def htmlParseCharRef(self):
"""parse Reference declarations [66] CharRef ::= '&#' [0-9]+
';' | '&#x' [0-9a-fA-F]+ ';' """
ret = libxml2mod.htmlParseCharRef(self._o)
return ret
def htmlParseChunk(self, chunk, size, terminate):
"""Parse a Chunk of memory """
ret = libxml2mod.htmlParseChunk(self._o, chunk, size, terminate)
return ret
def htmlParseDocument(self):
"""parse an HTML document (and build a tree if using the
standard SAX interface). """
ret = libxml2mod.htmlParseDocument(self._o)
return ret
def htmlParseElement(self):
"""parse an HTML element, this is highly recursive this is
kept for compatibility with previous code versions [39]
element ::= EmptyElemTag | STag content ETag [41]
Attribute ::= Name Eq AttValue """
libxml2mod.htmlParseElement(self._o)
#
# parserCtxt functions from module parser
#
def byteConsumed(self):
"""This function provides the current index of the parser
relative to the start of the current entity. This function
is computed in bytes from the beginning starting at zero
and finishing at the size in byte of the file if parsing a
file. The function is of constant cost if the input is
UTF-8 but can be costly if run on non-UTF-8 input. """
ret = libxml2mod.xmlByteConsumed(self._o)
return ret
def clearParserCtxt(self):
"""Clear (release owned resources) and reinitialize a parser
context """
libxml2mod.xmlClearParserCtxt(self._o)
def ctxtReadDoc(self, cur, URL, encoding, options):
"""parse an XML in-memory document and build a tree. This
reuses the existing @ctxt parser context """
ret = libxml2mod.xmlCtxtReadDoc(self._o, cur, URL, encoding, options)
if ret is None:raise treeError('xmlCtxtReadDoc() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def ctxtReadFd(self, fd, URL, encoding, options):
"""parse an XML from a file descriptor and build a tree. This
reuses the existing @ctxt parser context NOTE that the file
descriptor will not be closed when the reader is closed or
reset. """
ret = libxml2mod.xmlCtxtReadFd(self._o, fd, URL, encoding, options)
if ret is None:raise treeError('xmlCtxtReadFd() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def ctxtReadFile(self, filename, encoding, options):
"""parse an XML file from the filesystem or the network. This
reuses the existing @ctxt parser context """
ret = libxml2mod.xmlCtxtReadFile(self._o, filename, encoding, options)
if ret is None:raise treeError('xmlCtxtReadFile() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def ctxtReadMemory(self, buffer, size, URL, encoding, options):
"""parse an XML in-memory document and build a tree. This
reuses the existing @ctxt parser context """
ret = libxml2mod.xmlCtxtReadMemory(self._o, buffer, size, URL, encoding, options)
if ret is None:raise treeError('xmlCtxtReadMemory() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def ctxtReset(self):
"""Reset a parser context """
libxml2mod.xmlCtxtReset(self._o)
def ctxtResetPush(self, chunk, size, filename, encoding):
"""Reset a push parser context """
ret = libxml2mod.xmlCtxtResetPush(self._o, chunk, size, filename, encoding)
return ret
def ctxtUseOptions(self, options):
"""Applies the options to the parser context """
ret = libxml2mod.xmlCtxtUseOptions(self._o, options)
return ret
def initParserCtxt(self):
"""Initialize a parser context """
ret = libxml2mod.xmlInitParserCtxt(self._o)
return ret
def parseChunk(self, chunk, size, terminate):
"""Parse a Chunk of memory """
ret = libxml2mod.xmlParseChunk(self._o, chunk, size, terminate)
return ret
def parseDocument(self):
"""parse an XML document (and build a tree if using the
standard SAX interface). [1] document ::= prolog element
Misc* [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? """
ret = libxml2mod.xmlParseDocument(self._o)
return ret
def parseExtParsedEnt(self):
"""parse a general parsed entity An external general parsed
entity is well-formed if it matches the production labeled
extParsedEnt. [78] extParsedEnt ::= TextDecl? content """
ret = libxml2mod.xmlParseExtParsedEnt(self._o)
return ret
def setupParserForBuffer(self, buffer, filename):
"""Setup the parser context to parse a new buffer; Clears any
prior contents from the parser context. The buffer
parameter must not be None, but the filename parameter can
be """
libxml2mod.xmlSetupParserForBuffer(self._o, buffer, filename)
def stopParser(self):
"""Blocks further parser processing """
libxml2mod.xmlStopParser(self._o)
#
# parserCtxt functions from module parserInternals
#
def decodeEntities(self, len, what, end, end2, end3):
"""This function is deprecated, we now always process entities
content through xmlStringDecodeEntities TODO: remove it in
next major release. [67] Reference ::= EntityRef | CharRef
[69] PEReference ::= '%' Name ';' """
ret = libxml2mod.xmlDecodeEntities(self._o, len, what, end, end2, end3)
return ret
def handleEntity(self, entity):
"""Default handling of defined entities, when should we define
a new input stream ? When do we just handle that as a set
of chars ? OBSOLETE: to be removed at some point. """
if entity is None: entity__o = None
else: entity__o = entity._o
libxml2mod.xmlHandleEntity(self._o, entity__o)
def namespaceParseNCName(self):
"""parse an XML namespace name. TODO: this seems not in use
anymore, the namespace handling is done on top of the SAX
interfaces, i.e. not on raw input. [NS 3] NCName ::=
(Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::= Letter
| Digit | '.' | '-' | '_' | CombiningChar | Extender """
ret = libxml2mod.xmlNamespaceParseNCName(self._o)
return ret
def namespaceParseNSDef(self):
"""parse a namespace prefix declaration TODO: this seems not
in use anymore, the namespace handling is done on top of
the SAX interfaces, i.e. not on raw input. [NS 1] NSDef
::= PrefixDef Eq SystemLiteral [NS 2] PrefixDef ::=
'xmlns' (':' NCName)? """
ret = libxml2mod.xmlNamespaceParseNSDef(self._o)
return ret
def nextChar(self):
"""Skip to the next char input char. """
libxml2mod.xmlNextChar(self._o)
def parseAttValue(self):
"""parse a value for an attribute Note: the parser won't do
substitution of entities here, this will be handled later
in xmlStringGetNodeList [10] AttValue ::= '"' ([^<&"] |
Reference)* '"' | "'" ([^<&'] | Reference)* "'" 3.3.3
Attribute-Value Normalization: Before the value of an
attribute is passed to the application or checked for
validity, the XML processor must normalize it as follows: -
a character reference is processed by appending the
referenced character to the attribute value - an entity
reference is processed by recursively processing the
replacement text of the entity - a whitespace character
(#x20, #xD, #xA, #x9) is processed by appending #x20 to the
normalized value, except that only a single #x20 is
appended for a "#xD#xA" sequence that is part of an
external parsed entity or the literal entity value of an
internal parsed entity - other characters are processed by
appending them to the normalized value If the declared
value is not CDATA, then the XML processor must further
process the normalized attribute value by discarding any
leading and trailing space (#x20) characters, and by
replacing sequences of space (#x20) characters by a single
space (#x20) character. All attributes for which no
declaration has been read should be treated by a
non-validating parser as if declared CDATA. """
ret = libxml2mod.xmlParseAttValue(self._o)
return ret
def parseAttributeListDecl(self):
""": parse the Attribute list def for an element [52]
AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' [53]
AttDef ::= S Name S AttType S DefaultDecl """
libxml2mod.xmlParseAttributeListDecl(self._o)
def parseCDSect(self):
"""Parse escaped pure raw content. [18] CDSect ::= CDStart
CData CDEnd [19] CDStart ::= '<![CDATA[' [20] Data ::=
(Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>' """
libxml2mod.xmlParseCDSect(self._o)
def parseCharData(self, cdata):
"""parse a CharData section. if we are within a CDATA section
']]>' marks an end of section. The right angle bracket (>)
may be represented using the string ">", and must, for
compatibility, be escaped using ">" or a character
reference when it appears in the string "]]>" in content,
when that string is not marking the end of a CDATA section.
[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) """
libxml2mod.xmlParseCharData(self._o, cdata)
def parseCharRef(self):
"""parse Reference declarations [66] CharRef ::= '&#' [0-9]+
';' | '&#x' [0-9a-fA-F]+ ';' [ WFC: Legal Character ]
Characters referred to using character references must
match the production for Char. """
ret = libxml2mod.xmlParseCharRef(self._o)
return ret
def parseComment(self):
"""Skip an XML (SGML) comment <!-- .... --> The spec says that
"For compatibility, the string "--" (double-hyphen) must
not occur within comments. " [15] Comment ::= '<!--'
((Char - '-') | ('-' (Char - '-')))* '-->' """
libxml2mod.xmlParseComment(self._o)
def parseContent(self):
"""Parse a content: [43] content ::= (element | CharData |
Reference | CDSect | PI | Comment)* """
libxml2mod.xmlParseContent(self._o)
def parseDocTypeDecl(self):
"""parse a DOCTYPE declaration [28] doctypedecl ::=
'<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl |
PEReference | S)* ']' S?)? '>' [ VC: Root Element Type ]
The Name in the document type declaration must match the
element type of the root element. """
libxml2mod.xmlParseDocTypeDecl(self._o)
def parseElement(self):
"""parse an XML element, this is highly recursive [39]
element ::= EmptyElemTag | STag content ETag [ WFC:
Element Type Match ] The Name in an element's end-tag must
match the element type in the start-tag. """
libxml2mod.xmlParseElement(self._o)
def parseElementDecl(self):
"""parse an Element declaration. [45] elementdecl ::=
'<!ELEMENT' S Name S contentspec S? '>' [ VC: Unique
Element Type Declaration ] No element type may be declared
more than once """
ret = libxml2mod.xmlParseElementDecl(self._o)
return ret
def parseEncName(self):
"""parse the XML encoding name [81] EncName ::= [A-Za-z]
([A-Za-z0-9._] | '-')* """
ret = libxml2mod.xmlParseEncName(self._o)
return ret
def parseEncodingDecl(self):
"""parse the XML encoding declaration [80] EncodingDecl ::= S
'encoding' Eq ('"' EncName '"' | "'" EncName "'") this
setups the conversion filters. """
ret = libxml2mod.xmlParseEncodingDecl(self._o)
return ret
def parseEndTag(self):
"""parse an end of tag [42] ETag ::= '</' Name S? '>' With
namespace [NS 9] ETag ::= '</' QName S? '>' """
libxml2mod.xmlParseEndTag(self._o)
def parseEntityDecl(self):
"""parse <!ENTITY declarations [70] EntityDecl ::= GEDecl |
PEDecl [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S?
'>' [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)
[74] PEDef ::= EntityValue | ExternalID [76] NDataDecl ::=
S 'NDATA' S Name [ VC: Notation Declared ] The Name must
match the declared name of a notation. """
libxml2mod.xmlParseEntityDecl(self._o)
def parseEntityRef(self):
"""parse ENTITY references declarations [68] EntityRef ::=
'&' Name ';' [ WFC: Entity Declared ] In a document
without any DTD, a document with only an internal DTD
subset which contains no parameter entity references, or a
document with "standalone='yes'", the Name given in the
entity reference must match that in an entity declaration,
except that well-formed documents need not declare any of
the following entities: amp, lt, gt, apos, quot. The
declaration of a parameter entity must precede any
reference to it. Similarly, the declaration of a general
entity must precede any reference to it which appears in a
default value in an attribute-list declaration. Note that
if entities are declared in the external subset or in
external parameter entities, a non-validating processor is
not obligated to read and process their declarations; for
such documents, the rule that an entity must be declared is
a well-formedness constraint only if standalone='yes'. [
WFC: Parsed Entity ] An entity reference must not contain
the name of an unparsed entity """
ret = libxml2mod.xmlParseEntityRef(self._o)
if ret is None:raise parserError('xmlParseEntityRef() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp
def parseExternalSubset(self, ExternalID, SystemID):
"""parse Markup declarations from an external subset [30]
extSubset ::= textDecl? extSubsetDecl [31] extSubsetDecl
::= (markupdecl | conditionalSect | PEReference | S) * """
libxml2mod.xmlParseExternalSubset(self._o, ExternalID, SystemID)
def parseMarkupDecl(self):
"""parse Markup declarations [29] markupdecl ::= elementdecl
| AttlistDecl | EntityDecl | NotationDecl | PI | Comment [
VC: Proper Declaration/PE Nesting ] Parameter-entity
replacement text must be properly nested with markup
declarations. That is to say, if either the first character
or the last character of a markup declaration (markupdecl
above) is contained in the replacement text for a
parameter-entity reference, both must be contained in the
same replacement text. [ WFC: PEs in Internal Subset ] In
the internal DTD subset, parameter-entity references can
occur only where markup declarations can occur, not within
markup declarations. (This does not apply to references
that occur in external parameter entities or to the
external subset.) """
libxml2mod.xmlParseMarkupDecl(self._o)
def parseMisc(self):
"""parse an XML Misc* optional field. [27] Misc ::= Comment |
PI | S """
libxml2mod.xmlParseMisc(self._o)
def parseName(self):
"""parse an XML name. [4] NameChar ::= Letter | Digit | '.' |
'-' | '_' | ':' | CombiningChar | Extender [5] Name ::=
(Letter | '_' | ':') (NameChar)* [6] Names ::= Name (#x20
Name)* """
ret = libxml2mod.xmlParseName(self._o)
return ret
def parseNamespace(self):
"""xmlParseNamespace: parse specific PI '<?namespace ...'
constructs. This is what the older xml-name Working Draft
specified, a bunch of other stuff may still rely on it, so
support is still here as if it was declared on the root of
the Tree:-( TODO: remove from library To be removed at
next drop of binary compatibility """
libxml2mod.xmlParseNamespace(self._o)
def parseNmtoken(self):
"""parse an XML Nmtoken. [7] Nmtoken ::= (NameChar)+ [8]
Nmtokens ::= Nmtoken (#x20 Nmtoken)* """
ret = libxml2mod.xmlParseNmtoken(self._o)
return ret
def parseNotationDecl(self):
"""parse a notation declaration [82] NotationDecl ::=
'<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral
'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S
SystemLiteral See the NOTE on xmlParseExternalID(). """
libxml2mod.xmlParseNotationDecl(self._o)
def parsePEReference(self):
"""parse PEReference declarations The entity content is
handled directly by pushing it's content as a new input
stream. [69] PEReference ::= '%' Name ';' [ WFC: No
Recursion ] A parsed entity must not contain a recursive
reference to itself, either directly or indirectly. [ WFC:
Entity Declared ] In a document without any DTD, a document
with only an internal DTD subset which contains no
parameter entity references, or a document with
"standalone='yes'", ... ... The declaration of a parameter
entity must precede any reference to it... [ VC: Entity
Declared ] In a document with an external subset or
external parameter entities with "standalone='no'", ...
... The declaration of a parameter entity must precede any
reference to it... [ WFC: In DTD ] Parameter-entity
references may only appear in the DTD. NOTE: misleading but
this is handled. """
libxml2mod.xmlParsePEReference(self._o)
def parsePI(self):
"""parse an XML Processing Instruction. [16] PI ::= '<?'
PITarget (S (Char* - (Char* '?>' Char*)))? '?>' The
processing is transfered to SAX once parsed. """
libxml2mod.xmlParsePI(self._o)
def parsePITarget(self):
"""parse the name of a PI [17] PITarget ::= Name - (('X' |
'x') ('M' | 'm') ('L' | 'l')) """
ret = libxml2mod.xmlParsePITarget(self._o)
return ret
def parsePubidLiteral(self):
"""parse an XML public literal [12] PubidLiteral ::= '"'
PubidChar* '"' | "'" (PubidChar - "'")* "'" """
ret = libxml2mod.xmlParsePubidLiteral(self._o)
return ret
def parseQuotedString(self):
"""Parse and return a string between quotes or doublequotes
TODO: Deprecated, to be removed at next drop of binary
compatibility """
ret = libxml2mod.xmlParseQuotedString(self._o)
return ret
def parseReference(self):
"""parse and handle entity references in content, depending on
the SAX interface, this may end-up in a call to character()
if this is a CharRef, a predefined entity, if there is no
reference() callback. or if the parser was asked to switch
to that mode. [67] Reference ::= EntityRef | CharRef """
libxml2mod.xmlParseReference(self._o)
def parseSDDecl(self):
"""parse the XML standalone declaration [32] SDDecl ::= S
'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' |
'no')'"')) [ VC: Standalone Document Declaration ] TODO
The standalone document declaration must have the value
"no" if any external markup declarations contain
declarations of: - attributes with default values, if
elements to which these attributes apply appear in the
document without specifications of values for these
attributes, or - entities (other than amp, lt, gt, apos,
quot), if references to those entities appear in the
document, or - attributes with values subject to
normalization, where the attribute appears in the document
with a value which will change as a result of
normalization, or - element types with element content, if
white space occurs directly within any instance of those
types. """
ret = libxml2mod.xmlParseSDDecl(self._o)
return ret
def parseStartTag(self):
"""parse a start of tag either for rule element or
EmptyElement. In both case we don't parse the tag closing
chars. [40] STag ::= '<' Name (S Attribute)* S? '>' [
WFC: Unique Att Spec ] No attribute name may appear more
than once in the same start-tag or empty-element tag. [44]
EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [ WFC:
Unique Att Spec ] No attribute name may appear more than
once in the same start-tag or empty-element tag. With
namespace: [NS 8] STag ::= '<' QName (S Attribute)* S? '>'
[NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>' """
ret = libxml2mod.xmlParseStartTag(self._o)
return ret
def parseSystemLiteral(self):
"""parse an XML Literal [11] SystemLiteral ::= ('"' [^"]*
'"') | ("'" [^']* "'") """
ret = libxml2mod.xmlParseSystemLiteral(self._o)
return ret
def parseTextDecl(self):
"""parse an XML declaration header for external entities [77]
TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' """
libxml2mod.xmlParseTextDecl(self._o)
def parseVersionInfo(self):
"""parse the XML version. [24] VersionInfo ::= S 'version' Eq
(' VersionNum ' | " VersionNum ") [25] Eq ::= S? '=' S? """
ret = libxml2mod.xmlParseVersionInfo(self._o)
return ret
def parseVersionNum(self):
"""parse the XML version value. [26] VersionNum ::= '1.'
[0-9]+ In practice allow [0-9].[0-9]+ at that level """
ret = libxml2mod.xmlParseVersionNum(self._o)
return ret
def parseXMLDecl(self):
"""parse an XML declaration header [23] XMLDecl ::= '<?xml'
VersionInfo EncodingDecl? SDDecl? S? '?>' """
libxml2mod.xmlParseXMLDecl(self._o)
def parserHandlePEReference(self):
"""[69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A
parsed entity must not contain a recursive reference to
itself, either directly or indirectly. [ WFC: Entity
Declared ] In a document without any DTD, a document with
only an internal DTD subset which contains no parameter
entity references, or a document with "standalone='yes'",
... ... The declaration of a parameter entity must precede
any reference to it... [ VC: Entity Declared ] In a
document with an external subset or external parameter
entities with "standalone='no'", ... ... The declaration
of a parameter entity must precede any reference to it...
[ WFC: In DTD ] Parameter-entity references may only appear
in the DTD. NOTE: misleading but this is handled. A
PEReference may have been detected in the current input
stream the handling is done accordingly to
http://www.w3.org/TR/REC-xml#entproc i.e. - Included in
literal in entity values - Included as Parameter Entity
reference within DTDs """
libxml2mod.xmlParserHandlePEReference(self._o)
def parserHandleReference(self):
"""TODO: Remove, now deprecated ... the test is done directly
in the content parsing routines. [67] Reference ::=
EntityRef | CharRef [68] EntityRef ::= '&' Name ';' [
WFC: Entity Declared ] the Name given in the entity
reference must match that in an entity declaration, except
that well-formed documents need not declare any of the
following entities: amp, lt, gt, apos, quot. [ WFC: Parsed
Entity ] An entity reference must not contain the name of
an unparsed entity [66] CharRef ::= '&#' [0-9]+ ';' |
'&#x' [0-9a-fA-F]+ ';' A PEReference may have been
detected in the current input stream the handling is done
accordingly to http://www.w3.org/TR/REC-xml#entproc """
libxml2mod.xmlParserHandleReference(self._o)
def popInput(self):
"""xmlPopInput: the current input pointed by ctxt->input came
to an end pop it and return the next char. """
ret = libxml2mod.xmlPopInput(self._o)
return ret
def scanName(self):
"""Trickery: parse an XML name but without consuming the input
flow Needed for rollback cases. Used only when parsing
entities references. TODO: seems deprecated now, only used
in the default part of xmlParserHandleReference [4]
NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
CombiningChar | Extender [5] Name ::= (Letter | '_' | ':')
(NameChar)* [6] Names ::= Name (S Name)* """
ret = libxml2mod.xmlScanName(self._o)
return ret
def skipBlankChars(self):
"""skip all blanks character found at that point in the input
streams. It pops up finished entities in the process if
allowable at that point. """
ret = libxml2mod.xmlSkipBlankChars(self._o)
return ret
def stringDecodeEntities(self, str, what, end, end2, end3):
"""Takes a entity string content and process to do the
adequate substitutions. [67] Reference ::= EntityRef |
CharRef [69] PEReference ::= '%' Name ';' """
ret = libxml2mod.xmlStringDecodeEntities(self._o, str, what, end, end2, end3)
return ret
def stringLenDecodeEntities(self, str, len, what, end, end2, end3):
"""Takes a entity string content and process to do the
adequate substitutions. [67] Reference ::= EntityRef |
CharRef [69] PEReference ::= '%' Name ';' """
ret = libxml2mod.xmlStringLenDecodeEntities(self._o, str, len, what, end, end2, end3)
return ret
class xmlAttr(xmlNode):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlAttr got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlAttr (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlAttr functions from module debugXML
#
def debugDumpAttr(self, output, depth):
"""Dumps debug information for the attribute """
libxml2mod.xmlDebugDumpAttr(output, self._o, depth)
def debugDumpAttrList(self, output, depth):
"""Dumps debug information for the attribute list """
libxml2mod.xmlDebugDumpAttrList(output, self._o, depth)
#
# xmlAttr functions from module tree
#
def copyProp(self, target):
"""Do a copy of the attribute. """
if target is None: target__o = None
else: target__o = target._o
ret = libxml2mod.xmlCopyProp(target__o, self._o)
if ret is None:raise treeError('xmlCopyProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def copyPropList(self, target):
"""Do a copy of an attribute list. """
if target is None: target__o = None
else: target__o = target._o
ret = libxml2mod.xmlCopyPropList(target__o, self._o)
if ret is None:raise treeError('xmlCopyPropList() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def freeProp(self):
"""Free one attribute, all the content is freed too """
libxml2mod.xmlFreeProp(self._o)
def freePropList(self):
"""Free a property and all its siblings, all the children are
freed too. """
libxml2mod.xmlFreePropList(self._o)
def removeProp(self):
"""Unlink and free one attribute, all the content is freed too
Note this doesn't work for namespace definition attributes """
ret = libxml2mod.xmlRemoveProp(self._o)
return ret
#
# xmlAttr functions from module valid
#
def removeID(self, doc):
"""Remove the given attribute from the ID table maintained
internally. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlRemoveID(doc__o, self._o)
return ret
def removeRef(self, doc):
"""Remove the given attribute from the Ref table maintained
internally. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlRemoveRef(doc__o, self._o)
return ret
class xmlAttribute(xmlNode):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlAttribute got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlAttribute (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
class catalog:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeCatalog(self._o)
self._o = None
#
# catalog functions from module catalog
#
def add(self, type, orig, replace):
"""Add an entry in the catalog, it may overwrite existing but
different entries. """
ret = libxml2mod.xmlACatalogAdd(self._o, type, orig, replace)
return ret
def catalogIsEmpty(self):
"""Check is a catalog is empty """
ret = libxml2mod.xmlCatalogIsEmpty(self._o)
return ret
def convertSGMLCatalog(self):
"""Convert all the SGML catalog entries as XML ones """
ret = libxml2mod.xmlConvertSGMLCatalog(self._o)
return ret
def dump(self, out):
"""Dump the given catalog to the given file. """
libxml2mod.xmlACatalogDump(self._o, out)
def remove(self, value):
"""Remove an entry from the catalog """
ret = libxml2mod.xmlACatalogRemove(self._o, value)
return ret
def resolve(self, pubID, sysID):
"""Do a complete resolution lookup of an External Identifier """
ret = libxml2mod.xmlACatalogResolve(self._o, pubID, sysID)
return ret
def resolvePublic(self, pubID):
"""Try to lookup the catalog local reference associated to a
public ID in that catalog """
ret = libxml2mod.xmlACatalogResolvePublic(self._o, pubID)
return ret
def resolveSystem(self, sysID):
"""Try to lookup the catalog resource for a system ID """
ret = libxml2mod.xmlACatalogResolveSystem(self._o, sysID)
return ret
def resolveURI(self, URI):
"""Do a complete resolution lookup of an URI """
ret = libxml2mod.xmlACatalogResolveURI(self._o, URI)
return ret
class xmlDtd(xmlNode):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlDtd got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlDtd (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlDtd functions from module debugXML
#
def debugDumpDTD(self, output):
"""Dumps debug information for the DTD """
libxml2mod.xmlDebugDumpDTD(output, self._o)
#
# xmlDtd functions from module tree
#
def copyDtd(self):
"""Do a copy of the dtd. """
ret = libxml2mod.xmlCopyDtd(self._o)
if ret is None:raise treeError('xmlCopyDtd() failed')
__tmp = xmlDtd(_obj=ret)
return __tmp
def freeDtd(self):
"""Free a DTD structure. """
libxml2mod.xmlFreeDtd(self._o)
#
# xmlDtd functions from module valid
#
def dtdAttrDesc(self, elem, name):
"""Search the DTD for the description of this attribute on
this element. """
ret = libxml2mod.xmlGetDtdAttrDesc(self._o, elem, name)
if ret is None:raise treeError('xmlGetDtdAttrDesc() failed')
__tmp = xmlAttribute(_obj=ret)
return __tmp
def dtdElementDesc(self, name):
"""Search the DTD for the description of this element """
ret = libxml2mod.xmlGetDtdElementDesc(self._o, name)
if ret is None:raise treeError('xmlGetDtdElementDesc() failed')
__tmp = xmlElement(_obj=ret)
return __tmp
def dtdQAttrDesc(self, elem, name, prefix):
"""Search the DTD for the description of this qualified
attribute on this element. """
ret = libxml2mod.xmlGetDtdQAttrDesc(self._o, elem, name, prefix)
if ret is None:raise treeError('xmlGetDtdQAttrDesc() failed')
__tmp = xmlAttribute(_obj=ret)
return __tmp
def dtdQElementDesc(self, name, prefix):
"""Search the DTD for the description of this element """
ret = libxml2mod.xmlGetDtdQElementDesc(self._o, name, prefix)
if ret is None:raise treeError('xmlGetDtdQElementDesc() failed')
__tmp = xmlElement(_obj=ret)
return __tmp
class xmlElement(xmlNode):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlElement got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlElement (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
class xmlEntity(xmlNode):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlEntity got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlEntity (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlEntity functions from module parserInternals
#
def handleEntity(self, ctxt):
"""Default handling of defined entities, when should we define
a new input stream ? When do we just handle that as a set
of chars ? OBSOLETE: to be removed at some point. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
libxml2mod.xmlHandleEntity(ctxt__o, self._o)
class Error:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
# accessors for Error
def code(self):
"""The error code, e.g. an xmlParserError """
ret = libxml2mod.xmlErrorGetCode(self._o)
return ret
def domain(self):
"""What part of the library raised this error """
ret = libxml2mod.xmlErrorGetDomain(self._o)
return ret
def file(self):
"""the filename """
ret = libxml2mod.xmlErrorGetFile(self._o)
return ret
def level(self):
"""how consequent is the error """
ret = libxml2mod.xmlErrorGetLevel(self._o)
return ret
def line(self):
"""the line number if available """
ret = libxml2mod.xmlErrorGetLine(self._o)
return ret
def message(self):
"""human-readable informative error message """
ret = libxml2mod.xmlErrorGetMessage(self._o)
return ret
#
# Error functions from module xmlerror
#
def copyError(self, to):
"""Save the original error to the new place. """
if to is None: to__o = None
else: to__o = to._o
ret = libxml2mod.xmlCopyError(self._o, to__o)
return ret
def resetError(self):
"""Cleanup the error. """
libxml2mod.xmlResetError(self._o)
class xmlNs(xmlNode):
def __init__(self, _obj=None):
if checkWrapper(_obj) != 0: raise TypeError('xmlNs got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
return "<xmlNs (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlNs functions from module tree
#
def copyNamespace(self):
"""Do a copy of the namespace. """
ret = libxml2mod.xmlCopyNamespace(self._o)
if ret is None:raise treeError('xmlCopyNamespace() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def copyNamespaceList(self):
"""Do a copy of an namespace list. """
ret = libxml2mod.xmlCopyNamespaceList(self._o)
if ret is None:raise treeError('xmlCopyNamespaceList() failed')
__tmp = xmlNs(_obj=ret)
return __tmp
def freeNs(self):
"""Free up the structures associated to a namespace """
libxml2mod.xmlFreeNs(self._o)
def freeNsList(self):
"""Free up all the structures associated to the chained
namespaces. """
libxml2mod.xmlFreeNsList(self._o)
def newChild(self, parent, name, content):
"""Creation of a new child element, added at the end of
@parent children list. @ns and @content parameters are
optional (None). If @ns is None, the newly created element
inherits the namespace of @parent. If @content is non None,
a child list containing the TEXTs and ENTITY_REFs node will
be created. NOTE: @content is supposed to be a piece of XML
CDATA, so it allows entity references. XML special chars
must be escaped first by using
xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should
be used. """
if parent is None: parent__o = None
else: parent__o = parent._o
ret = libxml2mod.xmlNewChild(parent__o, self._o, name, content)
if ret is None:raise treeError('xmlNewChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocNode(self, doc, name, content):
"""Creation of a new node element within a document. @ns and
@content are optional (None). NOTE: @content is supposed to
be a piece of XML CDATA, so it allow entities references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
don't need entities support. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlNewDocNode(doc__o, self._o, name, content)
if ret is None:raise treeError('xmlNewDocNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocNodeEatName(self, doc, name, content):
"""Creation of a new node element within a document. @ns and
@content are optional (None). NOTE: @content is supposed to
be a piece of XML CDATA, so it allow entities references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
don't need entities support. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlNewDocNodeEatName(doc__o, self._o, name, content)
if ret is None:raise treeError('xmlNewDocNodeEatName() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newDocRawNode(self, doc, name, content):
"""Creation of a new node element within a document. @ns and
@content are optional (None). """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlNewDocRawNode(doc__o, self._o, name, content)
if ret is None:raise treeError('xmlNewDocRawNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newNodeEatName(self, name):
"""Creation of a new node element. @ns is optional (None). """
ret = libxml2mod.xmlNewNodeEatName(self._o, name)
if ret is None:raise treeError('xmlNewNodeEatName() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def newNsProp(self, node, name, value):
"""Create a new property tagged with a namespace and carried
by a node. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlNewNsProp(node__o, self._o, name, value)
if ret is None:raise treeError('xmlNewNsProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def newNsPropEatName(self, node, name, value):
"""Create a new property tagged with a namespace and carried
by a node. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlNewNsPropEatName(node__o, self._o, name, value)
if ret is None:raise treeError('xmlNewNsPropEatName() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def newTextChild(self, parent, name, content):
"""Creation of a new child element, added at the end of
@parent children list. @ns and @content parameters are
optional (None). If @ns is None, the newly created element
inherits the namespace of @parent. If @content is non None,
a child TEXT node will be created containing the string
@content. NOTE: Use xmlNewChild() if @content will contain
entities that need to be preserved. Use this function,
xmlNewTextChild(), if you need to ensure that reserved XML
chars that might appear in @content, such as the ampersand,
greater-than or less-than signs, are automatically replaced
by their XML escaped entity representations. """
if parent is None: parent__o = None
else: parent__o = parent._o
ret = libxml2mod.xmlNewTextChild(parent__o, self._o, name, content)
if ret is None:raise treeError('xmlNewTextChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def setNs(self, node):
"""Associate a namespace to a node, a posteriori. """
if node is None: node__o = None
else: node__o = node._o
libxml2mod.xmlSetNs(node__o, self._o)
def setNsProp(self, node, name, value):
"""Set (or reset) an attribute carried by a node. The ns
structure must be in scope, this is not checked """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlSetNsProp(node__o, self._o, name, value)
if ret is None:raise treeError('xmlSetNsProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp
def unsetNsProp(self, node, name):
"""Remove an attribute carried by a node. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlUnsetNsProp(node__o, self._o, name)
return ret
#
# xmlNs functions from module xpathInternals
#
def xpathNodeSetFreeNs(self):
"""Namespace nodes in libxml don't match the XPath semantic.
In a node set the namespace nodes are duplicated and the
next pointer is set to the parent node in the XPath
semantic. Check if such a node needs to be freed """
libxml2mod.xmlXPathNodeSetFreeNs(self._o)
class outputBuffer(ioWriteWrapper):
def __init__(self, _obj=None):
self._o = _obj
ioWriteWrapper.__init__(self, _obj=_obj)
#
# outputBuffer functions from module HTMLtree
#
def htmlDocContentDumpFormatOutput(self, cur, encoding, format):
"""Dump an HTML document. """
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlDocContentDumpFormatOutput(self._o, cur__o, encoding, format)
def htmlDocContentDumpOutput(self, cur, encoding):
"""Dump an HTML document. Formating return/spaces are added. """
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlDocContentDumpOutput(self._o, cur__o, encoding)
def htmlNodeDumpFormatOutput(self, doc, cur, encoding, format):
"""Dump an HTML node, recursive behaviour,children are printed
too. """
if doc is None: doc__o = None
else: doc__o = doc._o
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlNodeDumpFormatOutput(self._o, doc__o, cur__o, encoding, format)
def htmlNodeDumpOutput(self, doc, cur, encoding):
"""Dump an HTML node, recursive behaviour,children are printed
too, and formatting returns/spaces are added. """
if doc is None: doc__o = None
else: doc__o = doc._o
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlNodeDumpOutput(self._o, doc__o, cur__o, encoding)
#
# outputBuffer functions from module tree
#
def nodeDumpOutput(self, doc, cur, level, format, encoding):
"""Dump an XML node, recursive behaviour, children are printed
too. Note that @format = 1 provide node indenting only if
xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
called """
if doc is None: doc__o = None
else: doc__o = doc._o
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.xmlNodeDumpOutput(self._o, doc__o, cur__o, level, format, encoding)
def saveFileTo(self, cur, encoding):
"""Dump an XML document to an I/O buffer. Warning ! This call
xmlOutputBufferClose() on buf which is not available after
this call. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlSaveFileTo(self._o, cur__o, encoding)
return ret
def saveFormatFileTo(self, cur, encoding, format):
"""Dump an XML document to an I/O buffer. Warning ! This call
xmlOutputBufferClose() on buf which is not available after
this call. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlSaveFormatFileTo(self._o, cur__o, encoding, format)
return ret
#
# outputBuffer functions from module xmlIO
#
def getContent(self):
"""Gives a pointer to the data currently held in the output
buffer """
ret = libxml2mod.xmlOutputBufferGetContent(self._o)
return ret
def write(self, len, buf):
"""Write the content of the array in the output I/O buffer
This routine handle the I18N transcoding from internal
UTF-8 The buffer is lossless, i.e. will store in case of
partial or delayed writes. """
ret = libxml2mod.xmlOutputBufferWrite(self._o, len, buf)
return ret
def writeString(self, str):
"""Write the content of the string in the output I/O buffer
This routine handle the I18N transcoding from internal
UTF-8 The buffer is lossless, i.e. will store in case of
partial or delayed writes. """
ret = libxml2mod.xmlOutputBufferWriteString(self._o, str)
return ret
class inputBuffer(ioReadWrapper):
def __init__(self, _obj=None):
self._o = _obj
ioReadWrapper.__init__(self, _obj=_obj)
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeParserInputBuffer(self._o)
self._o = None
#
# inputBuffer functions from module xmlIO
#
def grow(self, len):
"""Grow up the content of the input buffer, the old data are
preserved This routine handle the I18N transcoding to
internal UTF-8 This routine is used when operating the
parser in normal (pull) mode TODO: one should be able to
remove one extra copy by copying directly onto in->buffer
or in->raw """
ret = libxml2mod.xmlParserInputBufferGrow(self._o, len)
return ret
def push(self, len, buf):
"""Push the content of the arry in the input buffer This
routine handle the I18N transcoding to internal UTF-8 This
is used when operating the parser in progressive (push)
mode. """
ret = libxml2mod.xmlParserInputBufferPush(self._o, len, buf)
return ret
def read(self, len):
"""Refresh the content of the input buffer, the old data are
considered consumed This routine handle the I18N
transcoding to internal UTF-8 """
ret = libxml2mod.xmlParserInputBufferRead(self._o, len)
return ret
#
# inputBuffer functions from module xmlreader
#
def Setup(self, reader, URL, encoding, options):
"""Setup an XML reader with new options """
if reader is None: reader__o = None
else: reader__o = reader._o
ret = libxml2mod.xmlTextReaderSetup(reader__o, self._o, URL, encoding, options)
return ret
def newTextReader(self, URI):
"""Create an xmlTextReader structure fed with @input """
ret = libxml2mod.xmlNewTextReader(self._o, URI)
if ret is None:raise treeError('xmlNewTextReader() failed')
__tmp = xmlTextReader(_obj=ret)
__tmp.input = self
return __tmp
class xmlReg:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlRegFreeRegexp(self._o)
self._o = None
#
# xmlReg functions from module xmlregexp
#
def regexpExec(self, content):
"""Check if the regular expression generates the value """
ret = libxml2mod.xmlRegexpExec(self._o, content)
return ret
def regexpIsDeterminist(self):
"""Check if the regular expression is determinist """
ret = libxml2mod.xmlRegexpIsDeterminist(self._o)
return ret
def regexpPrint(self, output):
"""Print the content of the compiled regular expression """
libxml2mod.xmlRegexpPrint(output, self._o)
class relaxNgParserCtxt:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlRelaxNGFreeParserCtxt(self._o)
self._o = None
#
# relaxNgParserCtxt functions from module relaxng
#
def relaxNGParse(self):
"""parse a schema definition resource and build an internal
XML Shema struture which can be used to validate instances. """
ret = libxml2mod.xmlRelaxNGParse(self._o)
if ret is None:raise parserError('xmlRelaxNGParse() failed')
__tmp = relaxNgSchema(_obj=ret)
return __tmp
def relaxParserSetFlag(self, flags):
"""Semi private function used to pass informations to a parser
context which are a combination of xmlRelaxNGParserFlag . """
ret = libxml2mod.xmlRelaxParserSetFlag(self._o, flags)
return ret
class relaxNgSchema:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlRelaxNGFree(self._o)
self._o = None
#
# relaxNgSchema functions from module relaxng
#
def relaxNGDump(self, output):
"""Dump a RelaxNG structure back """
libxml2mod.xmlRelaxNGDump(output, self._o)
def relaxNGDumpTree(self, output):
"""Dump the transformed RelaxNG tree. """
libxml2mod.xmlRelaxNGDumpTree(output, self._o)
def relaxNGNewValidCtxt(self):
"""Create an XML RelaxNGs validation context based on the
given schema """
ret = libxml2mod.xmlRelaxNGNewValidCtxt(self._o)
if ret is None:raise treeError('xmlRelaxNGNewValidCtxt() failed')
__tmp = relaxNgValidCtxt(_obj=ret)
__tmp.schema = self
return __tmp
#
# relaxNgSchema functions from module xmlreader
#
def RelaxNGSetSchema(self, reader):
"""Use RelaxNG to validate the document as it is processed.
Activation is only possible before the first Read(). if
@schema is None, then RelaxNG validation is desactivated. @
The @schema should not be freed until the reader is
deallocated or its use has been deactivated. """
if reader is None: reader__o = None
else: reader__o = reader._o
ret = libxml2mod.xmlTextReaderRelaxNGSetSchema(reader__o, self._o)
return ret
class relaxNgValidCtxt(relaxNgValidCtxtCore):
def __init__(self, _obj=None):
self.schema = None
self._o = _obj
relaxNgValidCtxtCore.__init__(self, _obj=_obj)
def __del__(self):
if self._o != None:
libxml2mod.xmlRelaxNGFreeValidCtxt(self._o)
self._o = None
#
# relaxNgValidCtxt functions from module relaxng
#
def relaxNGValidateDoc(self, doc):
"""Validate a document tree in memory. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlRelaxNGValidateDoc(self._o, doc__o)
return ret
def relaxNGValidateFullElement(self, doc, elem):
"""Validate a full subtree when
xmlRelaxNGValidatePushElement() returned 0 and the content
of the node has been expanded. """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlRelaxNGValidateFullElement(self._o, doc__o, elem__o)
return ret
def relaxNGValidatePopElement(self, doc, elem):
"""Pop the element end from the RelaxNG validation stack. """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlRelaxNGValidatePopElement(self._o, doc__o, elem__o)
return ret
def relaxNGValidatePushCData(self, data, len):
"""check the CData parsed for validation in the current stack """
ret = libxml2mod.xmlRelaxNGValidatePushCData(self._o, data, len)
return ret
def relaxNGValidatePushElement(self, doc, elem):
"""Push a new element start on the RelaxNG validation stack. """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlRelaxNGValidatePushElement(self._o, doc__o, elem__o)
return ret
#
# relaxNgValidCtxt functions from module xmlreader
#
def RelaxNGValidateCtxt(self, reader, options):
"""Use RelaxNG schema context to validate the document as it
is processed. Activation is only possible before the first
Read(). If @ctxt is None, then RelaxNG schema validation is
deactivated. """
if reader is None: reader__o = None
else: reader__o = reader._o
ret = libxml2mod.xmlTextReaderRelaxNGValidateCtxt(reader__o, self._o, options)
return ret
class SchemaParserCtxt:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlSchemaFreeParserCtxt(self._o)
self._o = None
#
# SchemaParserCtxt functions from module xmlschemas
#
def schemaParse(self):
"""parse a schema definition resource and build an internal
XML Shema struture which can be used to validate instances. """
ret = libxml2mod.xmlSchemaParse(self._o)
if ret is None:raise parserError('xmlSchemaParse() failed')
__tmp = Schema(_obj=ret)
return __tmp
class Schema:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlSchemaFree(self._o)
self._o = None
#
# Schema functions from module xmlreader
#
def SetSchema(self, reader):
"""Use XSD Schema to validate the document as it is processed.
Activation is only possible before the first Read(). if
@schema is None, then Schema validation is desactivated. @
The @schema should not be freed until the reader is
deallocated or its use has been deactivated. """
if reader is None: reader__o = None
else: reader__o = reader._o
ret = libxml2mod.xmlTextReaderSetSchema(reader__o, self._o)
return ret
#
# Schema functions from module xmlschemas
#
def schemaDump(self, output):
"""Dump a Schema structure. """
libxml2mod.xmlSchemaDump(output, self._o)
def schemaNewValidCtxt(self):
"""Create an XML Schemas validation context based on the given
schema. """
ret = libxml2mod.xmlSchemaNewValidCtxt(self._o)
if ret is None:raise treeError('xmlSchemaNewValidCtxt() failed')
__tmp = SchemaValidCtxt(_obj=ret)
__tmp.schema = self
return __tmp
class SchemaValidCtxt(SchemaValidCtxtCore):
def __init__(self, _obj=None):
self.schema = None
self._o = _obj
SchemaValidCtxtCore.__init__(self, _obj=_obj)
def __del__(self):
if self._o != None:
libxml2mod.xmlSchemaFreeValidCtxt(self._o)
self._o = None
#
# SchemaValidCtxt functions from module xmlreader
#
def SchemaValidateCtxt(self, reader, options):
"""Use W3C XSD schema context to validate the document as it
is processed. Activation is only possible before the first
Read(). If @ctxt is None, then XML Schema validation is
deactivated. """
if reader is None: reader__o = None
else: reader__o = reader._o
ret = libxml2mod.xmlTextReaderSchemaValidateCtxt(reader__o, self._o, options)
return ret
#
# SchemaValidCtxt functions from module xmlschemas
#
def schemaIsValid(self):
"""Check if any error was detected during validation. """
ret = libxml2mod.xmlSchemaIsValid(self._o)
return ret
def schemaSetValidOptions(self, options):
"""Sets the options to be used during the validation. """
ret = libxml2mod.xmlSchemaSetValidOptions(self._o, options)
return ret
def schemaValidCtxtGetOptions(self):
"""Get the validation context options. """
ret = libxml2mod.xmlSchemaValidCtxtGetOptions(self._o)
return ret
def schemaValidCtxtGetParserCtxt(self):
"""allow access to the parser context of the schema validation
context """
ret = libxml2mod.xmlSchemaValidCtxtGetParserCtxt(self._o)
if ret is None:raise parserError('xmlSchemaValidCtxtGetParserCtxt() failed')
__tmp = parserCtxt(_obj=ret)
return __tmp
def schemaValidateDoc(self, doc):
"""Validate a document tree in memory. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlSchemaValidateDoc(self._o, doc__o)
return ret
def schemaValidateFile(self, filename, options):
"""Do a schemas validation of the given resource, it will use
the SAX streamable validation internally. """
ret = libxml2mod.xmlSchemaValidateFile(self._o, filename, options)
return ret
def schemaValidateOneElement(self, elem):
"""Validate a branch of a tree, starting with the given @elem. """
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlSchemaValidateOneElement(self._o, elem__o)
return ret
def schemaValidateSetFilename(self, filename):
"""Workaround to provide file error reporting information when
this is not provided by current APIs """
libxml2mod.xmlSchemaValidateSetFilename(self._o, filename)
class xmlTextReaderLocator:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
#
# xmlTextReaderLocator functions from module xmlreader
#
def BaseURI(self):
"""Obtain the base URI for the given locator. """
ret = libxml2mod.xmlTextReaderLocatorBaseURI(self._o)
return ret
def LineNumber(self):
"""Obtain the line number for the given locator. """
ret = libxml2mod.xmlTextReaderLocatorLineNumber(self._o)
return ret
class xmlTextReader(xmlTextReaderCore):
def __init__(self, _obj=None):
self.input = None
self._o = _obj
xmlTextReaderCore.__init__(self, _obj=_obj)
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeTextReader(self._o)
self._o = None
#
# xmlTextReader functions from module xmlreader
#
def AttributeCount(self):
"""Provides the number of attributes of the current node """
ret = libxml2mod.xmlTextReaderAttributeCount(self._o)
return ret
def BaseUri(self):
"""The base URI of the node. """
ret = libxml2mod.xmlTextReaderConstBaseUri(self._o)
return ret
def ByteConsumed(self):
"""This function provides the current index of the parser used
by the reader, relative to the start of the current entity.
This function actually just wraps a call to
xmlBytesConsumed() for the parser context associated with
the reader. See xmlBytesConsumed() for more information. """
ret = libxml2mod.xmlTextReaderByteConsumed(self._o)
return ret
def Close(self):
"""This method releases any resources allocated by the current
instance changes the state to Closed and close any
underlying input. """
ret = libxml2mod.xmlTextReaderClose(self._o)
return ret
def CurrentDoc(self):
"""Hacking interface allowing to get the xmlDocPtr
correponding to the current document being accessed by the
xmlTextReader. NOTE: as a result of this call, the reader
will not destroy the associated XML document and calling
xmlFreeDoc() on the result is needed once the reader
parsing has finished. """
ret = libxml2mod.xmlTextReaderCurrentDoc(self._o)
if ret is None:raise treeError('xmlTextReaderCurrentDoc() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def CurrentNode(self):
"""Hacking interface allowing to get the xmlNodePtr
correponding to the current node being accessed by the
xmlTextReader. This is dangerous because the underlying
node may be destroyed on the next Reads. """
ret = libxml2mod.xmlTextReaderCurrentNode(self._o)
if ret is None:raise treeError('xmlTextReaderCurrentNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def Depth(self):
"""The depth of the node in the tree. """
ret = libxml2mod.xmlTextReaderDepth(self._o)
return ret
def Encoding(self):
"""Determine the encoding of the document being read. """
ret = libxml2mod.xmlTextReaderConstEncoding(self._o)
return ret
def Expand(self):
"""Reads the contents of the current node and the full
subtree. It then makes the subtree available until the next
xmlTextReaderRead() call """
ret = libxml2mod.xmlTextReaderExpand(self._o)
if ret is None:raise treeError('xmlTextReaderExpand() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def GetAttribute(self, name):
"""Provides the value of the attribute with the specified
qualified name. """
ret = libxml2mod.xmlTextReaderGetAttribute(self._o, name)
return ret
def GetAttributeNo(self, no):
"""Provides the value of the attribute with the specified
index relative to the containing element. """
ret = libxml2mod.xmlTextReaderGetAttributeNo(self._o, no)
return ret
def GetAttributeNs(self, localName, namespaceURI):
"""Provides the value of the specified attribute """
ret = libxml2mod.xmlTextReaderGetAttributeNs(self._o, localName, namespaceURI)
return ret
def GetParserColumnNumber(self):
"""Provide the column number of the current parsing point. """
ret = libxml2mod.xmlTextReaderGetParserColumnNumber(self._o)
return ret
def GetParserLineNumber(self):
"""Provide the line number of the current parsing point. """
ret = libxml2mod.xmlTextReaderGetParserLineNumber(self._o)
return ret
def GetParserProp(self, prop):
"""Read the parser internal property. """
ret = libxml2mod.xmlTextReaderGetParserProp(self._o, prop)
return ret
def GetRemainder(self):
"""Method to get the remainder of the buffered XML. this
method stops the parser, set its state to End Of File and
return the input stream with what is left that the parser
did not use. The implementation is not good, the parser
certainly procgressed past what's left in reader->input,
and there is an allocation problem. Best would be to
rewrite it differently. """
ret = libxml2mod.xmlTextReaderGetRemainder(self._o)
if ret is None:raise treeError('xmlTextReaderGetRemainder() failed')
__tmp = inputBuffer(_obj=ret)
return __tmp
def HasAttributes(self):
"""Whether the node has attributes. """
ret = libxml2mod.xmlTextReaderHasAttributes(self._o)
return ret
def HasValue(self):
"""Whether the node can have a text value. """
ret = libxml2mod.xmlTextReaderHasValue(self._o)
return ret
def IsDefault(self):
"""Whether an Attribute node was generated from the default
value defined in the DTD or schema. """
ret = libxml2mod.xmlTextReaderIsDefault(self._o)
return ret
def IsEmptyElement(self):
"""Check if the current node is empty """
ret = libxml2mod.xmlTextReaderIsEmptyElement(self._o)
return ret
def IsNamespaceDecl(self):
"""Determine whether the current node is a namespace
declaration rather than a regular attribute. """
ret = libxml2mod.xmlTextReaderIsNamespaceDecl(self._o)
return ret
def IsValid(self):
"""Retrieve the validity status from the parser context """
ret = libxml2mod.xmlTextReaderIsValid(self._o)
return ret
def LocalName(self):
"""The local name of the node. """
ret = libxml2mod.xmlTextReaderConstLocalName(self._o)
return ret
def LookupNamespace(self, prefix):
"""Resolves a namespace prefix in the scope of the current
element. """
ret = libxml2mod.xmlTextReaderLookupNamespace(self._o, prefix)
return ret
def MoveToAttribute(self, name):
"""Moves the position of the current instance to the attribute
with the specified qualified name. """
ret = libxml2mod.xmlTextReaderMoveToAttribute(self._o, name)
return ret
def MoveToAttributeNo(self, no):
"""Moves the position of the current instance to the attribute
with the specified index relative to the containing element. """
ret = libxml2mod.xmlTextReaderMoveToAttributeNo(self._o, no)
return ret
def MoveToAttributeNs(self, localName, namespaceURI):
"""Moves the position of the current instance to the attribute
with the specified local name and namespace URI. """
ret = libxml2mod.xmlTextReaderMoveToAttributeNs(self._o, localName, namespaceURI)
return ret
def MoveToElement(self):
"""Moves the position of the current instance to the node that
contains the current Attribute node. """
ret = libxml2mod.xmlTextReaderMoveToElement(self._o)
return ret
def MoveToFirstAttribute(self):
"""Moves the position of the current instance to the first
attribute associated with the current node. """
ret = libxml2mod.xmlTextReaderMoveToFirstAttribute(self._o)
return ret
def MoveToNextAttribute(self):
"""Moves the position of the current instance to the next
attribute associated with the current node. """
ret = libxml2mod.xmlTextReaderMoveToNextAttribute(self._o)
return ret
def Name(self):
"""The qualified name of the node, equal to Prefix :LocalName. """
ret = libxml2mod.xmlTextReaderConstName(self._o)
return ret
def NamespaceUri(self):
"""The URI defining the namespace associated with the node. """
ret = libxml2mod.xmlTextReaderConstNamespaceUri(self._o)
return ret
def NewDoc(self, cur, URL, encoding, options):
"""Setup an xmltextReader to parse an XML in-memory document.
The parsing flags @options are a combination of
xmlParserOption. This reuses the existing @reader
xmlTextReader. """
ret = libxml2mod.xmlReaderNewDoc(self._o, cur, URL, encoding, options)
return ret
def NewFd(self, fd, URL, encoding, options):
"""Setup an xmltextReader to parse an XML from a file
descriptor. NOTE that the file descriptor will not be
closed when the reader is closed or reset. The parsing
flags @options are a combination of xmlParserOption. This
reuses the existing @reader xmlTextReader. """
ret = libxml2mod.xmlReaderNewFd(self._o, fd, URL, encoding, options)
return ret
def NewFile(self, filename, encoding, options):
"""parse an XML file from the filesystem or the network. The
parsing flags @options are a combination of
xmlParserOption. This reuses the existing @reader
xmlTextReader. """
ret = libxml2mod.xmlReaderNewFile(self._o, filename, encoding, options)
return ret
def NewMemory(self, buffer, size, URL, encoding, options):
"""Setup an xmltextReader to parse an XML in-memory document.
The parsing flags @options are a combination of
xmlParserOption. This reuses the existing @reader
xmlTextReader. """
ret = libxml2mod.xmlReaderNewMemory(self._o, buffer, size, URL, encoding, options)
return ret
def NewWalker(self, doc):
"""Setup an xmltextReader to parse a preparsed XML document.
This reuses the existing @reader xmlTextReader. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlReaderNewWalker(self._o, doc__o)
return ret
def Next(self):
"""Skip to the node following the current one in document
order while avoiding the subtree if any. """
ret = libxml2mod.xmlTextReaderNext(self._o)
return ret
def NextSibling(self):
"""Skip to the node following the current one in document
order while avoiding the subtree if any. Currently
implemented only for Readers built on a document """
ret = libxml2mod.xmlTextReaderNextSibling(self._o)
return ret
def NodeType(self):
"""Get the node type of the current node Reference:
http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/Xm
lNodeType.html """
ret = libxml2mod.xmlTextReaderNodeType(self._o)
return ret
def Normalization(self):
"""The value indicating whether to normalize white space and
attribute values. Since attribute value and end of line
normalizations are a MUST in the XML specification only the
value true is accepted. The broken bahaviour of accepting
out of range character entities like � is of course not
supported either. """
ret = libxml2mod.xmlTextReaderNormalization(self._o)
return ret
def Prefix(self):
"""A shorthand reference to the namespace associated with the
node. """
ret = libxml2mod.xmlTextReaderConstPrefix(self._o)
return ret
def Preserve(self):
"""This tells the XML Reader to preserve the current node. The
caller must also use xmlTextReaderCurrentDoc() to keep an
handle on the resulting document once parsing has finished """
ret = libxml2mod.xmlTextReaderPreserve(self._o)
if ret is None:raise treeError('xmlTextReaderPreserve() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def QuoteChar(self):
"""The quotation mark character used to enclose the value of
an attribute. """
ret = libxml2mod.xmlTextReaderQuoteChar(self._o)
return ret
def Read(self):
"""Moves the position of the current instance to the next node
in the stream, exposing its properties. """
ret = libxml2mod.xmlTextReaderRead(self._o)
return ret
def ReadAttributeValue(self):
"""Parses an attribute value into one or more Text and
EntityReference nodes. """
ret = libxml2mod.xmlTextReaderReadAttributeValue(self._o)
return ret
def ReadInnerXml(self):
"""Reads the contents of the current node, including child
nodes and markup. """
ret = libxml2mod.xmlTextReaderReadInnerXml(self._o)
return ret
def ReadOuterXml(self):
"""Reads the contents of the current node, including child
nodes and markup. """
ret = libxml2mod.xmlTextReaderReadOuterXml(self._o)
return ret
def ReadState(self):
"""Gets the read state of the reader. """
ret = libxml2mod.xmlTextReaderReadState(self._o)
return ret
def ReadString(self):
"""Reads the contents of an element or a text node as a string. """
ret = libxml2mod.xmlTextReaderReadString(self._o)
return ret
def RelaxNGSetSchema(self, schema):
"""Use RelaxNG to validate the document as it is processed.
Activation is only possible before the first Read(). if
@schema is None, then RelaxNG validation is desactivated. @
The @schema should not be freed until the reader is
deallocated or its use has been deactivated. """
if schema is None: schema__o = None
else: schema__o = schema._o
ret = libxml2mod.xmlTextReaderRelaxNGSetSchema(self._o, schema__o)
return ret
def RelaxNGValidate(self, rng):
"""Use RelaxNG schema to validate the document as it is
processed. Activation is only possible before the first
Read(). If @rng is None, then RelaxNG schema validation is
deactivated. """
ret = libxml2mod.xmlTextReaderRelaxNGValidate(self._o, rng)
return ret
def RelaxNGValidateCtxt(self, ctxt, options):
"""Use RelaxNG schema context to validate the document as it
is processed. Activation is only possible before the first
Read(). If @ctxt is None, then RelaxNG schema validation is
deactivated. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlTextReaderRelaxNGValidateCtxt(self._o, ctxt__o, options)
return ret
def SchemaValidate(self, xsd):
"""Use W3C XSD schema to validate the document as it is
processed. Activation is only possible before the first
Read(). If @xsd is None, then XML Schema validation is
deactivated. """
ret = libxml2mod.xmlTextReaderSchemaValidate(self._o, xsd)
return ret
def SchemaValidateCtxt(self, ctxt, options):
"""Use W3C XSD schema context to validate the document as it
is processed. Activation is only possible before the first
Read(). If @ctxt is None, then XML Schema validation is
deactivated. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.xmlTextReaderSchemaValidateCtxt(self._o, ctxt__o, options)
return ret
def SetParserProp(self, prop, value):
"""Change the parser processing behaviour by changing some of
its internal properties. Note that some properties can only
be changed before any read has been done. """
ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value)
return ret
def SetSchema(self, schema):
"""Use XSD Schema to validate the document as it is processed.
Activation is only possible before the first Read(). if
@schema is None, then Schema validation is desactivated. @
The @schema should not be freed until the reader is
deallocated or its use has been deactivated. """
if schema is None: schema__o = None
else: schema__o = schema._o
ret = libxml2mod.xmlTextReaderSetSchema(self._o, schema__o)
return ret
def Setup(self, input, URL, encoding, options):
"""Setup an XML reader with new options """
if input is None: input__o = None
else: input__o = input._o
ret = libxml2mod.xmlTextReaderSetup(self._o, input__o, URL, encoding, options)
return ret
def Standalone(self):
"""Determine the standalone status of the document being read. """
ret = libxml2mod.xmlTextReaderStandalone(self._o)
return ret
def String(self, str):
"""Get an interned string from the reader, allows for example
to speedup string name comparisons """
ret = libxml2mod.xmlTextReaderConstString(self._o, str)
return ret
def Value(self):
"""Provides the text value of the node if present """
ret = libxml2mod.xmlTextReaderConstValue(self._o)
return ret
def XmlLang(self):
"""The xml:lang scope within which the node resides. """
ret = libxml2mod.xmlTextReaderConstXmlLang(self._o)
return ret
def XmlVersion(self):
"""Determine the XML version of the document being read. """
ret = libxml2mod.xmlTextReaderConstXmlVersion(self._o)
return ret
class URI:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeURI(self._o)
self._o = None
# accessors for URI
def authority(self):
"""Get the authority part from an URI """
ret = libxml2mod.xmlURIGetAuthority(self._o)
return ret
def fragment(self):
"""Get the fragment part from an URI """
ret = libxml2mod.xmlURIGetFragment(self._o)
return ret
def opaque(self):
"""Get the opaque part from an URI """
ret = libxml2mod.xmlURIGetOpaque(self._o)
return ret
def path(self):
"""Get the path part from an URI """
ret = libxml2mod.xmlURIGetPath(self._o)
return ret
def port(self):
"""Get the port part from an URI """
ret = libxml2mod.xmlURIGetPort(self._o)
return ret
def query(self):
"""Get the query part from an URI """
ret = libxml2mod.xmlURIGetQuery(self._o)
return ret
def queryRaw(self):
"""Get the raw query part from an URI (i.e. the unescaped
form). """
ret = libxml2mod.xmlURIGetQueryRaw(self._o)
return ret
def scheme(self):
"""Get the scheme part from an URI """
ret = libxml2mod.xmlURIGetScheme(self._o)
return ret
def server(self):
"""Get the server part from an URI """
ret = libxml2mod.xmlURIGetServer(self._o)
return ret
def setAuthority(self, authority):
"""Set the authority part of an URI. """
libxml2mod.xmlURISetAuthority(self._o, authority)
def setFragment(self, fragment):
"""Set the fragment part of an URI. """
libxml2mod.xmlURISetFragment(self._o, fragment)
def setOpaque(self, opaque):
"""Set the opaque part of an URI. """
libxml2mod.xmlURISetOpaque(self._o, opaque)
def setPath(self, path):
"""Set the path part of an URI. """
libxml2mod.xmlURISetPath(self._o, path)
def setPort(self, port):
"""Set the port part of an URI. """
libxml2mod.xmlURISetPort(self._o, port)
def setQuery(self, query):
"""Set the query part of an URI. """
libxml2mod.xmlURISetQuery(self._o, query)
def setQueryRaw(self, query_raw):
"""Set the raw query part of an URI (i.e. the unescaped form). """
libxml2mod.xmlURISetQueryRaw(self._o, query_raw)
def setScheme(self, scheme):
"""Set the scheme part of an URI. """
libxml2mod.xmlURISetScheme(self._o, scheme)
def setServer(self, server):
"""Set the server part of an URI. """
libxml2mod.xmlURISetServer(self._o, server)
def setUser(self, user):
"""Set the user part of an URI. """
libxml2mod.xmlURISetUser(self._o, user)
def user(self):
"""Get the user part from an URI """
ret = libxml2mod.xmlURIGetUser(self._o)
return ret
#
# URI functions from module uri
#
def parseURIReference(self, str):
"""Parse an URI reference string based on RFC 3986 and fills
in the appropriate fields of the @uri structure
URI-reference = URI / relative-ref """
ret = libxml2mod.xmlParseURIReference(self._o, str)
return ret
def printURI(self, stream):
"""Prints the URI in the stream @stream. """
libxml2mod.xmlPrintURI(stream, self._o)
def saveUri(self):
"""Save the URI as an escaped string """
ret = libxml2mod.xmlSaveUri(self._o)
return ret
class ValidCtxt(ValidCtxtCore):
def __init__(self, _obj=None):
self._o = _obj
ValidCtxtCore.__init__(self, _obj=_obj)
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeValidCtxt(self._o)
self._o = None
#
# ValidCtxt functions from module valid
#
def validCtxtNormalizeAttributeValue(self, doc, elem, name, value):
"""Does the validation related extra step of the normalization
of attribute values: If the declared value is not CDATA,
then the XML processor must further process the normalized
attribute value by discarding any leading and trailing
space (#x20) characters, and by replacing sequences of
space (#x20) characters by single space (#x20) character.
Also check VC: Standalone Document Declaration in P32, and
update ctxt->valid accordingly """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidCtxtNormalizeAttributeValue(self._o, doc__o, elem__o, name, value)
return ret
def validateDocument(self, doc):
"""Try to validate the document instance basically it does
the all the checks described by the XML Rec i.e. validates
the internal and external subset (if present) and validate
the document tree. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlValidateDocument(self._o, doc__o)
return ret
def validateDocumentFinal(self, doc):
"""Does the final step for the document validation once all
the incremental validation steps have been completed
basically it does the following checks described by the XML
Rec Check all the IDREF/IDREFS attributes definition for
validity """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlValidateDocumentFinal(self._o, doc__o)
return ret
def validateDtd(self, doc, dtd):
"""Try to validate the document against the dtd instance
Basically it does check all the definitions in the DtD.
Note the the internal subset (if present) is de-coupled
(i.e. not used), which could give problems if ID or IDREF
is present. """
if doc is None: doc__o = None
else: doc__o = doc._o
if dtd is None: dtd__o = None
else: dtd__o = dtd._o
ret = libxml2mod.xmlValidateDtd(self._o, doc__o, dtd__o)
return ret
def validateDtdFinal(self, doc):
"""Does the final step for the dtds validation once all the
subsets have been parsed basically it does the following
checks described by the XML Rec - check that ENTITY and
ENTITIES type attributes default or possible values matches
one of the defined entities. - check that NOTATION type
attributes default or possible values matches one of the
defined notations. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlValidateDtdFinal(self._o, doc__o)
return ret
def validateElement(self, doc, elem):
"""Try to validate the subtree under an element """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidateElement(self._o, doc__o, elem__o)
return ret
def validateNotationUse(self, doc, notationName):
"""Validate that the given name match a notation declaration.
- [ VC: Notation Declared ] """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlValidateNotationUse(self._o, doc__o, notationName)
return ret
def validateOneAttribute(self, doc, elem, attr, value):
"""Try to validate a single attribute for an element basically
it does the following checks as described by the XML-1.0
recommendation: - [ VC: Attribute Value Type ] - [ VC:
Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC:
Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity
Name ] - [ VC: Notation Attributes ] The ID/IDREF
uniqueness and matching are done separately """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
if attr is None: attr__o = None
else: attr__o = attr._o
ret = libxml2mod.xmlValidateOneAttribute(self._o, doc__o, elem__o, attr__o, value)
return ret
def validateOneElement(self, doc, elem):
"""Try to validate a single element and it's attributes,
basically it does the following checks as described by the
XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC:
Required Attribute ] Then call xmlValidateOneAttribute()
for each attribute present. The ID/IDREF checkings are
done separately """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidateOneElement(self._o, doc__o, elem__o)
return ret
def validateOneNamespace(self, doc, elem, prefix, ns, value):
"""Try to validate a single namespace declaration for an
element basically it does the following checks as described
by the XML-1.0 recommendation: - [ VC: Attribute Value Type
] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] -
[ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC:
Entity Name ] - [ VC: Notation Attributes ] The ID/IDREF
uniqueness and matching are done separately """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
if ns is None: ns__o = None
else: ns__o = ns._o
ret = libxml2mod.xmlValidateOneNamespace(self._o, doc__o, elem__o, prefix, ns__o, value)
return ret
def validatePopElement(self, doc, elem, qname):
"""Pop the element end from the validation stack. """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidatePopElement(self._o, doc__o, elem__o, qname)
return ret
def validatePushCData(self, data, len):
"""check the CData parsed for validation in the current stack """
ret = libxml2mod.xmlValidatePushCData(self._o, data, len)
return ret
def validatePushElement(self, doc, elem, qname):
"""Push a new element start on the validation stack. """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidatePushElement(self._o, doc__o, elem__o, qname)
return ret
def validateRoot(self, doc):
"""Try to validate a the root element basically it does the
following check as described by the XML-1.0 recommendation:
- [ VC: Root Element Type ] it doesn't try to recurse or
apply other check to the element """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlValidateRoot(self._o, doc__o)
return ret
class xpathContext:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
# accessors for xpathContext
def contextDoc(self):
"""Get the doc from an xpathContext """
ret = libxml2mod.xmlXPathGetContextDoc(self._o)
if ret is None:raise xpathError('xmlXPathGetContextDoc() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp
def contextNode(self):
"""Get the current node from an xpathContext """
ret = libxml2mod.xmlXPathGetContextNode(self._o)
if ret is None:raise xpathError('xmlXPathGetContextNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def contextPosition(self):
"""Get the current node from an xpathContext """
ret = libxml2mod.xmlXPathGetContextPosition(self._o)
return ret
def contextSize(self):
"""Get the current node from an xpathContext """
ret = libxml2mod.xmlXPathGetContextSize(self._o)
return ret
def function(self):
"""Get the current function name xpathContext """
ret = libxml2mod.xmlXPathGetFunction(self._o)
return ret
def functionURI(self):
"""Get the current function name URI xpathContext """
ret = libxml2mod.xmlXPathGetFunctionURI(self._o)
return ret
def setContextDoc(self, doc):
"""Set the doc of an xpathContext """
if doc is None: doc__o = None
else: doc__o = doc._o
libxml2mod.xmlXPathSetContextDoc(self._o, doc__o)
def setContextNode(self, node):
"""Set the current node of an xpathContext """
if node is None: node__o = None
else: node__o = node._o
libxml2mod.xmlXPathSetContextNode(self._o, node__o)
#
# xpathContext functions from module python
#
def registerXPathFunction(self, name, ns_uri, f):
"""Register a Python written function to the XPath interpreter """
ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f)
return ret
def xpathRegisterVariable(self, name, ns_uri, value):
"""Register a variable with the XPath context """
ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value)
return ret
#
# xpathContext functions from module xpath
#
def xpathContextSetCache(self, active, value, options):
"""Creates/frees an object cache on the XPath context. If
activates XPath objects (xmlXPathObject) will be cached
internally to be reused. @options: 0: This will set the
XPath object caching: @value: This will set the maximum
number of XPath objects to be cached per slot There are 5
slots for: node-set, string, number, boolean, and misc
objects. Use <0 for the default number (100). Other values
for @options have currently no effect. """
ret = libxml2mod.xmlXPathContextSetCache(self._o, active, value, options)
return ret
def xpathEval(self, str):
"""Evaluate the XPath Location Path in the given context. """
ret = libxml2mod.xmlXPathEval(str, self._o)
if ret is None:raise xpathError('xmlXPathEval() failed')
return xpathObjectRet(ret)
def xpathEvalExpression(self, str):
"""Evaluate the XPath expression in the given context. """
ret = libxml2mod.xmlXPathEvalExpression(str, self._o)
if ret is None:raise xpathError('xmlXPathEvalExpression() failed')
return xpathObjectRet(ret)
def xpathFreeContext(self):
"""Free up an xmlXPathContext """
libxml2mod.xmlXPathFreeContext(self._o)
#
# xpathContext functions from module xpathInternals
#
def xpathNewParserContext(self, str):
"""Create a new xmlXPathParserContext """
ret = libxml2mod.xmlXPathNewParserContext(str, self._o)
if ret is None:raise xpathError('xmlXPathNewParserContext() failed')
__tmp = xpathParserContext(_obj=ret)
return __tmp
def xpathNsLookup(self, prefix):
"""Search in the namespace declaration array of the context
for the given namespace name associated to the given prefix """
ret = libxml2mod.xmlXPathNsLookup(self._o, prefix)
return ret
def xpathRegisterAllFunctions(self):
"""Registers all default XPath functions in this context """
libxml2mod.xmlXPathRegisterAllFunctions(self._o)
def xpathRegisterNs(self, prefix, ns_uri):
"""Register a new namespace. If @ns_uri is None it unregisters
the namespace """
ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri)
return ret
def xpathRegisteredFuncsCleanup(self):
"""Cleanup the XPath context data associated to registered
functions """
libxml2mod.xmlXPathRegisteredFuncsCleanup(self._o)
def xpathRegisteredNsCleanup(self):
"""Cleanup the XPath context data associated to registered
variables """
libxml2mod.xmlXPathRegisteredNsCleanup(self._o)
def xpathRegisteredVariablesCleanup(self):
"""Cleanup the XPath context data associated to registered
variables """
libxml2mod.xmlXPathRegisteredVariablesCleanup(self._o)
def xpathVariableLookup(self, name):
"""Search in the Variable array of the context for the given
variable value. """
ret = libxml2mod.xmlXPathVariableLookup(self._o, name)
if ret is None:raise xpathError('xmlXPathVariableLookup() failed')
return xpathObjectRet(ret)
def xpathVariableLookupNS(self, name, ns_uri):
"""Search in the Variable array of the context for the given
variable value. """
ret = libxml2mod.xmlXPathVariableLookupNS(self._o, name, ns_uri)
if ret is None:raise xpathError('xmlXPathVariableLookupNS() failed')
return xpathObjectRet(ret)
#
# xpathContext functions from module xpointer
#
def xpointerEval(self, str):
"""Evaluate the XPath Location Path in the given context. """
ret = libxml2mod.xmlXPtrEval(str, self._o)
if ret is None:raise treeError('xmlXPtrEval() failed')
return xpathObjectRet(ret)
class xpathParserContext:
def __init__(self, _obj=None):
if _obj != None:self._o = _obj;return
self._o = None
# accessors for xpathParserContext
def context(self):
"""Get the xpathContext from an xpathParserContext """
ret = libxml2mod.xmlXPathParserGetContext(self._o)
if ret is None:raise xpathError('xmlXPathParserGetContext() failed')
__tmp = xpathContext(_obj=ret)
return __tmp
#
# xpathParserContext functions from module xpathInternals
#
def xpathAddValues(self):
"""Implement the add operation on XPath objects: The numeric
operators convert their operands to numbers as if by
calling the number function. """
libxml2mod.xmlXPathAddValues(self._o)
def xpathBooleanFunction(self, nargs):
"""Implement the boolean() XPath function boolean
boolean(object) The boolean function converts its argument
to a boolean as follows: - a number is true if and only if
it is neither positive or negative zero nor NaN - a
node-set is true if and only if it is non-empty - a string
is true if and only if its length is non-zero """
libxml2mod.xmlXPathBooleanFunction(self._o, nargs)
def xpathCeilingFunction(self, nargs):
"""Implement the ceiling() XPath function number
ceiling(number) The ceiling function returns the smallest
(closest to negative infinity) number that is not less than
the argument and that is an integer. """
libxml2mod.xmlXPathCeilingFunction(self._o, nargs)
def xpathCompareValues(self, inf, strict):
"""Implement the compare operation on XPath objects: @arg1 <
@arg2 (1, 1, ... @arg1 <= @arg2 (1, 0, ... @arg1 >
@arg2 (0, 1, ... @arg1 >= @arg2 (0, 0, ... When
neither object to be compared is a node-set and the
operator is <=, <, >=, >, then the objects are compared by
converted both objects to numbers and comparing the numbers
according to IEEE 754. The < comparison will be true if and
only if the first number is less than the second number.
The <= comparison will be true if and only if the first
number is less than or equal to the second number. The >
comparison will be true if and only if the first number is
greater than the second number. The >= comparison will be
true if and only if the first number is greater than or
equal to the second number. """
ret = libxml2mod.xmlXPathCompareValues(self._o, inf, strict)
return ret
def xpathConcatFunction(self, nargs):
"""Implement the concat() XPath function string concat(string,
string, string*) The concat function returns the
concatenation of its arguments. """
libxml2mod.xmlXPathConcatFunction(self._o, nargs)
def xpathContainsFunction(self, nargs):
"""Implement the contains() XPath function boolean
contains(string, string) The contains function returns true
if the first argument string contains the second argument
string, and otherwise returns false. """
libxml2mod.xmlXPathContainsFunction(self._o, nargs)
def xpathCountFunction(self, nargs):
"""Implement the count() XPath function number count(node-set) """
libxml2mod.xmlXPathCountFunction(self._o, nargs)
def xpathDivValues(self):
"""Implement the div operation on XPath objects @arg1 / @arg2:
The numeric operators convert their operands to numbers as
if by calling the number function. """
libxml2mod.xmlXPathDivValues(self._o)
def xpathEqualValues(self):
"""Implement the equal operation on XPath objects content:
@arg1 == @arg2 """
ret = libxml2mod.xmlXPathEqualValues(self._o)
return ret
def xpathErr(self, error):
"""Handle an XPath error """
libxml2mod.xmlXPathErr(self._o, error)
def xpathEvalExpr(self):
"""Parse and evaluate an XPath expression in the given
context, then push the result on the context stack """
libxml2mod.xmlXPathEvalExpr(self._o)
def xpathFalseFunction(self, nargs):
"""Implement the false() XPath function boolean false() """
libxml2mod.xmlXPathFalseFunction(self._o, nargs)
def xpathFloorFunction(self, nargs):
"""Implement the floor() XPath function number floor(number)
The floor function returns the largest (closest to positive
infinity) number that is not greater than the argument and
that is an integer. """
libxml2mod.xmlXPathFloorFunction(self._o, nargs)
def xpathFreeParserContext(self):
"""Free up an xmlXPathParserContext """
libxml2mod.xmlXPathFreeParserContext(self._o)
def xpathIdFunction(self, nargs):
"""Implement the id() XPath function node-set id(object) The
id function selects elements by their unique ID (see [5.2.1
Unique IDs]). When the argument to id is of type node-set,
then the result is the union of the result of applying id
to the string value of each of the nodes in the argument
node-set. When the argument to id is of any other type, the
argument is converted to a string as if by a call to the
string function; the string is split into a
whitespace-separated list of tokens (whitespace is any
sequence of characters matching the production S); the
result is a node-set containing the elements in the same
document as the context node that have a unique ID equal to
any of the tokens in the list. """
libxml2mod.xmlXPathIdFunction(self._o, nargs)
def xpathLangFunction(self, nargs):
"""Implement the lang() XPath function boolean lang(string)
The lang function returns true or false depending on
whether the language of the context node as specified by
xml:lang attributes is the same as or is a sublanguage of
the language specified by the argument string. The language
of the context node is determined by the value of the
xml:lang attribute on the context node, or, if the context
node has no xml:lang attribute, by the value of the
xml:lang attribute on the nearest ancestor of the context
node that has an xml:lang attribute. If there is no such
attribute, then lang """
libxml2mod.xmlXPathLangFunction(self._o, nargs)
def xpathLastFunction(self, nargs):
"""Implement the last() XPath function number last() The last
function returns the number of nodes in the context node
list. """
libxml2mod.xmlXPathLastFunction(self._o, nargs)
def xpathLocalNameFunction(self, nargs):
"""Implement the local-name() XPath function string
local-name(node-set?) The local-name function returns a
string containing the local part of the name of the node in
the argument node-set that is first in document order. If
the node-set is empty or the first node has no name, an
empty string is returned. If the argument is omitted it
defaults to the context node. """
libxml2mod.xmlXPathLocalNameFunction(self._o, nargs)
def xpathModValues(self):
"""Implement the mod operation on XPath objects: @arg1 / @arg2
The numeric operators convert their operands to numbers as
if by calling the number function. """
libxml2mod.xmlXPathModValues(self._o)
def xpathMultValues(self):
"""Implement the multiply operation on XPath objects: The
numeric operators convert their operands to numbers as if
by calling the number function. """
libxml2mod.xmlXPathMultValues(self._o)
def xpathNamespaceURIFunction(self, nargs):
"""Implement the namespace-uri() XPath function string
namespace-uri(node-set?) The namespace-uri function returns
a string containing the namespace URI of the expanded name
of the node in the argument node-set that is first in
document order. If the node-set is empty, the first node
has no name, or the expanded name has no namespace URI, an
empty string is returned. If the argument is omitted it
defaults to the context node. """
libxml2mod.xmlXPathNamespaceURIFunction(self._o, nargs)
def xpathNextAncestor(self, cur):
"""Traversal function for the "ancestor" direction the
ancestor axis contains the ancestors of the context node;
the ancestors of the context node consist of the parent of
context node and the parent's parent and so on; the nodes
are ordered in reverse document order; thus the parent is
the first node on the axis, and the parent's parent is the
second node on the axis """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextAncestor(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextAncestor() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextAncestorOrSelf(self, cur):
"""Traversal function for the "ancestor-or-self" direction he
ancestor-or-self axis contains the context node and
ancestors of the context node in reverse document order;
thus the context node is the first node on the axis, and
the context node's parent the second; parent here is
defined the same as with the parent axis. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextAncestorOrSelf(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextAncestorOrSelf() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextAttribute(self, cur):
"""Traversal function for the "attribute" direction TODO:
support DTD inherited default attributes """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextAttribute(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextChild(self, cur):
"""Traversal function for the "child" direction The child axis
contains the children of the context node in document order. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextChild(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextDescendant(self, cur):
"""Traversal function for the "descendant" direction the
descendant axis contains the descendants of the context
node in document order; a descendant is a child or a child
of a child and so on. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextDescendant(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextDescendant() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextDescendantOrSelf(self, cur):
"""Traversal function for the "descendant-or-self" direction
the descendant-or-self axis contains the context node and
the descendants of the context node in document order; thus
the context node is the first node on the axis, and the
first child of the context node is the second node on the
axis """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextDescendantOrSelf(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextDescendantOrSelf() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextFollowing(self, cur):
"""Traversal function for the "following" direction The
following axis contains all nodes in the same document as
the context node that are after the context node in
document order, excluding any descendants and excluding
attribute nodes and namespace nodes; the nodes are ordered
in document order """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextFollowing(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextFollowing() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextFollowingSibling(self, cur):
"""Traversal function for the "following-sibling" direction
The following-sibling axis contains the following siblings
of the context node in document order. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextFollowingSibling(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextNamespace(self, cur):
"""Traversal function for the "namespace" direction the
namespace axis contains the namespace nodes of the context
node; the order of nodes on this axis is
implementation-defined; the axis will be empty unless the
context node is an element We keep the XML namespace node
at the end of the list. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextNamespace(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextNamespace() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextParent(self, cur):
"""Traversal function for the "parent" direction The parent
axis contains the parent of the context node, if there is
one. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextParent(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextParent() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextPreceding(self, cur):
"""Traversal function for the "preceding" direction the
preceding axis contains all nodes in the same document as
the context node that are before the context node in
document order, excluding any ancestors and excluding
attribute nodes and namespace nodes; the nodes are ordered
in reverse document order """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextPreceding(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextPreceding() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextPrecedingSibling(self, cur):
"""Traversal function for the "preceding-sibling" direction
The preceding-sibling axis contains the preceding siblings
of the context node in reverse document order; the first
preceding sibling is first on the axis; the sibling
preceding that node is the second on the axis and so on. """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextPrecedingSibling(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextPrecedingSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNextSelf(self, cur):
"""Traversal function for the "self" direction The self axis
contains just the context node itself """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlXPathNextSelf(self._o, cur__o)
if ret is None:raise xpathError('xmlXPathNextSelf() failed')
__tmp = xmlNode(_obj=ret)
return __tmp
def xpathNormalizeFunction(self, nargs):
"""Implement the normalize-space() XPath function string
normalize-space(string?) The normalize-space function
returns the argument string with white space normalized by
stripping leading and trailing whitespace and replacing
sequences of whitespace characters by a single space.
Whitespace characters are the same allowed by the S
production in XML. If the argument is omitted, it defaults
to the context node converted to a string, in other words
the value of the context node. """
libxml2mod.xmlXPathNormalizeFunction(self._o, nargs)
def xpathNotEqualValues(self):
"""Implement the equal operation on XPath objects content:
@arg1 == @arg2 """
ret = libxml2mod.xmlXPathNotEqualValues(self._o)
return ret
def xpathNotFunction(self, nargs):
"""Implement the not() XPath function boolean not(boolean) The
not function returns true if its argument is false, and
false otherwise. """
libxml2mod.xmlXPathNotFunction(self._o, nargs)
def xpathNumberFunction(self, nargs):
"""Implement the number() XPath function number number(object?) """
libxml2mod.xmlXPathNumberFunction(self._o, nargs)
def xpathParseNCName(self):
"""parse an XML namespace non qualified name. [NS 3] NCName
::= (Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::=
Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender """
ret = libxml2mod.xmlXPathParseNCName(self._o)
return ret
def xpathParseName(self):
"""parse an XML name [4] NameChar ::= Letter | Digit | '.' |
'-' | '_' | ':' | CombiningChar | Extender [5] Name ::=
(Letter | '_' | ':') (NameChar)* """
ret = libxml2mod.xmlXPathParseName(self._o)
return ret
def xpathPopBoolean(self):
"""Pops a boolean from the stack, handling conversion if
needed. Check error with #xmlXPathCheckError. """
ret = libxml2mod.xmlXPathPopBoolean(self._o)
return ret
def xpathPopNumber(self):
"""Pops a number from the stack, handling conversion if
needed. Check error with #xmlXPathCheckError. """
ret = libxml2mod.xmlXPathPopNumber(self._o)
return ret
def xpathPopString(self):
"""Pops a string from the stack, handling conversion if
needed. Check error with #xmlXPathCheckError. """
ret = libxml2mod.xmlXPathPopString(self._o)
return ret
def xpathPositionFunction(self, nargs):
"""Implement the position() XPath function number position()
The position function returns the position of the context
node in the context node list. The first position is 1, and
so the last position will be equal to last(). """
libxml2mod.xmlXPathPositionFunction(self._o, nargs)
def xpathRoot(self):
"""Initialize the context to the root of the document """
libxml2mod.xmlXPathRoot(self._o)
def xpathRoundFunction(self, nargs):
"""Implement the round() XPath function number round(number)
The round function returns the number that is closest to
the argument and that is an integer. If there are two such
numbers, then the one that is even is returned. """
libxml2mod.xmlXPathRoundFunction(self._o, nargs)
def xpathStartsWithFunction(self, nargs):
"""Implement the starts-with() XPath function boolean
starts-with(string, string) The starts-with function
returns true if the first argument string starts with the
second argument string, and otherwise returns false. """
libxml2mod.xmlXPathStartsWithFunction(self._o, nargs)
def xpathStringFunction(self, nargs):
"""Implement the string() XPath function string
string(object?) The string function converts an object to a
string as follows: - A node-set is converted to a string by
returning the value of the node in the node-set that is
first in document order. If the node-set is empty, an empty
string is returned. - A number is converted to a string as
follows + NaN is converted to the string NaN + positive
zero is converted to the string 0 + negative zero is
converted to the string 0 + positive infinity is converted
to the string Infinity + negative infinity is converted to
the string -Infinity + if the number is an integer, the
number is represented in decimal form as a Number with no
decimal point and no leading zeros, preceded by a minus
sign (-) if the number is negative + otherwise, the number
is represented in decimal form as a Number including a
decimal point with at least one digit before the decimal
point and at least one digit after the decimal point,
preceded by a minus sign (-) if the number is negative;
there must be no leading zeros before the decimal point
apart possibly from the one required digit immediately
before the decimal point; beyond the one required digit
after the decimal point there must be as many, but only as
many, more digits as are needed to uniquely distinguish the
number from all other IEEE 754 numeric values. - The
boolean false value is converted to the string false. The
boolean true value is converted to the string true. If the
argument is omitted, it defaults to a node-set with the
context node as its only member. """
libxml2mod.xmlXPathStringFunction(self._o, nargs)
def xpathStringLengthFunction(self, nargs):
"""Implement the string-length() XPath function number
string-length(string?) The string-length returns the number
of characters in the string (see [3.6 Strings]). If the
argument is omitted, it defaults to the context node
converted to a string, in other words the value of the
context node. """
libxml2mod.xmlXPathStringLengthFunction(self._o, nargs)
def xpathSubValues(self):
"""Implement the subtraction operation on XPath objects: The
numeric operators convert their operands to numbers as if
by calling the number function. """
libxml2mod.xmlXPathSubValues(self._o)
def xpathSubstringAfterFunction(self, nargs):
"""Implement the substring-after() XPath function string
substring-after(string, string) The substring-after
function returns the substring of the first argument string
that follows the first occurrence of the second argument
string in the first argument string, or the empty stringi
if the first argument string does not contain the second
argument string. For example,
substring-after("1999/04/01","/") returns 04/01, and
substring-after("1999/04/01","19") returns 99/04/01. """
libxml2mod.xmlXPathSubstringAfterFunction(self._o, nargs)
def xpathSubstringBeforeFunction(self, nargs):
"""Implement the substring-before() XPath function string
substring-before(string, string) The substring-before
function returns the substring of the first argument string
that precedes the first occurrence of the second argument
string in the first argument string, or the empty string if
the first argument string does not contain the second
argument string. For example,
substring-before("1999/04/01","/") returns 1999. """
libxml2mod.xmlXPathSubstringBeforeFunction(self._o, nargs)
def xpathSubstringFunction(self, nargs):
"""Implement the substring() XPath function string
substring(string, number, number?) The substring function
returns the substring of the first argument starting at the
position specified in the second argument with length
specified in the third argument. For example,
substring("12345",2,3) returns "234". If the third argument
is not specified, it returns the substring starting at the
position specified in the second argument and continuing to
the end of the string. For example, substring("12345",2)
returns "2345". More precisely, each character in the
string (see [3.6 Strings]) is considered to have a numeric
position: the position of the first character is 1, the
position of the second character is 2 and so on. The
returned substring contains those characters for which the
position of the character is greater than or equal to the
second argument and, if the third argument is specified,
less than the sum of the second and third arguments; the
comparisons and addition used for the above follow the
standard IEEE 754 rules. Thus: - substring("12345", 1.5,
2.6) returns "234" - substring("12345", 0, 3) returns "12"
- substring("12345", 0 div 0, 3) returns "" -
substring("12345", 1, 0 div 0) returns "" -
substring("12345", -42, 1 div 0) returns "12345" -
substring("12345", -1 div 0, 1 div 0) returns "" """
libxml2mod.xmlXPathSubstringFunction(self._o, nargs)
def xpathSumFunction(self, nargs):
"""Implement the sum() XPath function number sum(node-set) The
sum function returns the sum of the values of the nodes in
the argument node-set. """
libxml2mod.xmlXPathSumFunction(self._o, nargs)
def xpathTranslateFunction(self, nargs):
"""Implement the translate() XPath function string
translate(string, string, string) The translate function
returns the first argument string with occurrences of
characters in the second argument string replaced by the
character at the corresponding position in the third
argument string. For example, translate("bar","abc","ABC")
returns the string BAr. If there is a character in the
second argument string with no character at a corresponding
position in the third argument string (because the second
argument string is longer than the third argument string),
then occurrences of that character in the first argument
string are removed. For example,
translate("--aaa--","abc-","ABC") """
libxml2mod.xmlXPathTranslateFunction(self._o, nargs)
def xpathTrueFunction(self, nargs):
"""Implement the true() XPath function boolean true() """
libxml2mod.xmlXPathTrueFunction(self._o, nargs)
def xpathValueFlipSign(self):
"""Implement the unary - operation on an XPath object The
numeric operators convert their operands to numbers as if
by calling the number function. """
libxml2mod.xmlXPathValueFlipSign(self._o)
def xpatherror(self, file, line, no):
"""Formats an error message. """
libxml2mod.xmlXPatherror(self._o, file, line, no)
#
# xpathParserContext functions from module xpointer
#
def xpointerEvalRangePredicate(self):
"""[8] Predicate ::= '[' PredicateExpr ']' [9]
PredicateExpr ::= Expr Evaluate a predicate as in
xmlXPathEvalPredicate() but for a Location Set instead of a
node set """
libxml2mod.xmlXPtrEvalRangePredicate(self._o)
def xpointerRangeToFunction(self, nargs):
"""Implement the range-to() XPointer function """
libxml2mod.xmlXPtrRangeToFunction(self._o, nargs)
# xlinkShow
XLINK_SHOW_NONE = 0
XLINK_SHOW_NEW = 1
XLINK_SHOW_EMBED = 2
XLINK_SHOW_REPLACE = 3
# xmlRelaxNGParserFlag
XML_RELAXNGP_NONE = 0
XML_RELAXNGP_FREE_DOC = 1
XML_RELAXNGP_CRNG = 2
# xmlBufferAllocationScheme
XML_BUFFER_ALLOC_DOUBLEIT = 1
XML_BUFFER_ALLOC_EXACT = 2
XML_BUFFER_ALLOC_IMMUTABLE = 3
XML_BUFFER_ALLOC_IO = 4
XML_BUFFER_ALLOC_HYBRID = 5
XML_BUFFER_ALLOC_BOUNDED = 6
# xmlParserSeverities
XML_PARSER_SEVERITY_VALIDITY_WARNING = 1
XML_PARSER_SEVERITY_VALIDITY_ERROR = 2
XML_PARSER_SEVERITY_WARNING = 3
XML_PARSER_SEVERITY_ERROR = 4
# xmlAttributeDefault
XML_ATTRIBUTE_NONE = 1
XML_ATTRIBUTE_REQUIRED = 2
XML_ATTRIBUTE_IMPLIED = 3
XML_ATTRIBUTE_FIXED = 4
# xmlSchemaValType
XML_SCHEMAS_UNKNOWN = 0
XML_SCHEMAS_STRING = 1
XML_SCHEMAS_NORMSTRING = 2
XML_SCHEMAS_DECIMAL = 3
XML_SCHEMAS_TIME = 4
XML_SCHEMAS_GDAY = 5
XML_SCHEMAS_GMONTH = 6
XML_SCHEMAS_GMONTHDAY = 7
XML_SCHEMAS_GYEAR = 8
XML_SCHEMAS_GYEARMONTH = 9
XML_SCHEMAS_DATE = 10
XML_SCHEMAS_DATETIME = 11
XML_SCHEMAS_DURATION = 12
XML_SCHEMAS_FLOAT = 13
XML_SCHEMAS_DOUBLE = 14
XML_SCHEMAS_BOOLEAN = 15
XML_SCHEMAS_TOKEN = 16
XML_SCHEMAS_LANGUAGE = 17
XML_SCHEMAS_NMTOKEN = 18
XML_SCHEMAS_NMTOKENS = 19
XML_SCHEMAS_NAME = 20
XML_SCHEMAS_QNAME = 21
XML_SCHEMAS_NCNAME = 22
XML_SCHEMAS_ID = 23
XML_SCHEMAS_IDREF = 24
XML_SCHEMAS_IDREFS = 25
XML_SCHEMAS_ENTITY = 26
XML_SCHEMAS_ENTITIES = 27
XML_SCHEMAS_NOTATION = 28
XML_SCHEMAS_ANYURI = 29
XML_SCHEMAS_INTEGER = 30
XML_SCHEMAS_NPINTEGER = 31
XML_SCHEMAS_NINTEGER = 32
XML_SCHEMAS_NNINTEGER = 33
XML_SCHEMAS_PINTEGER = 34
XML_SCHEMAS_INT = 35
XML_SCHEMAS_UINT = 36
XML_SCHEMAS_LONG = 37
XML_SCHEMAS_ULONG = 38
XML_SCHEMAS_SHORT = 39
XML_SCHEMAS_USHORT = 40
XML_SCHEMAS_BYTE = 41
XML_SCHEMAS_UBYTE = 42
XML_SCHEMAS_HEXBINARY = 43
XML_SCHEMAS_BASE64BINARY = 44
XML_SCHEMAS_ANYTYPE = 45
XML_SCHEMAS_ANYSIMPLETYPE = 46
# xmlParserInputState
XML_PARSER_EOF = -1
XML_PARSER_START = 0
XML_PARSER_MISC = 1
XML_PARSER_PI = 2
XML_PARSER_DTD = 3
XML_PARSER_PROLOG = 4
XML_PARSER_COMMENT = 5
XML_PARSER_START_TAG = 6
XML_PARSER_CONTENT = 7
XML_PARSER_CDATA_SECTION = 8
XML_PARSER_END_TAG = 9
XML_PARSER_ENTITY_DECL = 10
XML_PARSER_ENTITY_VALUE = 11
XML_PARSER_ATTRIBUTE_VALUE = 12
XML_PARSER_SYSTEM_LITERAL = 13
XML_PARSER_EPILOG = 14
XML_PARSER_IGNORE = 15
XML_PARSER_PUBLIC_LITERAL = 16
# xmlEntityType
XML_INTERNAL_GENERAL_ENTITY = 1
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3
XML_INTERNAL_PARAMETER_ENTITY = 4
XML_EXTERNAL_PARAMETER_ENTITY = 5
XML_INTERNAL_PREDEFINED_ENTITY = 6
# xmlSaveOption
XML_SAVE_FORMAT = 1
XML_SAVE_NO_DECL = 2
XML_SAVE_NO_EMPTY = 4
XML_SAVE_NO_XHTML = 8
XML_SAVE_XHTML = 16
XML_SAVE_AS_XML = 32
XML_SAVE_AS_HTML = 64
XML_SAVE_WSNONSIG = 128
# xmlPatternFlags
XML_PATTERN_DEFAULT = 0
XML_PATTERN_XPATH = 1
XML_PATTERN_XSSEL = 2
XML_PATTERN_XSFIELD = 4
# xmlParserErrors
XML_ERR_OK = 0
XML_ERR_INTERNAL_ERROR = 1
XML_ERR_NO_MEMORY = 2
XML_ERR_DOCUMENT_START = 3
XML_ERR_DOCUMENT_EMPTY = 4
XML_ERR_DOCUMENT_END = 5
XML_ERR_INVALID_HEX_CHARREF = 6
XML_ERR_INVALID_DEC_CHARREF = 7
XML_ERR_INVALID_CHARREF = 8
XML_ERR_INVALID_CHAR = 9
XML_ERR_CHARREF_AT_EOF = 10
XML_ERR_CHARREF_IN_PROLOG = 11
XML_ERR_CHARREF_IN_EPILOG = 12
XML_ERR_CHARREF_IN_DTD = 13
XML_ERR_ENTITYREF_AT_EOF = 14
XML_ERR_ENTITYREF_IN_PROLOG = 15
XML_ERR_ENTITYREF_IN_EPILOG = 16
XML_ERR_ENTITYREF_IN_DTD = 17
XML_ERR_PEREF_AT_EOF = 18
XML_ERR_PEREF_IN_PROLOG = 19
XML_ERR_PEREF_IN_EPILOG = 20
XML_ERR_PEREF_IN_INT_SUBSET = 21
XML_ERR_ENTITYREF_NO_NAME = 22
XML_ERR_ENTITYREF_SEMICOL_MISSING = 23
XML_ERR_PEREF_NO_NAME = 24
XML_ERR_PEREF_SEMICOL_MISSING = 25
XML_ERR_UNDECLARED_ENTITY = 26
XML_WAR_UNDECLARED_ENTITY = 27
XML_ERR_UNPARSED_ENTITY = 28
XML_ERR_ENTITY_IS_EXTERNAL = 29
XML_ERR_ENTITY_IS_PARAMETER = 30
XML_ERR_UNKNOWN_ENCODING = 31
XML_ERR_UNSUPPORTED_ENCODING = 32
XML_ERR_STRING_NOT_STARTED = 33
XML_ERR_STRING_NOT_CLOSED = 34
XML_ERR_NS_DECL_ERROR = 35
XML_ERR_ENTITY_NOT_STARTED = 36
XML_ERR_ENTITY_NOT_FINISHED = 37
XML_ERR_LT_IN_ATTRIBUTE = 38
XML_ERR_ATTRIBUTE_NOT_STARTED = 39
XML_ERR_ATTRIBUTE_NOT_FINISHED = 40
XML_ERR_ATTRIBUTE_WITHOUT_VALUE = 41
XML_ERR_ATTRIBUTE_REDEFINED = 42
XML_ERR_LITERAL_NOT_STARTED = 43
XML_ERR_LITERAL_NOT_FINISHED = 44
XML_ERR_COMMENT_NOT_FINISHED = 45
XML_ERR_PI_NOT_STARTED = 46
XML_ERR_PI_NOT_FINISHED = 47
XML_ERR_NOTATION_NOT_STARTED = 48
XML_ERR_NOTATION_NOT_FINISHED = 49
XML_ERR_ATTLIST_NOT_STARTED = 50
XML_ERR_ATTLIST_NOT_FINISHED = 51
XML_ERR_MIXED_NOT_STARTED = 52
XML_ERR_MIXED_NOT_FINISHED = 53
XML_ERR_ELEMCONTENT_NOT_STARTED = 54
XML_ERR_ELEMCONTENT_NOT_FINISHED = 55
XML_ERR_XMLDECL_NOT_STARTED = 56
XML_ERR_XMLDECL_NOT_FINISHED = 57
XML_ERR_CONDSEC_NOT_STARTED = 58
XML_ERR_CONDSEC_NOT_FINISHED = 59
XML_ERR_EXT_SUBSET_NOT_FINISHED = 60
XML_ERR_DOCTYPE_NOT_FINISHED = 61
XML_ERR_MISPLACED_CDATA_END = 62
XML_ERR_CDATA_NOT_FINISHED = 63
XML_ERR_RESERVED_XML_NAME = 64
XML_ERR_SPACE_REQUIRED = 65
XML_ERR_SEPARATOR_REQUIRED = 66
XML_ERR_NMTOKEN_REQUIRED = 67
XML_ERR_NAME_REQUIRED = 68
XML_ERR_PCDATA_REQUIRED = 69
XML_ERR_URI_REQUIRED = 70
XML_ERR_PUBID_REQUIRED = 71
XML_ERR_LT_REQUIRED = 72
XML_ERR_GT_REQUIRED = 73
XML_ERR_LTSLASH_REQUIRED = 74
XML_ERR_EQUAL_REQUIRED = 75
XML_ERR_TAG_NAME_MISMATCH = 76
XML_ERR_TAG_NOT_FINISHED = 77
XML_ERR_STANDALONE_VALUE = 78
XML_ERR_ENCODING_NAME = 79
XML_ERR_HYPHEN_IN_COMMENT = 80
XML_ERR_INVALID_ENCODING = 81
XML_ERR_EXT_ENTITY_STANDALONE = 82
XML_ERR_CONDSEC_INVALID = 83
XML_ERR_VALUE_REQUIRED = 84
XML_ERR_NOT_WELL_BALANCED = 85
XML_ERR_EXTRA_CONTENT = 86
XML_ERR_ENTITY_CHAR_ERROR = 87
XML_ERR_ENTITY_PE_INTERNAL = 88
XML_ERR_ENTITY_LOOP = 89
XML_ERR_ENTITY_BOUNDARY = 90
XML_ERR_INVALID_URI = 91
XML_ERR_URI_FRAGMENT = 92
XML_WAR_CATALOG_PI = 93
XML_ERR_NO_DTD = 94
XML_ERR_CONDSEC_INVALID_KEYWORD = 95
XML_ERR_VERSION_MISSING = 96
XML_WAR_UNKNOWN_VERSION = 97
XML_WAR_LANG_VALUE = 98
XML_WAR_NS_URI = 99
XML_WAR_NS_URI_RELATIVE = 100
XML_ERR_MISSING_ENCODING = 101
XML_WAR_SPACE_VALUE = 102
XML_ERR_NOT_STANDALONE = 103
XML_ERR_ENTITY_PROCESSING = 104
XML_ERR_NOTATION_PROCESSING = 105
XML_WAR_NS_COLUMN = 106
XML_WAR_ENTITY_REDEFINED = 107
XML_ERR_UNKNOWN_VERSION = 108
XML_ERR_VERSION_MISMATCH = 109
XML_ERR_NAME_TOO_LONG = 110
XML_ERR_USER_STOP = 111
XML_NS_ERR_XML_NAMESPACE = 200
XML_NS_ERR_UNDEFINED_NAMESPACE = 201
XML_NS_ERR_QNAME = 202
XML_NS_ERR_ATTRIBUTE_REDEFINED = 203
XML_NS_ERR_EMPTY = 204
XML_NS_ERR_COLON = 205
XML_DTD_ATTRIBUTE_DEFAULT = 500
XML_DTD_ATTRIBUTE_REDEFINED = 501
XML_DTD_ATTRIBUTE_VALUE = 502
XML_DTD_CONTENT_ERROR = 503
XML_DTD_CONTENT_MODEL = 504
XML_DTD_CONTENT_NOT_DETERMINIST = 505
XML_DTD_DIFFERENT_PREFIX = 506
XML_DTD_ELEM_DEFAULT_NAMESPACE = 507
XML_DTD_ELEM_NAMESPACE = 508
XML_DTD_ELEM_REDEFINED = 509
XML_DTD_EMPTY_NOTATION = 510
XML_DTD_ENTITY_TYPE = 511
XML_DTD_ID_FIXED = 512
XML_DTD_ID_REDEFINED = 513
XML_DTD_ID_SUBSET = 514
XML_DTD_INVALID_CHILD = 515
XML_DTD_INVALID_DEFAULT = 516
XML_DTD_LOAD_ERROR = 517
XML_DTD_MISSING_ATTRIBUTE = 518
XML_DTD_MIXED_CORRUPT = 519
XML_DTD_MULTIPLE_ID = 520
XML_DTD_NO_DOC = 521
XML_DTD_NO_DTD = 522
XML_DTD_NO_ELEM_NAME = 523
XML_DTD_NO_PREFIX = 524
XML_DTD_NO_ROOT = 525
XML_DTD_NOTATION_REDEFINED = 526
XML_DTD_NOTATION_VALUE = 527
XML_DTD_NOT_EMPTY = 528
XML_DTD_NOT_PCDATA = 529
XML_DTD_NOT_STANDALONE = 530
XML_DTD_ROOT_NAME = 531
XML_DTD_STANDALONE_WHITE_SPACE = 532
XML_DTD_UNKNOWN_ATTRIBUTE = 533
XML_DTD_UNKNOWN_ELEM = 534
XML_DTD_UNKNOWN_ENTITY = 535
XML_DTD_UNKNOWN_ID = 536
XML_DTD_UNKNOWN_NOTATION = 537
XML_DTD_STANDALONE_DEFAULTED = 538
XML_DTD_XMLID_VALUE = 539
XML_DTD_XMLID_TYPE = 540
XML_DTD_DUP_TOKEN = 541
XML_HTML_STRUCURE_ERROR = 800
XML_HTML_UNKNOWN_TAG = 801
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000
XML_RNGP_ATTR_CONFLICT = 1001
XML_RNGP_ATTRIBUTE_CHILDREN = 1002
XML_RNGP_ATTRIBUTE_CONTENT = 1003
XML_RNGP_ATTRIBUTE_EMPTY = 1004
XML_RNGP_ATTRIBUTE_NOOP = 1005
XML_RNGP_CHOICE_CONTENT = 1006
XML_RNGP_CHOICE_EMPTY = 1007
XML_RNGP_CREATE_FAILURE = 1008
XML_RNGP_DATA_CONTENT = 1009
XML_RNGP_DEF_CHOICE_AND_INTERLEAVE = 1010
XML_RNGP_DEFINE_CREATE_FAILED = 1011
XML_RNGP_DEFINE_EMPTY = 1012
XML_RNGP_DEFINE_MISSING = 1013
XML_RNGP_DEFINE_NAME_MISSING = 1014
XML_RNGP_ELEM_CONTENT_EMPTY = 1015
XML_RNGP_ELEM_CONTENT_ERROR = 1016
XML_RNGP_ELEMENT_EMPTY = 1017
XML_RNGP_ELEMENT_CONTENT = 1018
XML_RNGP_ELEMENT_NAME = 1019
XML_RNGP_ELEMENT_NO_CONTENT = 1020
XML_RNGP_ELEM_TEXT_CONFLICT = 1021
XML_RNGP_EMPTY = 1022
XML_RNGP_EMPTY_CONSTRUCT = 1023
XML_RNGP_EMPTY_CONTENT = 1024
XML_RNGP_EMPTY_NOT_EMPTY = 1025
XML_RNGP_ERROR_TYPE_LIB = 1026
XML_RNGP_EXCEPT_EMPTY = 1027
XML_RNGP_EXCEPT_MISSING = 1028
XML_RNGP_EXCEPT_MULTIPLE = 1029
XML_RNGP_EXCEPT_NO_CONTENT = 1030
XML_RNGP_EXTERNALREF_EMTPY = 1031
XML_RNGP_EXTERNAL_REF_FAILURE = 1032
XML_RNGP_EXTERNALREF_RECURSE = 1033
XML_RNGP_FORBIDDEN_ATTRIBUTE = 1034
XML_RNGP_FOREIGN_ELEMENT = 1035
XML_RNGP_GRAMMAR_CONTENT = 1036
XML_RNGP_GRAMMAR_EMPTY = 1037
XML_RNGP_GRAMMAR_MISSING = 1038
XML_RNGP_GRAMMAR_NO_START = 1039
XML_RNGP_GROUP_ATTR_CONFLICT = 1040
XML_RNGP_HREF_ERROR = 1041
XML_RNGP_INCLUDE_EMPTY = 1042
XML_RNGP_INCLUDE_FAILURE = 1043
XML_RNGP_INCLUDE_RECURSE = 1044
XML_RNGP_INTERLEAVE_ADD = 1045
XML_RNGP_INTERLEAVE_CREATE_FAILED = 1046
XML_RNGP_INTERLEAVE_EMPTY = 1047
XML_RNGP_INTERLEAVE_NO_CONTENT = 1048
XML_RNGP_INVALID_DEFINE_NAME = 1049
XML_RNGP_INVALID_URI = 1050
XML_RNGP_INVALID_VALUE = 1051
XML_RNGP_MISSING_HREF = 1052
XML_RNGP_NAME_MISSING = 1053
XML_RNGP_NEED_COMBINE = 1054
XML_RNGP_NOTALLOWED_NOT_EMPTY = 1055
XML_RNGP_NSNAME_ATTR_ANCESTOR = 1056
XML_RNGP_NSNAME_NO_NS = 1057
XML_RNGP_PARAM_FORBIDDEN = 1058
XML_RNGP_PARAM_NAME_MISSING = 1059
XML_RNGP_PARENTREF_CREATE_FAILED = 1060
XML_RNGP_PARENTREF_NAME_INVALID = 1061
XML_RNGP_PARENTREF_NO_NAME = 1062
XML_RNGP_PARENTREF_NO_PARENT = 1063
XML_RNGP_PARENTREF_NOT_EMPTY = 1064
XML_RNGP_PARSE_ERROR = 1065
XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME = 1066
XML_RNGP_PAT_ATTR_ATTR = 1067
XML_RNGP_PAT_ATTR_ELEM = 1068
XML_RNGP_PAT_DATA_EXCEPT_ATTR = 1069
XML_RNGP_PAT_DATA_EXCEPT_ELEM = 1070
XML_RNGP_PAT_DATA_EXCEPT_EMPTY = 1071
XML_RNGP_PAT_DATA_EXCEPT_GROUP = 1072
XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE = 1073
XML_RNGP_PAT_DATA_EXCEPT_LIST = 1074
XML_RNGP_PAT_DATA_EXCEPT_ONEMORE = 1075
XML_RNGP_PAT_DATA_EXCEPT_REF = 1076
XML_RNGP_PAT_DATA_EXCEPT_TEXT = 1077
XML_RNGP_PAT_LIST_ATTR = 1078
XML_RNGP_PAT_LIST_ELEM = 1079
XML_RNGP_PAT_LIST_INTERLEAVE = 1080
XML_RNGP_PAT_LIST_LIST = 1081
XML_RNGP_PAT_LIST_REF = 1082
XML_RNGP_PAT_LIST_TEXT = 1083
XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME = 1084
XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME = 1085
XML_RNGP_PAT_ONEMORE_GROUP_ATTR = 1086
XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR = 1087
XML_RNGP_PAT_START_ATTR = 1088
XML_RNGP_PAT_START_DATA = 1089
XML_RNGP_PAT_START_EMPTY = 1090
XML_RNGP_PAT_START_GROUP = 1091
XML_RNGP_PAT_START_INTERLEAVE = 1092
XML_RNGP_PAT_START_LIST = 1093
XML_RNGP_PAT_START_ONEMORE = 1094
XML_RNGP_PAT_START_TEXT = 1095
XML_RNGP_PAT_START_VALUE = 1096
XML_RNGP_PREFIX_UNDEFINED = 1097
XML_RNGP_REF_CREATE_FAILED = 1098
XML_RNGP_REF_CYCLE = 1099
XML_RNGP_REF_NAME_INVALID = 1100
XML_RNGP_REF_NO_DEF = 1101
XML_RNGP_REF_NO_NAME = 1102
XML_RNGP_REF_NOT_EMPTY = 1103
XML_RNGP_START_CHOICE_AND_INTERLEAVE = 1104
XML_RNGP_START_CONTENT = 1105
XML_RNGP_START_EMPTY = 1106
XML_RNGP_START_MISSING = 1107
XML_RNGP_TEXT_EXPECTED = 1108
XML_RNGP_TEXT_HAS_CHILD = 1109
XML_RNGP_TYPE_MISSING = 1110
XML_RNGP_TYPE_NOT_FOUND = 1111
XML_RNGP_TYPE_VALUE = 1112
XML_RNGP_UNKNOWN_ATTRIBUTE = 1113
XML_RNGP_UNKNOWN_COMBINE = 1114
XML_RNGP_UNKNOWN_CONSTRUCT = 1115
XML_RNGP_UNKNOWN_TYPE_LIB = 1116
XML_RNGP_URI_FRAGMENT = 1117
XML_RNGP_URI_NOT_ABSOLUTE = 1118
XML_RNGP_VALUE_EMPTY = 1119
XML_RNGP_VALUE_NO_CONTENT = 1120
XML_RNGP_XMLNS_NAME = 1121
XML_RNGP_XML_NS = 1122
XML_XPATH_EXPRESSION_OK = 1200
XML_XPATH_NUMBER_ERROR = 1201
XML_XPATH_UNFINISHED_LITERAL_ERROR = 1202
XML_XPATH_START_LITERAL_ERROR = 1203
XML_XPATH_VARIABLE_REF_ERROR = 1204
XML_XPATH_UNDEF_VARIABLE_ERROR = 1205
XML_XPATH_INVALID_PREDICATE_ERROR = 1206
XML_XPATH_EXPR_ERROR = 1207
XML_XPATH_UNCLOSED_ERROR = 1208
XML_XPATH_UNKNOWN_FUNC_ERROR = 1209
XML_XPATH_INVALID_OPERAND = 1210
XML_XPATH_INVALID_TYPE = 1211
XML_XPATH_INVALID_ARITY = 1212
XML_XPATH_INVALID_CTXT_SIZE = 1213
XML_XPATH_INVALID_CTXT_POSITION = 1214
XML_XPATH_MEMORY_ERROR = 1215
XML_XPTR_SYNTAX_ERROR = 1216
XML_XPTR_RESOURCE_ERROR = 1217
XML_XPTR_SUB_RESOURCE_ERROR = 1218
XML_XPATH_UNDEF_PREFIX_ERROR = 1219
XML_XPATH_ENCODING_ERROR = 1220
XML_XPATH_INVALID_CHAR_ERROR = 1221
XML_TREE_INVALID_HEX = 1300
XML_TREE_INVALID_DEC = 1301
XML_TREE_UNTERMINATED_ENTITY = 1302
XML_TREE_NOT_UTF8 = 1303
XML_SAVE_NOT_UTF8 = 1400
XML_SAVE_CHAR_INVALID = 1401
XML_SAVE_NO_DOCTYPE = 1402
XML_SAVE_UNKNOWN_ENCODING = 1403
XML_REGEXP_COMPILE_ERROR = 1450
XML_IO_UNKNOWN = 1500
XML_IO_EACCES = 1501
XML_IO_EAGAIN = 1502
XML_IO_EBADF = 1503
XML_IO_EBADMSG = 1504
XML_IO_EBUSY = 1505
XML_IO_ECANCELED = 1506
XML_IO_ECHILD = 1507
XML_IO_EDEADLK = 1508
XML_IO_EDOM = 1509
XML_IO_EEXIST = 1510
XML_IO_EFAULT = 1511
XML_IO_EFBIG = 1512
XML_IO_EINPROGRESS = 1513
XML_IO_EINTR = 1514
XML_IO_EINVAL = 1515
XML_IO_EIO = 1516
XML_IO_EISDIR = 1517
XML_IO_EMFILE = 1518
XML_IO_EMLINK = 1519
XML_IO_EMSGSIZE = 1520
XML_IO_ENAMETOOLONG = 1521
XML_IO_ENFILE = 1522
XML_IO_ENODEV = 1523
XML_IO_ENOENT = 1524
XML_IO_ENOEXEC = 1525
XML_IO_ENOLCK = 1526
XML_IO_ENOMEM = 1527
XML_IO_ENOSPC = 1528
XML_IO_ENOSYS = 1529
XML_IO_ENOTDIR = 1530
XML_IO_ENOTEMPTY = 1531
XML_IO_ENOTSUP = 1532
XML_IO_ENOTTY = 1533
XML_IO_ENXIO = 1534
XML_IO_EPERM = 1535
XML_IO_EPIPE = 1536
XML_IO_ERANGE = 1537
XML_IO_EROFS = 1538
XML_IO_ESPIPE = 1539
XML_IO_ESRCH = 1540
XML_IO_ETIMEDOUT = 1541
XML_IO_EXDEV = 1542
XML_IO_NETWORK_ATTEMPT = 1543
XML_IO_ENCODER = 1544
XML_IO_FLUSH = 1545
XML_IO_WRITE = 1546
XML_IO_NO_INPUT = 1547
XML_IO_BUFFER_FULL = 1548
XML_IO_LOAD_ERROR = 1549
XML_IO_ENOTSOCK = 1550
XML_IO_EISCONN = 1551
XML_IO_ECONNREFUSED = 1552
XML_IO_ENETUNREACH = 1553
XML_IO_EADDRINUSE = 1554
XML_IO_EALREADY = 1555
XML_IO_EAFNOSUPPORT = 1556
XML_XINCLUDE_RECURSION = 1600
XML_XINCLUDE_PARSE_VALUE = 1601
XML_XINCLUDE_ENTITY_DEF_MISMATCH = 1602
XML_XINCLUDE_NO_HREF = 1603
XML_XINCLUDE_NO_FALLBACK = 1604
XML_XINCLUDE_HREF_URI = 1605
XML_XINCLUDE_TEXT_FRAGMENT = 1606
XML_XINCLUDE_TEXT_DOCUMENT = 1607
XML_XINCLUDE_INVALID_CHAR = 1608
XML_XINCLUDE_BUILD_FAILED = 1609
XML_XINCLUDE_UNKNOWN_ENCODING = 1610
XML_XINCLUDE_MULTIPLE_ROOT = 1611
XML_XINCLUDE_XPTR_FAILED = 1612
XML_XINCLUDE_XPTR_RESULT = 1613
XML_XINCLUDE_INCLUDE_IN_INCLUDE = 1614
XML_XINCLUDE_FALLBACKS_IN_INCLUDE = 1615
XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE = 1616
XML_XINCLUDE_DEPRECATED_NS = 1617
XML_XINCLUDE_FRAGMENT_ID = 1618
XML_CATALOG_MISSING_ATTR = 1650
XML_CATALOG_ENTRY_BROKEN = 1651
XML_CATALOG_PREFER_VALUE = 1652
XML_CATALOG_NOT_CATALOG = 1653
XML_CATALOG_RECURSION = 1654
XML_SCHEMAP_PREFIX_UNDEFINED = 1700
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE = 1701
XML_SCHEMAP_ATTRGRP_NONAME_NOREF = 1702
XML_SCHEMAP_ATTR_NONAME_NOREF = 1703
XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF = 1704
XML_SCHEMAP_ELEMFORMDEFAULT_VALUE = 1705
XML_SCHEMAP_ELEM_NONAME_NOREF = 1706
XML_SCHEMAP_EXTENSION_NO_BASE = 1707
XML_SCHEMAP_FACET_NO_VALUE = 1708
XML_SCHEMAP_FAILED_BUILD_IMPORT = 1709
XML_SCHEMAP_GROUP_NONAME_NOREF = 1710
XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI = 1711
XML_SCHEMAP_IMPORT_REDEFINE_NSNAME = 1712
XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI = 1713
XML_SCHEMAP_INVALID_BOOLEAN = 1714
XML_SCHEMAP_INVALID_ENUM = 1715
XML_SCHEMAP_INVALID_FACET = 1716
XML_SCHEMAP_INVALID_FACET_VALUE = 1717
XML_SCHEMAP_INVALID_MAXOCCURS = 1718
XML_SCHEMAP_INVALID_MINOCCURS = 1719
XML_SCHEMAP_INVALID_REF_AND_SUBTYPE = 1720
XML_SCHEMAP_INVALID_WHITE_SPACE = 1721
XML_SCHEMAP_NOATTR_NOREF = 1722
XML_SCHEMAP_NOTATION_NO_NAME = 1723
XML_SCHEMAP_NOTYPE_NOREF = 1724
XML_SCHEMAP_REF_AND_SUBTYPE = 1725
XML_SCHEMAP_RESTRICTION_NONAME_NOREF = 1726
XML_SCHEMAP_SIMPLETYPE_NONAME = 1727
XML_SCHEMAP_TYPE_AND_SUBTYPE = 1728
XML_SCHEMAP_UNKNOWN_ALL_CHILD = 1729
XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD = 1730
XML_SCHEMAP_UNKNOWN_ATTR_CHILD = 1731
XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD = 1732
XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP = 1733
XML_SCHEMAP_UNKNOWN_BASE_TYPE = 1734
XML_SCHEMAP_UNKNOWN_CHOICE_CHILD = 1735
XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD = 1736
XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD = 1737
XML_SCHEMAP_UNKNOWN_ELEM_CHILD = 1738
XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD = 1739
XML_SCHEMAP_UNKNOWN_FACET_CHILD = 1740
XML_SCHEMAP_UNKNOWN_FACET_TYPE = 1741
XML_SCHEMAP_UNKNOWN_GROUP_CHILD = 1742
XML_SCHEMAP_UNKNOWN_IMPORT_CHILD = 1743
XML_SCHEMAP_UNKNOWN_LIST_CHILD = 1744
XML_SCHEMAP_UNKNOWN_NOTATION_CHILD = 1745
XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD = 1746
XML_SCHEMAP_UNKNOWN_REF = 1747
XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD = 1748
XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD = 1749
XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD = 1750
XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD = 1751
XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD = 1752
XML_SCHEMAP_UNKNOWN_TYPE = 1753
XML_SCHEMAP_UNKNOWN_UNION_CHILD = 1754
XML_SCHEMAP_ELEM_DEFAULT_FIXED = 1755
XML_SCHEMAP_REGEXP_INVALID = 1756
XML_SCHEMAP_FAILED_LOAD = 1757
XML_SCHEMAP_NOTHING_TO_PARSE = 1758
XML_SCHEMAP_NOROOT = 1759
XML_SCHEMAP_REDEFINED_GROUP = 1760
XML_SCHEMAP_REDEFINED_TYPE = 1761
XML_SCHEMAP_REDEFINED_ELEMENT = 1762
XML_SCHEMAP_REDEFINED_ATTRGROUP = 1763
XML_SCHEMAP_REDEFINED_ATTR = 1764
XML_SCHEMAP_REDEFINED_NOTATION = 1765
XML_SCHEMAP_FAILED_PARSE = 1766
XML_SCHEMAP_UNKNOWN_PREFIX = 1767
XML_SCHEMAP_DEF_AND_PREFIX = 1768
XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD = 1769
XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI = 1770
XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI = 1771
XML_SCHEMAP_NOT_SCHEMA = 1772
XML_SCHEMAP_UNKNOWN_MEMBER_TYPE = 1773
XML_SCHEMAP_INVALID_ATTR_USE = 1774
XML_SCHEMAP_RECURSIVE = 1775
XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE = 1776
XML_SCHEMAP_INVALID_ATTR_COMBINATION = 1777
XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION = 1778
XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD = 1779
XML_SCHEMAP_INVALID_ATTR_NAME = 1780
XML_SCHEMAP_REF_AND_CONTENT = 1781
XML_SCHEMAP_CT_PROPS_CORRECT_1 = 1782
XML_SCHEMAP_CT_PROPS_CORRECT_2 = 1783
XML_SCHEMAP_CT_PROPS_CORRECT_3 = 1784
XML_SCHEMAP_CT_PROPS_CORRECT_4 = 1785
XML_SCHEMAP_CT_PROPS_CORRECT_5 = 1786
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1 = 1787
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1 = 1788
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2 = 1789
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2 = 1790
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3 = 1791
XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER = 1792
XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE = 1793
XML_SCHEMAP_UNION_NOT_EXPRESSIBLE = 1794
XML_SCHEMAP_SRC_IMPORT_3_1 = 1795
XML_SCHEMAP_SRC_IMPORT_3_2 = 1796
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1 = 1797
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2 = 1798
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3 = 1799
XML_SCHEMAP_COS_CT_EXTENDS_1_3 = 1800
XML_SCHEMAV_NOROOT = 1801
XML_SCHEMAV_UNDECLAREDELEM = 1802
XML_SCHEMAV_NOTTOPLEVEL = 1803
XML_SCHEMAV_MISSING = 1804
XML_SCHEMAV_WRONGELEM = 1805
XML_SCHEMAV_NOTYPE = 1806
XML_SCHEMAV_NOROLLBACK = 1807
XML_SCHEMAV_ISABSTRACT = 1808
XML_SCHEMAV_NOTEMPTY = 1809
XML_SCHEMAV_ELEMCONT = 1810
XML_SCHEMAV_HAVEDEFAULT = 1811
XML_SCHEMAV_NOTNILLABLE = 1812
XML_SCHEMAV_EXTRACONTENT = 1813
XML_SCHEMAV_INVALIDATTR = 1814
XML_SCHEMAV_INVALIDELEM = 1815
XML_SCHEMAV_NOTDETERMINIST = 1816
XML_SCHEMAV_CONSTRUCT = 1817
XML_SCHEMAV_INTERNAL = 1818
XML_SCHEMAV_NOTSIMPLE = 1819
XML_SCHEMAV_ATTRUNKNOWN = 1820
XML_SCHEMAV_ATTRINVALID = 1821
XML_SCHEMAV_VALUE = 1822
XML_SCHEMAV_FACET = 1823
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1 = 1824
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2 = 1825
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3 = 1826
XML_SCHEMAV_CVC_TYPE_3_1_1 = 1827
XML_SCHEMAV_CVC_TYPE_3_1_2 = 1828
XML_SCHEMAV_CVC_FACET_VALID = 1829
XML_SCHEMAV_CVC_LENGTH_VALID = 1830
XML_SCHEMAV_CVC_MINLENGTH_VALID = 1831
XML_SCHEMAV_CVC_MAXLENGTH_VALID = 1832
XML_SCHEMAV_CVC_MININCLUSIVE_VALID = 1833
XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID = 1834
XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID = 1835
XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID = 1836
XML_SCHEMAV_CVC_TOTALDIGITS_VALID = 1837
XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID = 1838
XML_SCHEMAV_CVC_PATTERN_VALID = 1839
XML_SCHEMAV_CVC_ENUMERATION_VALID = 1840
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1 = 1841
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2 = 1842
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3 = 1843
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4 = 1844
XML_SCHEMAV_CVC_ELT_1 = 1845
XML_SCHEMAV_CVC_ELT_2 = 1846
XML_SCHEMAV_CVC_ELT_3_1 = 1847
XML_SCHEMAV_CVC_ELT_3_2_1 = 1848
XML_SCHEMAV_CVC_ELT_3_2_2 = 1849
XML_SCHEMAV_CVC_ELT_4_1 = 1850
XML_SCHEMAV_CVC_ELT_4_2 = 1851
XML_SCHEMAV_CVC_ELT_4_3 = 1852
XML_SCHEMAV_CVC_ELT_5_1_1 = 1853
XML_SCHEMAV_CVC_ELT_5_1_2 = 1854
XML_SCHEMAV_CVC_ELT_5_2_1 = 1855
XML_SCHEMAV_CVC_ELT_5_2_2_1 = 1856
XML_SCHEMAV_CVC_ELT_5_2_2_2_1 = 1857
XML_SCHEMAV_CVC_ELT_5_2_2_2_2 = 1858
XML_SCHEMAV_CVC_ELT_6 = 1859
XML_SCHEMAV_CVC_ELT_7 = 1860
XML_SCHEMAV_CVC_ATTRIBUTE_1 = 1861
XML_SCHEMAV_CVC_ATTRIBUTE_2 = 1862
XML_SCHEMAV_CVC_ATTRIBUTE_3 = 1863
XML_SCHEMAV_CVC_ATTRIBUTE_4 = 1864
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1 = 1865
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1 = 1866
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2 = 1867
XML_SCHEMAV_CVC_COMPLEX_TYPE_4 = 1868
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1 = 1869
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2 = 1870
XML_SCHEMAV_ELEMENT_CONTENT = 1871
XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING = 1872
XML_SCHEMAV_CVC_COMPLEX_TYPE_1 = 1873
XML_SCHEMAV_CVC_AU = 1874
XML_SCHEMAV_CVC_TYPE_1 = 1875
XML_SCHEMAV_CVC_TYPE_2 = 1876
XML_SCHEMAV_CVC_IDC = 1877
XML_SCHEMAV_CVC_WILDCARD = 1878
XML_SCHEMAV_MISC = 1879
XML_XPTR_UNKNOWN_SCHEME = 1900
XML_XPTR_CHILDSEQ_START = 1901
XML_XPTR_EVAL_FAILED = 1902
XML_XPTR_EXTRA_OBJECTS = 1903
XML_C14N_CREATE_CTXT = 1950
XML_C14N_REQUIRES_UTF8 = 1951
XML_C14N_CREATE_STACK = 1952
XML_C14N_INVALID_NODE = 1953
XML_C14N_UNKNOW_NODE = 1954
XML_C14N_RELATIVE_NAMESPACE = 1955
XML_FTP_PASV_ANSWER = 2000
XML_FTP_EPSV_ANSWER = 2001
XML_FTP_ACCNT = 2002
XML_FTP_URL_SYNTAX = 2003
XML_HTTP_URL_SYNTAX = 2020
XML_HTTP_USE_IP = 2021
XML_HTTP_UNKNOWN_HOST = 2022
XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000
XML_SCHEMAP_SRC_SIMPLE_TYPE_2 = 3001
XML_SCHEMAP_SRC_SIMPLE_TYPE_3 = 3002
XML_SCHEMAP_SRC_SIMPLE_TYPE_4 = 3003
XML_SCHEMAP_SRC_RESOLVE = 3004
XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE = 3005
XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE = 3006
XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES = 3007
XML_SCHEMAP_ST_PROPS_CORRECT_1 = 3008
XML_SCHEMAP_ST_PROPS_CORRECT_2 = 3009
XML_SCHEMAP_ST_PROPS_CORRECT_3 = 3010
XML_SCHEMAP_COS_ST_RESTRICTS_1_1 = 3011
XML_SCHEMAP_COS_ST_RESTRICTS_1_2 = 3012
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1 = 3013
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2 = 3014
XML_SCHEMAP_COS_ST_RESTRICTS_2_1 = 3015
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1 = 3016
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2 = 3017
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1 = 3018
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2 = 3019
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3 = 3020
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4 = 3021
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5 = 3022
XML_SCHEMAP_COS_ST_RESTRICTS_3_1 = 3023
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1 = 3024
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2 = 3025
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2 = 3026
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1 = 3027
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3 = 3028
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4 = 3029
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5 = 3030
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1 = 3031
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2 = 3032
XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED = 3033
XML_SCHEMAP_S4S_ELEM_MISSING = 3034
XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED = 3035
XML_SCHEMAP_S4S_ATTR_MISSING = 3036
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE = 3037
XML_SCHEMAP_SRC_ELEMENT_1 = 3038
XML_SCHEMAP_SRC_ELEMENT_2_1 = 3039
XML_SCHEMAP_SRC_ELEMENT_2_2 = 3040
XML_SCHEMAP_SRC_ELEMENT_3 = 3041
XML_SCHEMAP_P_PROPS_CORRECT_1 = 3042
XML_SCHEMAP_P_PROPS_CORRECT_2_1 = 3043
XML_SCHEMAP_P_PROPS_CORRECT_2_2 = 3044
XML_SCHEMAP_E_PROPS_CORRECT_2 = 3045
XML_SCHEMAP_E_PROPS_CORRECT_3 = 3046
XML_SCHEMAP_E_PROPS_CORRECT_4 = 3047
XML_SCHEMAP_E_PROPS_CORRECT_5 = 3048
XML_SCHEMAP_E_PROPS_CORRECT_6 = 3049
XML_SCHEMAP_SRC_INCLUDE = 3050
XML_SCHEMAP_SRC_ATTRIBUTE_1 = 3051
XML_SCHEMAP_SRC_ATTRIBUTE_2 = 3052
XML_SCHEMAP_SRC_ATTRIBUTE_3_1 = 3053
XML_SCHEMAP_SRC_ATTRIBUTE_3_2 = 3054
XML_SCHEMAP_SRC_ATTRIBUTE_4 = 3055
XML_SCHEMAP_NO_XMLNS = 3056
XML_SCHEMAP_NO_XSI = 3057
XML_SCHEMAP_COS_VALID_DEFAULT_1 = 3058
XML_SCHEMAP_COS_VALID_DEFAULT_2_1 = 3059
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1 = 3060
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2 = 3061
XML_SCHEMAP_CVC_SIMPLE_TYPE = 3062
XML_SCHEMAP_COS_CT_EXTENDS_1_1 = 3063
XML_SCHEMAP_SRC_IMPORT_1_1 = 3064
XML_SCHEMAP_SRC_IMPORT_1_2 = 3065
XML_SCHEMAP_SRC_IMPORT_2 = 3066
XML_SCHEMAP_SRC_IMPORT_2_1 = 3067
XML_SCHEMAP_SRC_IMPORT_2_2 = 3068
XML_SCHEMAP_INTERNAL = 3069
XML_SCHEMAP_NOT_DETERMINISTIC = 3070
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1 = 3071
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2 = 3072
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3 = 3073
XML_SCHEMAP_MG_PROPS_CORRECT_1 = 3074
XML_SCHEMAP_MG_PROPS_CORRECT_2 = 3075
XML_SCHEMAP_SRC_CT_1 = 3076
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3 = 3077
XML_SCHEMAP_AU_PROPS_CORRECT_2 = 3078
XML_SCHEMAP_A_PROPS_CORRECT_2 = 3079
XML_SCHEMAP_C_PROPS_CORRECT = 3080
XML_SCHEMAP_SRC_REDEFINE = 3081
XML_SCHEMAP_SRC_IMPORT = 3082
XML_SCHEMAP_WARN_SKIP_SCHEMA = 3083
XML_SCHEMAP_WARN_UNLOCATED_SCHEMA = 3084
XML_SCHEMAP_WARN_ATTR_REDECL_PROH = 3085
XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH = 3086
XML_SCHEMAP_AG_PROPS_CORRECT = 3087
XML_SCHEMAP_COS_CT_EXTENDS_1_2 = 3088
XML_SCHEMAP_AU_PROPS_CORRECT = 3089
XML_SCHEMAP_A_PROPS_CORRECT_3 = 3090
XML_SCHEMAP_COS_ALL_LIMITED = 3091
XML_SCHEMATRONV_ASSERT = 4000
XML_SCHEMATRONV_REPORT = 4001
XML_MODULE_OPEN = 4900
XML_MODULE_CLOSE = 4901
XML_CHECK_FOUND_ELEMENT = 5000
XML_CHECK_FOUND_ATTRIBUTE = 5001
XML_CHECK_FOUND_TEXT = 5002
XML_CHECK_FOUND_CDATA = 5003
XML_CHECK_FOUND_ENTITYREF = 5004
XML_CHECK_FOUND_ENTITY = 5005
XML_CHECK_FOUND_PI = 5006
XML_CHECK_FOUND_COMMENT = 5007
XML_CHECK_FOUND_DOCTYPE = 5008
XML_CHECK_FOUND_FRAGMENT = 5009
XML_CHECK_FOUND_NOTATION = 5010
XML_CHECK_UNKNOWN_NODE = 5011
XML_CHECK_ENTITY_TYPE = 5012
XML_CHECK_NO_PARENT = 5013
XML_CHECK_NO_DOC = 5014
XML_CHECK_NO_NAME = 5015
XML_CHECK_NO_ELEM = 5016
XML_CHECK_WRONG_DOC = 5017
XML_CHECK_NO_PREV = 5018
XML_CHECK_WRONG_PREV = 5019
XML_CHECK_NO_NEXT = 5020
XML_CHECK_WRONG_NEXT = 5021
XML_CHECK_NOT_DTD = 5022
XML_CHECK_NOT_ATTR = 5023
XML_CHECK_NOT_ATTR_DECL = 5024
XML_CHECK_NOT_ELEM_DECL = 5025
XML_CHECK_NOT_ENTITY_DECL = 5026
XML_CHECK_NOT_NS_DECL = 5027
XML_CHECK_NO_HREF = 5028
XML_CHECK_WRONG_PARENT = 5029
XML_CHECK_NS_SCOPE = 5030
XML_CHECK_NS_ANCESTOR = 5031
XML_CHECK_NOT_UTF8 = 5032
XML_CHECK_NO_DICT = 5033
XML_CHECK_NOT_NCNAME = 5034
XML_CHECK_OUTSIDE_DICT = 5035
XML_CHECK_WRONG_NAME = 5036
XML_CHECK_NAME_NOT_NULL = 5037
XML_I18N_NO_NAME = 6000
XML_I18N_NO_HANDLER = 6001
XML_I18N_EXCESS_HANDLER = 6002
XML_I18N_CONV_FAILED = 6003
XML_I18N_NO_OUTPUT = 6004
XML_BUF_OVERFLOW = 7000
# xmlExpNodeType
XML_EXP_EMPTY = 0
XML_EXP_FORBID = 1
XML_EXP_ATOM = 2
XML_EXP_SEQ = 3
XML_EXP_OR = 4
XML_EXP_COUNT = 5
# xmlElementContentType
XML_ELEMENT_CONTENT_PCDATA = 1
XML_ELEMENT_CONTENT_ELEMENT = 2
XML_ELEMENT_CONTENT_SEQ = 3
XML_ELEMENT_CONTENT_OR = 4
# xmlParserProperties
XML_PARSER_LOADDTD = 1
XML_PARSER_DEFAULTATTRS = 2
XML_PARSER_VALIDATE = 3
XML_PARSER_SUBST_ENTITIES = 4
# xmlReaderTypes
XML_READER_TYPE_NONE = 0
XML_READER_TYPE_ELEMENT = 1
XML_READER_TYPE_ATTRIBUTE = 2
XML_READER_TYPE_TEXT = 3
XML_READER_TYPE_CDATA = 4
XML_READER_TYPE_ENTITY_REFERENCE = 5
XML_READER_TYPE_ENTITY = 6
XML_READER_TYPE_PROCESSING_INSTRUCTION = 7
XML_READER_TYPE_COMMENT = 8
XML_READER_TYPE_DOCUMENT = 9
XML_READER_TYPE_DOCUMENT_TYPE = 10
XML_READER_TYPE_DOCUMENT_FRAGMENT = 11
XML_READER_TYPE_NOTATION = 12
XML_READER_TYPE_WHITESPACE = 13
XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14
XML_READER_TYPE_END_ELEMENT = 15
XML_READER_TYPE_END_ENTITY = 16
XML_READER_TYPE_XML_DECLARATION = 17
# xmlCatalogPrefer
XML_CATA_PREFER_NONE = 0
XML_CATA_PREFER_PUBLIC = 1
XML_CATA_PREFER_SYSTEM = 2
# xmlElementType
XML_ELEMENT_NODE = 1
XML_ATTRIBUTE_NODE = 2
XML_TEXT_NODE = 3
XML_CDATA_SECTION_NODE = 4
XML_ENTITY_REF_NODE = 5
XML_ENTITY_NODE = 6
XML_PI_NODE = 7
XML_COMMENT_NODE = 8
XML_DOCUMENT_NODE = 9
XML_DOCUMENT_TYPE_NODE = 10
XML_DOCUMENT_FRAG_NODE = 11
XML_NOTATION_NODE = 12
XML_HTML_DOCUMENT_NODE = 13
XML_DTD_NODE = 14
XML_ELEMENT_DECL = 15
XML_ATTRIBUTE_DECL = 16
XML_ENTITY_DECL = 17
XML_NAMESPACE_DECL = 18
XML_XINCLUDE_START = 19
XML_XINCLUDE_END = 20
XML_DOCB_DOCUMENT_NODE = 21
# xlinkActuate
XLINK_ACTUATE_NONE = 0
XLINK_ACTUATE_AUTO = 1
XLINK_ACTUATE_ONREQUEST = 2
# xmlFeature
XML_WITH_THREAD = 1
XML_WITH_TREE = 2
XML_WITH_OUTPUT = 3
XML_WITH_PUSH = 4
XML_WITH_READER = 5
XML_WITH_PATTERN = 6
XML_WITH_WRITER = 7
XML_WITH_SAX1 = 8
XML_WITH_FTP = 9
XML_WITH_HTTP = 10
XML_WITH_VALID = 11
XML_WITH_HTML = 12
XML_WITH_LEGACY = 13
XML_WITH_C14N = 14
XML_WITH_CATALOG = 15
XML_WITH_XPATH = 16
XML_WITH_XPTR = 17
XML_WITH_XINCLUDE = 18
XML_WITH_ICONV = 19
XML_WITH_ISO8859X = 20
XML_WITH_UNICODE = 21
XML_WITH_REGEXP = 22
XML_WITH_AUTOMATA = 23
XML_WITH_EXPR = 24
XML_WITH_SCHEMAS = 25
XML_WITH_SCHEMATRON = 26
XML_WITH_MODULES = 27
XML_WITH_DEBUG = 28
XML_WITH_DEBUG_MEM = 29
XML_WITH_DEBUG_RUN = 30
XML_WITH_ZLIB = 31
XML_WITH_ICU = 32
XML_WITH_LZMA = 33
XML_WITH_NONE = 99999
# xmlElementContentOccur
XML_ELEMENT_CONTENT_ONCE = 1
XML_ELEMENT_CONTENT_OPT = 2
XML_ELEMENT_CONTENT_MULT = 3
XML_ELEMENT_CONTENT_PLUS = 4
# xmlXPathError
XPATH_EXPRESSION_OK = 0
XPATH_NUMBER_ERROR = 1
XPATH_UNFINISHED_LITERAL_ERROR = 2
XPATH_START_LITERAL_ERROR = 3
XPATH_VARIABLE_REF_ERROR = 4
XPATH_UNDEF_VARIABLE_ERROR = 5
XPATH_INVALID_PREDICATE_ERROR = 6
XPATH_EXPR_ERROR = 7
XPATH_UNCLOSED_ERROR = 8
XPATH_UNKNOWN_FUNC_ERROR = 9
XPATH_INVALID_OPERAND = 10
XPATH_INVALID_TYPE = 11
XPATH_INVALID_ARITY = 12
XPATH_INVALID_CTXT_SIZE = 13
XPATH_INVALID_CTXT_POSITION = 14
XPATH_MEMORY_ERROR = 15
XPTR_SYNTAX_ERROR = 16
XPTR_RESOURCE_ERROR = 17
XPTR_SUB_RESOURCE_ERROR = 18
XPATH_UNDEF_PREFIX_ERROR = 19
XPATH_ENCODING_ERROR = 20
XPATH_INVALID_CHAR_ERROR = 21
XPATH_INVALID_CTXT = 22
XPATH_STACK_ERROR = 23
XPATH_FORBID_VARIABLE_ERROR = 24
# xmlTextReaderMode
XML_TEXTREADER_MODE_INITIAL = 0
XML_TEXTREADER_MODE_INTERACTIVE = 1
XML_TEXTREADER_MODE_ERROR = 2
XML_TEXTREADER_MODE_EOF = 3
XML_TEXTREADER_MODE_CLOSED = 4
XML_TEXTREADER_MODE_READING = 5
# xmlErrorLevel
XML_ERR_NONE = 0
XML_ERR_WARNING = 1
XML_ERR_ERROR = 2
XML_ERR_FATAL = 3
# xmlCharEncoding
XML_CHAR_ENCODING_ERROR = -1
XML_CHAR_ENCODING_NONE = 0
XML_CHAR_ENCODING_UTF8 = 1
XML_CHAR_ENCODING_UTF16LE = 2
XML_CHAR_ENCODING_UTF16BE = 3
XML_CHAR_ENCODING_UCS4LE = 4
XML_CHAR_ENCODING_UCS4BE = 5
XML_CHAR_ENCODING_EBCDIC = 6
XML_CHAR_ENCODING_UCS4_2143 = 7
XML_CHAR_ENCODING_UCS4_3412 = 8
XML_CHAR_ENCODING_UCS2 = 9
XML_CHAR_ENCODING_8859_1 = 10
XML_CHAR_ENCODING_8859_2 = 11
XML_CHAR_ENCODING_8859_3 = 12
XML_CHAR_ENCODING_8859_4 = 13
XML_CHAR_ENCODING_8859_5 = 14
XML_CHAR_ENCODING_8859_6 = 15
XML_CHAR_ENCODING_8859_7 = 16
XML_CHAR_ENCODING_8859_8 = 17
XML_CHAR_ENCODING_8859_9 = 18
XML_CHAR_ENCODING_2022_JP = 19
XML_CHAR_ENCODING_SHIFT_JIS = 20
XML_CHAR_ENCODING_EUC_JP = 21
XML_CHAR_ENCODING_ASCII = 22
# xmlErrorDomain
XML_FROM_NONE = 0
XML_FROM_PARSER = 1
XML_FROM_TREE = 2
XML_FROM_NAMESPACE = 3
XML_FROM_DTD = 4
XML_FROM_HTML = 5
XML_FROM_MEMORY = 6
XML_FROM_OUTPUT = 7
XML_FROM_IO = 8
XML_FROM_FTP = 9
XML_FROM_HTTP = 10
XML_FROM_XINCLUDE = 11
XML_FROM_XPATH = 12
XML_FROM_XPOINTER = 13
XML_FROM_REGEXP = 14
XML_FROM_DATATYPE = 15
XML_FROM_SCHEMASP = 16
XML_FROM_SCHEMASV = 17
XML_FROM_RELAXNGP = 18
XML_FROM_RELAXNGV = 19
XML_FROM_CATALOG = 20
XML_FROM_C14N = 21
XML_FROM_XSLT = 22
XML_FROM_VALID = 23
XML_FROM_CHECK = 24
XML_FROM_WRITER = 25
XML_FROM_MODULE = 26
XML_FROM_I18N = 27
XML_FROM_SCHEMATRONV = 28
XML_FROM_BUFFER = 29
XML_FROM_URI = 30
# htmlStatus
HTML_NA = 0
HTML_INVALID = 1
HTML_DEPRECATED = 2
HTML_VALID = 4
HTML_REQUIRED = 12
# xmlSchemaValidOption
XML_SCHEMA_VAL_VC_I_CREATE = 1
# xmlSchemaWhitespaceValueType
XML_SCHEMA_WHITESPACE_UNKNOWN = 0
XML_SCHEMA_WHITESPACE_PRESERVE = 1
XML_SCHEMA_WHITESPACE_REPLACE = 2
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
# htmlParserOption
HTML_PARSE_RECOVER = 1
HTML_PARSE_NODEFDTD = 4
HTML_PARSE_NOERROR = 32
HTML_PARSE_NOWARNING = 64
HTML_PARSE_PEDANTIC = 128
HTML_PARSE_NOBLANKS = 256
HTML_PARSE_NONET = 2048
HTML_PARSE_NOIMPLIED = 8192
HTML_PARSE_COMPACT = 65536
HTML_PARSE_IGNORE_ENC = 2097152
# xmlRelaxNGValidErr
XML_RELAXNG_OK = 0
XML_RELAXNG_ERR_MEMORY = 1
XML_RELAXNG_ERR_TYPE = 2
XML_RELAXNG_ERR_TYPEVAL = 3
XML_RELAXNG_ERR_DUPID = 4
XML_RELAXNG_ERR_TYPECMP = 5
XML_RELAXNG_ERR_NOSTATE = 6
XML_RELAXNG_ERR_NODEFINE = 7
XML_RELAXNG_ERR_LISTEXTRA = 8
XML_RELAXNG_ERR_LISTEMPTY = 9
XML_RELAXNG_ERR_INTERNODATA = 10
XML_RELAXNG_ERR_INTERSEQ = 11
XML_RELAXNG_ERR_INTEREXTRA = 12
XML_RELAXNG_ERR_ELEMNAME = 13
XML_RELAXNG_ERR_ATTRNAME = 14
XML_RELAXNG_ERR_ELEMNONS = 15
XML_RELAXNG_ERR_ATTRNONS = 16
XML_RELAXNG_ERR_ELEMWRONGNS = 17
XML_RELAXNG_ERR_ATTRWRONGNS = 18
XML_RELAXNG_ERR_ELEMEXTRANS = 19
XML_RELAXNG_ERR_ATTREXTRANS = 20
XML_RELAXNG_ERR_ELEMNOTEMPTY = 21
XML_RELAXNG_ERR_NOELEM = 22
XML_RELAXNG_ERR_NOTELEM = 23
XML_RELAXNG_ERR_ATTRVALID = 24
XML_RELAXNG_ERR_CONTENTVALID = 25
XML_RELAXNG_ERR_EXTRACONTENT = 26
XML_RELAXNG_ERR_INVALIDATTR = 27
XML_RELAXNG_ERR_DATAELEM = 28
XML_RELAXNG_ERR_VALELEM = 29
XML_RELAXNG_ERR_LISTELEM = 30
XML_RELAXNG_ERR_DATATYPE = 31
XML_RELAXNG_ERR_VALUE = 32
XML_RELAXNG_ERR_LIST = 33
XML_RELAXNG_ERR_NOGRAMMAR = 34
XML_RELAXNG_ERR_EXTRADATA = 35
XML_RELAXNG_ERR_LACKDATA = 36
XML_RELAXNG_ERR_INTERNAL = 37
XML_RELAXNG_ERR_ELEMWRONG = 38
XML_RELAXNG_ERR_TEXTWRONG = 39
# xmlCatalogAllow
XML_CATA_ALLOW_NONE = 0
XML_CATA_ALLOW_GLOBAL = 1
XML_CATA_ALLOW_DOCUMENT = 2
XML_CATA_ALLOW_ALL = 3
# xmlAttributeType
XML_ATTRIBUTE_CDATA = 1
XML_ATTRIBUTE_ID = 2
XML_ATTRIBUTE_IDREF = 3
XML_ATTRIBUTE_IDREFS = 4
XML_ATTRIBUTE_ENTITY = 5
XML_ATTRIBUTE_ENTITIES = 6
XML_ATTRIBUTE_NMTOKEN = 7
XML_ATTRIBUTE_NMTOKENS = 8
XML_ATTRIBUTE_ENUMERATION = 9
XML_ATTRIBUTE_NOTATION = 10
# xmlSchematronValidOptions
XML_SCHEMATRON_OUT_QUIET = 1
XML_SCHEMATRON_OUT_TEXT = 2
XML_SCHEMATRON_OUT_XML = 4
XML_SCHEMATRON_OUT_ERROR = 8
XML_SCHEMATRON_OUT_FILE = 256
XML_SCHEMATRON_OUT_BUFFER = 512
XML_SCHEMATRON_OUT_IO = 1024
# xmlSchemaContentType
XML_SCHEMA_CONTENT_UNKNOWN = 0
XML_SCHEMA_CONTENT_EMPTY = 1
XML_SCHEMA_CONTENT_ELEMENTS = 2
XML_SCHEMA_CONTENT_MIXED = 3
XML_SCHEMA_CONTENT_SIMPLE = 4
XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5
XML_SCHEMA_CONTENT_BASIC = 6
XML_SCHEMA_CONTENT_ANY = 7
# xmlSchemaTypeType
XML_SCHEMA_TYPE_BASIC = 1
XML_SCHEMA_TYPE_ANY = 2
XML_SCHEMA_TYPE_FACET = 3
XML_SCHEMA_TYPE_SIMPLE = 4
XML_SCHEMA_TYPE_COMPLEX = 5
XML_SCHEMA_TYPE_SEQUENCE = 6
XML_SCHEMA_TYPE_CHOICE = 7
XML_SCHEMA_TYPE_ALL = 8
XML_SCHEMA_TYPE_SIMPLE_CONTENT = 9
XML_SCHEMA_TYPE_COMPLEX_CONTENT = 10
XML_SCHEMA_TYPE_UR = 11
XML_SCHEMA_TYPE_RESTRICTION = 12
XML_SCHEMA_TYPE_EXTENSION = 13
XML_SCHEMA_TYPE_ELEMENT = 14
XML_SCHEMA_TYPE_ATTRIBUTE = 15
XML_SCHEMA_TYPE_ATTRIBUTEGROUP = 16
XML_SCHEMA_TYPE_GROUP = 17
XML_SCHEMA_TYPE_NOTATION = 18
XML_SCHEMA_TYPE_LIST = 19
XML_SCHEMA_TYPE_UNION = 20
XML_SCHEMA_TYPE_ANY_ATTRIBUTE = 21
XML_SCHEMA_TYPE_IDC_UNIQUE = 22
XML_SCHEMA_TYPE_IDC_KEY = 23
XML_SCHEMA_TYPE_IDC_KEYREF = 24
XML_SCHEMA_TYPE_PARTICLE = 25
XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26
XML_SCHEMA_FACET_MININCLUSIVE = 1000
XML_SCHEMA_FACET_MINEXCLUSIVE = 1001
XML_SCHEMA_FACET_MAXINCLUSIVE = 1002
XML_SCHEMA_FACET_MAXEXCLUSIVE = 1003
XML_SCHEMA_FACET_TOTALDIGITS = 1004
XML_SCHEMA_FACET_FRACTIONDIGITS = 1005
XML_SCHEMA_FACET_PATTERN = 1006
XML_SCHEMA_FACET_ENUMERATION = 1007
XML_SCHEMA_FACET_WHITESPACE = 1008
XML_SCHEMA_FACET_LENGTH = 1009
XML_SCHEMA_FACET_MAXLENGTH = 1010
XML_SCHEMA_FACET_MINLENGTH = 1011
XML_SCHEMA_EXTRA_QNAMEREF = 2000
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001
# xmlModuleOption
XML_MODULE_LAZY = 1
XML_MODULE_LOCAL = 2
# xmlParserMode
XML_PARSE_UNKNOWN = 0
XML_PARSE_DOM = 1
XML_PARSE_SAX = 2
XML_PARSE_PUSH_DOM = 3
XML_PARSE_PUSH_SAX = 4
XML_PARSE_READER = 5
# xmlC14NMode
XML_C14N_1_0 = 0
XML_C14N_EXCLUSIVE_1_0 = 1
XML_C14N_1_1 = 2
# xmlParserOption
XML_PARSE_RECOVER = 1
XML_PARSE_NOENT = 2
XML_PARSE_DTDLOAD = 4
XML_PARSE_DTDATTR = 8
XML_PARSE_DTDVALID = 16
XML_PARSE_NOERROR = 32
XML_PARSE_NOWARNING = 64
XML_PARSE_PEDANTIC = 128
XML_PARSE_NOBLANKS = 256
XML_PARSE_SAX1 = 512
XML_PARSE_XINCLUDE = 1024
XML_PARSE_NONET = 2048
XML_PARSE_NODICT = 4096
XML_PARSE_NSCLEAN = 8192
XML_PARSE_NOCDATA = 16384
XML_PARSE_NOXINCNODE = 32768
XML_PARSE_COMPACT = 65536
XML_PARSE_OLD10 = 131072
XML_PARSE_NOBASEFIX = 262144
XML_PARSE_HUGE = 524288
XML_PARSE_OLDSAX = 1048576
XML_PARSE_IGNORE_ENC = 2097152
XML_PARSE_BIG_LINES = 4194304
# xmlElementTypeVal
XML_ELEMENT_TYPE_UNDEFINED = 0
XML_ELEMENT_TYPE_EMPTY = 1
XML_ELEMENT_TYPE_ANY = 2
XML_ELEMENT_TYPE_MIXED = 3
XML_ELEMENT_TYPE_ELEMENT = 4
# xmlDocProperties
XML_DOC_WELLFORMED = 1
XML_DOC_NSVALID = 2
XML_DOC_OLD10 = 4
XML_DOC_DTDVALID = 8
XML_DOC_XINCLUDE = 16
XML_DOC_USERBUILT = 32
XML_DOC_INTERNAL = 64
XML_DOC_HTML = 128
# xlinkType
XLINK_TYPE_NONE = 0
XLINK_TYPE_SIMPLE = 1
XLINK_TYPE_EXTENDED = 2
XLINK_TYPE_EXTENDED_SET = 3
# xmlXPathObjectType
XPATH_UNDEFINED = 0
XPATH_NODESET = 1
XPATH_BOOLEAN = 2
XPATH_NUMBER = 3
XPATH_STRING = 4
XPATH_POINT = 5
XPATH_RANGE = 6
XPATH_LOCATIONSET = 7
XPATH_USERS = 8
XPATH_XSLT_TREE = 9
# xmlSchemaValidError
XML_SCHEMAS_ERR_OK = 0
XML_SCHEMAS_ERR_NOROOT = 1
XML_SCHEMAS_ERR_UNDECLAREDELEM = 2
XML_SCHEMAS_ERR_NOTTOPLEVEL = 3
XML_SCHEMAS_ERR_MISSING = 4
XML_SCHEMAS_ERR_WRONGELEM = 5
XML_SCHEMAS_ERR_NOTYPE = 6
XML_SCHEMAS_ERR_NOROLLBACK = 7
XML_SCHEMAS_ERR_ISABSTRACT = 8
XML_SCHEMAS_ERR_NOTEMPTY = 9
XML_SCHEMAS_ERR_ELEMCONT = 10
XML_SCHEMAS_ERR_HAVEDEFAULT = 11
XML_SCHEMAS_ERR_NOTNILLABLE = 12
XML_SCHEMAS_ERR_EXTRACONTENT = 13
XML_SCHEMAS_ERR_INVALIDATTR = 14
XML_SCHEMAS_ERR_INVALIDELEM = 15
XML_SCHEMAS_ERR_NOTDETERMINIST = 16
XML_SCHEMAS_ERR_CONSTRUCT = 17
XML_SCHEMAS_ERR_INTERNAL = 18
XML_SCHEMAS_ERR_NOTSIMPLE = 19
XML_SCHEMAS_ERR_ATTRUNKNOWN = 20
XML_SCHEMAS_ERR_ATTRINVALID = 21
XML_SCHEMAS_ERR_VALUE = 22
XML_SCHEMAS_ERR_FACET = 23
XML_SCHEMAS_ERR_ = 24
XML_SCHEMAS_ERR_XXX = 25
|