-
-
Save HASKADOG/20241dcb4ac069190e9d51d96231c612 to your computer and use it in GitHub Desktop.
<component name="ProjectCodeStyleConfiguration"> | |
<state> | |
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> | |
</state> | |
</component> |
<component name="InspectionProjectProfileManager"> | |
<settings> | |
<option name="USE_PROJECT_PROFILE" value="false" /> | |
<version value="1.0" /> | |
</settings> | |
</component> |
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="JavaScriptSettings"> | |
<option name="languageLevel" value="ES6" /> | |
</component> | |
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (untitled)" project-jdk-type="Python SDK" /> | |
</project> |
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/untitled.iml" filepath="$PROJECT_DIR$/.idea/untitled.iml" /> | |
</modules> | |
</component> | |
</project> |
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$"> | |
<excludeFolder url="file://$MODULE_DIR$/venv" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
<component name="TestRunnerService"> | |
<option name="PROJECT_TEST_RUNNER" value="Unittests" /> | |
</component> | |
</module> |
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ChangeListManager"> | |
<list default="true" id="7a304e30-1c78-4b0d-b93b-017fb2af6dad" name="Default Changelist" comment="" /> | |
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | |
<option name="SHOW_DIALOG" value="false" /> | |
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |
<option name="LAST_RESOLUTION" value="IGNORE" /> | |
</component> | |
<component name="FileTemplateManagerImpl"> | |
<option name="RECENT_TEMPLATES"> | |
<list> | |
<option value="Python Script" /> | |
</list> | |
</option> | |
</component> | |
<component name="ProjectId" id="1SQruwUaLoX2w7YAbaZCRXzJsw9" /> | |
<component name="PropertiesComponent"> | |
<property name="WebServerToolWindowFactoryState" value="false" /> | |
<property name="settings.editor.selected.configurable" value="editor.preferences.fonts.default" /> | |
</component> | |
<component name="RunDashboard"> | |
<option name="ruleStates"> | |
<list> | |
<RuleState> | |
<option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | |
</RuleState> | |
<RuleState> | |
<option name="name" value="StatusDashboardGroupingRule" /> | |
</RuleState> | |
</list> | |
</option> | |
</component> | |
<component name="RunManager"> | |
<configuration name="Attr" type="PythonConfigurationType" factoryName="Python" temporary="true"> | |
<module name="untitled" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="" /> | |
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | |
<option name="IS_MODULE_SDK" value="true" /> | |
<option name="ADD_CONTENT_ROOTS" value="true" /> | |
<option name="ADD_SOURCE_ROOTS" value="true" /> | |
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> | |
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/Attr.py" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="false" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<recent_temporary> | |
<list> | |
<item itemvalue="Python.Attr" /> | |
</list> | |
</recent_temporary> | |
</component> | |
<component name="SvnConfiguration"> | |
<configuration /> | |
</component> | |
<component name="TaskManager"> | |
<task active="true" id="Default" summary="Default task"> | |
<changelist id="7a304e30-1c78-4b0d-b93b-017fb2af6dad" name="Default Changelist" comment="" /> | |
<created>1571506886556</created> | |
<option name="number" value="Default" /> | |
<option name="presentableId" value="Default" /> | |
<updated>1571506886556</updated> | |
<workItem from="1571506890995" duration="250000" /> | |
<workItem from="1571507166243" duration="6620000" /> | |
</task> | |
<servers /> | |
</component> | |
<component name="TypeScriptGeneratedFilesManager"> | |
<option name="version" value="1" /> | |
</component> | |
<component name="com.intellij.coverage.CoverageDataManagerImpl"> | |
<SUITE FILE_PATH="coverage/untitled$Attr.coverage" NAME="Attr Coverage Results" MODIFIED="1571515262682" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> | |
</component> | |
</project> |
import wget | |
import os | |
from lxml import etree | |
def get_attrs(roots): | |
for root in roots.getchildren(): | |
rootattr = root.attrib | |
print(rootattr.get('internal-id')) | |
oldId = open('old-ids.txt', 'a') | |
if str(rootattr.get('internal-id')) == "None": | |
oldId.close() | |
else: | |
oldId.write(str(rootattr.get('internal-id')) + '\n') | |
oldId.close() | |
def checkIfWas(roots, url): | |
new = []; | |
old = open('old-ids.txt', '+') | |
for new in old: | |
print(old.readline()) | |
def parseBookXML(xmlFile): | |
wget.download(xmlFile, 'C:\\Users\\Cplasplas\\PycharmProjects\\untitled\\urls.xml') | |
with open('urls.xml', 'rb') as fobj: | |
xml = fobj.read() | |
root = etree.fromstring(xml) | |
get_attrs(root) | |
os.remove('urls.xml') | |
if __name__ == "__main__": | |
#parseBookXML("https://base.kvartus.ru/reklama/xml/base/9995/yrl_bitrix.xml") |
889283 | |
889556 | |
889571 | |
927410 | |
927722 | |
929564 | |
934142 | |
943370 | |
944819 | |
945704 | |
947189 | |
958943 | |
959081 | |
967055 | |
967508 | |
967526 | |
1012214 | |
1015475 | |
1015532 | |
1015610 | |
1042844 | |
1042850 | |
1042865 | |
1042871 | |
1042877 | |
1048136 | |
1070141 | |
1196066 | |
1196102 | |
1196234 | |
1197605 | |
1197617 | |
1213277 | |
1308641 | |
1309827 | |
1309863 | |
1309869 | |
1309884 | |
1309899 | |
1309905 | |
1309929 | |
1309932 | |
1309944 | |
1320612 | |
1327644 | |
1329330 | |
1337628 | |
1337712 | |
1337751 | |
1337775 | |
1359279 | |
1361682 | |
1362168 | |
1366986 | |
1412519 | |
1427471 | |
1427585 | |
1462733 | |
1473128 | |
1473146 | |
1474814 | |
1486259 | |
1582820 | |
1635194 | |
1635212 | |
1644608 | |
1644626 | |
1644659 | |
1657757 | |
1670288 | |
1718942 | |
1719473 | |
1721048 | |
1724495 | |
1724756 | |
1759148 | |
1759625 | |
1765763 | |
1770521 | |
1779827 | |
1781480 | |
1787807 | |
1789655 | |
1790846 | |
1790957 | |
1791017 | |
1791077 | |
1791560 | |
1791650 | |
1791716 | |
1794626 | |
1794641 | |
1794650 | |
1794674 | |
1794695 | |
1795088 | |
1795109 | |
1832387 | |
1904750 | |
1927103 | |
1936226 | |
1951634 | |
1951787 | |
1951802 | |
1951814 | |
1964318 | |
1979306 | |
1982933 | |
1985255 | |
1985276 | |
2018753 | |
2021834 | |
2030204 | |
2030216 | |
2096372 | |
2097674 | |
2132381 | |
2139503 | |
2143520 | |
2145284 | |
2145314 | |
2145332 | |
2153348 | |
2158790 | |
2158817 | |
2165255 | |
2174630 | |
2184263 | |
2192063 | |
2192228 | |
2192237 | |
2194070 | |
2194082 | |
2205551 | |
2210096 | |
2248829 | |
2248913 | |
2248925 | |
2257322 | |
2257385 | |
2264351 | |
2264462 | |
2264480 | |
2264774 | |
2265851 | |
2265869 | |
2265881 | |
2266610 | |
2267051 | |
2268059 | |
2268110 | |
2268188 | |
2268209 | |
2270627 | |
2270666 | |
2278007 | |
2280278 | |
2281598 | |
2281727 | |
2282978 | |
2287160 | |
2304785 | |
2304857 | |
2309795 | |
2311589 | |
2319893 | |
2319938 | |
2320256 | |
2320859 | |
2320976 | |
2321024 | |
2323895 | |
2323916 | |
2324096 | |
2324225 | |
2328200 | |
2328245 | |
2328368 | |
2328659 | |
2328758 | |
2328821 | |
2340575 | |
2342846 | |
2343029 | |
2343107 | |
2343209 | |
2343383 | |
2343506 | |
2343635 | |
2343869 | |
2344292 | |
2344565 | |
2347070 | |
2348720 | |
2349692 | |
2349728 | |
2350877 | |
2351006 | |
2358050 | |
2358251 | |
2358428 | |
2358533 | |
2358602 | |
2358638 | |
2365976 | |
2368934 | |
2381600 | |
2381639 | |
2383367 | |
2389235 | |
2389388 | |
2390654 | |
2392823 | |
2393345 | |
2394347 | |
2396237 | |
2414780 | |
2428115 | |
2436566 | |
2448515 | |
2453855 | |
2454980 | |
2456075 | |
2457410 | |
2477510 | |
2478287 | |
2484731 | |
2506334 | |
2509451 | |
2509640 | |
2512574 | |
2514515 | |
2514632 | |
2515835 | |
2522603 | |
2524706 | |
2528477 | |
2532125 | |
2532563 | |
2532767 | |
2537453 | |
2537498 | |
2537525 | |
2537594 | |
2537897 | |
2559857 | |
2563154 | |
2572559 | |
2572823 | |
2572922 | |
2573027 | |
2573114 | |
2573396 | |
2573426 | |
2573486 | |
2573537 | |
2574047 | |
2574068 | |
2574074 | |
2574191 | |
2574233 | |
2582765 | |
2591168 | |
2596694 | |
2606480 | |
2607056 | |
2607224 | |
2608493 | |
2609537 | |
2611067 | |
2612099 | |
2612309 | |
2612573 | |
2614340 | |
2616599 | |
2616701 | |
2617064 | |
2617622 | |
2617805 | |
2620883 | |
2628794 | |
2629727 | |
2629958 | |
2630075 | |
2630246 | |
2630498 | |
2630579 | |
2630618 | |
2630663 | |
2635910 | |
2636090 | |
2636285 | |
2636435 | |
2637620 | |
2637740 | |
2637878 | |
2637962 | |
2638379 | |
2638442 | |
2638517 | |
2640014 | |
2666261 | |
2670551 | |
2670626 | |
2670638 | |
2670647 | |
2670662 | |
2670680 | |
2672852 | |
2673404 | |
2676509 | |
2676605 | |
2676650 | |
2680700 | |
2684018 | |
2685236 | |
2685383 | |
2685509 | |
2695718 | |
2701700 | |
2701775 | |
2706644 | |
2708699 | |
2708786 | |
2708798 | |
2708822 | |
2708828 | |
2708882 | |
2708939 | |
2708972 | |
2708978 | |
2708996 | |
2709575 | |
2709590 | |
2709602 | |
2709614 | |
2709620 | |
2709632 | |
2709644 | |
2709650 | |
2709656 | |
2709659 | |
2709806 | |
2709812 | |
2709824 | |
2709830 | |
2709833 | |
2710493 | |
2715248 | |
2715302 | |
2715314 | |
2720999 | |
2726465 | |
2730626 | |
2732450 | |
2739143 | |
2743154 | |
2766788 | |
2767340 | |
2767409 | |
2768492 | |
2768663 | |
2773874 | |
2785934 | |
2787557 | |
2787926 | |
2787938 | |
2837060 | |
2838560 | |
2838572 | |
2838917 | |
2842259 | |
2843981 | |
2845823 | |
2845904 | |
2846453 | |
2855144 | |
2855324 | |
2862344 | |
2865197 | |
2866034 | |
2866061 | |
2870834 | |
2874251 | |
2874524 | |
2875913 | |
2876240 | |
2882363 | |
2892110 | |
2892212 | |
2892281 | |
2892320 | |
2893136 | |
2895299 | |
2898494 | |
2899100 | |
2899151 | |
2899196 | |
2899220 | |
2899262 | |
2899319 | |
2899358 | |
2899373 | |
2899379 | |
2899400 | |
2899409 | |
2899421 | |
2899481 | |
2899673 | |
2899691 | |
2899721 | |
2899736 | |
2899751 | |
2899766 | |
2899781 | |
2899814 | |
2899817 | |
2899820 | |
2899829 | |
2900060 | |
2900081 | |
2901152 | |
2906705 | |
2908421 | |
2911313 | |
2912948 | |
2913284 | |
2913329 | |
2913332 | |
2913353 | |
2913371 | |
2913509 | |
2914607 | |
2914622 | |
2914634 | |
2914664 | |
2914697 | |
2914817 | |
2921225 | |
2921555 | |
2921570 | |
2921588 | |
2921834 | |
2922134 | |
2922173 | |
2924264 | |
2928821 | |
2928875 | |
2928983 | |
2929022 | |
2929424 | |
2929502 | |
2929556 | |
2929862 | |
2929973 | |
2930066 | |
2930816 | |
2939921 | |
2939978 | |
2941904 | |
2942174 | |
2942396 | |
2942597 | |
2948732 | |
2949152 | |
2949158 | |
2949182 | |
2949245 | |
2949326 | |
2957102 | |
2957177 | |
2960135 | |
2961794 | |
2962088 | |
2962247 | |
2962298 | |
2962355 | |
2962373 | |
2964191 | |
2964503 | |
2966531 | |
2969012 | |
2970962 | |
2973017 | |
2975930 | |
2981558 | |
2981621 | |
2989709 | |
2994098 | |
2995727 | |
2995805 | |
2996384 | |
3002093 | |
3004163 | |
3011384 | |
3014306 | |
3028907 | |
3029378 | |
3029420 | |
3029516 | |
3029738 | |
3043790 | |
3049292 | |
3051833 | |
3053165 | |
3060104 | |
3060434 | |
3075539 | |
3078968 | |
3081923 | |
3081998 | |
3082253 | |
3083852 | |
3090773 | |
3090791 | |
3091013 | |
3097676 | |
3098519 | |
3101747 | |
3101753 | |
3101759 | |
3102200 | |
3106937 | |
3109055 | |
3113120 | |
3113156 | |
3113384 | |
3113519 | |
3117410 | |
3117542 | |
3117638 | |
3133154 | |
3133169 | |
3133178 | |
3133907 | |
3139280 | |
3141011 | |
3141065 | |
3142682 | |
3154373 | |
3154382 | |
3154850 | |
3157058 | |
3158096 | |
3158453 | |
3159779 | |
3159983 | |
3160106 | |
3162893 | |
3162917 | |
3162920 | |
3162926 | |
3163061 | |
3166679 | |
3170660 | |
3173561 | |
3173780 | |
3173876 | |
3173900 | |
3175037 | |
3176294 | |
3177623 | |
3177965 | |
3181385 | |
3181505 | |
3182369 | |
3186359 | |
3186707 | |
3186758 | |
3186806 | |
3186929 | |
3187322 | |
3190124 | |
3190214 | |
3192191 | |
3192332 | |
3192344 | |
3192941 | |
3195287 | |
3195353 | |
3195443 | |
3196430 | |
3197342 | |
3198371 | |
3198935 | |
3198959 | |
3199052 | |
3199100 | |
3202559 | |
3202625 | |
3202658 | |
3202676 | |
3202715 | |
3202718 | |
3202727 | |
3202742 | |
3202751 | |
3202766 | |
3202820 | |
3202829 | |
3202832 | |
3202850 | |
3202871 | |
3202889 | |
3202907 | |
3202922 | |
3202928 | |
3202943 | |
3203357 | |
3204575 | |
3204611 | |
3208850 | |
3208853 | |
3208856 | |
3208865 | |
3208868 | |
3208871 | |
3208874 | |
3208877 | |
3208880 | |
3208883 | |
3208889 | |
3208892 | |
3209996 | |
3211229 | |
3216188 | |
3217862 | |
3218636 | |
3220925 | |
3221147 | |
3222956 | |
3224495 | |
3226775 | |
3231965 | |
3233432 | |
3234434 | |
3234458 | |
3234488 | |
3238919 | |
3239066 | |
3239123 | |
3244442 | |
3245972 | |
3245975 | |
3246008 | |
3246014 | |
3250712 | |
3250724 | |
3250733 | |
3253976 | |
3255164 | |
3255188 | |
3255209 | |
3257738 | |
3259142 | |
3261836 | |
3263828 | |
3265067 | |
3265169 | |
3269585 | |
3269651 | |
3269705 | |
3269771 | |
3269834 | |
3269909 | |
3270083 | |
3270305 | |
3270311 | |
3271001 | |
3271193 | |
3272063 | |
3273176 | |
3273179 | |
3273182 | |
3273188 | |
3273221 | |
3273227 | |
3273230 | |
3273905 | |
3278132 | |
3278285 | |
3279914 | |
3282515 | |
3282611 | |
3282731 | |
3283763 | |
3283814 | |
3284288 | |
3284381 | |
3287045 | |
3287054 | |
3287126 | |
3287153 | |
3287651 | |
3287855 | |
3287861 | |
3287876 | |
3287903 | |
3288014 | |
3288038 | |
3288170 | |
3288272 | |
3288476 | |
3288665 | |
3289511 | |
3289517 | |
3289763 | |
3289853 | |
3289877 | |
3291113 | |
3291314 | |
3291401 | |
3298121 | |
3299168 | |
3300596 | |
3300719 | |
3301061 | |
3301313 | |
3305447 | |
3305633 | |
3307658 | |
3311374 | |
3311554 | |
3311857 | |
3313940 | |
3314069 | |
3314078 | |
3314126 | |
3315210 | |
3315948 | |
3315959 | |
3316388 | |
3316390 | |
3316401 | |
3316988 | |
3316990 | |
3316994 | |
3317045 | |
3317047 | |
3317049 | |
3317052 | |
3317055 | |
3317056 | |
3317057 | |
3317063 | |
3318017 | |
3318079 | |
3318350 | |
3319137 | |
3319501 | |
3319712 | |
3319744 | |
3319765 | |
3319814 | |
3320893 | |
3323092 | |
3323217 | |
3323230 | |
3323301 | |
3323445 | |
3323517 | |
3323530 | |
3324360 | |
3324413 | |
3325122 | |
3325129 | |
3325451 | |
3325462 | |
3327851 | |
3327882 | |
3327902 | |
3327903 | |
3328851 | |
3328857 | |
3328870 | |
3328873 |
./setuptools-40.8.0-py3.7.egg | |
./pip-19.0.3-py3.7.egg |
pip |
lxml is copyright Infrae and distributed under the BSD license (see | |
doc/licenses/BSD.txt), with the following exceptions: | |
Some code, such a selftest.py, selftest2.py and | |
src/lxml/_elementpath.py are derived from ElementTree and | |
cElementTree. See doc/licenses/elementtree.txt for the license text. | |
lxml.cssselect and lxml.html are copyright Ian Bicking and distributed | |
under the BSD license (see doc/licenses/BSD.txt). | |
test.py, the test-runner script, is GPL and copyright Shuttleworth | |
Foundation. See doc/licenses/GPL.txt. It is believed the unchanged | |
inclusion of test.py to run the unit test suite falls under the | |
"aggregation" clause of the GPL and thus does not affect the license | |
of the rest of the package. | |
The isoschematron implementation uses several XSL and RelaxNG resources: | |
* The (XML syntax) RelaxNG schema for schematron, copyright International | |
Organization for Standardization (see | |
src/lxml/isoschematron/resources/rng/iso-schematron.rng for the license | |
text) | |
* The skeleton iso-schematron-xlt1 pure-xslt schematron implementation | |
xsl stylesheets, copyright Rick Jelliffe and Academia Sinica Computing | |
Center, Taiwan (see the xsl files here for the license text: | |
src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/) | |
* The xsd/rng schema schematron extraction xsl transformations are unlicensed | |
and copyright the respective authors as noted (see | |
src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl and | |
src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl) |
Metadata-Version: 2.1 | |
Name: lxml | |
Version: 4.4.1 | |
Summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API. | |
Home-page: http://lxml.de/ | |
Author: lxml dev team | |
Author-email: lxml-dev@lxml.de | |
Maintainer: lxml dev team | |
Maintainer-email: lxml-dev@lxml.de | |
License: BSD | |
Platform: UNKNOWN | |
Classifier: Development Status :: 5 - Production/Stable | |
Classifier: Intended Audience :: Developers | |
Classifier: Intended Audience :: Information Technology | |
Classifier: License :: OSI Approved :: BSD License | |
Classifier: Programming Language :: Cython | |
Classifier: Programming Language :: Python :: 2 | |
Classifier: Programming Language :: Python :: 2.7 | |
Classifier: Programming Language :: Python :: 3 | |
Classifier: Programming Language :: Python :: 3.5 | |
Classifier: Programming Language :: Python :: 3.6 | |
Classifier: Programming Language :: Python :: 3.7 | |
Classifier: Programming Language :: C | |
Classifier: Operating System :: OS Independent | |
Classifier: Topic :: Text Processing :: Markup :: HTML | |
Classifier: Topic :: Text Processing :: Markup :: XML | |
Classifier: Topic :: Software Development :: Libraries :: Python Modules | |
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.* | |
Provides-Extra: cssselect | |
Requires-Dist: cssselect (>=0.7) ; extra == 'cssselect' | |
Provides-Extra: html5 | |
Requires-Dist: html5lib ; extra == 'html5' | |
Provides-Extra: htmlsoup | |
Requires-Dist: BeautifulSoup4 ; extra == 'htmlsoup' | |
Provides-Extra: source | |
Requires-Dist: Cython (>=0.29.7) ; extra == 'source' | |
lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It | |
provides safe and convenient access to these libraries using the ElementTree | |
API. | |
It extends the ElementTree API significantly to offer support for XPath, | |
RelaxNG, XML Schema, XSLT, C14N and much more. | |
To contact the project, go to the `project home page | |
<http://lxml.de/>`_ or see our bug tracker at | |
https://launchpad.net/lxml | |
In case you want to use the current in-development version of lxml, | |
you can get it from the github repository at | |
https://github.com/lxml/lxml . Note that this requires Cython to | |
build the sources, see the build instructions on the project home | |
page. To the same end, running ``easy_install lxml==dev`` will | |
install lxml from | |
https://github.com/lxml/lxml/tarball/master#egg=lxml-dev if you have | |
an appropriate version of Cython installed. | |
After an official release of a new stable series, bug fixes may become | |
available at | |
https://github.com/lxml/lxml/tree/lxml-4.4 . | |
Running ``easy_install lxml==4.4bugfix`` will install | |
the unreleased branch state from | |
https://github.com/lxml/lxml/tarball/lxml-4.4#egg=lxml-4.4bugfix | |
as soon as a maintenance branch has been established. Note that this | |
requires Cython to be installed at an appropriate version for the build. | |
4.4.1 (2019-08-11) | |
================== | |
Bugs fixed | |
---------- | |
* LP#1838252: The order of an OrderedDict was lost in 4.4.0 when passing it as | |
attrib mapping during element creation. | |
* LP#1838521: The package metadata now lists the supported Python versions. | |
lxml-4.4.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 | |
lxml-4.4.1.dist-info/LICENSES.txt,sha256=QdSd1AaqDhVIptXyGjDWv2OLPNlutyid00jYPtLkA5I,1514 | |
lxml-4.4.1.dist-info/METADATA,sha256=_AQzRNQxHvAfAl_eQsXqPxqT7pPvUoXFwmdmuIj4gAc,3049 | |
lxml-4.4.1.dist-info/RECORD,, | |
lxml-4.4.1.dist-info/WHEEL,sha256=lZrZVSunAsdph2A7GL0UUoLJct7efkntCUJ_-xF1QuQ,102 | |
lxml-4.4.1.dist-info/top_level.txt,sha256=NjD988wqaKq512nshNdLt-uDxsjkp4Bh51m6N-dhUrk,5 | |
lxml/ElementInclude.py,sha256=BXdowSt8EyZThmV-XjcitqFrleu0f5hWcnI3NnV4xug,8591 | |
lxml/__init__.py,sha256=lYLRn8M0_xdnN2bhEnZ2L7mlY5zM3gwz1kgLILLxC34,551 | |
lxml/__pycache__/ElementInclude.cpython-37.pyc,, | |
lxml/__pycache__/__init__.cpython-37.pyc,, | |
lxml/__pycache__/_elementpath.cpython-37.pyc,, | |
lxml/__pycache__/builder.cpython-37.pyc,, | |
lxml/__pycache__/cssselect.cpython-37.pyc,, | |
lxml/__pycache__/doctestcompare.cpython-37.pyc,, | |
lxml/__pycache__/pyclasslookup.cpython-37.pyc,, | |
lxml/__pycache__/sax.cpython-37.pyc,, | |
lxml/__pycache__/usedoctest.cpython-37.pyc,, | |
lxml/_elementpath.cp37-win32.pyd,sha256=GRKcriBt5hVc1zVal5AYGi_eWwn-WxxR9xhuMVbJQsY,133632 | |
lxml/_elementpath.py,sha256=wo6_CnGtKSkadI-krW8gbEZ1fVPTnIJINNwrdRfT_fw,10742 | |
lxml/builder.cp37-win32.pyd,sha256=SMrMnPqsxaf1UZms2hZLWYb9q458qf910X0076YD1Ms,70656 | |
lxml/builder.py,sha256=R5WsHI0bCOHYehskKXENvBkuarviL5rNJsmnh6cZGUA,7975 | |
lxml/cssselect.py,sha256=ADTqox2BUhZI_28K26Dnd-rPqvwL1A7KpXwDetXZLfA,3366 | |
lxml/doctestcompare.py,sha256=dAjqNzMGJuDsxY0xOXwOWzEsq7gSfQf-6uuxZZwaNXM,18339 | |
lxml/etree.cp37-win32.pyd,sha256=qKnZINq6sSHvgGSMRekAToop7BGyjeOpu-eKvyeCHWQ,3499008 | |
lxml/etree.h,sha256=ovyaRkrRJRkTtHo0YoPvopYLhrcOVUvYhuio6iTmF58,8555 | |
lxml/etree_api.h,sha256=ctFt9PRo6JEtPZYPmZhWs6dDQwgtc_OuPjNQFp2io-U,17467 | |
lxml/html/ElementSoup.py,sha256=9NQNksJmEr0M2DqzaKhXWdALLo0btwVwjgTHnkfGfvk,319 | |
lxml/html/__init__.py,sha256=vFxnC3XWddHuM3pR8pYE7cRxdl1TgtJF0twoUVDTzUk,64806 | |
lxml/html/__pycache__/ElementSoup.cpython-37.pyc,, | |
lxml/html/__pycache__/__init__.cpython-37.pyc,, | |
lxml/html/__pycache__/_diffcommand.cpython-37.pyc,, | |
lxml/html/__pycache__/_html5builder.cpython-37.pyc,, | |
lxml/html/__pycache__/_setmixin.cpython-37.pyc,, | |
lxml/html/__pycache__/builder.cpython-37.pyc,, | |
lxml/html/__pycache__/clean.cpython-37.pyc,, | |
lxml/html/__pycache__/defs.cpython-37.pyc,, | |
lxml/html/__pycache__/diff.cpython-37.pyc,, | |
lxml/html/__pycache__/formfill.cpython-37.pyc,, | |
lxml/html/__pycache__/html5parser.cpython-37.pyc,, | |
lxml/html/__pycache__/soupparser.cpython-37.pyc,, | |
lxml/html/__pycache__/usedoctest.cpython-37.pyc,, | |
lxml/html/_diffcommand.py,sha256=7-tz3udrgg0unGPAI8pa_uN4e7vW0MmgOXE43kKPdw8,2121 | |
lxml/html/_html5builder.py,sha256=cASxN0Tks3_vqCA_sXa1oCx_McyRL6VpuRLA1T-B58o,3246 | |
lxml/html/_setmixin.py,sha256=uVCgBUC4SJ7N9GotmlKHrhH7R4Kk7wGU3u1WmEJKGeM,1184 | |
lxml/html/builder.py,sha256=1NuLqKPSaat75wCGufVuv1jIeBLuQCWsJVA_T2XjjUI,4310 | |
lxml/html/clean.cp37-win32.pyd,sha256=G_yFTQ8J4mLpQC_KvPyPUXAsnTQIis-me1zYX068hyc,186368 | |
lxml/html/clean.py,sha256=7LoNhrkhE25j3wgjEVBgONk38TlIwUlaj44B0wVX-24,26422 | |
lxml/html/defs.py,sha256=ohRO7uinvxWwLZb59FsYdzr6UcIvCjuSWnnYwev6c9M,4192 | |
lxml/html/diff.cp37-win32.pyd,sha256=xrFwXChfxXVlk8TsQf9WKeNw22S-ISAqgRcVKxr5Ca8,251392 | |
lxml/html/diff.py,sha256=F1A1vYO3dQdYfGDkI46zj5GN6UzaGMQt7ezqV5i324Q,30553 | |
lxml/html/formfill.py,sha256=9lnv7BnrQS0HOBY8ToeP1408xMN1wnltpsY-0CTGBpQ,9689 | |
lxml/html/html5parser.py,sha256=dnyC4cqHxywjZSzk0mu2L7THTZjxhg4yF4pncjusa_w,8634 | |
lxml/html/soupparser.py,sha256=tfdraMayPbMBCd2kGxUoTvNkhKUclfP3LmV9R85WKI4,10203 | |
lxml/html/usedoctest.py,sha256=tPlmVz4KK1GRKV5DJLrdVECeqsT9PlDzSqqTodVi5s0,249 | |
lxml/includes/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | |
lxml/includes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | |
lxml/includes/__pycache__/__init__.cpython-37.pyc,, | |
lxml/includes/c14n.pxd,sha256=pGf910mVH9IdBb7r_aE-J59axIQcqFH4Sx_Tm0PA1m0,1123 | |
lxml/includes/config.pxd,sha256=H6Mrl8It21hzRI2hzMId9W48QqkYYkoLT4dniLNmdTw,96 | |
lxml/includes/dtdvalid.pxd,sha256=Rf2vRBbM4O1AOiIsUk_5M7pV3Dz309sS7Ccd2zGFHT0,671 | |
lxml/includes/etree_defs.h,sha256=e8Nlc-wG74xRyK3EqonkWx02LGzq7pl6bmLYzuWO9_Q,15559 | |
lxml/includes/etreepublic.pxd,sha256=3cdjIVlfkeZWYUav4y_T2uHwAo8yUCTlCvNLEvsZ_aI,10122 | |
lxml/includes/htmlparser.pxd,sha256=Va2qbs5zVokERn57HbDY__CiBQOoCS4uI9wEfCnT6zk,2868 | |
lxml/includes/libexslt/exslt.h,sha256=Z91WbHADa4o5-kJufstf6Y100qBTMqBiK1aZsxcp_Ao,3018 | |
lxml/includes/libexslt/exsltconfig.h,sha256=uUKX4TumO91Fg-Y2KB2Lwh-V6m4DB1DH1yO1z03YyWY,1291 | |
lxml/includes/libexslt/exsltexports.h,sha256=b5995w60ve9w6ZfdJCxtVnaP8kmY9chXldRmE_9DmG4,3383 | |
lxml/includes/libexslt/libexslt.h,sha256=EnT0rQzqljwg12CNnc-wd4IyWYO19IE5-nKxnCUefLQ,674 | |
lxml/includes/libxml/DOCBparser.h,sha256=QCzfpD-a5w-3T9fbCLhJI12H_iN5LVtOiWu3L21eyJo,3157 | |
lxml/includes/libxml/HTMLparser.h,sha256=3LY9MRXs5ZCMbF91gTQol33ceRpambWVY0ciEPu6otI,9410 | |
lxml/includes/libxml/HTMLtree.h,sha256=-i37-IqS_LU9jei_9yUi6Fs80ZErlrCGZWwaTHIg9p8,3646 | |
lxml/includes/libxml/SAX.h,sha256=EgEjbXP_0OtfSYEb6FHHnWmPEgnQYZ5IaX8Ehh7YvVg,4341 | |
lxml/includes/libxml/SAX2.h,sha256=9Z6vTKhysqsnLMv63aJTcyRLh6Qm8Base48qRZWMQ0M,4949 | |
lxml/includes/libxml/c14n.h,sha256=yJO-_m0HOgTfbBiv_j-P02LftZ8_ofzIpJEonBPyULY,3109 | |
lxml/includes/libxml/catalog.h,sha256=ugBmcsBjZefAsAE8vs7OwMZonYVBzDj2rNyWVF4YK3I,4905 | |
lxml/includes/libxml/chvalid.h,sha256=H9_NIeLyDhdKDZg9euK_5b5QmeXWWNq4KTENFkcUUtA,5159 | |
lxml/includes/libxml/debugXML.h,sha256=eatflryQfcmuAgmyz_f3JoSpTmvDA26mrcUjd7vwSLY,5152 | |
lxml/includes/libxml/dict.h,sha256=o36P53gHvahFTU4K-RMkeqy5oJzXza_akJ069CmdorE,1955 | |
lxml/includes/libxml/encoding.h,sha256=4D82UVBCn1biuxeAOarKDGqu5u-HOWZABy3-2Ns_IeQ,8301 | |
lxml/includes/libxml/entities.h,sha256=uJ8I3voqfwMEw8MQJveLtS0mOanjzzREreKrSs8_018,4712 | |
lxml/includes/libxml/globals.h,sha256=CHp7u46nJ-qE4N4tFVS6xRXnQgrnqEvKA0u2744F34M,14694 | |
lxml/includes/libxml/hash.h,sha256=yqN7eHBJ4GrDbMl-9D9DWWC_fOh7xDPF3OdVzKO-qdw,6492 | |
lxml/includes/libxml/list.h,sha256=QTym8NLQGYBe91ddyqhXW4fZIJBf13VHOC7T54RBzyw,3366 | |
lxml/includes/libxml/nanoftp.h,sha256=ZOKrFIQjW-h4d7gsG45h05GhpqdD9f9lCwgvP2D8l8Q,3762 | |
lxml/includes/libxml/nanohttp.h,sha256=LLgN_JcupVO24_Oki895yVKsJzFe5mcF2vH8Ekymq_I,2005 | |
lxml/includes/libxml/parser.h,sha256=fAvfRpely07ySdKS8MJRCwcyOoZpM-h5y6tPhXCZaNs,39717 | |
lxml/includes/libxml/parserInternals.h,sha256=2c5f6anmOJaYlqJhAky-mtn6CNBFFy1COvPXHtDkb2I,17418 | |
lxml/includes/libxml/pattern.h,sha256=FK85vxjka2kzTPZeCep57HMa7qc-I46WH3fOkUYOsWc,2586 | |
lxml/includes/libxml/relaxng.h,sha256=D1ufdqizDSPx8wOL_ZsjuIl--nK52cWMiZwIdEIbhSc,5996 | |
lxml/includes/libxml/schemasInternals.h,sha256=I1VSv5fO7wDHdgSoR2xrcUSGL1UEeOgabpnZT5wXayo,26243 | |
lxml/includes/libxml/schematron.h,sha256=lNOe9oFbhBqk1GVv4nJ4eZR3tieJVuw-gqbrmPtG3K4,4371 | |
lxml/includes/libxml/threads.h,sha256=xJjVOa3EFYx3INBFQ_-IHI4Xm6AwNBgAlLzfK8mNEJ8,1852 | |
lxml/includes/libxml/tree.h,sha256=80Hw_WvLrk4P3yruakmhoIzMXn0RLtsikDIGUk2n8Tc,38105 | |
lxml/includes/libxml/uri.h,sha256=nGU1MVe2zr7e3jReDYKCMPQkTkQRN-iNlLewkpP9cLo,2664 | |
lxml/includes/libxml/valid.h,sha256=__oCp9iK1nJc7s2iRZqtz8iHu6--9-XI_MWLXIBq_C0,13622 | |
lxml/includes/libxml/xinclude.h,sha256=iL_sqfaWIhThheHWBbEUQt59_sd-jnExhxaYeXxInqk,2967 | |
lxml/includes/libxml/xlink.h,sha256=hV-cvCxIJ_F1VdWcMYZ3w2jkGwWyLc9SZ8PdnUZxYNs,5040 | |
lxml/includes/libxml/xmlIO.h,sha256=-5MYRiCCuO81Y23ldZJU7Uh_my3U7yyg9rMfahcVans,10611 | |
lxml/includes/libxml/xmlautomata.h,sha256=rIJxLWBGZrfkFYDXdJZBoAhygp93vFBO_WI6nUCxBN4,3956 | |
lxml/includes/libxml/xmlerror.h,sha256=I7xskOqrTkctmlL76j2-_VMmMB_RPcXTglE1jHRXa5g,36808 | |
lxml/includes/libxml/xmlexports.h,sha256=xKNFpSDT-d53xTWeyClzXtsFusNiyo9l4Iwo4JNc7MM,3920 | |
lxml/includes/libxml/xmlmemory.h,sha256=Z6y0IQCIKXfVnYOPiGoFwc5Hq4rUdZ5AJwKJeav0TNw,5945 | |
lxml/includes/libxml/xmlmodule.h,sha256=c5vXusZj46FsM9UPHGt8g9gdPhTVOH1rJEFf2pJ8K4c,1170 | |
lxml/includes/libxml/xmlreader.h,sha256=mAAVz-ZYrOt56fzLds-ytusW7UqEGS5L9BGi5kzpTv4,12607 | |
lxml/includes/libxml/xmlregexp.h,sha256=UHbZDD3CZVn4NDiaHB64Aa-90pxzSsconMqneCp1ZDc,5458 | |
lxml/includes/libxml/xmlsave.h,sha256=8QlBKC6tuZ7lFQr_KJDTAxp4gmXtZWg-KGmLMkD7TCw,2337 | |
lxml/includes/libxml/xmlschemas.h,sha256=mvK9-OmM-FxfAPSpfkte4R-EWdkwvY6WFX6JmUeF3_U,7069 | |
lxml/includes/libxml/xmlschemastypes.h,sha256=alMLzZOds02Ksbv7K86owr0_IXjFPQ2Kk99rGhniZPE,4841 | |
lxml/includes/libxml/xmlstring.h,sha256=P_40FyEE40e_8h8Tlk9TSNze1zrJygFgsxkFydPnnPs,5511 | |
lxml/includes/libxml/xmlunicode.h,sha256=TpTZ8Bf313Rs9m-ww1cBCHwvW-uHj9tQ125iQfaDorU,9993 | |
lxml/includes/libxml/xmlversion.h,sha256=25QgUEOSP9i2QkQjjzbYfxImb0vy4VfuX3Fitfauub0,8634 | |
lxml/includes/libxml/xmlwriter.h,sha256=ddjdRh9PBH-FynmNgjkRg1JFBRzlZBPyyh7FX3JX1lY,21265 | |
lxml/includes/libxml/xpath.h,sha256=zo45KZIebdrOgK-Zu7kWQMm9yAs4pt_5b5QGnDApMc0,16398 | |
lxml/includes/libxml/xpathInternals.h,sha256=EWeEX1yCVHsUUeDxxOe-4jO25LBEDoM564CoPc1YNGU,19353 | |
lxml/includes/libxml/xpointer.h,sha256=6MQwhGyIy3PKp9yWaXRg0LAdL-bR2jjFNYUxUSkc6lk,3359 | |
lxml/includes/libxslt/attributes.h,sha256=vwJCNwOWLxNtoTh4Zqf9jhlxOjYJ-2e6KbaDEM7sEHY,930 | |
lxml/includes/libxslt/documents.h,sha256=kBihgH5pqRvFalhm_fOFHtJTFhTpBcm681yT5dxgwfw,2704 | |
lxml/includes/libxslt/extensions.h,sha256=bTyuv5_mj-RdPFhpT89LIM-iaMJ5dZtJFJkq0sbfaxE,6903 | |
lxml/includes/libxslt/extra.h,sha256=MqVdYuHZNw4wYQZdHs0mLY0xMjV-OoiZJeP7NG5iZgw,1641 | |
lxml/includes/libxslt/functions.h,sha256=LOR4F-xCPfST2QulovzKF2bQvan_Xw_jjaF5pqECDdM,2006 | |
lxml/includes/libxslt/imports.h,sha256=18kIjoGqdFXR63Ce3ZtzxsTiYV3XGKpchYakMUPDuUI,1840 | |
lxml/includes/libxslt/keys.h,sha256=16v25VEluS7jYhgg6gYFwVxgGMn-1ctnlhhWWT4RcBY,1155 | |
lxml/includes/libxslt/libxslt.h,sha256=2_zwp2lV_LzH4c9bitbn5vOyixfrnk1Yy26Cc2uEJ2I,860 | |
lxml/includes/libxslt/namespaces.h,sha256=VofSn2Kkn-a5JyRKCmY3jPp7amQy3n09vzy0KUQt4q0,1666 | |
lxml/includes/libxslt/numbersInternals.h,sha256=Eg5gYZ5p3h0_e5wyI61S-0E6_ArVJzv0yr63j6BU2fc,2019 | |
lxml/includes/libxslt/preproc.h,sha256=-19NH8t3q1NGsG6OsnctVHkk43tfNgbp1ei5glt_jNU,892 | |
lxml/includes/libxslt/security.h,sha256=fUD1cy_WxFCTvTNAF0WOQIU4p5CNWn1LHFyZJd-Fx5U,2652 | |
lxml/includes/libxslt/templates.h,sha256=bnt6Jqui6KU5pNUdMNPbQZkZ5d-VTWqC0TMGkOlVoIo,2268 | |
lxml/includes/libxslt/transform.h,sha256=UUHNbTEgGEVVaIhC86wi_CpffipfLob619bxiPpEwNI,6328 | |
lxml/includes/libxslt/trio.h,sha256=wTiet4_VXcF-NifQQHp_KFKIg4AYHI7WE3UcUzUk_z8,7199 | |
lxml/includes/libxslt/triodef.h,sha256=l1-U1p5j0OUAdi7sUXqL5mJ_TBbmzNJkHvWfTyLpx18,6692 | |
lxml/includes/libxslt/variables.h,sha256=09J1Jx8iDk1CXye24-3cYLYtI-ZaMwRh390jpLZ6TDo,3338 | |
lxml/includes/libxslt/win32config.h,sha256=RosX8sl9SQdWFn_1GLSX5OhQgoI78eeqfmEYQ0slbig,2929 | |
lxml/includes/libxslt/xslt.h,sha256=wmFx2Q31Pd8Iq2phAQpY9J3QQatb8lWg3gABtqKFgEw,1964 | |
lxml/includes/libxslt/xsltInternals.h,sha256=_kZYrVzE1EQlUJR8Y-QlVEUjuj4gCB0D7dxaNWXFkaw,57359 | |
lxml/includes/libxslt/xsltconfig.h,sha256=vFgdnmpfQSP8tRm6Bx5an9qrTSJOhun66DwZ7ChR3os,3825 | |
lxml/includes/libxslt/xsltexports.h,sha256=QLg1cfT3LW3m1iQnduDbstdg88cIBlPkaxMx3hlB7vE,3426 | |
lxml/includes/libxslt/xsltlocale.h,sha256=GL2phHwee_mJMaSh3K3oeRRuidcsTmomqe1blB7uil8,1396 | |
lxml/includes/libxslt/xsltutils.h,sha256=D2Gqop4cieJiOsQtLWTJezGea9kONcUFxeykLjGRI_E,8297 | |
lxml/includes/lxml-version.h,sha256=DxAwZukabp5qkRTdQq4djXyJjJDWYj0rhpusbZ92vy4,74 | |
lxml/includes/relaxng.pxd,sha256=12yapjqDZLF_HTlcuSXSoQpPGK1NU7fj7gzS1EF8kZw,2669 | |
lxml/includes/schematron.pxd,sha256=5_PUpLHTzzYZ_d-8d2OjKLdwtLIdOm7C20HFUAX8hD4,1640 | |
lxml/includes/tree.pxd,sha256=dtnXNbEfxV3-5kOwWYkYoCE8HT5zvFVNdKFaIBuNXBc,20091 | |
lxml/includes/uri.pxd,sha256=5wPtpGU1JtdmpZMTzR8EswazihP3dxkns6Fgo9NWOt8,139 | |
lxml/includes/xinclude.pxd,sha256=onXD71LVdAbXjUj82_SDtSixNsNh8xbu6Nd9x0V3bmM,852 | |
lxml/includes/xmlerror.pxd,sha256=rV-nzG4TwgnNjuw7w68abmGDk_c8LGm4Y8f5oPw8OVc,57935 | |
lxml/includes/xmlparser.pxd,sha256=v-G3Y11eR4C1e2ImWLmGZpuTA90Y9N_uy-8H0-zwJY8,10852 | |
lxml/includes/xmlschema.pxd,sha256=yYQFrIKAQ_feenENV24X2AZyBIYGBltRDm9qB7CYMww,1696 | |
lxml/includes/xpath.pxd,sha256=tKYAcwpbSRq8qrsZ2ISVYvEaLnCV9GadNC5o_f8Ua_g,5794 | |
lxml/includes/xslt.pxd,sha256=qBU-0dLhIMQFv58I4q1XkBq9QJpJzKEAK9qBFPXBj_g,8341 | |
lxml/isoschematron/__init__.py,sha256=NUoI0bb87VB2XePzFcMtwUasrUAQACfb3Z9dPaMz6Fs,12399 | |
lxml/isoschematron/__pycache__/__init__.cpython-37.pyc,, | |
lxml/isoschematron/resources/rng/iso-schematron.rng,sha256=VsWxPyi3iViJDDbjJJw0wWkEHkLrz9zoCA8zJLor9N4,18337 | |
lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl,sha256=ObebsB8Wt-d3uIA_U5NU85TpnQ3PxPX38TdOAqosMac,3172 | |
lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl,sha256=QweRrIIM-zFcgg98GXA2CaWfIbgVE0XKEeYSfvv67A0,4563 | |
lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl,sha256=xSZ_Ekq_I-62ZpiE5AqYYHwFW_qh855zt9V4_s7rbkY,11703 | |
lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl,sha256=x42QJ-dxQ1waPzydsCoQnp2Xj15y53nW43O7BuoDRHk,39957 | |
lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl,sha256=Tr9BnO6pzjVWwhqJfm10UlvAy95EgfSCz2iMlrVGT6Q,2015 | |
lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl,sha256=ue8q_88X4e_jsJizo31GRNBxNhdxkEE9fY20oq0Iqwk,71764 | |
lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl,sha256=BBAdsVSi5zAzeGepuN6gS1saQINDqITXKplmmj4dTWg,20382 | |
lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt,sha256=OGLiFswuLJEW5EPYKOeoauuCJFEtVa6jyzBE1OcJI98,3310 | |
lxml/lxml.etree.h,sha256=d1kAAdlJRoSCXqU4ShvbSEWXd7OtPMoHDsjGlpC55VA,8778 | |
lxml/lxml.etree_api.h,sha256=QObRHIEJ_2M2PPWsxfZ-9FxrxpuLFVY8OUW7sULYmnA,17691 | |
lxml/objectify.cp37-win32.pyd,sha256=pzAQEBHGEG1RYAWZUdrJ1Jq5nqbmKuCXdSIREA1iAwU,1547776 | |
lxml/pyclasslookup.py,sha256=gLD1HM2HtITYYiGzjEOewSwbB7XkVx_NZv_quCt79Oc,92 | |
lxml/sax.cp37-win32.pyd,sha256=Z4_3tdh8SzFyWJntMsbsVE7xdD4rI4BEpz6_t3fPpvM,116224 | |
lxml/sax.py,sha256=xwHH7zbL6Vzp26fm50o2Jw1OkdualIcN4QoccYWRbqM,9406 | |
lxml/usedoctest.py,sha256=qRgZKQVcAZcl-zN0AIXVJnOsETUXz2nPXkxuzs1lGgk,230 |
lxml |
Wheel-Version: 1.0 | |
Generator: bdist_wheel (0.33.4) | |
Root-Is-Purelib: false | |
Tag: cp37-cp37m-win32 | |
# this is a package | |
def get_include(): | |
""" | |
Returns a list of header include paths (for lxml itself, libxml2 | |
and libxslt) needed to compile C code against lxml if it was built | |
with statically linked libraries. | |
""" | |
import os | |
lxml_path = __path__[0] | |
include_path = os.path.join(lxml_path, 'includes') | |
includes = [include_path, lxml_path] | |
for name in os.listdir(include_path): | |
path = os.path.join(include_path, name) | |
if os.path.isdir(path): | |
includes.append(path) | |
return includes | |
# cython: language_level=2 | |
# | |
# ElementTree | |
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $ | |
# | |
# limited xpath support for element trees | |
# | |
# history: | |
# 2003-05-23 fl created | |
# 2003-05-28 fl added support for // etc | |
# 2003-08-27 fl fixed parsing of periods in element names | |
# 2007-09-10 fl new selection engine | |
# 2007-09-12 fl fixed parent selector | |
# 2007-09-13 fl added iterfind; changed findall to return a list | |
# 2007-11-30 fl added namespaces support | |
# 2009-10-30 fl added child element value filter | |
# | |
# Copyright (c) 2003-2009 by Fredrik Lundh. All rights reserved. | |
# | |
# fredrik@pythonware.com | |
# http://www.pythonware.com | |
# | |
# -------------------------------------------------------------------- | |
# The ElementTree toolkit is | |
# | |
# Copyright (c) 1999-2009 by Fredrik Lundh | |
# | |
# By obtaining, using, and/or copying this software and/or its | |
# associated documentation, you agree that you have read, understood, | |
# and will comply with the following terms and conditions: | |
# | |
# Permission to use, copy, modify, and distribute this software and | |
# its associated documentation for any purpose and without fee is | |
# hereby granted, provided that the above copyright notice appears in | |
# all copies, and that both that copyright notice and this permission | |
# notice appear in supporting documentation, and that the name of | |
# Secret Labs AB or the author not be used in advertising or publicity | |
# pertaining to distribution of the software without specific, written | |
# prior permission. | |
# | |
# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- | |
# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR | |
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY | |
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
# OF THIS SOFTWARE. | |
# -------------------------------------------------------------------- | |
## | |
# Implementation module for XPath support. There's usually no reason | |
# to import this module directly; the <b>ElementTree</b> does this for | |
# you, if needed. | |
## | |
from __future__ import absolute_import | |
import re | |
xpath_tokenizer_re = re.compile( | |
"(" | |
"'[^']*'|\"[^\"]*\"|" | |
"::|" | |
"//?|" | |
r"\.\.|" | |
r"\(\)|" | |
r"[/.*:\[\]\(\)@=])|" | |
r"((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|" | |
r"\s+" | |
) | |
def xpath_tokenizer(pattern, namespaces=None): | |
# ElementTree uses '', lxml used None originally. | |
default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None | |
parsing_attribute = False | |
for token in xpath_tokenizer_re.findall(pattern): | |
ttype, tag = token | |
if tag and tag[0] != "{": | |
if ":" in tag: | |
prefix, uri = tag.split(":", 1) | |
try: | |
if not namespaces: | |
raise KeyError | |
yield ttype, "{%s}%s" % (namespaces[prefix], uri) | |
except KeyError: | |
raise SyntaxError("prefix %r not found in prefix map" % prefix) | |
elif default_namespace and not parsing_attribute: | |
yield ttype, "{%s}%s" % (default_namespace, tag) | |
else: | |
yield token | |
parsing_attribute = False | |
else: | |
yield token | |
parsing_attribute = ttype == '@' | |
def prepare_child(next, token): | |
tag = token[1] | |
def select(result): | |
for elem in result: | |
for e in elem.iterchildren(tag): | |
yield e | |
return select | |
def prepare_star(next, token): | |
def select(result): | |
for elem in result: | |
for e in elem.iterchildren('*'): | |
yield e | |
return select | |
def prepare_self(next, token): | |
def select(result): | |
return result | |
return select | |
def prepare_descendant(next, token): | |
token = next() | |
if token[0] == "*": | |
tag = "*" | |
elif not token[0]: | |
tag = token[1] | |
else: | |
raise SyntaxError("invalid descendant") | |
def select(result): | |
for elem in result: | |
for e in elem.iterdescendants(tag): | |
yield e | |
return select | |
def prepare_parent(next, token): | |
def select(result): | |
for elem in result: | |
parent = elem.getparent() | |
if parent is not None: | |
yield parent | |
return select | |
def prepare_predicate(next, token): | |
# FIXME: replace with real parser!!! refs: | |
# http://effbot.org/zone/simple-iterator-parser.htm | |
# http://javascript.crockford.com/tdop/tdop.html | |
signature = '' | |
predicate = [] | |
while 1: | |
token = next() | |
if token[0] == "]": | |
break | |
if token == ('', ''): | |
# ignore whitespace | |
continue | |
if token[0] and token[0][:1] in "'\"": | |
token = "'", token[0][1:-1] | |
signature += token[0] or "-" | |
predicate.append(token[1]) | |
# use signature to determine predicate type | |
if signature == "@-": | |
# [@attribute] predicate | |
key = predicate[1] | |
def select(result): | |
for elem in result: | |
if elem.get(key) is not None: | |
yield elem | |
return select | |
if signature == "@-='": | |
# [@attribute='value'] | |
key = predicate[1] | |
value = predicate[-1] | |
def select(result): | |
for elem in result: | |
if elem.get(key) == value: | |
yield elem | |
return select | |
if signature == "-" and not re.match(r"-?\d+$", predicate[0]): | |
# [tag] | |
tag = predicate[0] | |
def select(result): | |
for elem in result: | |
for _ in elem.iterchildren(tag): | |
yield elem | |
break | |
return select | |
if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])): | |
# [.='value'] or [tag='value'] | |
tag = predicate[0] | |
value = predicate[-1] | |
if tag: | |
def select(result): | |
for elem in result: | |
for e in elem.iterchildren(tag): | |
if "".join(e.itertext()) == value: | |
yield elem | |
break | |
else: | |
def select(result): | |
for elem in result: | |
if "".join(elem.itertext()) == value: | |
yield elem | |
return select | |
if signature == "-" or signature == "-()" or signature == "-()-": | |
# [index] or [last()] or [last()-index] | |
if signature == "-": | |
# [index] | |
index = int(predicate[0]) - 1 | |
if index < 0: | |
if index == -1: | |
raise SyntaxError( | |
"indices in path predicates are 1-based, not 0-based") | |
else: | |
raise SyntaxError("path index >= 1 expected") | |
else: | |
if predicate[0] != "last": | |
raise SyntaxError("unsupported function") | |
if signature == "-()-": | |
try: | |
index = int(predicate[2]) - 1 | |
except ValueError: | |
raise SyntaxError("unsupported expression") | |
else: | |
index = -1 | |
def select(result): | |
for elem in result: | |
parent = elem.getparent() | |
if parent is None: | |
continue | |
try: | |
# FIXME: what if the selector is "*" ? | |
elems = list(parent.iterchildren(elem.tag)) | |
if elems[index] is elem: | |
yield elem | |
except IndexError: | |
pass | |
return select | |
raise SyntaxError("invalid predicate") | |
ops = { | |
"": prepare_child, | |
"*": prepare_star, | |
".": prepare_self, | |
"..": prepare_parent, | |
"//": prepare_descendant, | |
"[": prepare_predicate, | |
} | |
# -------------------------------------------------------------------- | |
_cache = {} | |
def _build_path_iterator(path, namespaces): | |
"""compile selector pattern""" | |
if path[-1:] == "/": | |
path += "*" # implicit all (FIXME: keep this?) | |
cache_key = (path,) | |
if namespaces: | |
# lxml originally used None for the default namespace but ElementTree uses the | |
# more convenient (all-strings-dict) empty string, so we support both here, | |
# preferring the more convenient '', as long as they aren't ambiguous. | |
if None in namespaces: | |
if '' in namespaces and namespaces[None] != namespaces['']: | |
raise ValueError("Ambiguous default namespace provided: %r versus %r" % ( | |
namespaces[None], namespaces[''])) | |
cache_key += (namespaces[None],) + tuple(sorted( | |
item for item in namespaces.items() if item[0] is not None)) | |
else: | |
cache_key += tuple(sorted(namespaces.items())) | |
try: | |
return _cache[cache_key] | |
except KeyError: | |
pass | |
if len(_cache) > 100: | |
_cache.clear() | |
if path[:1] == "/": | |
raise SyntaxError("cannot use absolute path on element") | |
stream = iter(xpath_tokenizer(path, namespaces)) | |
try: | |
_next = stream.next | |
except AttributeError: | |
# Python 3 | |
_next = stream.__next__ | |
try: | |
token = _next() | |
except StopIteration: | |
raise SyntaxError("empty path expression") | |
selector = [] | |
while 1: | |
try: | |
selector.append(ops[token[0]](_next, token)) | |
except StopIteration: | |
raise SyntaxError("invalid path") | |
try: | |
token = _next() | |
if token[0] == "/": | |
token = _next() | |
except StopIteration: | |
break | |
_cache[cache_key] = selector | |
return selector | |
## | |
# Iterate over the matching nodes | |
def iterfind(elem, path, namespaces=None): | |
selector = _build_path_iterator(path, namespaces) | |
result = iter((elem,)) | |
for select in selector: | |
result = select(result) | |
return result | |
## | |
# Find first matching object. | |
def find(elem, path, namespaces=None): | |
it = iterfind(elem, path, namespaces) | |
try: | |
return next(it) | |
except StopIteration: | |
return None | |
## | |
# Find all matching objects. | |
def findall(elem, path, namespaces=None): | |
return list(iterfind(elem, path, namespaces)) | |
## | |
# Find text for first matching object. | |
def findtext(elem, path, default=None, namespaces=None): | |
el = find(elem, path, namespaces) | |
if el is None: | |
return default | |
else: | |
return el.text or '' |
# cython: language_level=2 | |
# | |
# Element generator factory by Fredrik Lundh. | |
# | |
# Source: | |
# http://online.effbot.org/2006_11_01_archive.htm#et-builder | |
# http://effbot.python-hosting.com/file/stuff/sandbox/elementlib/builder.py | |
# | |
# -------------------------------------------------------------------- | |
# The ElementTree toolkit is | |
# | |
# Copyright (c) 1999-2004 by Fredrik Lundh | |
# | |
# By obtaining, using, and/or copying this software and/or its | |
# associated documentation, you agree that you have read, understood, | |
# and will comply with the following terms and conditions: | |
# | |
# Permission to use, copy, modify, and distribute this software and | |
# its associated documentation for any purpose and without fee is | |
# hereby granted, provided that the above copyright notice appears in | |
# all copies, and that both that copyright notice and this permission | |
# notice appear in supporting documentation, and that the name of | |
# Secret Labs AB or the author not be used in advertising or publicity | |
# pertaining to distribution of the software without specific, written | |
# prior permission. | |
# | |
# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- | |
# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR | |
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY | |
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
# OF THIS SOFTWARE. | |
# -------------------------------------------------------------------- | |
""" | |
The ``E`` Element factory for generating XML documents. | |
""" | |
from __future__ import absolute_import | |
import lxml.etree as ET | |
from functools import partial | |
try: | |
basestring | |
except NameError: | |
basestring = str | |
try: | |
unicode | |
except NameError: | |
unicode = str | |
class ElementMaker(object): | |
"""Element generator factory. | |
Unlike the ordinary Element factory, the E factory allows you to pass in | |
more than just a tag and some optional attributes; you can also pass in | |
text and other elements. The text is added as either text or tail | |
attributes, and elements are inserted at the right spot. Some small | |
examples:: | |
>>> from lxml import etree as ET | |
>>> from lxml.builder import E | |
>>> ET.tostring(E("tag")) | |
'<tag/>' | |
>>> ET.tostring(E("tag", "text")) | |
'<tag>text</tag>' | |
>>> ET.tostring(E("tag", "text", key="value")) | |
'<tag key="value">text</tag>' | |
>>> ET.tostring(E("tag", E("subtag", "text"), "tail")) | |
'<tag><subtag>text</subtag>tail</tag>' | |
For simple tags, the factory also allows you to write ``E.tag(...)`` instead | |
of ``E('tag', ...)``:: | |
>>> ET.tostring(E.tag()) | |
'<tag/>' | |
>>> ET.tostring(E.tag("text")) | |
'<tag>text</tag>' | |
>>> ET.tostring(E.tag(E.subtag("text"), "tail")) | |
'<tag><subtag>text</subtag>tail</tag>' | |
Here's a somewhat larger example; this shows how to generate HTML | |
documents, using a mix of prepared factory functions for inline elements, | |
nested ``E.tag`` calls, and embedded XHTML fragments:: | |
# some common inline elements | |
A = E.a | |
I = E.i | |
B = E.b | |
def CLASS(v): | |
# helper function, 'class' is a reserved word | |
return {'class': v} | |
page = ( | |
E.html( | |
E.head( | |
E.title("This is a sample document") | |
), | |
E.body( | |
E.h1("Hello!", CLASS("title")), | |
E.p("This is a paragraph with ", B("bold"), " text in it!"), | |
E.p("This is another paragraph, with a ", | |
A("link", href="http://www.python.org"), "."), | |
E.p("Here are some reserved characters: <spam&egg>."), | |
ET.XML("<p>And finally, here is an embedded XHTML fragment.</p>"), | |
) | |
) | |
) | |
print ET.tostring(page) | |
Here's a prettyprinted version of the output from the above script:: | |
<html> | |
<head> | |
<title>This is a sample document</title> | |
</head> | |
<body> | |
<h1 class="title">Hello!</h1> | |
<p>This is a paragraph with <b>bold</b> text in it!</p> | |
<p>This is another paragraph, with <a href="http://www.python.org">link</a>.</p> | |
<p>Here are some reserved characters: <spam&egg>.</p> | |
<p>And finally, here is an embedded XHTML fragment.</p> | |
</body> | |
</html> | |
For namespace support, you can pass a namespace map (``nsmap``) | |
and/or a specific target ``namespace`` to the ElementMaker class:: | |
>>> E = ElementMaker(namespace="http://my.ns/") | |
>>> print(ET.tostring( E.test )) | |
<test xmlns="http://my.ns/"/> | |
>>> E = ElementMaker(namespace="http://my.ns/", nsmap={'p':'http://my.ns/'}) | |
>>> print(ET.tostring( E.test )) | |
<p:test xmlns:p="http://my.ns/"/> | |
""" | |
def __init__(self, typemap=None, | |
namespace=None, nsmap=None, makeelement=None): | |
if namespace is not None: | |
self._namespace = '{' + namespace + '}' | |
else: | |
self._namespace = None | |
if nsmap: | |
self._nsmap = dict(nsmap) | |
else: | |
self._nsmap = None | |
if makeelement is not None: | |
assert callable(makeelement) | |
self._makeelement = makeelement | |
else: | |
self._makeelement = ET.Element | |
# initialize type map for this element factory | |
if typemap: | |
typemap = dict(typemap) | |
else: | |
typemap = {} | |
def add_text(elem, item): | |
try: | |
elem[-1].tail = (elem[-1].tail or "") + item | |
except IndexError: | |
elem.text = (elem.text or "") + item | |
def add_cdata(elem, cdata): | |
if elem.text: | |
raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text) | |
elem.text = cdata | |
if str not in typemap: | |
typemap[str] = add_text | |
if unicode not in typemap: | |
typemap[unicode] = add_text | |
if ET.CDATA not in typemap: | |
typemap[ET.CDATA] = add_cdata | |
def add_dict(elem, item): | |
attrib = elem.attrib | |
for k, v in item.items(): | |
if isinstance(v, basestring): | |
attrib[k] = v | |
else: | |
attrib[k] = typemap[type(v)](None, v) | |
if dict not in typemap: | |
typemap[dict] = add_dict | |
self._typemap = typemap | |
def __call__(self, tag, *children, **attrib): | |
typemap = self._typemap | |
if self._namespace is not None and tag[0] != '{': | |
tag = self._namespace + tag | |
elem = self._makeelement(tag, nsmap=self._nsmap) | |
if attrib: | |
typemap[dict](elem, attrib) | |
for item in children: | |
if callable(item): | |
item = item() | |
t = typemap.get(type(item)) | |
if t is None: | |
if ET.iselement(item): | |
elem.append(item) | |
continue | |
for basetype in type(item).__mro__: | |
# See if the typemap knows of any of this type's bases. | |
t = typemap.get(basetype) | |
if t is not None: | |
break | |
else: | |
raise TypeError("bad argument type: %s(%r)" % | |
(type(item).__name__, item)) | |
v = t(elem, item) | |
if v: | |
typemap.get(type(v))(elem, v) | |
return elem | |
def __getattr__(self, tag): | |
return partial(self, tag) | |
# create factory object | |
E = ElementMaker() |
"""CSS Selectors based on XPath. | |
This module supports selecting XML/HTML tags based on CSS selectors. | |
See the `CSSSelector` class for details. | |
This is a thin wrapper around cssselect 0.7 or later. | |
""" | |
from __future__ import absolute_import | |
from . import etree | |
try: | |
import cssselect as external_cssselect | |
except ImportError: | |
raise ImportError( | |
'cssselect does not seem to be installed. ' | |
'See http://packages.python.org/cssselect/') | |
SelectorSyntaxError = external_cssselect.SelectorSyntaxError | |
ExpressionError = external_cssselect.ExpressionError | |
SelectorError = external_cssselect.SelectorError | |
__all__ = ['SelectorSyntaxError', 'ExpressionError', 'SelectorError', | |
'CSSSelector'] | |
class LxmlTranslator(external_cssselect.GenericTranslator): | |
""" | |
A custom CSS selector to XPath translator with lxml-specific extensions. | |
""" | |
def xpath_contains_function(self, xpath, function): | |
# Defined there, removed in later drafts: | |
# http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#content-selectors | |
if function.argument_types() not in (['STRING'], ['IDENT']): | |
raise ExpressionError( | |
"Expected a single string or ident for :contains(), got %r" | |
% function.arguments) | |
value = function.arguments[0].value | |
return xpath.add_condition( | |
'contains(__lxml_internal_css:lower-case(string(.)), %s)' | |
% self.xpath_literal(value.lower())) | |
class LxmlHTMLTranslator(LxmlTranslator, external_cssselect.HTMLTranslator): | |
""" | |
lxml extensions + HTML support. | |
""" | |
def _make_lower_case(context, s): | |
return s.lower() | |
ns = etree.FunctionNamespace('http://codespeak.net/lxml/css/') | |
ns.prefix = '__lxml_internal_css' | |
ns['lower-case'] = _make_lower_case | |
class CSSSelector(etree.XPath): | |
"""A CSS selector. | |
Usage:: | |
>>> from lxml import etree, cssselect | |
>>> select = cssselect.CSSSelector("a tag > child") | |
>>> root = etree.XML("<a><b><c/><tag><child>TEXT</child></tag></b></a>") | |
>>> [ el.tag for el in select(root) ] | |
['child'] | |
To use CSS namespaces, you need to pass a prefix-to-namespace | |
mapping as ``namespaces`` keyword argument:: | |
>>> rdfns = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' | |
>>> select_ns = cssselect.CSSSelector('root > rdf|Description', | |
... namespaces={'rdf': rdfns}) | |
>>> rdf = etree.XML(( | |
... '<root xmlns:rdf="%s">' | |
... '<rdf:Description>blah</rdf:Description>' | |
... '</root>') % rdfns) | |
>>> [(el.tag, el.text) for el in select_ns(rdf)] | |
[('{http://www.w3.org/1999/02/22-rdf-syntax-ns#}Description', 'blah')] | |
""" | |
def __init__(self, css, namespaces=None, translator='xml'): | |
if translator == 'xml': | |
translator = LxmlTranslator() | |
elif translator == 'html': | |
translator = LxmlHTMLTranslator() | |
elif translator == 'xhtml': | |
translator = LxmlHTMLTranslator(xhtml=True) | |
path = translator.css_to_xpath(css) | |
etree.XPath.__init__(self, path, namespaces=namespaces) | |
self.css = css | |
def __repr__(self): | |
return '<%s %s for %r>' % ( | |
self.__class__.__name__, | |
hex(abs(id(self)))[2:], | |
self.css) |
""" | |
lxml-based doctest output comparison. | |
Note: normally, you should just import the `lxml.usedoctest` and | |
`lxml.html.usedoctest` modules from within a doctest, instead of this | |
one:: | |
>>> import lxml.usedoctest # for XML output | |
>>> import lxml.html.usedoctest # for HTML output | |
To use this module directly, you must call ``lxmldoctest.install()``, | |
which will cause doctest to use this in all subsequent calls. | |
This changes the way output is checked and comparisons are made for | |
XML or HTML-like content. | |
XML or HTML content is noticed because the example starts with ``<`` | |
(it's HTML if it starts with ``<html``). You can also use the | |
``PARSE_HTML`` and ``PARSE_XML`` flags to force parsing. | |
Some rough wildcard-like things are allowed. Whitespace is generally | |
ignored (except in attributes). In text (attributes and text in the | |
body) you can use ``...`` as a wildcard. In an example it also | |
matches any trailing tags in the element, though it does not match | |
leading tags. You may create a tag ``<any>`` or include an ``any`` | |
attribute in the tag. An ``any`` tag matches any tag, while the | |
attribute matches any and all attributes. | |
When a match fails, the reformatted example and gotten text is | |
displayed (indented), and a rough diff-like output is given. Anything | |
marked with ``+`` is in the output but wasn't supposed to be, and | |
similarly ``-`` means its in the example but wasn't in the output. | |
You can disable parsing on one line with ``# doctest:+NOPARSE_MARKUP`` | |
""" | |
from lxml import etree | |
import sys | |
import re | |
import doctest | |
try: | |
from html import escape as html_escape | |
except ImportError: | |
from cgi import escape as html_escape | |
__all__ = ['PARSE_HTML', 'PARSE_XML', 'NOPARSE_MARKUP', 'LXMLOutputChecker', | |
'LHTMLOutputChecker', 'install', 'temp_install'] | |
try: | |
_basestring = basestring | |
except NameError: | |
_basestring = (str, bytes) | |
_IS_PYTHON_3 = sys.version_info[0] >= 3 | |
PARSE_HTML = doctest.register_optionflag('PARSE_HTML') | |
PARSE_XML = doctest.register_optionflag('PARSE_XML') | |
NOPARSE_MARKUP = doctest.register_optionflag('NOPARSE_MARKUP') | |
OutputChecker = doctest.OutputChecker | |
def strip(v): | |
if v is None: | |
return None | |
else: | |
return v.strip() | |
def norm_whitespace(v): | |
return _norm_whitespace_re.sub(' ', v) | |
_html_parser = etree.HTMLParser(recover=False, remove_blank_text=True) | |
def html_fromstring(html): | |
return etree.fromstring(html, _html_parser) | |
# We use this to distinguish repr()s from elements: | |
_repr_re = re.compile(r'^<[^>]+ (at|object) ') | |
_norm_whitespace_re = re.compile(r'[ \t\n][ \t\n]+') | |
class LXMLOutputChecker(OutputChecker): | |
empty_tags = ( | |
'param', 'img', 'area', 'br', 'basefont', 'input', | |
'base', 'meta', 'link', 'col') | |
def get_default_parser(self): | |
return etree.XML | |
def check_output(self, want, got, optionflags): | |
alt_self = getattr(self, '_temp_override_self', None) | |
if alt_self is not None: | |
super_method = self._temp_call_super_check_output | |
self = alt_self | |
else: | |
super_method = OutputChecker.check_output | |
parser = self.get_parser(want, got, optionflags) | |
if not parser: | |
return super_method( | |
self, want, got, optionflags) | |
try: | |
want_doc = parser(want) | |
except etree.XMLSyntaxError: | |
return False | |
try: | |
got_doc = parser(got) | |
except etree.XMLSyntaxError: | |
return False | |
return self.compare_docs(want_doc, got_doc) | |
def get_parser(self, want, got, optionflags): | |
parser = None | |
if NOPARSE_MARKUP & optionflags: | |
return None | |
if PARSE_HTML & optionflags: | |
parser = html_fromstring | |
elif PARSE_XML & optionflags: | |
parser = etree.XML | |
elif (want.strip().lower().startswith('<html') | |
and got.strip().startswith('<html')): | |
parser = html_fromstring | |
elif (self._looks_like_markup(want) | |
and self._looks_like_markup(got)): | |
parser = self.get_default_parser() | |
return parser | |
def _looks_like_markup(self, s): | |
s = s.strip() | |
return (s.startswith('<') | |
and not _repr_re.search(s)) | |
def compare_docs(self, want, got): | |
if not self.tag_compare(want.tag, got.tag): | |
return False | |
if not self.text_compare(want.text, got.text, True): | |
return False | |
if not self.text_compare(want.tail, got.tail, True): | |
return False | |
if 'any' not in want.attrib: | |
want_keys = sorted(want.attrib.keys()) | |
got_keys = sorted(got.attrib.keys()) | |
if want_keys != got_keys: | |
return False | |
for key in want_keys: | |
if not self.text_compare(want.attrib[key], got.attrib[key], False): | |
return False | |
if want.text != '...' or len(want): | |
want_children = list(want) | |
got_children = list(got) | |
while want_children or got_children: | |
if not want_children or not got_children: | |
return False | |
want_first = want_children.pop(0) | |
got_first = got_children.pop(0) | |
if not self.compare_docs(want_first, got_first): | |
return False | |
if not got_children and want_first.tail == '...': | |
break | |
return True | |
def text_compare(self, want, got, strip): | |
want = want or '' | |
got = got or '' | |
if strip: | |
want = norm_whitespace(want).strip() | |
got = norm_whitespace(got).strip() | |
want = '^%s$' % re.escape(want) | |
want = want.replace(r'\.\.\.', '.*') | |
if re.search(want, got): | |
return True | |
else: | |
return False | |
def tag_compare(self, want, got): | |
if want == 'any': | |
return True | |
if (not isinstance(want, _basestring) | |
or not isinstance(got, _basestring)): | |
return want == got | |
want = want or '' | |
got = got or '' | |
if want.startswith('{...}'): | |
# Ellipsis on the namespace | |
return want.split('}')[-1] == got.split('}')[-1] | |
else: | |
return want == got | |
def output_difference(self, example, got, optionflags): | |
want = example.want | |
parser = self.get_parser(want, got, optionflags) | |
errors = [] | |
if parser is not None: | |
try: | |
want_doc = parser(want) | |
except etree.XMLSyntaxError: | |
e = sys.exc_info()[1] | |
errors.append('In example: %s' % e) | |
try: | |
got_doc = parser(got) | |
except etree.XMLSyntaxError: | |
e = sys.exc_info()[1] | |
errors.append('In actual output: %s' % e) | |
if parser is None or errors: | |
value = OutputChecker.output_difference( | |
self, example, got, optionflags) | |
if errors: | |
errors.append(value) | |
return '\n'.join(errors) | |
else: | |
return value | |
html = parser is html_fromstring | |
diff_parts = ['Expected:', | |
self.format_doc(want_doc, html, 2), | |
'Got:', | |
self.format_doc(got_doc, html, 2), | |
'Diff:', | |
self.collect_diff(want_doc, got_doc, html, 2)] | |
return '\n'.join(diff_parts) | |
def html_empty_tag(self, el, html=True): | |
if not html: | |
return False | |
if el.tag not in self.empty_tags: | |
return False | |
if el.text or len(el): | |
# This shouldn't happen (contents in an empty tag) | |
return False | |
return True | |
def format_doc(self, doc, html, indent, prefix=''): | |
parts = [] | |
if not len(doc): | |
# No children... | |
parts.append(' '*indent) | |
parts.append(prefix) | |
parts.append(self.format_tag(doc)) | |
if not self.html_empty_tag(doc, html): | |
if strip(doc.text): | |
parts.append(self.format_text(doc.text)) | |
parts.append(self.format_end_tag(doc)) | |
if strip(doc.tail): | |
parts.append(self.format_text(doc.tail)) | |
parts.append('\n') | |
return ''.join(parts) | |
parts.append(' '*indent) | |
parts.append(prefix) | |
parts.append(self.format_tag(doc)) | |
if not self.html_empty_tag(doc, html): | |
parts.append('\n') | |
if strip(doc.text): | |
parts.append(' '*indent) | |
parts.append(self.format_text(doc.text)) | |
parts.append('\n') | |
for el in doc: | |
parts.append(self.format_doc(el, html, indent+2)) | |
parts.append(' '*indent) | |
parts.append(self.format_end_tag(doc)) | |
parts.append('\n') | |
if strip(doc.tail): | |
parts.append(' '*indent) | |
parts.append(self.format_text(doc.tail)) | |
parts.append('\n') | |
return ''.join(parts) | |
def format_text(self, text, strip=True): | |
if text is None: | |
return '' | |
if strip: | |
text = text.strip() | |
return html_escape(text, 1) | |
def format_tag(self, el): | |
attrs = [] | |
if isinstance(el, etree.CommentBase): | |
# FIXME: probably PIs should be handled specially too? | |
return '<!--' | |
for name, value in sorted(el.attrib.items()): | |
attrs.append('%s="%s"' % (name, self.format_text(value, False))) | |
if not attrs: | |
return '<%s>' % el.tag | |
return '<%s %s>' % (el.tag, ' '.join(attrs)) | |
def format_end_tag(self, el): | |
if isinstance(el, etree.CommentBase): | |
# FIXME: probably PIs should be handled specially too? | |
return '-->' | |
return '</%s>' % el.tag | |
def collect_diff(self, want, got, html, indent): | |
parts = [] | |
if not len(want) and not len(got): | |
parts.append(' '*indent) | |
parts.append(self.collect_diff_tag(want, got)) | |
if not self.html_empty_tag(got, html): | |
parts.append(self.collect_diff_text(want.text, got.text)) | |
parts.append(self.collect_diff_end_tag(want, got)) | |
parts.append(self.collect_diff_text(want.tail, got.tail)) | |
parts.append('\n') | |
return ''.join(parts) | |
parts.append(' '*indent) | |
parts.append(self.collect_diff_tag(want, got)) | |
parts.append('\n') | |
if strip(want.text) or strip(got.text): | |
parts.append(' '*indent) | |
parts.append(self.collect_diff_text(want.text, got.text)) | |
parts.append('\n') | |
want_children = list(want) | |
got_children = list(got) | |
while want_children or got_children: | |
if not want_children: | |
parts.append(self.format_doc(got_children.pop(0), html, indent+2, '+')) | |
continue | |
if not got_children: | |
parts.append(self.format_doc(want_children.pop(0), html, indent+2, '-')) | |
continue | |
parts.append(self.collect_diff( | |
want_children.pop(0), got_children.pop(0), html, indent+2)) | |
parts.append(' '*indent) | |
parts.append(self.collect_diff_end_tag(want, got)) | |
parts.append('\n') | |
if strip(want.tail) or strip(got.tail): | |
parts.append(' '*indent) | |
parts.append(self.collect_diff_text(want.tail, got.tail)) | |
parts.append('\n') | |
return ''.join(parts) | |
def collect_diff_tag(self, want, got): | |
if not self.tag_compare(want.tag, got.tag): | |
tag = '%s (got: %s)' % (want.tag, got.tag) | |
else: | |
tag = got.tag | |
attrs = [] | |
any = want.tag == 'any' or 'any' in want.attrib | |
for name, value in sorted(got.attrib.items()): | |
if name not in want.attrib and not any: | |
attrs.append('+%s="%s"' % (name, self.format_text(value, False))) | |
else: | |
if name in want.attrib: | |
text = self.collect_diff_text(want.attrib[name], value, False) | |
else: | |
text = self.format_text(value, False) | |
attrs.append('%s="%s"' % (name, text)) | |
if not any: | |
for name, value in sorted(want.attrib.items()): | |
if name in got.attrib: | |
continue | |
attrs.append('-%s="%s"' % (name, self.format_text(value, False))) | |
if attrs: | |
tag = '<%s %s>' % (tag, ' '.join(attrs)) | |
else: | |
tag = '<%s>' % tag | |
return tag | |
def collect_diff_end_tag(self, want, got): | |
if want.tag != got.tag: | |
tag = '%s (got: %s)' % (want.tag, got.tag) | |
else: | |
tag = got.tag | |
return '</%s>' % tag | |
def collect_diff_text(self, want, got, strip=True): | |
if self.text_compare(want, got, strip): | |
if not got: | |
return '' | |
return self.format_text(got, strip) | |
text = '%s (got: %s)' % (want, got) | |
return self.format_text(text, strip) | |
class LHTMLOutputChecker(LXMLOutputChecker): | |
def get_default_parser(self): | |
return html_fromstring | |
def install(html=False): | |
""" | |
Install doctestcompare for all future doctests. | |
If html is true, then by default the HTML parser will be used; | |
otherwise the XML parser is used. | |
""" | |
if html: | |
doctest.OutputChecker = LHTMLOutputChecker | |
else: | |
doctest.OutputChecker = LXMLOutputChecker | |
def temp_install(html=False, del_module=None): | |
""" | |
Use this *inside* a doctest to enable this checker for this | |
doctest only. | |
If html is true, then by default the HTML parser will be used; | |
otherwise the XML parser is used. | |
""" | |
if html: | |
Checker = LHTMLOutputChecker | |
else: | |
Checker = LXMLOutputChecker | |
frame = _find_doctest_frame() | |
dt_self = frame.f_locals['self'] | |
checker = Checker() | |
old_checker = dt_self._checker | |
dt_self._checker = checker | |
# The unfortunate thing is that there is a local variable 'check' | |
# in the function that runs the doctests, that is a bound method | |
# into the output checker. We have to update that. We can't | |
# modify the frame, so we have to modify the object in place. The | |
# only way to do this is to actually change the func_code | |
# attribute of the method. We change it, and then wait for | |
# __record_outcome to be run, which signals the end of the __run | |
# method, at which point we restore the previous check_output | |
# implementation. | |
if _IS_PYTHON_3: | |
check_func = frame.f_locals['check'].__func__ | |
checker_check_func = checker.check_output.__func__ | |
else: | |
check_func = frame.f_locals['check'].im_func | |
checker_check_func = checker.check_output.im_func | |
# Because we can't patch up func_globals, this is the only global | |
# in check_output that we care about: | |
doctest.etree = etree | |
_RestoreChecker(dt_self, old_checker, checker, | |
check_func, checker_check_func, | |
del_module) | |
class _RestoreChecker(object): | |
def __init__(self, dt_self, old_checker, new_checker, check_func, clone_func, | |
del_module): | |
self.dt_self = dt_self | |
self.checker = old_checker | |
self.checker._temp_call_super_check_output = self.call_super | |
self.checker._temp_override_self = new_checker | |
self.check_func = check_func | |
self.clone_func = clone_func | |
self.del_module = del_module | |
self.install_clone() | |
self.install_dt_self() | |
def install_clone(self): | |
if _IS_PYTHON_3: | |
self.func_code = self.check_func.__code__ | |
self.func_globals = self.check_func.__globals__ | |
self.check_func.__code__ = self.clone_func.__code__ | |
else: | |
self.func_code = self.check_func.func_code | |
self.func_globals = self.check_func.func_globals | |
self.check_func.func_code = self.clone_func.func_code | |
def uninstall_clone(self): | |
if _IS_PYTHON_3: | |
self.check_func.__code__ = self.func_code | |
else: | |
self.check_func.func_code = self.func_code | |
def install_dt_self(self): | |
self.prev_func = self.dt_self._DocTestRunner__record_outcome | |
self.dt_self._DocTestRunner__record_outcome = self | |
def uninstall_dt_self(self): | |
self.dt_self._DocTestRunner__record_outcome = self.prev_func | |
def uninstall_module(self): | |
if self.del_module: | |
import sys | |
del sys.modules[self.del_module] | |
if '.' in self.del_module: | |
package, module = self.del_module.rsplit('.', 1) | |
package_mod = sys.modules[package] | |
delattr(package_mod, module) | |
def __call__(self, *args, **kw): | |
self.uninstall_clone() | |
self.uninstall_dt_self() | |
del self.checker._temp_override_self | |
del self.checker._temp_call_super_check_output | |
result = self.prev_func(*args, **kw) | |
self.uninstall_module() | |
return result | |
def call_super(self, *args, **kw): | |
self.uninstall_clone() | |
try: | |
return self.check_func(*args, **kw) | |
finally: | |
self.install_clone() | |
def _find_doctest_frame(): | |
import sys | |
frame = sys._getframe(1) | |
while frame: | |
l = frame.f_locals | |
if 'BOOM' in l: | |
# Sign of doctest | |
return frame | |
frame = frame.f_back | |
raise LookupError( | |
"Could not find doctest (only use this function *inside* a doctest)") | |
__test__ = { | |
'basic': ''' | |
>>> temp_install() | |
>>> print """<xml a="1" b="2">stuff</xml>""" | |
<xml b="2" a="1">...</xml> | |
>>> print """<xml xmlns="http://example.com"><tag attr="bar" /></xml>""" | |
<xml xmlns="..."> | |
<tag attr="..." /> | |
</xml> | |
>>> print """<xml>blahblahblah<foo /></xml>""" # doctest: +NOPARSE_MARKUP, +ELLIPSIS | |
<xml>...foo /></xml> | |
'''} | |
if __name__ == '__main__': | |
import doctest | |
doctest.testmod() | |
# | |
# ElementTree | |
# $Id: ElementInclude.py 1862 2004-06-18 07:31:02Z Fredrik $ | |
# | |
# limited xinclude support for element trees | |
# | |
# history: | |
# 2003-08-15 fl created | |
# 2003-11-14 fl fixed default loader | |
# | |
# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved. | |
# | |
# fredrik@pythonware.com | |
# http://www.pythonware.com | |
# | |
# -------------------------------------------------------------------- | |
# The ElementTree toolkit is | |
# | |
# Copyright (c) 1999-2004 by Fredrik Lundh | |
# | |
# By obtaining, using, and/or copying this software and/or its | |
# associated documentation, you agree that you have read, understood, | |
# and will comply with the following terms and conditions: | |
# | |
# Permission to use, copy, modify, and distribute this software and | |
# its associated documentation for any purpose and without fee is | |
# hereby granted, provided that the above copyright notice appears in | |
# all copies, and that both that copyright notice and this permission | |
# notice appear in supporting documentation, and that the name of | |
# Secret Labs AB or the author not be used in advertising or publicity | |
# pertaining to distribution of the software without specific, written | |
# prior permission. | |
# | |
# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- | |
# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR | |
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY | |
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
# OF THIS SOFTWARE. | |
# -------------------------------------------------------------------- | |
""" | |
Limited XInclude support for the ElementTree package. | |
While lxml.etree has full support for XInclude (see | |
`etree.ElementTree.xinclude()`), this module provides a simpler, pure | |
Python, ElementTree compatible implementation that supports a simple | |
form of custom URL resolvers. | |
""" | |
from lxml import etree | |
try: | |
from urlparse import urljoin | |
from urllib2 import urlopen | |
except ImportError: | |
# Python 3 | |
from urllib.parse import urljoin | |
from urllib.request import urlopen | |
XINCLUDE = "{http://www.w3.org/2001/XInclude}" | |
XINCLUDE_INCLUDE = XINCLUDE + "include" | |
XINCLUDE_FALLBACK = XINCLUDE + "fallback" | |
XINCLUDE_ITER_TAG = XINCLUDE + "*" | |
# For security reasons, the inclusion depth is limited to this read-only value by default. | |
DEFAULT_MAX_INCLUSION_DEPTH = 6 | |
## | |
# Fatal include error. | |
class FatalIncludeError(etree.LxmlSyntaxError): | |
pass | |
class LimitedRecursiveIncludeError(FatalIncludeError): | |
pass | |
## | |
# ET compatible default loader. | |
# This loader reads an included resource from disk. | |
# | |
# @param href Resource reference. | |
# @param parse Parse mode. Either "xml" or "text". | |
# @param encoding Optional text encoding. | |
# @return The expanded resource. If the parse mode is "xml", this | |
# is an ElementTree instance. If the parse mode is "text", this | |
# is a Unicode string. If the loader fails, it can return None | |
# or raise an IOError exception. | |
# @throws IOError If the loader fails to load the resource. | |
def default_loader(href, parse, encoding=None): | |
file = open(href, 'rb') | |
if parse == "xml": | |
data = etree.parse(file).getroot() | |
else: | |
data = file.read() | |
if not encoding: | |
encoding = 'utf-8' | |
data = data.decode(encoding) | |
file.close() | |
return data | |
## | |
# Default loader used by lxml.etree - handles custom resolvers properly | |
# | |
def _lxml_default_loader(href, parse, encoding=None, parser=None): | |
if parse == "xml": | |
data = etree.parse(href, parser).getroot() | |
else: | |
if "://" in href: | |
f = urlopen(href) | |
else: | |
f = open(href, 'rb') | |
data = f.read() | |
f.close() | |
if not encoding: | |
encoding = 'utf-8' | |
data = data.decode(encoding) | |
return data | |
## | |
# Wrapper for ET compatibility - drops the parser | |
def _wrap_et_loader(loader): | |
def load(href, parse, encoding=None, parser=None): | |
return loader(href, parse, encoding) | |
return load | |
## | |
# Expand XInclude directives. | |
# | |
# @param elem Root element. | |
# @param loader Optional resource loader. If omitted, it defaults | |
# to {@link default_loader}. If given, it should be a callable | |
# that implements the same interface as <b>default_loader</b>. | |
# @param base_url The base URL of the original file, to resolve | |
# relative include file references. | |
# @param max_depth The maximum number of recursive inclusions. | |
# Limited to reduce the risk of malicious content explosion. | |
# Pass None to disable the limitation. | |
# @throws LimitedRecursiveIncludeError If the {@link max_depth} was exceeded. | |
# @throws FatalIncludeError If the function fails to include a given | |
# resource, or if the tree contains malformed XInclude elements. | |
# @throws IOError If the function fails to load a given resource. | |
# @returns the node or its replacement if it was an XInclude node | |
def include(elem, loader=None, base_url=None, | |
max_depth=DEFAULT_MAX_INCLUSION_DEPTH): | |
if max_depth is None: | |
max_depth = -1 | |
elif max_depth < 0: | |
raise ValueError("expected non-negative depth or None for 'max_depth', got %r" % max_depth) | |
if base_url is None: | |
if hasattr(elem, 'getroot'): | |
tree = elem | |
elem = elem.getroot() | |
else: | |
tree = elem.getroottree() | |
if hasattr(tree, 'docinfo'): | |
base_url = tree.docinfo.URL | |
elif hasattr(elem, 'getroot'): | |
elem = elem.getroot() | |
_include(elem, loader, base_url, max_depth) | |
def _include(elem, loader=None, base_url=None, | |
max_depth=DEFAULT_MAX_INCLUSION_DEPTH, _parent_hrefs=None): | |
if loader is not None: | |
load_include = _wrap_et_loader(loader) | |
else: | |
load_include = _lxml_default_loader | |
if _parent_hrefs is None: | |
_parent_hrefs = set() | |
parser = elem.getroottree().parser | |
include_elements = list( | |
elem.iter(XINCLUDE_ITER_TAG)) | |
for e in include_elements: | |
if e.tag == XINCLUDE_INCLUDE: | |
# process xinclude directive | |
href = urljoin(base_url, e.get("href")) | |
parse = e.get("parse", "xml") | |
parent = e.getparent() | |
if parse == "xml": | |
if href in _parent_hrefs: | |
raise FatalIncludeError( | |
"recursive include of %r detected" % href | |
) | |
if max_depth == 0: | |
raise LimitedRecursiveIncludeError( | |
"maximum xinclude depth reached when including file %s" % href) | |
_parent_hrefs.add(href) | |
node = load_include(href, parse, parser=parser) | |
if node is None: | |
raise FatalIncludeError( | |
"cannot load %r as %r" % (href, parse) | |
) | |
node = _include(node, loader, href, max_depth - 1, _parent_hrefs) | |
if e.tail: | |
node.tail = (node.tail or "") + e.tail | |
if parent is None: | |
return node # replaced the root node! | |
parent.replace(e, node) | |
elif parse == "text": | |
text = load_include(href, parse, encoding=e.get("encoding")) | |
if text is None: | |
raise FatalIncludeError( | |
"cannot load %r as %r" % (href, parse) | |
) | |
predecessor = e.getprevious() | |
if predecessor is not None: | |
predecessor.tail = (predecessor.tail or "") + text | |
elif parent is None: | |
return text # replaced the root node! | |
else: | |
parent.text = (parent.text or "") + text + (e.tail or "") | |
parent.remove(e) | |
else: | |
raise FatalIncludeError( | |
"unknown parse type in xi:include tag (%r)" % parse | |
) | |
elif e.tag == XINCLUDE_FALLBACK: | |
parent = e.getparent() | |
if parent is not None and parent.tag != XINCLUDE_INCLUDE: | |
raise FatalIncludeError( | |
"xi:fallback tag must be child of xi:include (%r)" % e.tag | |
) | |
else: | |
raise FatalIncludeError( | |
"Invalid element found in XInclude namespace (%r)" % e.tag | |
) | |
return elem |
/* Generated by Cython 0.29.13 */ | |
#ifndef __PYX_HAVE__lxml__etree | |
#define __PYX_HAVE__lxml__etree | |
struct LxmlDocument; | |
struct LxmlElement; | |
struct LxmlElementTree; | |
struct LxmlElementTagMatcher; | |
struct LxmlElementIterator; | |
struct LxmlElementBase; | |
struct LxmlElementClassLookup; | |
struct LxmlFallbackElementClassLookup; | |
/* "lxml/etree.pyx":322 | |
* | |
* # type of a function that steps from node to node | |
* ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*) # <<<<<<<<<<<<<< | |
* | |
* | |
*/ | |
typedef xmlNode *(*_node_to_node_function)(xmlNode *); | |
/* "lxml/etree.pyx":338 | |
* @cython.final | |
* @cython.freelist(8) | |
* cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]: # <<<<<<<<<<<<<< | |
* u"""Internal base class to reference a libxml document. | |
* | |
*/ | |
struct LxmlDocument { | |
PyObject_HEAD | |
struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtab; | |
int _ns_counter; | |
PyObject *_prefix_tail; | |
xmlDoc *_c_doc; | |
struct __pyx_obj_4lxml_5etree__BaseParser *_parser; | |
}; | |
/* "lxml/etree.pyx":687 | |
* | |
* @cython.no_gc_clear | |
* cdef public class _Element [ type LxmlElementType, object LxmlElement ]: # <<<<<<<<<<<<<< | |
* u"""Element class. | |
* | |
*/ | |
struct LxmlElement { | |
PyObject_HEAD | |
struct LxmlDocument *_doc; | |
xmlNode *_c_node; | |
PyObject *_tag; | |
}; | |
/* "lxml/etree.pyx":1853 | |
* | |
* | |
* cdef public class _ElementTree [ type LxmlElementTreeType, # <<<<<<<<<<<<<< | |
* object LxmlElementTree ]: | |
* cdef _Document _doc | |
*/ | |
struct LxmlElementTree { | |
PyObject_HEAD | |
struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtab; | |
struct LxmlDocument *_doc; | |
struct LxmlElement *_context_node; | |
}; | |
/* "lxml/etree.pyx":2597 | |
* | |
* | |
* cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher, # <<<<<<<<<<<<<< | |
* type LxmlElementTagMatcherType ]: | |
* """ | |
*/ | |
struct LxmlElementTagMatcher { | |
PyObject_HEAD | |
struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtab; | |
PyObject *_pystrings; | |
int _node_type; | |
char *_href; | |
char *_name; | |
}; | |
/* "lxml/etree.pyx":2628 | |
* self._name = NULL | |
* | |
* cdef public class _ElementIterator(_ElementTagMatcher) [ # <<<<<<<<<<<<<< | |
* object LxmlElementIterator, type LxmlElementIteratorType ]: | |
* """ | |
*/ | |
struct LxmlElementIterator { | |
struct LxmlElementTagMatcher __pyx_base; | |
struct LxmlElement *_node; | |
_node_to_node_function _next_element; | |
}; | |
/* "src/lxml/classlookup.pxi":6 | |
* # Custom Element classes | |
* | |
* cdef public class ElementBase(_Element) [ type LxmlElementBaseType, # <<<<<<<<<<<<<< | |
* object LxmlElementBase ]: | |
* u"""ElementBase(*children, attrib=None, nsmap=None, **_extra) | |
*/ | |
struct LxmlElementBase { | |
struct LxmlElement __pyx_base; | |
}; | |
/* "src/lxml/classlookup.pxi":210 | |
* # Element class lookup | |
* | |
* ctypedef public object (*_element_class_lookup_function)(object, _Document, xmlNode*) # <<<<<<<<<<<<<< | |
* | |
* # class to store element class lookup functions | |
*/ | |
typedef PyObject *(*_element_class_lookup_function)(PyObject *, struct LxmlDocument *, xmlNode *); | |
/* "src/lxml/classlookup.pxi":213 | |
* | |
* # class to store element class lookup functions | |
* cdef public class ElementClassLookup [ type LxmlElementClassLookupType, # <<<<<<<<<<<<<< | |
* object LxmlElementClassLookup ]: | |
* u"""ElementClassLookup(self) | |
*/ | |
struct LxmlElementClassLookup { | |
PyObject_HEAD | |
_element_class_lookup_function _lookup_function; | |
}; | |
/* "src/lxml/classlookup.pxi":221 | |
* | |
* | |
* cdef public class FallbackElementClassLookup(ElementClassLookup) \ # <<<<<<<<<<<<<< | |
* [ type LxmlFallbackElementClassLookupType, | |
* object LxmlFallbackElementClassLookup ]: | |
*/ | |
struct LxmlFallbackElementClassLookup { | |
struct LxmlElementClassLookup __pyx_base; | |
struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtab; | |
struct LxmlElementClassLookup *fallback; | |
_element_class_lookup_function _fallback_function; | |
}; | |
#ifndef __PYX_HAVE_API__lxml__etree | |
#ifndef __PYX_EXTERN_C | |
#ifdef __cplusplus | |
#define __PYX_EXTERN_C extern "C" | |
#else | |
#define __PYX_EXTERN_C extern | |
#endif | |
#endif | |
#ifndef DL_IMPORT | |
#define DL_IMPORT(_T) _T | |
#endif | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlDocumentType; | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementType; | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementTreeType; | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementTagMatcherType; | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementIteratorType; | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementBaseType; | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementClassLookupType; | |
__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlFallbackElementClassLookupType; | |
__PYX_EXTERN_C struct LxmlElement *deepcopyNodeToDocument(struct LxmlDocument *, xmlNode *); | |
__PYX_EXTERN_C struct LxmlElementTree *elementTreeFactory(struct LxmlElement *); | |
__PYX_EXTERN_C struct LxmlElementTree *newElementTree(struct LxmlElement *, PyObject *); | |
__PYX_EXTERN_C struct LxmlElementTree *adoptExternalDocument(xmlDoc *, PyObject *, int); | |
__PYX_EXTERN_C struct LxmlElement *elementFactory(struct LxmlDocument *, xmlNode *); | |
__PYX_EXTERN_C struct LxmlElement *makeElement(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); | |
__PYX_EXTERN_C struct LxmlElement *makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); | |
__PYX_EXTERN_C void setElementClassLookupFunction(_element_class_lookup_function, PyObject *); | |
__PYX_EXTERN_C PyObject *lookupDefaultElementClass(PyObject *, PyObject *, xmlNode *); | |
__PYX_EXTERN_C PyObject *lookupNamespaceElementClass(PyObject *, PyObject *, xmlNode *); | |
__PYX_EXTERN_C PyObject *callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); | |
__PYX_EXTERN_C int tagMatches(xmlNode *, const xmlChar *, const xmlChar *); | |
__PYX_EXTERN_C struct LxmlDocument *documentOrRaise(PyObject *); | |
__PYX_EXTERN_C struct LxmlElement *rootNodeOrRaise(PyObject *); | |
__PYX_EXTERN_C int hasText(xmlNode *); | |
__PYX_EXTERN_C int hasTail(xmlNode *); | |
__PYX_EXTERN_C PyObject *textOf(xmlNode *); | |
__PYX_EXTERN_C PyObject *tailOf(xmlNode *); | |
__PYX_EXTERN_C int setNodeText(xmlNode *, PyObject *); | |
__PYX_EXTERN_C int setTailText(xmlNode *, PyObject *); | |
__PYX_EXTERN_C PyObject *attributeValue(xmlNode *, xmlAttr *); | |
__PYX_EXTERN_C PyObject *attributeValueFromNsName(xmlNode *, const xmlChar *, const xmlChar *); | |
__PYX_EXTERN_C PyObject *getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); | |
__PYX_EXTERN_C PyObject *iterattributes(struct LxmlElement *, int); | |
__PYX_EXTERN_C PyObject *collectAttributes(xmlNode *, int); | |
__PYX_EXTERN_C int setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); | |
__PYX_EXTERN_C int delAttribute(struct LxmlElement *, PyObject *); | |
__PYX_EXTERN_C int delAttributeFromNsName(xmlNode *, const xmlChar *, const xmlChar *); | |
__PYX_EXTERN_C int hasChild(xmlNode *); | |
__PYX_EXTERN_C xmlNode *findChild(xmlNode *, Py_ssize_t); | |
__PYX_EXTERN_C xmlNode *findChildForwards(xmlNode *, Py_ssize_t); | |
__PYX_EXTERN_C xmlNode *findChildBackwards(xmlNode *, Py_ssize_t); | |
__PYX_EXTERN_C xmlNode *nextElement(xmlNode *); | |
__PYX_EXTERN_C xmlNode *previousElement(xmlNode *); | |
__PYX_EXTERN_C void appendChild(struct LxmlElement *, struct LxmlElement *); | |
__PYX_EXTERN_C int appendChildToElement(struct LxmlElement *, struct LxmlElement *); | |
__PYX_EXTERN_C PyObject *pyunicode(const xmlChar *); | |
__PYX_EXTERN_C PyObject *utf8(PyObject *); | |
__PYX_EXTERN_C PyObject *getNsTag(PyObject *); | |
__PYX_EXTERN_C PyObject *getNsTagWithEmptyNs(PyObject *); | |
__PYX_EXTERN_C PyObject *namespacedName(xmlNode *); | |
__PYX_EXTERN_C PyObject *namespacedNameFromNsName(const xmlChar *, const xmlChar *); | |
__PYX_EXTERN_C void iteratorStoreNext(struct LxmlElementIterator *, struct LxmlElement *); | |
__PYX_EXTERN_C void initTagMatch(struct LxmlElementTagMatcher *, PyObject *); | |
__PYX_EXTERN_C xmlNs *findOrBuildNodeNsPrefix(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *); | |
#endif /* !__PYX_HAVE_API__lxml__etree */ | |
/* WARNING: the interface of the module init function changed in CPython 3.5. */ | |
/* It now returns a PyModuleDef instance instead of a PyModule instance. */ | |
#if PY_MAJOR_VERSION < 3 | |
PyMODINIT_FUNC initetree(void); | |
#else | |
PyMODINIT_FUNC PyInit_etree(void); | |
#endif | |
#endif /* !__PYX_HAVE__lxml__etree */ |
/* Generated by Cython 0.29.13 */ | |
#ifndef __PYX_HAVE_API__lxml__etree | |
#define __PYX_HAVE_API__lxml__etree | |
#ifdef __MINGW64__ | |
#define MS_WIN64 | |
#endif | |
#include "Python.h" | |
#include "etree.h" | |
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_deepcopyNodeToDocument)(struct LxmlDocument *, xmlNode *) = 0; | |
#define deepcopyNodeToDocument __pyx_api_f_4lxml_5etree_deepcopyNodeToDocument | |
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_elementTreeFactory)(struct LxmlElement *) = 0; | |
#define elementTreeFactory __pyx_api_f_4lxml_5etree_elementTreeFactory | |
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_newElementTree)(struct LxmlElement *, PyObject *) = 0; | |
#define newElementTree __pyx_api_f_4lxml_5etree_newElementTree | |
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_adoptExternalDocument)(xmlDoc *, PyObject *, int) = 0; | |
#define adoptExternalDocument __pyx_api_f_4lxml_5etree_adoptExternalDocument | |
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_elementFactory)(struct LxmlDocument *, xmlNode *) = 0; | |
#define elementFactory __pyx_api_f_4lxml_5etree_elementFactory | |
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_makeElement)(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *) = 0; | |
#define makeElement __pyx_api_f_4lxml_5etree_makeElement | |
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_makeSubElement)(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *) = 0; | |
#define makeSubElement __pyx_api_f_4lxml_5etree_makeSubElement | |
static void (*__pyx_api_f_4lxml_5etree_setElementClassLookupFunction)(_element_class_lookup_function, PyObject *) = 0; | |
#define setElementClassLookupFunction __pyx_api_f_4lxml_5etree_setElementClassLookupFunction | |
static PyObject *(*__pyx_api_f_4lxml_5etree_lookupDefaultElementClass)(PyObject *, PyObject *, xmlNode *) = 0; | |
#define lookupDefaultElementClass __pyx_api_f_4lxml_5etree_lookupDefaultElementClass | |
static PyObject *(*__pyx_api_f_4lxml_5etree_lookupNamespaceElementClass)(PyObject *, PyObject *, xmlNode *) = 0; | |
#define lookupNamespaceElementClass __pyx_api_f_4lxml_5etree_lookupNamespaceElementClass | |
static PyObject *(*__pyx_api_f_4lxml_5etree_callLookupFallback)(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *) = 0; | |
#define callLookupFallback __pyx_api_f_4lxml_5etree_callLookupFallback | |
static int (*__pyx_api_f_4lxml_5etree_tagMatches)(xmlNode *, const xmlChar *, const xmlChar *) = 0; | |
#define tagMatches __pyx_api_f_4lxml_5etree_tagMatches | |
static struct LxmlDocument *(*__pyx_api_f_4lxml_5etree_documentOrRaise)(PyObject *) = 0; | |
#define documentOrRaise __pyx_api_f_4lxml_5etree_documentOrRaise | |
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_rootNodeOrRaise)(PyObject *) = 0; | |
#define rootNodeOrRaise __pyx_api_f_4lxml_5etree_rootNodeOrRaise | |
static int (*__pyx_api_f_4lxml_5etree_hasText)(xmlNode *) = 0; | |
#define hasText __pyx_api_f_4lxml_5etree_hasText | |
static int (*__pyx_api_f_4lxml_5etree_hasTail)(xmlNode *) = 0; | |
#define hasTail __pyx_api_f_4lxml_5etree_hasTail | |
static PyObject *(*__pyx_api_f_4lxml_5etree_textOf)(xmlNode *) = 0; | |
#define textOf __pyx_api_f_4lxml_5etree_textOf | |
static PyObject *(*__pyx_api_f_4lxml_5etree_tailOf)(xmlNode *) = 0; | |
#define tailOf __pyx_api_f_4lxml_5etree_tailOf | |
static int (*__pyx_api_f_4lxml_5etree_setNodeText)(xmlNode *, PyObject *) = 0; | |
#define setNodeText __pyx_api_f_4lxml_5etree_setNodeText | |
static int (*__pyx_api_f_4lxml_5etree_setTailText)(xmlNode *, PyObject *) = 0; | |
#define setTailText __pyx_api_f_4lxml_5etree_setTailText | |
static PyObject *(*__pyx_api_f_4lxml_5etree_attributeValue)(xmlNode *, xmlAttr *) = 0; | |
#define attributeValue __pyx_api_f_4lxml_5etree_attributeValue | |
static PyObject *(*__pyx_api_f_4lxml_5etree_attributeValueFromNsName)(xmlNode *, const xmlChar *, const xmlChar *) = 0; | |
#define attributeValueFromNsName __pyx_api_f_4lxml_5etree_attributeValueFromNsName | |
static PyObject *(*__pyx_api_f_4lxml_5etree_getAttributeValue)(struct LxmlElement *, PyObject *, PyObject *) = 0; | |
#define getAttributeValue __pyx_api_f_4lxml_5etree_getAttributeValue | |
static PyObject *(*__pyx_api_f_4lxml_5etree_iterattributes)(struct LxmlElement *, int) = 0; | |
#define iterattributes __pyx_api_f_4lxml_5etree_iterattributes | |
static PyObject *(*__pyx_api_f_4lxml_5etree_collectAttributes)(xmlNode *, int) = 0; | |
#define collectAttributes __pyx_api_f_4lxml_5etree_collectAttributes | |
static int (*__pyx_api_f_4lxml_5etree_setAttributeValue)(struct LxmlElement *, PyObject *, PyObject *) = 0; | |
#define setAttributeValue __pyx_api_f_4lxml_5etree_setAttributeValue | |
static int (*__pyx_api_f_4lxml_5etree_delAttribute)(struct LxmlElement *, PyObject *) = 0; | |
#define delAttribute __pyx_api_f_4lxml_5etree_delAttribute | |
static int (*__pyx_api_f_4lxml_5etree_delAttributeFromNsName)(xmlNode *, const xmlChar *, const xmlChar *) = 0; | |
#define delAttributeFromNsName __pyx_api_f_4lxml_5etree_delAttributeFromNsName | |
static int (*__pyx_api_f_4lxml_5etree_hasChild)(xmlNode *) = 0; | |
#define hasChild __pyx_api_f_4lxml_5etree_hasChild | |
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChild)(xmlNode *, Py_ssize_t) = 0; | |
#define findChild __pyx_api_f_4lxml_5etree_findChild | |
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChildForwards)(xmlNode *, Py_ssize_t) = 0; | |
#define findChildForwards __pyx_api_f_4lxml_5etree_findChildForwards | |
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChildBackwards)(xmlNode *, Py_ssize_t) = 0; | |
#define findChildBackwards __pyx_api_f_4lxml_5etree_findChildBackwards | |
static xmlNode *(*__pyx_api_f_4lxml_5etree_nextElement)(xmlNode *) = 0; | |
#define nextElement __pyx_api_f_4lxml_5etree_nextElement | |
static xmlNode *(*__pyx_api_f_4lxml_5etree_previousElement)(xmlNode *) = 0; | |
#define previousElement __pyx_api_f_4lxml_5etree_previousElement | |
static void (*__pyx_api_f_4lxml_5etree_appendChild)(struct LxmlElement *, struct LxmlElement *) = 0; | |
#define appendChild __pyx_api_f_4lxml_5etree_appendChild | |
static int (*__pyx_api_f_4lxml_5etree_appendChildToElement)(struct LxmlElement *, struct LxmlElement *) = 0; | |
#define appendChildToElement __pyx_api_f_4lxml_5etree_appendChildToElement | |
static PyObject *(*__pyx_api_f_4lxml_5etree_pyunicode)(const xmlChar *) = 0; | |
#define pyunicode __pyx_api_f_4lxml_5etree_pyunicode | |
static PyObject *(*__pyx_api_f_4lxml_5etree_utf8)(PyObject *) = 0; | |
#define utf8 __pyx_api_f_4lxml_5etree_utf8 | |
static PyObject *(*__pyx_api_f_4lxml_5etree_getNsTag)(PyObject *) = 0; | |
#define getNsTag __pyx_api_f_4lxml_5etree_getNsTag | |
static PyObject *(*__pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs)(PyObject *) = 0; | |
#define getNsTagWithEmptyNs __pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs | |
static PyObject *(*__pyx_api_f_4lxml_5etree_namespacedName)(xmlNode *) = 0; | |
#define namespacedName __pyx_api_f_4lxml_5etree_namespacedName | |
static PyObject *(*__pyx_api_f_4lxml_5etree_namespacedNameFromNsName)(const xmlChar *, const xmlChar *) = 0; | |
#define namespacedNameFromNsName __pyx_api_f_4lxml_5etree_namespacedNameFromNsName | |
static void (*__pyx_api_f_4lxml_5etree_iteratorStoreNext)(struct LxmlElementIterator *, struct LxmlElement *) = 0; | |
#define iteratorStoreNext __pyx_api_f_4lxml_5etree_iteratorStoreNext | |
static void (*__pyx_api_f_4lxml_5etree_initTagMatch)(struct LxmlElementTagMatcher *, PyObject *) = 0; | |
#define initTagMatch __pyx_api_f_4lxml_5etree_initTagMatch | |
static xmlNs *(*__pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *) = 0; | |
#define findOrBuildNodeNsPrefix __pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix | |
#if !defined(__Pyx_PyIdentifier_FromString) | |
#if PY_MAJOR_VERSION < 3 | |
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) | |
#else | |
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) | |
#endif | |
#endif | |
#ifndef __PYX_HAVE_RT_ImportFunction | |
#define __PYX_HAVE_RT_ImportFunction | |
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { | |
PyObject *d = 0; | |
PyObject *cobj = 0; | |
union { | |
void (*fp)(void); | |
void *p; | |
} tmp; | |
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); | |
if (!d) | |
goto bad; | |
cobj = PyDict_GetItemString(d, funcname); | |
if (!cobj) { | |
PyErr_Format(PyExc_ImportError, | |
"%.200s does not export expected C function %.200s", | |
PyModule_GetName(module), funcname); | |
goto bad; | |
} | |
#if PY_VERSION_HEX >= 0x02070000 | |
if (!PyCapsule_IsValid(cobj, sig)) { | |
PyErr_Format(PyExc_TypeError, | |
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", | |
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); | |
goto bad; | |
} | |
tmp.p = PyCapsule_GetPointer(cobj, sig); | |
#else | |
{const char *desc, *s1, *s2; | |
desc = (const char *)PyCObject_GetDesc(cobj); | |
if (!desc) | |
goto bad; | |
s1 = desc; s2 = sig; | |
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } | |
if (*s1 != *s2) { | |
PyErr_Format(PyExc_TypeError, | |
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", | |
PyModule_GetName(module), funcname, sig, desc); | |
goto bad; | |
} | |
tmp.p = PyCObject_AsVoidPtr(cobj);} | |
#endif | |
*f = tmp.fp; | |
if (!(*f)) | |
goto bad; | |
Py_DECREF(d); | |
return 0; | |
bad: | |
Py_XDECREF(d); | |
return -1; | |
} | |
#endif | |
static int import_lxml__etree(void) { | |
PyObject *module = 0; | |
module = PyImport_ImportModule("lxml.etree"); | |
if (!module) goto bad; | |
if (__Pyx_ImportFunction(module, "deepcopyNodeToDocument", (void (**)(void))&__pyx_api_f_4lxml_5etree_deepcopyNodeToDocument, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "elementTreeFactory", (void (**)(void))&__pyx_api_f_4lxml_5etree_elementTreeFactory, "struct LxmlElementTree *(struct LxmlElement *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "newElementTree", (void (**)(void))&__pyx_api_f_4lxml_5etree_newElementTree, "struct LxmlElementTree *(struct LxmlElement *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "adoptExternalDocument", (void (**)(void))&__pyx_api_f_4lxml_5etree_adoptExternalDocument, "struct LxmlElementTree *(xmlDoc *, PyObject *, int)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "elementFactory", (void (**)(void))&__pyx_api_f_4lxml_5etree_elementFactory, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "makeElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_makeElement, "struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "makeSubElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_makeSubElement, "struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "setElementClassLookupFunction", (void (**)(void))&__pyx_api_f_4lxml_5etree_setElementClassLookupFunction, "void (_element_class_lookup_function, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "lookupDefaultElementClass", (void (**)(void))&__pyx_api_f_4lxml_5etree_lookupDefaultElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "lookupNamespaceElementClass", (void (**)(void))&__pyx_api_f_4lxml_5etree_lookupNamespaceElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "callLookupFallback", (void (**)(void))&__pyx_api_f_4lxml_5etree_callLookupFallback, "PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "tagMatches", (void (**)(void))&__pyx_api_f_4lxml_5etree_tagMatches, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "documentOrRaise", (void (**)(void))&__pyx_api_f_4lxml_5etree_documentOrRaise, "struct LxmlDocument *(PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "rootNodeOrRaise", (void (**)(void))&__pyx_api_f_4lxml_5etree_rootNodeOrRaise, "struct LxmlElement *(PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "hasText", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasText, "int (xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "hasTail", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasTail, "int (xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "textOf", (void (**)(void))&__pyx_api_f_4lxml_5etree_textOf, "PyObject *(xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "tailOf", (void (**)(void))&__pyx_api_f_4lxml_5etree_tailOf, "PyObject *(xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "setNodeText", (void (**)(void))&__pyx_api_f_4lxml_5etree_setNodeText, "int (xmlNode *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "setTailText", (void (**)(void))&__pyx_api_f_4lxml_5etree_setTailText, "int (xmlNode *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "attributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_attributeValue, "PyObject *(xmlNode *, xmlAttr *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "attributeValueFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_attributeValueFromNsName, "PyObject *(xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "getAttributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_getAttributeValue, "PyObject *(struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "iterattributes", (void (**)(void))&__pyx_api_f_4lxml_5etree_iterattributes, "PyObject *(struct LxmlElement *, int)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "collectAttributes", (void (**)(void))&__pyx_api_f_4lxml_5etree_collectAttributes, "PyObject *(xmlNode *, int)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "setAttributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_setAttributeValue, "int (struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "delAttribute", (void (**)(void))&__pyx_api_f_4lxml_5etree_delAttribute, "int (struct LxmlElement *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "delAttributeFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_delAttributeFromNsName, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "hasChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasChild, "int (xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "findChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChild, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "findChildForwards", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChildForwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "findChildBackwards", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChildBackwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "nextElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_nextElement, "xmlNode *(xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "previousElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_previousElement, "xmlNode *(xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "appendChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_appendChild, "void (struct LxmlElement *, struct LxmlElement *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "appendChildToElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_appendChildToElement, "int (struct LxmlElement *, struct LxmlElement *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "pyunicode", (void (**)(void))&__pyx_api_f_4lxml_5etree_pyunicode, "PyObject *(const xmlChar *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "utf8", (void (**)(void))&__pyx_api_f_4lxml_5etree_utf8, "PyObject *(PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "getNsTag", (void (**)(void))&__pyx_api_f_4lxml_5etree_getNsTag, "PyObject *(PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "getNsTagWithEmptyNs", (void (**)(void))&__pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs, "PyObject *(PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "namespacedName", (void (**)(void))&__pyx_api_f_4lxml_5etree_namespacedName, "PyObject *(xmlNode *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "namespacedNameFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_namespacedNameFromNsName, "PyObject *(const xmlChar *, const xmlChar *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "iteratorStoreNext", (void (**)(void))&__pyx_api_f_4lxml_5etree_iteratorStoreNext, "void (struct LxmlElementIterator *, struct LxmlElement *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "initTagMatch", (void (**)(void))&__pyx_api_f_4lxml_5etree_initTagMatch, "void (struct LxmlElementTagMatcher *, PyObject *)") < 0) goto bad; | |
if (__Pyx_ImportFunction(module, "findOrBuildNodeNsPrefix", (void (**)(void))&__pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix, "xmlNs *(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad; | |
Py_DECREF(module); module = 0; | |
return 0; | |
bad: | |
Py_XDECREF(module); | |
return -1; | |
} | |
#endif /* !__PYX_HAVE_API__lxml__etree */ |
# Copyright (c) 2004 Ian Bicking. All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are | |
# met: | |
# | |
# 1. Redistributions of source code must retain the above copyright | |
# notice, this list of conditions and the following disclaimer. | |
# | |
# 2. Redistributions in binary form must reproduce the above copyright | |
# notice, this list of conditions and the following disclaimer in | |
# the documentation and/or other materials provided with the | |
# distribution. | |
# | |
# 3. Neither the name of Ian Bicking nor the names of its contributors may | |
# be used to endorse or promote products derived from this software | |
# without specific prior written permission. | |
# | |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IAN BICKING OR | |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
"""The ``lxml.html`` tool set for HTML handling. | |
""" | |
from __future__ import absolute_import | |
__all__ = [ | |
'document_fromstring', 'fragment_fromstring', 'fragments_fromstring', 'fromstring', | |
'tostring', 'Element', 'defs', 'open_in_browser', 'submit_form', | |
'find_rel_links', 'find_class', 'make_links_absolute', | |
'resolve_base_href', 'iterlinks', 'rewrite_links', 'open_in_browser', 'parse'] | |
import copy | |
import sys | |
import re | |
from functools import partial | |
try: | |
from collections.abc import MutableMapping, MutableSet | |
except ImportError: | |
from collections import MutableMapping, MutableSet | |
from .. import etree | |
from . import defs | |
from ._setmixin import SetMixin | |
try: | |
from urlparse import urljoin | |
except ImportError: | |
# Python 3 | |
from urllib.parse import urljoin | |
try: | |
unicode | |
except NameError: | |
# Python 3 | |
unicode = str | |
try: | |
basestring | |
except NameError: | |
# Python 3 | |
basestring = (str, bytes) | |
def __fix_docstring(s): | |
if not s: | |
return s | |
if sys.version_info[0] >= 3: | |
sub = re.compile(r"^(\s*)u'", re.M).sub | |
else: | |
sub = re.compile(r"^(\s*)b'", re.M).sub | |
return sub(r"\1'", s) | |
XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml" | |
_rel_links_xpath = etree.XPath("descendant-or-self::a[@rel]|descendant-or-self::x:a[@rel]", | |
namespaces={'x':XHTML_NAMESPACE}) | |
_options_xpath = etree.XPath("descendant-or-self::option|descendant-or-self::x:option", | |
namespaces={'x':XHTML_NAMESPACE}) | |
_forms_xpath = etree.XPath("descendant-or-self::form|descendant-or-self::x:form", | |
namespaces={'x':XHTML_NAMESPACE}) | |
#_class_xpath = etree.XPath(r"descendant-or-self::*[regexp:match(@class, concat('\b', $class_name, '\b'))]", {'regexp': 'http://exslt.org/regular-expressions'}) | |
_class_xpath = etree.XPath("descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), concat(' ', $class_name, ' '))]") | |
_id_xpath = etree.XPath("descendant-or-self::*[@id=$id]") | |
_collect_string_content = etree.XPath("string()") | |
_iter_css_urls = re.compile(r'url\(('+'["][^"]*["]|'+"['][^']*[']|"+r'[^)]*)\)', re.I).finditer | |
_iter_css_imports = re.compile(r'@import "(.*?)"').finditer | |
_label_xpath = etree.XPath("//label[@for=$id]|//x:label[@for=$id]", | |
namespaces={'x':XHTML_NAMESPACE}) | |
_archive_re = re.compile(r'[^ ]+') | |
_parse_meta_refresh_url = re.compile( | |
r'[^;=]*;\s*(?:url\s*=\s*)?(?P<url>.*)$', re.I).search | |
def _unquote_match(s, pos): | |
if s[:1] == '"' and s[-1:] == '"' or s[:1] == "'" and s[-1:] == "'": | |
return s[1:-1], pos+1 | |
else: | |
return s,pos | |
def _transform_result(typ, result): | |
"""Convert the result back into the input type. | |
""" | |
if issubclass(typ, bytes): | |
return tostring(result, encoding='utf-8') | |
elif issubclass(typ, unicode): | |
return tostring(result, encoding='unicode') | |
else: | |
return result | |
def _nons(tag): | |
if isinstance(tag, basestring): | |
if tag[0] == '{' and tag[1:len(XHTML_NAMESPACE)+1] == XHTML_NAMESPACE: | |
return tag.split('}')[-1] | |
return tag | |
class Classes(MutableSet): | |
"""Provides access to an element's class attribute as a set-like collection. | |
Usage:: | |
>>> el = fromstring('<p class="hidden large">Text</p>') | |
>>> classes = el.classes # or: classes = Classes(el.attrib) | |
>>> classes |= ['block', 'paragraph'] | |
>>> el.get('class') | |
'hidden large block paragraph' | |
>>> classes.toggle('hidden') | |
False | |
>>> el.get('class') | |
'large block paragraph' | |
>>> classes -= ('some', 'classes', 'block') | |
>>> el.get('class') | |
'large paragraph' | |
""" | |
def __init__(self, attributes): | |
self._attributes = attributes | |
self._get_class_value = partial(attributes.get, 'class', '') | |
def add(self, value): | |
""" | |
Add a class. | |
This has no effect if the class is already present. | |
""" | |
if not value or re.search(r'\s', value): | |
raise ValueError("Invalid class name: %r" % value) | |
classes = self._get_class_value().split() | |
if value in classes: | |
return | |
classes.append(value) | |
self._attributes['class'] = ' '.join(classes) | |
def discard(self, value): | |
""" | |
Remove a class if it is currently present. | |
If the class is not present, do nothing. | |
""" | |
if not value or re.search(r'\s', value): | |
raise ValueError("Invalid class name: %r" % value) | |
classes = [name for name in self._get_class_value().split() | |
if name != value] | |
if classes: | |
self._attributes['class'] = ' '.join(classes) | |
elif 'class' in self._attributes: | |
del self._attributes['class'] | |
def remove(self, value): | |
""" | |
Remove a class; it must currently be present. | |
If the class is not present, raise a KeyError. | |
""" | |
if not value or re.search(r'\s', value): | |
raise ValueError("Invalid class name: %r" % value) | |
super(Classes, self).remove(value) | |
def __contains__(self, name): | |
classes = self._get_class_value() | |
return name in classes and name in classes.split() | |
def __iter__(self): | |
return iter(self._get_class_value().split()) | |
def __len__(self): | |
return len(self._get_class_value().split()) | |
# non-standard methods | |
def update(self, values): | |
""" | |
Add all names from 'values'. | |
""" | |
classes = self._get_class_value().split() | |
extended = False | |
for value in values: | |
if value not in classes: | |
classes.append(value) | |
extended = True | |
if extended: | |
self._attributes['class'] = ' '.join(classes) | |
def toggle(self, value): | |
""" | |
Add a class name if it isn't there yet, or remove it if it exists. | |
Returns true if the class was added (and is now enabled) and | |
false if it was removed (and is now disabled). | |
""" | |
if not value or re.search(r'\s', value): | |
raise ValueError("Invalid class name: %r" % value) | |
classes = self._get_class_value().split() | |
try: | |
classes.remove(value) | |
enabled = False | |
except ValueError: | |
classes.append(value) | |
enabled = True | |
if classes: | |
self._attributes['class'] = ' '.join(classes) | |
else: | |
del self._attributes['class'] | |
return enabled | |
class HtmlMixin(object): | |
def set(self, key, value=None): | |
"""set(self, key, value=None) | |
Sets an element attribute. If no value is provided, or if the value is None, | |
creates a 'boolean' attribute without value, e.g. "<form novalidate></form>" | |
for ``form.set('novalidate')``. | |
""" | |
super(HtmlElement, self).set(key, value) | |
@property | |
def classes(self): | |
""" | |
A set-like wrapper around the 'class' attribute. | |
""" | |
return Classes(self.attrib) | |
@classes.setter | |
def classes(self, classes): | |
assert isinstance(classes, Classes) # only allow "el.classes |= ..." etc. | |
value = classes._get_class_value() | |
if value: | |
self.set('class', value) | |
elif self.get('class') is not None: | |
del self.attrib['class'] | |
@property | |
def base_url(self): | |
""" | |
Returns the base URL, given when the page was parsed. | |
Use with ``urlparse.urljoin(el.base_url, href)`` to get | |
absolute URLs. | |
""" | |
return self.getroottree().docinfo.URL | |
@property | |
def forms(self): | |
""" | |
Return a list of all the forms | |
""" | |
return _forms_xpath(self) | |
@property | |
def body(self): | |
""" | |
Return the <body> element. Can be called from a child element | |
to get the document's head. | |
""" | |
return self.xpath('//body|//x:body', namespaces={'x':XHTML_NAMESPACE})[0] | |
@property | |
def head(self): | |
""" | |
Returns the <head> element. Can be called from a child | |
element to get the document's head. | |
""" | |
return self.xpath('//head|//x:head', namespaces={'x':XHTML_NAMESPACE})[0] | |
@property | |
def label(self): | |
""" | |
Get or set any <label> element associated with this element. | |
""" | |
id = self.get('id') | |
if not id: | |
return None | |
result = _label_xpath(self, id=id) | |
if not result: | |
return None | |
else: | |
return result[0] | |
@label.setter | |
def label(self, label): | |
id = self.get('id') | |
if not id: | |
raise TypeError( | |
"You cannot set a label for an element (%r) that has no id" | |
% self) | |
if _nons(label.tag) != 'label': | |
raise TypeError( | |
"You can only assign label to a label element (not %r)" | |
% label) | |
label.set('for', id) | |
@label.deleter | |
def label(self): | |
label = self.label | |
if label is not None: | |
del label.attrib['for'] | |
def drop_tree(self): | |
""" | |
Removes this element from the tree, including its children and | |
text. The tail text is joined to the previous element or | |
parent. | |
""" | |
parent = self.getparent() | |
assert parent is not None | |
if self.tail: | |
previous = self.getprevious() | |
if previous is None: | |
parent.text = (parent.text or '') + self.tail | |
else: | |
previous.tail = (previous.tail or '') + self.tail | |
parent.remove(self) | |
def drop_tag(self): | |
""" | |
Remove the tag, but not its children or text. The children and text | |
are merged into the parent. | |
Example:: | |
>>> h = fragment_fromstring('<div>Hello <b>World!</b></div>') | |
>>> h.find('.//b').drop_tag() | |
>>> print(tostring(h, encoding='unicode')) | |
<div>Hello World!</div> | |
""" | |
parent = self.getparent() | |
assert parent is not None | |
previous = self.getprevious() | |
if self.text and isinstance(self.tag, basestring): | |
# not a Comment, etc. | |
if previous is None: | |
parent.text = (parent.text or '') + self.text | |
else: | |
previous.tail = (previous.tail or '') + self.text | |
if self.tail: | |
if len(self): | |
last = self[-1] | |
last.tail = (last.tail or '') + self.tail | |
elif previous is None: | |
parent.text = (parent.text or '') + self.tail | |
else: | |
previous.tail = (previous.tail or '') + self.tail | |
index = parent.index(self) | |
parent[index:index+1] = self[:] | |
def find_rel_links(self, rel): | |
""" | |
Find any links like ``<a rel="{rel}">...</a>``; returns a list of elements. | |
""" | |
rel = rel.lower() | |
return [el for el in _rel_links_xpath(self) | |
if el.get('rel').lower() == rel] | |
def find_class(self, class_name): | |
""" | |
Find any elements with the given class name. | |
""" | |
return _class_xpath(self, class_name=class_name) | |
def get_element_by_id(self, id, *default): | |
""" | |
Get the first element in a document with the given id. If none is | |
found, return the default argument if provided or raise KeyError | |
otherwise. | |
Note that there can be more than one element with the same id, | |
and this isn't uncommon in HTML documents found in the wild. | |
Browsers return only the first match, and this function does | |
the same. | |
""" | |
try: | |
# FIXME: should this check for multiple matches? | |
# browsers just return the first one | |
return _id_xpath(self, id=id)[0] | |
except IndexError: | |
if default: | |
return default[0] | |
else: | |
raise KeyError(id) | |
def text_content(self): | |
""" | |
Return the text content of the tag (and the text in any children). | |
""" | |
return _collect_string_content(self) | |
def cssselect(self, expr, translator='html'): | |
""" | |
Run the CSS expression on this element and its children, | |
returning a list of the results. | |
Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self) | |
-- note that pre-compiling the expression can provide a substantial | |
speedup. | |
""" | |
# Do the import here to make the dependency optional. | |
from lxml.cssselect import CSSSelector | |
return CSSSelector(expr, translator=translator)(self) | |
######################################## | |
## Link functions | |
######################################## | |
def make_links_absolute(self, base_url=None, resolve_base_href=True, | |
handle_failures=None): | |
""" | |
Make all links in the document absolute, given the | |
``base_url`` for the document (the full URL where the document | |
came from), or if no ``base_url`` is given, then the ``.base_url`` | |
of the document. | |
If ``resolve_base_href`` is true, then any ``<base href>`` | |
tags in the document are used *and* removed from the document. | |
If it is false then any such tag is ignored. | |
If ``handle_failures`` is None (default), a failure to process | |
a URL will abort the processing. If set to 'ignore', errors | |
are ignored. If set to 'discard', failing URLs will be removed. | |
""" | |
if base_url is None: | |
base_url = self.base_url | |
if base_url is None: | |
raise TypeError( | |
"No base_url given, and the document has no base_url") | |
if resolve_base_href: | |
self.resolve_base_href() | |
if handle_failures == 'ignore': | |
def link_repl(href): | |
try: | |
return urljoin(base_url, href) | |
except ValueError: | |
return href | |
elif handle_failures == 'discard': | |
def link_repl(href): | |
try: | |
return urljoin(base_url, href) | |
except ValueError: | |
return None | |
elif handle_failures is None: | |
def link_repl(href): | |
return urljoin(base_url, href) | |
else: | |
raise ValueError( | |
"unexpected value for handle_failures: %r" % handle_failures) | |
self.rewrite_links(link_repl) | |
def resolve_base_href(self, handle_failures=None): | |
""" | |
Find any ``<base href>`` tag in the document, and apply its | |
values to all links found in the document. Also remove the | |
tag once it has been applied. | |
If ``handle_failures`` is None (default), a failure to process | |
a URL will abort the processing. If set to 'ignore', errors | |
are ignored. If set to 'discard', failing URLs will be removed. | |
""" | |
base_href = None | |
basetags = self.xpath('//base[@href]|//x:base[@href]', | |
namespaces={'x': XHTML_NAMESPACE}) | |
for b in basetags: | |
base_href = b.get('href') | |
b.drop_tree() | |
if not base_href: | |
return | |
self.make_links_absolute(base_href, resolve_base_href=False, | |
handle_failures=handle_failures) | |
def iterlinks(self): | |
""" | |
Yield (element, attribute, link, pos), where attribute may be None | |
(indicating the link is in the text). ``pos`` is the position | |
where the link occurs; often 0, but sometimes something else in | |
the case of links in stylesheets or style tags. | |
Note: <base href> is *not* taken into account in any way. The | |
link you get is exactly the link in the document. | |
Note: multiple links inside of a single text string or | |
attribute value are returned in reversed order. This makes it | |
possible to replace or delete them from the text string value | |
based on their reported text positions. Otherwise, a | |
modification at one text position can change the positions of | |
links reported later on. | |
""" | |
link_attrs = defs.link_attrs | |
for el in self.iter(etree.Element): | |
attribs = el.attrib | |
tag = _nons(el.tag) | |
if tag == 'object': | |
codebase = None | |
## <object> tags have attributes that are relative to | |
## codebase | |
if 'codebase' in attribs: | |
codebase = el.get('codebase') | |
yield (el, 'codebase', codebase, 0) | |
for attrib in ('classid', 'data'): | |
if attrib in attribs: | |
value = el.get(attrib) | |
if codebase is not None: | |
value = urljoin(codebase, value) | |
yield (el, attrib, value, 0) | |
if 'archive' in attribs: | |
for match in _archive_re.finditer(el.get('archive')): | |
value = match.group(0) | |
if codebase is not None: | |
value = urljoin(codebase, value) | |
yield (el, 'archive', value, match.start()) | |
else: | |
for attrib in link_attrs: | |
if attrib in attribs: | |
yield (el, attrib, attribs[attrib], 0) | |
if tag == 'meta': | |
http_equiv = attribs.get('http-equiv', '').lower() | |
if http_equiv == 'refresh': | |
content = attribs.get('content', '') | |
match = _parse_meta_refresh_url(content) | |
url = (match.group('url') if match else content).strip() | |
# unexpected content means the redirect won't work, but we might | |
# as well be permissive and return the entire string. | |
if url: | |
url, pos = _unquote_match( | |
url, match.start('url') if match else content.find(url)) | |
yield (el, 'content', url, pos) | |
elif tag == 'param': | |
valuetype = el.get('valuetype') or '' | |
if valuetype.lower() == 'ref': | |
## FIXME: while it's fine we *find* this link, | |
## according to the spec we aren't supposed to | |
## actually change the value, including resolving | |
## it. It can also still be a link, even if it | |
## doesn't have a valuetype="ref" (which seems to be the norm) | |
## http://www.w3.org/TR/html401/struct/objects.html#adef-valuetype | |
yield (el, 'value', el.get('value'), 0) | |
elif tag == 'style' and el.text: | |
urls = [ | |
# (start_pos, url) | |
_unquote_match(match.group(1), match.start(1))[::-1] | |
for match in _iter_css_urls(el.text) | |
] + [ | |
(match.start(1), match.group(1)) | |
for match in _iter_css_imports(el.text) | |
] | |
if urls: | |
# sort by start pos to bring both match sets back into order | |
# and reverse the list to report correct positions despite | |
# modifications | |
urls.sort(reverse=True) | |
for start, url in urls: | |
yield (el, None, url, start) | |
if 'style' in attribs: | |
urls = list(_iter_css_urls(attribs['style'])) | |
if urls: | |
# return in reversed order to simplify in-place modifications | |
for match in urls[::-1]: | |
url, start = _unquote_match(match.group(1), match.start(1)) | |
yield (el, 'style', url, start) | |
def rewrite_links(self, link_repl_func, resolve_base_href=True, | |
base_href=None): | |
""" | |
Rewrite all the links in the document. For each link | |
``link_repl_func(link)`` will be called, and the return value | |
will replace the old link. | |
Note that links may not be absolute (unless you first called | |
``make_links_absolute()``), and may be internal (e.g., | |
``'#anchor'``). They can also be values like | |
``'mailto:email'`` or ``'javascript:expr'``. | |
If you give ``base_href`` then all links passed to | |
``link_repl_func()`` will take that into account. | |
If the ``link_repl_func`` returns None, the attribute or | |
tag text will be removed completely. | |
""" | |
if base_href is not None: | |
# FIXME: this can be done in one pass with a wrapper | |
# around link_repl_func | |
self.make_links_absolute( | |
base_href, resolve_base_href=resolve_base_href) | |
elif resolve_base_href: | |
self.resolve_base_href() | |
for el, attrib, link, pos in self.iterlinks(): | |
new_link = link_repl_func(link.strip()) | |
if new_link == link: | |
continue | |
if new_link is None: | |
# Remove the attribute or element content | |
if attrib is None: | |
el.text = '' | |
else: | |
del el.attrib[attrib] | |
continue | |
if attrib is None: | |
new = el.text[:pos] + new_link + el.text[pos+len(link):] | |
el.text = new | |
else: | |
cur = el.get(attrib) | |
if not pos and len(cur) == len(link): | |
new = new_link # most common case | |
else: | |
new = cur[:pos] + new_link + cur[pos+len(link):] | |
el.set(attrib, new) | |
class _MethodFunc(object): | |
""" | |
An object that represents a method on an element as a function; | |
the function takes either an element or an HTML string. It | |
returns whatever the function normally returns, or if the function | |
works in-place (and so returns None) it returns a serialized form | |
of the resulting document. | |
""" | |
def __init__(self, name, copy=False, source_class=HtmlMixin): | |
self.name = name | |
self.copy = copy | |
self.__doc__ = getattr(source_class, self.name).__doc__ | |
def __call__(self, doc, *args, **kw): | |
result_type = type(doc) | |
if isinstance(doc, basestring): | |
if 'copy' in kw: | |
raise TypeError( | |
"The keyword 'copy' can only be used with element inputs to %s, not a string input" % self.name) | |
doc = fromstring(doc, **kw) | |
else: | |
if 'copy' in kw: | |
make_a_copy = kw.pop('copy') | |
else: | |
make_a_copy = self.copy | |
if make_a_copy: | |
doc = copy.deepcopy(doc) | |
meth = getattr(doc, self.name) | |
result = meth(*args, **kw) | |
# FIXME: this None test is a bit sloppy | |
if result is None: | |
# Then return what we got in | |
return _transform_result(result_type, doc) | |
else: | |
return result | |
find_rel_links = _MethodFunc('find_rel_links', copy=False) | |
find_class = _MethodFunc('find_class', copy=False) | |
make_links_absolute = _MethodFunc('make_links_absolute', copy=True) | |
resolve_base_href = _MethodFunc('resolve_base_href', copy=True) | |
iterlinks = _MethodFunc('iterlinks', copy=False) | |
rewrite_links = _MethodFunc('rewrite_links', copy=True) | |
class HtmlComment(etree.CommentBase, HtmlMixin): | |
pass | |
class HtmlElement(etree.ElementBase, HtmlMixin): | |
# Override etree.ElementBase.cssselect() and set(), despite the MRO (FIXME: change base order?) | |
cssselect = HtmlMixin.cssselect | |
set = HtmlMixin.set | |
class HtmlProcessingInstruction(etree.PIBase, HtmlMixin): | |
pass | |
class HtmlEntity(etree.EntityBase, HtmlMixin): | |
pass | |
class HtmlElementClassLookup(etree.CustomElementClassLookup): | |
"""A lookup scheme for HTML Element classes. | |
To create a lookup instance with different Element classes, pass a tag | |
name mapping of Element classes in the ``classes`` keyword argument and/or | |
a tag name mapping of Mixin classes in the ``mixins`` keyword argument. | |
The special key '*' denotes a Mixin class that should be mixed into all | |
Element classes. | |
""" | |
_default_element_classes = {} | |
def __init__(self, classes=None, mixins=None): | |
etree.CustomElementClassLookup.__init__(self) | |
if classes is None: | |
classes = self._default_element_classes.copy() | |
if mixins: | |
mixers = {} | |
for name, value in mixins: | |
if name == '*': | |
for n in classes.keys(): | |
mixers.setdefault(n, []).append(value) | |
else: | |
mixers.setdefault(name, []).append(value) | |
for name, mix_bases in mixers.items(): | |
cur = classes.get(name, HtmlElement) | |
bases = tuple(mix_bases + [cur]) | |
classes[name] = type(cur.__name__, bases, {}) | |
self._element_classes = classes | |
def lookup(self, node_type, document, namespace, name): | |
if node_type == 'element': | |
return self._element_classes.get(name.lower(), HtmlElement) | |
elif node_type == 'comment': | |
return HtmlComment | |
elif node_type == 'PI': | |
return HtmlProcessingInstruction | |
elif node_type == 'entity': | |
return HtmlEntity | |
# Otherwise normal lookup | |
return None | |
################################################################################ | |
# parsing | |
################################################################################ | |
_looks_like_full_html_unicode = re.compile( | |
unicode(r'^\s*<(?:html|!doctype)'), re.I).match | |
_looks_like_full_html_bytes = re.compile( | |
r'^\s*<(?:html|!doctype)'.encode('ascii'), re.I).match | |
def document_fromstring(html, parser=None, ensure_head_body=False, **kw): | |
if parser is None: | |
parser = html_parser | |
value = etree.fromstring(html, parser, **kw) | |
if value is None: | |
raise etree.ParserError( | |
"Document is empty") | |
if ensure_head_body and value.find('head') is None: | |
value.insert(0, Element('head')) | |
if ensure_head_body and value.find('body') is None: | |
value.append(Element('body')) | |
return value | |
def fragments_fromstring(html, no_leading_text=False, base_url=None, | |
parser=None, **kw): | |
"""Parses several HTML elements, returning a list of elements. | |
The first item in the list may be a string. | |
If no_leading_text is true, then it will be an error if there is | |
leading text, and it will always be a list of only elements. | |
base_url will set the document's base_url attribute | |
(and the tree's docinfo.URL). | |
""" | |
if parser is None: | |
parser = html_parser | |
# FIXME: check what happens when you give html with a body, head, etc. | |
if isinstance(html, bytes): | |
if not _looks_like_full_html_bytes(html): | |
# can't use %-formatting in early Py3 versions | |
html = ('<html><body>'.encode('ascii') + html + | |
'</body></html>'.encode('ascii')) | |
else: | |
if not _looks_like_full_html_unicode(html): | |
html = '<html><body>%s</body></html>' % html | |
doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) | |
assert _nons(doc.tag) == 'html' | |
bodies = [e for e in doc if _nons(e.tag) == 'body'] | |
assert len(bodies) == 1, ("too many bodies: %r in %r" % (bodies, html)) | |
body = bodies[0] | |
elements = [] | |
if no_leading_text and body.text and body.text.strip(): | |
raise etree.ParserError( | |
"There is leading text: %r" % body.text) | |
if body.text and body.text.strip(): | |
elements.append(body.text) | |
elements.extend(body) | |
# FIXME: removing the reference to the parent artificial document | |
# would be nice | |
return elements | |
def fragment_fromstring(html, create_parent=False, base_url=None, | |
parser=None, **kw): | |
""" | |
Parses a single HTML element; it is an error if there is more than | |
one element, or if anything but whitespace precedes or follows the | |
element. | |
If ``create_parent`` is true (or is a tag name) then a parent node | |
will be created to encapsulate the HTML in a single element. In this | |
case, leading or trailing text is also allowed, as are multiple elements | |
as result of the parsing. | |
Passing a ``base_url`` will set the document's ``base_url`` attribute | |
(and the tree's docinfo.URL). | |
""" | |
if parser is None: | |
parser = html_parser | |
accept_leading_text = bool(create_parent) | |
elements = fragments_fromstring( | |
html, parser=parser, no_leading_text=not accept_leading_text, | |
base_url=base_url, **kw) | |
if create_parent: | |
if not isinstance(create_parent, basestring): | |
create_parent = 'div' | |
new_root = Element(create_parent) | |
if elements: | |
if isinstance(elements[0], basestring): | |
new_root.text = elements[0] | |
del elements[0] | |
new_root.extend(elements) | |
return new_root | |
if not elements: | |
raise etree.ParserError('No elements found') | |
if len(elements) > 1: | |
raise etree.ParserError( | |
"Multiple elements found (%s)" | |
% ', '.join([_element_name(e) for e in elements])) | |
el = elements[0] | |
if el.tail and el.tail.strip(): | |
raise etree.ParserError( | |
"Element followed by text: %r" % el.tail) | |
el.tail = None | |
return el | |
def fromstring(html, base_url=None, parser=None, **kw): | |
""" | |
Parse the html, returning a single element/document. | |
This tries to minimally parse the chunk of text, without knowing if it | |
is a fragment or a document. | |
base_url will set the document's base_url attribute (and the tree's docinfo.URL) | |
""" | |
if parser is None: | |
parser = html_parser | |
if isinstance(html, bytes): | |
is_full_html = _looks_like_full_html_bytes(html) | |
else: | |
is_full_html = _looks_like_full_html_unicode(html) | |
doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) | |
if is_full_html: | |
return doc | |
# otherwise, lets parse it out... | |
bodies = doc.findall('body') | |
if not bodies: | |
bodies = doc.findall('{%s}body' % XHTML_NAMESPACE) | |
if bodies: | |
body = bodies[0] | |
if len(bodies) > 1: | |
# Somehow there are multiple bodies, which is bad, but just | |
# smash them into one body | |
for other_body in bodies[1:]: | |
if other_body.text: | |
if len(body): | |
body[-1].tail = (body[-1].tail or '') + other_body.text | |
else: | |
body.text = (body.text or '') + other_body.text | |
body.extend(other_body) | |
# We'll ignore tail | |
# I guess we are ignoring attributes too | |
other_body.drop_tree() | |
else: | |
body = None | |
heads = doc.findall('head') | |
if not heads: | |
heads = doc.findall('{%s}head' % XHTML_NAMESPACE) | |
if heads: | |
# Well, we have some sort of structure, so lets keep it all | |
head = heads[0] | |
if len(heads) > 1: | |
for other_head in heads[1:]: | |
head.extend(other_head) | |
# We don't care about text or tail in a head | |
other_head.drop_tree() | |
return doc | |
if body is None: | |
return doc | |
if (len(body) == 1 and (not body.text or not body.text.strip()) | |
and (not body[-1].tail or not body[-1].tail.strip())): | |
# The body has just one element, so it was probably a single | |
# element passed in | |
return body[0] | |
# Now we have a body which represents a bunch of tags which have the | |
# content that was passed in. We will create a fake container, which | |
# is the body tag, except <body> implies too much structure. | |
if _contains_block_level_tag(body): | |
body.tag = 'div' | |
else: | |
body.tag = 'span' | |
return body | |
def parse(filename_or_url, parser=None, base_url=None, **kw): | |
""" | |
Parse a filename, URL, or file-like object into an HTML document | |
tree. Note: this returns a tree, not an element. Use | |
``parse(...).getroot()`` to get the document root. | |
You can override the base URL with the ``base_url`` keyword. This | |
is most useful when parsing from a file-like object. | |
""" | |
if parser is None: | |
parser = html_parser | |
return etree.parse(filename_or_url, parser, base_url=base_url, **kw) | |
def _contains_block_level_tag(el): | |
# FIXME: I could do this with XPath, but would that just be | |
# unnecessarily slow? | |
for el in el.iter(etree.Element): | |
if _nons(el.tag) in defs.block_tags: | |
return True | |
return False | |
def _element_name(el): | |
if isinstance(el, etree.CommentBase): | |
return 'comment' | |
elif isinstance(el, basestring): | |
return 'string' | |
else: | |
return _nons(el.tag) | |
################################################################################ | |
# form handling | |
################################################################################ | |
class FormElement(HtmlElement): | |
""" | |
Represents a <form> element. | |
""" | |
@property | |
def inputs(self): | |
""" | |
Returns an accessor for all the input elements in the form. | |
See `InputGetter` for more information about the object. | |
""" | |
return InputGetter(self) | |
@property | |
def fields(self): | |
""" | |
Dictionary-like object that represents all the fields in this | |
form. You can set values in this dictionary to effect the | |
form. | |
""" | |
return FieldsDict(self.inputs) | |
@fields.setter | |
def fields(self, value): | |
fields = self.fields | |
prev_keys = fields.keys() | |
for key, value in value.items(): | |
if key in prev_keys: | |
prev_keys.remove(key) | |
fields[key] = value | |
for key in prev_keys: | |
if key is None: | |
# Case of an unnamed input; these aren't really | |
# expressed in form_values() anyway. | |
continue | |
fields[key] = None | |
def _name(self): | |
if self.get('name'): | |
return self.get('name') | |
elif self.get('id'): | |
return '#' + self.get('id') | |
iter_tags = self.body.iter | |
forms = list(iter_tags('form')) | |
if not forms: | |
forms = list(iter_tags('{%s}form' % XHTML_NAMESPACE)) | |
return str(forms.index(self)) | |
def form_values(self): | |
""" | |
Return a list of tuples of the field values for the form. | |
This is suitable to be passed to ``urllib.urlencode()``. | |
""" | |
results = [] | |
for el in self.inputs: | |
name = el.name | |
if not name or 'disabled' in el.attrib: | |
continue | |
tag = _nons(el.tag) | |
if tag == 'textarea': | |
results.append((name, el.value)) | |
elif tag == 'select': | |
value = el.value | |
if el.multiple: | |
for v in value: | |
results.append((name, v)) | |
elif value is not None: | |
results.append((name, el.value)) | |
else: | |
assert tag == 'input', ( | |
"Unexpected tag: %r" % el) | |
if el.checkable and not el.checked: | |
continue | |
if el.type in ('submit', 'image', 'reset', 'file'): | |
continue | |
value = el.value | |
if value is not None: | |
results.append((name, el.value)) | |
return results | |
@property | |
def action(self): | |
""" | |
Get/set the form's ``action`` attribute. | |
""" | |
base_url = self.base_url | |
action = self.get('action') | |
if base_url and action is not None: | |
return urljoin(base_url, action) | |
else: | |
return action | |
@action.setter | |
def action(self, value): | |
self.set('action', value) | |
@action.deleter | |
def action(self): | |
attrib = self.attrib | |
if 'action' in attrib: | |
del attrib['action'] | |
@property | |
def method(self): | |
""" | |
Get/set the form's method. Always returns a capitalized | |
string, and defaults to ``'GET'`` | |
""" | |
return self.get('method', 'GET').upper() | |
@method.setter | |
def method(self, value): | |
self.set('method', value.upper()) | |
HtmlElementClassLookup._default_element_classes['form'] = FormElement | |
def submit_form(form, extra_values=None, open_http=None): | |
""" | |
Helper function to submit a form. Returns a file-like object, as from | |
``urllib.urlopen()``. This object also has a ``.geturl()`` function, | |
which shows the URL if there were any redirects. | |
You can use this like:: | |
form = doc.forms[0] | |
form.inputs['foo'].value = 'bar' # etc | |
response = form.submit() | |
doc = parse(response) | |
doc.make_links_absolute(response.geturl()) | |
To change the HTTP requester, pass a function as ``open_http`` keyword | |
argument that opens the URL for you. The function must have the following | |
signature:: | |
open_http(method, URL, values) | |
The action is one of 'GET' or 'POST', the URL is the target URL as a | |
string, and the values are a sequence of ``(name, value)`` tuples with the | |
form data. | |
""" | |
values = form.form_values() | |
if extra_values: | |
if hasattr(extra_values, 'items'): | |
extra_values = extra_values.items() | |
values.extend(extra_values) | |
if open_http is None: | |
open_http = open_http_urllib | |
if form.action: | |
url = form.action | |
else: | |
url = form.base_url | |
return open_http(form.method, url, values) | |
def open_http_urllib(method, url, values): | |
if not url: | |
raise ValueError("cannot submit, no URL provided") | |
## FIXME: should test that it's not a relative URL or something | |
try: | |
from urllib import urlencode, urlopen | |
except ImportError: # Python 3 | |
from urllib.request import urlopen | |
from urllib.parse import urlencode | |
if method == 'GET': | |
if '?' in url: | |
url += '&' | |
else: | |
url += '?' | |
url += urlencode(values) | |
data = None | |
else: | |
data = urlencode(values) | |
if not isinstance(data, bytes): | |
data = data.encode('ASCII') | |
return urlopen(url, data) | |
class FieldsDict(MutableMapping): | |
def __init__(self, inputs): | |
self.inputs = inputs | |
def __getitem__(self, item): | |
return self.inputs[item].value | |
def __setitem__(self, item, value): | |
self.inputs[item].value = value | |
def __delitem__(self, item): | |
raise KeyError( | |
"You cannot remove keys from ElementDict") | |
def keys(self): | |
return self.inputs.keys() | |
def __contains__(self, item): | |
return item in self.inputs | |
def __iter__(self): | |
return iter(self.inputs.keys()) | |
def __len__(self): | |
return len(self.inputs) | |
def __repr__(self): | |
return '<%s for form %s>' % ( | |
self.__class__.__name__, | |
self.inputs.form._name()) | |
class InputGetter(object): | |
""" | |
An accessor that represents all the input fields in a form. | |
You can get fields by name from this, with | |
``form.inputs['field_name']``. If there are a set of checkboxes | |
with the same name, they are returned as a list (a `CheckboxGroup` | |
which also allows value setting). Radio inputs are handled | |
similarly. | |
You can also iterate over this to get all input elements. This | |
won't return the same thing as if you get all the names, as | |
checkboxes and radio elements are returned individually. | |
""" | |
_name_xpath = etree.XPath(".//*[@name = $name and (local-name(.) = 'select' or local-name(.) = 'input' or local-name(.) = 'textarea')]") | |
_all_xpath = etree.XPath(".//*[local-name() = 'select' or local-name() = 'input' or local-name() = 'textarea']") | |
def __init__(self, form): | |
self.form = form | |
def __repr__(self): | |
return '<%s for form %s>' % ( | |
self.__class__.__name__, | |
self.form._name()) | |
## FIXME: there should be more methods, and it's unclear if this is | |
## a dictionary-like object or list-like object | |
def __getitem__(self, name): | |
results = self._name_xpath(self.form, name=name) | |
if results: | |
type = results[0].get('type') | |
if type == 'radio' and len(results) > 1: | |
group = RadioGroup(results) | |
group.name = name | |
return group | |
elif type == 'checkbox' and len(results) > 1: | |
group = CheckboxGroup(results) | |
group.name = name | |
return group | |
else: | |
# I don't like throwing away elements like this | |
return results[0] | |
else: | |
raise KeyError( | |
"No input element with the name %r" % name) | |
def __contains__(self, name): | |
results = self._name_xpath(self.form, name=name) | |
return bool(results) | |
def keys(self): | |
names = set() | |
for el in self: | |
names.add(el.name) | |
if None in names: | |
names.remove(None) | |
return list(names) | |
def __iter__(self): | |
## FIXME: kind of dumb to turn a list into an iterator, only | |
## to have it likely turned back into a list again :( | |
return iter(self._all_xpath(self.form)) | |
class InputMixin(object): | |
""" | |
Mix-in for all input elements (input, select, and textarea) | |
""" | |
@property | |
def name(self): | |
""" | |
Get/set the name of the element | |
""" | |
return self.get('name') | |
@name.setter | |
def name(self, value): | |
self.set('name', value) | |
@name.deleter | |
def name(self): | |
attrib = self.attrib | |
if 'name' in attrib: | |
del attrib['name'] | |
def __repr__(self): | |
type_name = getattr(self, 'type', None) | |
if type_name: | |
type_name = ' type=%r' % type_name | |
else: | |
type_name = '' | |
return '<%s %x name=%r%s>' % ( | |
self.__class__.__name__, id(self), self.name, type_name) | |
class TextareaElement(InputMixin, HtmlElement): | |
""" | |
``<textarea>`` element. You can get the name with ``.name`` and | |
get/set the value with ``.value`` | |
""" | |
@property | |
def value(self): | |
""" | |
Get/set the value (which is the contents of this element) | |
""" | |
content = self.text or '' | |
if self.tag.startswith("{%s}" % XHTML_NAMESPACE): | |
serialisation_method = 'xml' | |
else: | |
serialisation_method = 'html' | |
for el in self: | |
# it's rare that we actually get here, so let's not use ''.join() | |
content += etree.tostring( | |
el, method=serialisation_method, encoding='unicode') | |
return content | |
@value.setter | |
def value(self, value): | |
del self[:] | |
self.text = value | |
@value.deleter | |
def value(self): | |
self.text = '' | |
del self[:] | |
HtmlElementClassLookup._default_element_classes['textarea'] = TextareaElement | |
class SelectElement(InputMixin, HtmlElement): | |
""" | |
``<select>`` element. You can get the name with ``.name``. | |
``.value`` will be the value of the selected option, unless this | |
is a multi-select element (``<select multiple>``), in which case | |
it will be a set-like object. In either case ``.value_options`` | |
gives the possible values. | |
The boolean attribute ``.multiple`` shows if this is a | |
multi-select. | |
""" | |
@property | |
def value(self): | |
""" | |
Get/set the value of this select (the selected option). | |
If this is a multi-select, this is a set-like object that | |
represents all the selected options. | |
""" | |
if self.multiple: | |
return MultipleSelectOptions(self) | |
options = _options_xpath(self) | |
try: | |
selected_option = next(el for el in reversed(options) if el.get('selected') is not None) | |
except StopIteration: | |
try: | |
selected_option = next(el for el in options if el.get('disabled') is None) | |
except StopIteration: | |
return None | |
value = selected_option.get('value') | |
if value is None: | |
value = (selected_option.text or '').strip() | |
return value | |
@value.setter | |
def value(self, value): | |
if self.multiple: | |
if isinstance(value, basestring): | |
raise TypeError("You must pass in a sequence") | |
values = self.value | |
values.clear() | |
values.update(value) | |
return | |
checked_option = None | |
if value is not None: | |
for el in _options_xpath(self): | |
opt_value = el.get('value') | |
if opt_value is None: | |
opt_value = (el.text or '').strip() | |
if opt_value == value: | |
checked_option = el | |
break | |
else: | |
raise ValueError( | |
"There is no option with the value of %r" % value) | |
for el in _options_xpath(self): | |
if 'selected' in el.attrib: | |
del el.attrib['selected'] | |
if checked_option is not None: | |
checked_option.set('selected', '') | |
@value.deleter | |
def value(self): | |
# FIXME: should del be allowed at all? | |
if self.multiple: | |
self.value.clear() | |
else: | |
self.value = None | |
@property | |
def value_options(self): | |
""" | |
All the possible values this select can have (the ``value`` | |
attribute of all the ``<option>`` elements. | |
""" | |
options = [] | |
for el in _options_xpath(self): | |
value = el.get('value') | |
if value is None: | |
value = (el.text or '').strip() | |
options.append(value) | |
return options | |
@property | |
def multiple(self): | |
""" | |
Boolean attribute: is there a ``multiple`` attribute on this element. | |
""" | |
return 'multiple' in self.attrib | |
@multiple.setter | |
def multiple(self, value): | |
if value: | |
self.set('multiple', '') | |
elif 'multiple' in self.attrib: | |
del self.attrib['multiple'] | |
HtmlElementClassLookup._default_element_classes['select'] = SelectElement | |
class MultipleSelectOptions(SetMixin): | |
""" | |
Represents all the selected options in a ``<select multiple>`` element. | |
You can add to this set-like option to select an option, or remove | |
to unselect the option. | |
""" | |
def __init__(self, select): | |
self.select = select | |
@property | |
def options(self): | |
""" | |
Iterator of all the ``<option>`` elements. | |
""" | |
return iter(_options_xpath(self.select)) | |
def __iter__(self): | |
for option in self.options: | |
if 'selected' in option.attrib: | |
opt_value = option.get('value') | |
if opt_value is None: | |
opt_value = (option.text or '').strip() | |
yield opt_value | |
def add(self, item): | |
for option in self.options: | |
opt_value = option.get('value') | |
if opt_value is None: | |
opt_value = (option.text or '').strip() | |
if opt_value == item: | |
option.set('selected', '') | |
break | |
else: | |
raise ValueError( | |
"There is no option with the value %r" % item) | |
def remove(self, item): | |
for option in self.options: | |
opt_value = option.get('value') | |
if opt_value is None: | |
opt_value = (option.text or '').strip() | |
if opt_value == item: | |
if 'selected' in option.attrib: | |
del option.attrib['selected'] | |
else: | |
raise ValueError( | |
"The option %r is not currently selected" % item) | |
break | |
else: | |
raise ValueError( | |
"There is not option with the value %r" % item) | |
def __repr__(self): | |
return '<%s {%s} for select name=%r>' % ( | |
self.__class__.__name__, | |
', '.join([repr(v) for v in self]), | |
self.select.name) | |
class RadioGroup(list): | |
""" | |
This object represents several ``<input type=radio>`` elements | |
that have the same name. | |
You can use this like a list, but also use the property | |
``.value`` to check/uncheck inputs. Also you can use | |
``.value_options`` to get the possible values. | |
""" | |
@property | |
def value(self): | |
""" | |
Get/set the value, which checks the radio with that value (and | |
unchecks any other value). | |
""" | |
for el in self: | |
if 'checked' in el.attrib: | |
return el.get('value') | |
return None | |
@value.setter | |
def value(self, value): | |
checked_option = None | |
if value is not None: | |
for el in self: | |
if el.get('value') == value: | |
checked_option = el | |
break | |
else: | |
raise ValueError("There is no radio input with the value %r" % value) | |
for el in self: | |
if 'checked' in el.attrib: | |
del el.attrib['checked'] | |
if checked_option is not None: | |
checked_option.set('checked', '') | |
@value.deleter | |
def value(self): | |
self.value = None | |
@property | |
def value_options(self): | |
""" | |
Returns a list of all the possible values. | |
""" | |
return [el.get('value') for el in self] | |
def __repr__(self): | |
return '%s(%s)' % ( | |
self.__class__.__name__, | |
list.__repr__(self)) | |
class CheckboxGroup(list): | |
""" | |
Represents a group of checkboxes (``<input type=checkbox>``) that | |
have the same name. | |
In addition to using this like a list, the ``.value`` attribute | |
returns a set-like object that you can add to or remove from to | |
check and uncheck checkboxes. You can also use ``.value_options`` | |
to get the possible values. | |
""" | |
@property | |
def value(self): | |
""" | |
Return a set-like object that can be modified to check or | |
uncheck individual checkboxes according to their value. | |
""" | |
return CheckboxValues(self) | |
@value.setter | |
def value(self, value): | |
values = self.value | |
values.clear() | |
if not hasattr(value, '__iter__'): | |
raise ValueError( | |
"A CheckboxGroup (name=%r) must be set to a sequence (not %r)" | |
% (self[0].name, value)) | |
values.update(value) | |
@value.deleter | |
def value(self): | |
self.value.clear() | |
@property | |
def value_options(self): | |
""" | |
Returns a list of all the possible values. | |
""" | |
return [el.get('value') for el in self] | |
def __repr__(self): | |
return '%s(%s)' % ( | |
self.__class__.__name__, list.__repr__(self)) | |
class CheckboxValues(SetMixin): | |
""" | |
Represents the values of the checked checkboxes in a group of | |
checkboxes with the same name. | |
""" | |
def __init__(self, group): | |
self.group = group | |
def __iter__(self): | |
return iter([ | |
el.get('value') | |
for el in self.group | |
if 'checked' in el.attrib]) | |
def add(self, value): | |
for el in self.group: | |
if el.get('value') == value: | |
el.set('checked', '') | |
break | |
else: | |
raise KeyError("No checkbox with value %r" % value) | |
def remove(self, value): | |
for el in self.group: | |
if el.get('value') == value: | |
if 'checked' in el.attrib: | |
del el.attrib['checked'] | |
else: | |
raise KeyError( | |
"The checkbox with value %r was already unchecked" % value) | |
break | |
else: | |
raise KeyError( | |
"No checkbox with value %r" % value) | |
def __repr__(self): | |
return '<%s {%s} for checkboxes name=%r>' % ( | |
self.__class__.__name__, | |
', '.join([repr(v) for v in self]), | |
self.group.name) | |
class InputElement(InputMixin, HtmlElement): | |
""" | |
Represents an ``<input>`` element. | |
You can get the type with ``.type`` (which is lower-cased and | |
defaults to ``'text'``). | |
Also you can get and set the value with ``.value`` | |
Checkboxes and radios have the attribute ``input.checkable == | |
True`` (for all others it is false) and a boolean attribute | |
``.checked``. | |
""" | |
## FIXME: I'm a little uncomfortable with the use of .checked | |
@property | |
def value(self): | |
""" | |
Get/set the value of this element, using the ``value`` attribute. | |
Also, if this is a checkbox and it has no value, this defaults | |
to ``'on'``. If it is a checkbox or radio that is not | |
checked, this returns None. | |
""" | |
if self.checkable: | |
if self.checked: | |
return self.get('value') or 'on' | |
else: | |
return None | |
return self.get('value') | |
@value.setter | |
def value(self, value): | |
if self.checkable: | |
if not value: | |
self.checked = False | |
else: | |
self.checked = True | |
if isinstance(value, basestring): | |
self.set('value', value) | |
else: | |
self.set('value', value) | |
@value.deleter | |
def value(self): | |
if self.checkable: | |
self.checked = False | |
else: | |
if 'value' in self.attrib: | |
del self.attrib['value'] | |
@property | |
def type(self): | |
""" | |
Return the type of this element (using the type attribute). | |
""" | |
return self.get('type', 'text').lower() | |
@type.setter | |
def type(self, value): | |
self.set('type', value) | |
@property | |
def checkable(self): | |
""" | |
Boolean: can this element be checked? | |
""" | |
return self.type in ('checkbox', 'radio') | |
@property | |
def checked(self): | |
""" | |
Boolean attribute to get/set the presence of the ``checked`` | |
attribute. | |
You can only use this on checkable input types. | |
""" | |
if not self.checkable: | |
raise AttributeError('Not a checkable input type') | |
return 'checked' in self.attrib | |
@checked.setter | |
def checked(self, value): | |
if not self.checkable: | |
raise AttributeError('Not a checkable input type') | |
if value: | |
self.set('checked', '') | |
else: | |
attrib = self.attrib | |
if 'checked' in attrib: | |
del attrib['checked'] | |
HtmlElementClassLookup._default_element_classes['input'] = InputElement | |
class LabelElement(HtmlElement): | |
""" | |
Represents a ``<label>`` element. | |
Label elements are linked to other elements with their ``for`` | |
attribute. You can access this element with ``label.for_element``. | |
""" | |
@property | |
def for_element(self): | |
""" | |
Get/set the element this label points to. Return None if it | |
can't be found. | |
""" | |
id = self.get('for') | |
if not id: | |
return None | |
return self.body.get_element_by_id(id) | |
@for_element.setter | |
def for_element(self, other): | |
id = other.get('id') | |
if not id: | |
raise TypeError( | |
"Element %r has no id attribute" % other) | |
self.set('for', id) | |
@for_element.deleter | |
def for_element(self): | |
attrib = self.attrib | |
if 'id' in attrib: | |
del attrib['id'] | |
HtmlElementClassLookup._default_element_classes['label'] = LabelElement | |
############################################################ | |
## Serialization | |
############################################################ | |
def html_to_xhtml(html): | |
"""Convert all tags in an HTML tree to XHTML by moving them to the | |
XHTML namespace. | |
""" | |
try: | |
html = html.getroot() | |
except AttributeError: | |
pass | |
prefix = "{%s}" % XHTML_NAMESPACE | |
for el in html.iter(etree.Element): | |
tag = el.tag | |
if tag[0] != '{': | |
el.tag = prefix + tag | |
def xhtml_to_html(xhtml): | |
"""Convert all tags in an XHTML tree to HTML by removing their | |
XHTML namespace. | |
""" | |
try: | |
xhtml = xhtml.getroot() | |
except AttributeError: | |
pass | |
prefix = "{%s}" % XHTML_NAMESPACE | |
prefix_len = len(prefix) | |
for el in xhtml.iter(prefix + "*"): | |
el.tag = el.tag[prefix_len:] | |
# This isn't a general match, but it's a match for what libxml2 | |
# specifically serialises: | |
__str_replace_meta_content_type = re.compile( | |
r'<meta http-equiv="Content-Type"[^>]*>').sub | |
__bytes_replace_meta_content_type = re.compile( | |
r'<meta http-equiv="Content-Type"[^>]*>'.encode('ASCII')).sub | |
def tostring(doc, pretty_print=False, include_meta_content_type=False, | |
encoding=None, method="html", with_tail=True, doctype=None): | |
"""Return an HTML string representation of the document. | |
Note: if include_meta_content_type is true this will create a | |
``<meta http-equiv="Content-Type" ...>`` tag in the head; | |
regardless of the value of include_meta_content_type any existing | |
``<meta http-equiv="Content-Type" ...>`` tag will be removed | |
The ``encoding`` argument controls the output encoding (defaults to | |
ASCII, with &#...; character references for any characters outside | |
of ASCII). Note that you can pass the name ``'unicode'`` as | |
``encoding`` argument to serialise to a Unicode string. | |
The ``method`` argument defines the output method. It defaults to | |
'html', but can also be 'xml' for xhtml output, or 'text' to | |
serialise to plain text without markup. | |
To leave out the tail text of the top-level element that is being | |
serialised, pass ``with_tail=False``. | |
The ``doctype`` option allows passing in a plain string that will | |
be serialised before the XML tree. Note that passing in non | |
well-formed content here will make the XML output non well-formed. | |
Also, an existing doctype in the document tree will not be removed | |
when serialising an ElementTree instance. | |
Example:: | |
>>> from lxml import html | |
>>> root = html.fragment_fromstring('<p>Hello<br>world!</p>') | |
>>> html.tostring(root) | |
b'<p>Hello<br>world!</p>' | |
>>> html.tostring(root, method='html') | |
b'<p>Hello<br>world!</p>' | |
>>> html.tostring(root, method='xml') | |
b'<p>Hello<br/>world!</p>' | |
>>> html.tostring(root, method='text') | |
b'Helloworld!' | |
>>> html.tostring(root, method='text', encoding='unicode') | |
u'Helloworld!' | |
>>> root = html.fragment_fromstring('<div><p>Hello<br>world!</p>TAIL</div>') | |
>>> html.tostring(root[0], method='text', encoding='unicode') | |
u'Helloworld!TAIL' | |
>>> html.tostring(root[0], method='text', encoding='unicode', with_tail=False) | |
u'Helloworld!' | |
>>> doc = html.document_fromstring('<p>Hello<br>world!</p>') | |
>>> html.tostring(doc, method='html', encoding='unicode') | |
u'<html><body><p>Hello<br>world!</p></body></html>' | |
>>> print(html.tostring(doc, method='html', encoding='unicode', | |
... doctype='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"' | |
... ' "http://www.w3.org/TR/html4/strict.dtd">')) | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html><body><p>Hello<br>world!</p></body></html> | |
""" | |
html = etree.tostring(doc, method=method, pretty_print=pretty_print, | |
encoding=encoding, with_tail=with_tail, | |
doctype=doctype) | |
if method == 'html' and not include_meta_content_type: | |
if isinstance(html, str): | |
html = __str_replace_meta_content_type('', html) | |
else: | |
html = __bytes_replace_meta_content_type(bytes(), html) | |
return html | |
tostring.__doc__ = __fix_docstring(tostring.__doc__) | |
def open_in_browser(doc, encoding=None): | |
""" | |
Open the HTML document in a web browser, saving it to a temporary | |
file to open it. Note that this does not delete the file after | |
use. This is mainly meant for debugging. | |
""" | |
import os | |
import webbrowser | |
import tempfile | |
if not isinstance(doc, etree._ElementTree): | |
doc = etree.ElementTree(doc) | |
handle, fn = tempfile.mkstemp(suffix='.html') | |
f = os.fdopen(handle, 'wb') | |
try: | |
doc.write(f, method="html", encoding=encoding or doc.docinfo.encoding or "UTF-8") | |
finally: | |
# we leak the file itself here, but we should at least close it | |
f.close() | |
url = 'file://' + fn.replace(os.path.sep, '/') | |
print(url) | |
webbrowser.open(url) | |
################################################################################ | |
# configure Element class lookup | |
################################################################################ | |
class HTMLParser(etree.HTMLParser): | |
"""An HTML parser that is configured to return lxml.html Element | |
objects. | |
""" | |
def __init__(self, **kwargs): | |
super(HTMLParser, self).__init__(**kwargs) | |
self.set_element_class_lookup(HtmlElementClassLookup()) | |
class XHTMLParser(etree.XMLParser): | |
"""An XML parser that is configured to return lxml.html Element | |
objects. | |
Note that this parser is not really XHTML aware unless you let it | |
load a DTD that declares the HTML entities. To do this, make sure | |
you have the XHTML DTDs installed in your catalogs, and create the | |
parser like this:: | |
>>> parser = XHTMLParser(load_dtd=True) | |
If you additionally want to validate the document, use this:: | |
>>> parser = XHTMLParser(dtd_validation=True) | |
For catalog support, see http://www.xmlsoft.org/catalog.html. | |
""" | |
def __init__(self, **kwargs): | |
super(XHTMLParser, self).__init__(**kwargs) | |
self.set_element_class_lookup(HtmlElementClassLookup()) | |
def Element(*args, **kw): | |
"""Create a new HTML Element. | |
This can also be used for XHTML documents. | |
""" | |
v = html_parser.makeelement(*args, **kw) | |
return v | |
html_parser = HTMLParser() | |
xhtml_parser = XHTMLParser() |
from __future__ import absolute_import | |
import optparse | |
import sys | |
import re | |
import os | |
from .diff import htmldiff | |
description = """\ | |
""" | |
parser = optparse.OptionParser( | |
usage="%prog [OPTIONS] FILE1 FILE2\n" | |
"%prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...", | |
description=description, | |
) | |
parser.add_option( | |
'-o', '--output', | |
metavar="FILE", | |
dest="output", | |
default="-", | |
help="File to write the difference to", | |
) | |
parser.add_option( | |
'-a', '--annotation', | |
action="store_true", | |
dest="annotation", | |
help="Do an annotation") | |
def main(args=None): | |
if args is None: | |
args = sys.argv[1:] | |
options, args = parser.parse_args(args) | |
if options.annotation: | |
return annotate(options, args) | |
if len(args) != 2: | |
print('Error: you must give two files') | |
parser.print_help() | |
sys.exit(1) | |
file1, file2 = args | |
input1 = read_file(file1) | |
input2 = read_file(file2) | |
body1 = split_body(input1)[1] | |
pre, body2, post = split_body(input2) | |
result = htmldiff(body1, body2) | |
result = pre + result + post | |
if options.output == '-': | |
if not result.endswith('\n'): | |
result += '\n' | |
sys.stdout.write(result) | |
else: | |
with open(options.output, 'wb') as f: | |
f.write(result) | |
def read_file(filename): | |
if filename == '-': | |
c = sys.stdin.read() | |
elif not os.path.exists(filename): | |
raise OSError( | |
"Input file %s does not exist" % filename) | |
else: | |
with open(filename, 'rb') as f: | |
c = f.read() | |
return c | |
body_start_re = re.compile( | |
r"<body.*?>", re.I|re.S) | |
body_end_re = re.compile( | |
r"</body.*?>", re.I|re.S) | |
def split_body(html): | |
pre = post = '' | |
match = body_start_re.search(html) | |
if match: | |
pre = html[:match.end()] | |
html = html[match.end():] | |
match = body_end_re.search(html) | |
if match: | |
post = html[match.start():] | |
html = html[:match.start()] | |
return pre, html, post | |
def annotate(options, args): | |
print("Not yet implemented") | |
sys.exit(1) | |
""" | |
Legacy module - don't use in new code! | |
html5lib now has its own proper implementation. | |
This module implements a tree builder for html5lib that generates lxml | |
html element trees. This module uses camelCase as it follows the | |
html5lib style guide. | |
""" | |
from html5lib.treebuilders import _base, etree as etree_builders | |
from lxml import html, etree | |
class DocumentType(object): | |
def __init__(self, name, publicId, systemId): | |
self.name = name | |
self.publicId = publicId | |
self.systemId = systemId | |
class Document(object): | |
def __init__(self): | |
self._elementTree = None | |
self.childNodes = [] | |
def appendChild(self, element): | |
self._elementTree.getroot().addnext(element._element) | |
class TreeBuilder(_base.TreeBuilder): | |
documentClass = Document | |
doctypeClass = DocumentType | |
elementClass = None | |
commentClass = None | |
fragmentClass = Document | |
def __init__(self, *args, **kwargs): | |
html_builder = etree_builders.getETreeModule(html, fullTree=False) | |
etree_builder = etree_builders.getETreeModule(etree, fullTree=False) | |
self.elementClass = html_builder.Element | |
self.commentClass = etree_builder.Comment | |
_base.TreeBuilder.__init__(self, *args, **kwargs) | |
def reset(self): | |
_base.TreeBuilder.reset(self) | |
self.rootInserted = False | |
self.initialComments = [] | |
self.doctype = None | |
def getDocument(self): | |
return self.document._elementTree | |
def getFragment(self): | |
fragment = [] | |
element = self.openElements[0]._element | |
if element.text: | |
fragment.append(element.text) | |
fragment.extend(element.getchildren()) | |
if element.tail: | |
fragment.append(element.tail) | |
return fragment | |
def insertDoctype(self, name, publicId, systemId): | |
doctype = self.doctypeClass(name, publicId, systemId) | |
self.doctype = doctype | |
def insertComment(self, data, parent=None): | |
if not self.rootInserted: | |
self.initialComments.append(data) | |
else: | |
_base.TreeBuilder.insertComment(self, data, parent) | |
def insertRoot(self, name): | |
buf = [] | |
if self.doctype and self.doctype.name: | |
buf.append('<!DOCTYPE %s' % self.doctype.name) | |
if self.doctype.publicId is not None or self.doctype.systemId is not None: | |
buf.append(' PUBLIC "%s" "%s"' % (self.doctype.publicId, | |
self.doctype.systemId)) | |
buf.append('>') | |
buf.append('<html></html>') | |
root = html.fromstring(''.join(buf)) | |
# Append the initial comments: | |
for comment in self.initialComments: | |
root.addprevious(etree.Comment(comment)) | |
# Create the root document and add the ElementTree to it | |
self.document = self.documentClass() | |
self.document._elementTree = root.getroottree() | |
# Add the root element to the internal child/open data structures | |
root_element = self.elementClass(name) | |
root_element._element = root | |
self.document.childNodes.append(root_element) | |
self.openElements.append(root_element) | |
self.rootInserted = True |
try: | |
from collections.abc import MutableSet | |
except ImportError: | |
from collections import MutableSet | |
class SetMixin(MutableSet): | |
""" | |
Mix-in for sets. You must define __iter__, add, remove | |
""" | |
def __len__(self): | |
length = 0 | |
for item in self: | |
length += 1 | |
return length | |
def __contains__(self, item): | |
for has_item in self: | |
if item == has_item: | |
return True | |
return False | |
issubset = MutableSet.__le__ | |
issuperset = MutableSet.__ge__ | |
union = MutableSet.__or__ | |
intersection = MutableSet.__and__ | |
difference = MutableSet.__sub__ | |
symmetric_difference = MutableSet.__xor__ | |
def copy(self): | |
return set(self) | |
def update(self, other): | |
self |= other | |
def intersection_update(self, other): | |
self &= other | |
def difference_update(self, other): | |
self -= other | |
def symmetric_difference_update(self, other): | |
self ^= other | |
def discard(self, item): | |
try: | |
self.remove(item) | |
except KeyError: | |
pass | |
@classmethod | |
def _from_iterable(cls, it): | |
return set(it) |
# -------------------------------------------------------------------- | |
# The ElementTree toolkit is | |
# Copyright (c) 1999-2004 by Fredrik Lundh | |
# -------------------------------------------------------------------- | |
""" | |
A set of HTML generator tags for building HTML documents. | |
Usage:: | |
>>> from lxml.html.builder import * | |
>>> html = HTML( | |
... HEAD( TITLE("Hello World") ), | |
... BODY( CLASS("main"), | |
... H1("Hello World !") | |
... ) | |
... ) | |
>>> import lxml.etree | |
>>> print lxml.etree.tostring(html, pretty_print=True) | |
<html> | |
<head> | |
<title>Hello World</title> | |
</head> | |
<body class="main"> | |
<h1>Hello World !</h1> | |
</body> | |
</html> | |
""" | |
from lxml.builder import ElementMaker | |
from lxml.html import html_parser | |
E = ElementMaker(makeelement=html_parser.makeelement) | |
# elements | |
A = E.a # anchor | |
ABBR = E.abbr # abbreviated form (e.g., WWW, HTTP, etc.) | |
ACRONYM = E.acronym # | |
ADDRESS = E.address # information on author | |
APPLET = E.applet # Java applet (DEPRECATED) | |
AREA = E.area # client-side image map area | |
B = E.b # bold text style | |
BASE = E.base # document base URI | |
BASEFONT = E.basefont # base font size (DEPRECATED) | |
BDO = E.bdo # I18N BiDi over-ride | |
BIG = E.big # large text style | |
BLOCKQUOTE = E.blockquote # long quotation | |
BODY = E.body # document body | |
BR = E.br # forced line break | |
BUTTON = E.button # push button | |
CAPTION = E.caption # table caption | |
CENTER = E.center # shorthand for DIV align=center (DEPRECATED) | |
CITE = E.cite # citation | |
CODE = E.code # computer code fragment | |
COL = E.col # table column | |
COLGROUP = E.colgroup # table column group | |
DD = E.dd # definition description | |
DEL = getattr(E, 'del') # deleted text | |
DFN = E.dfn # instance definition | |
DIR = E.dir # directory list (DEPRECATED) | |
DIV = E.div # generic language/style container | |
DL = E.dl # definition list | |
DT = E.dt # definition term | |
EM = E.em # emphasis | |
FIELDSET = E.fieldset # form control group | |
FONT = E.font # local change to font (DEPRECATED) | |
FORM = E.form # interactive form | |
FRAME = E.frame # subwindow | |
FRAMESET = E.frameset # window subdivision | |
H1 = E.h1 # heading | |
H2 = E.h2 # heading | |
H3 = E.h3 # heading | |
H4 = E.h4 # heading | |
H5 = E.h5 # heading | |
H6 = E.h6 # heading | |
HEAD = E.head # document head | |
HR = E.hr # horizontal rule | |
HTML = E.html # document root element | |
I = E.i # italic text style | |
IFRAME = E.iframe # inline subwindow | |
IMG = E.img # Embedded image | |
INPUT = E.input # form control | |
INS = E.ins # inserted text | |
ISINDEX = E.isindex # single line prompt (DEPRECATED) | |
KBD = E.kbd # text to be entered by the user | |
LABEL = E.label # form field label text | |
LEGEND = E.legend # fieldset legend | |
LI = E.li # list item | |
LINK = E.link # a media-independent link | |
MAP = E.map # client-side image map | |
MENU = E.menu # menu list (DEPRECATED) | |
META = E.meta # generic metainformation | |
NOFRAMES = E.noframes # alternate content container for non frame-based rendering | |
NOSCRIPT = E.noscript # alternate content container for non script-based rendering | |
OBJECT = E.object # generic embedded object | |
OL = E.ol # ordered list | |
OPTGROUP = E.optgroup # option group | |
OPTION = E.option # selectable choice | |
P = E.p # paragraph | |
PARAM = E.param # named property value | |
PRE = E.pre # preformatted text | |
Q = E.q # short inline quotation | |
S = E.s # strike-through text style (DEPRECATED) | |
SAMP = E.samp # sample program output, scripts, etc. | |
SCRIPT = E.script # script statements | |
SELECT = E.select # option selector | |
SMALL = E.small # small text style | |
SPAN = E.span # generic language/style container | |
STRIKE = E.strike # strike-through text (DEPRECATED) | |
STRONG = E.strong # strong emphasis | |
STYLE = E.style # style info | |
SUB = E.sub # subscript | |
SUP = E.sup # superscript | |
TABLE = E.table # | |
TBODY = E.tbody # table body | |
TD = E.td # table data cell | |
TEXTAREA = E.textarea # multi-line text field | |
TFOOT = E.tfoot # table footer | |
TH = E.th # table header cell | |
THEAD = E.thead # table header | |
TITLE = E.title # document title | |
TR = E.tr # table row | |
TT = E.tt # teletype or monospaced text style | |
U = E.u # underlined text style (DEPRECATED) | |
UL = E.ul # unordered list | |
VAR = E.var # instance of a variable or program argument | |
# attributes (only reserved words are included here) | |
ATTR = dict | |
def CLASS(v): return {'class': v} | |
def FOR(v): return {'for': v} |
# cython: language_level=2 | |
"""A cleanup tool for HTML. | |
Removes unwanted tags and content. See the `Cleaner` class for | |
details. | |
""" | |
from __future__ import absolute_import | |
import re | |
import copy | |
try: | |
from urlparse import urlsplit | |
from urllib import unquote_plus | |
except ImportError: | |
# Python 3 | |
from urllib.parse import urlsplit, unquote_plus | |
from lxml import etree | |
from lxml.html import defs | |
from lxml.html import fromstring, XHTML_NAMESPACE | |
from lxml.html import xhtml_to_html, _transform_result | |
try: | |
unichr | |
except NameError: | |
# Python 3 | |
unichr = chr | |
try: | |
unicode | |
except NameError: | |
# Python 3 | |
unicode = str | |
try: | |
basestring | |
except NameError: | |
basestring = (str, bytes) | |
__all__ = ['clean_html', 'clean', 'Cleaner', 'autolink', 'autolink_html', | |
'word_break', 'word_break_html'] | |
# Look at http://code.sixapart.com/trac/livejournal/browser/trunk/cgi-bin/cleanhtml.pl | |
# Particularly the CSS cleaning; most of the tag cleaning is integrated now | |
# I have multiple kinds of schemes searched; but should schemes be | |
# whitelisted instead? | |
# max height? | |
# remove images? Also in CSS? background attribute? | |
# Some way to whitelist object, iframe, etc (e.g., if you want to | |
# allow *just* embedded YouTube movies) | |
# Log what was deleted and why? | |
# style="behavior: ..." might be bad in IE? | |
# Should we have something for just <meta http-equiv>? That's the worst of the | |
# metas. | |
# UTF-7 detections? Example: | |
# <HEAD><META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-7"> </HEAD>+ADw-SCRIPT+AD4-alert('XSS');+ADw-/SCRIPT+AD4- | |
# you don't always have to have the charset set, if the page has no charset | |
# and there's UTF7-like code in it. | |
# Look at these tests: http://htmlpurifier.org/live/smoketests/xssAttacks.php | |
# This is an IE-specific construct you can have in a stylesheet to | |
# run some Javascript: | |
_css_javascript_re = re.compile( | |
r'expression\s*\(.*?\)', re.S|re.I) | |
# Do I have to worry about @\nimport? | |
_css_import_re = re.compile( | |
r'@\s*import', re.I) | |
# All kinds of schemes besides just javascript: that can cause | |
# execution: | |
_is_image_dataurl = re.compile( | |
r'^data:image/.+;base64', re.I).search | |
_is_possibly_malicious_scheme = re.compile( | |
r'(?:javascript|jscript|livescript|vbscript|data|about|mocha):', | |
re.I).search | |
def _is_javascript_scheme(s): | |
if _is_image_dataurl(s): | |
return None | |
return _is_possibly_malicious_scheme(s) | |
_substitute_whitespace = re.compile(r'[\s\x00-\x08\x0B\x0C\x0E-\x19]+').sub | |
# FIXME: should data: be blocked? | |
# FIXME: check against: http://msdn2.microsoft.com/en-us/library/ms537512.aspx | |
_conditional_comment_re = re.compile( | |
r'\[if[\s\n\r]+.*?][\s\n\r]*>', re.I|re.S) | |
_find_styled_elements = etree.XPath( | |
"descendant-or-self::*[@style]") | |
_find_external_links = etree.XPath( | |
("descendant-or-self::a [normalize-space(@href) and substring(normalize-space(@href),1,1) != '#'] |" | |
"descendant-or-self::x:a[normalize-space(@href) and substring(normalize-space(@href),1,1) != '#']"), | |
namespaces={'x':XHTML_NAMESPACE}) | |
class Cleaner(object): | |
""" | |
Instances cleans the document of each of the possible offending | |
elements. The cleaning is controlled by attributes; you can | |
override attributes in a subclass, or set them in the constructor. | |
``scripts``: | |
Removes any ``<script>`` tags. | |
``javascript``: | |
Removes any Javascript, like an ``onclick`` attribute. Also removes stylesheets | |
as they could contain Javascript. | |
``comments``: | |
Removes any comments. | |
``style``: | |
Removes any style tags. | |
``inline_style`` | |
Removes any style attributes. Defaults to the value of the ``style`` option. | |
``links``: | |
Removes any ``<link>`` tags | |
``meta``: | |
Removes any ``<meta>`` tags | |
``page_structure``: | |
Structural parts of a page: ``<head>``, ``<html>``, ``<title>``. | |
``processing_instructions``: | |
Removes any processing instructions. | |
``embedded``: | |
Removes any embedded objects (flash, iframes) | |
``frames``: | |
Removes any frame-related tags | |
``forms``: | |
Removes any form tags | |
``annoying_tags``: | |
Tags that aren't *wrong*, but are annoying. ``<blink>`` and ``<marquee>`` | |
``remove_tags``: | |
A list of tags to remove. Only the tags will be removed, | |
their content will get pulled up into the parent tag. | |
``kill_tags``: | |
A list of tags to kill. Killing also removes the tag's content, | |
i.e. the whole subtree, not just the tag itself. | |
``allow_tags``: | |
A list of tags to include (default include all). | |
``remove_unknown_tags``: | |
Remove any tags that aren't standard parts of HTML. | |
``safe_attrs_only``: | |
If true, only include 'safe' attributes (specifically the list | |
from the feedparser HTML sanitisation web site). | |
``safe_attrs``: | |
A set of attribute names to override the default list of attributes | |
considered 'safe' (when safe_attrs_only=True). | |
``add_nofollow``: | |
If true, then any <a> tags will have ``rel="nofollow"`` added to them. | |
``host_whitelist``: | |
A list or set of hosts that you can use for embedded content | |
(for content like ``<object>``, ``<link rel="stylesheet">``, etc). | |
You can also implement/override the method | |
``allow_embedded_url(el, url)`` or ``allow_element(el)`` to | |
implement more complex rules for what can be embedded. | |
Anything that passes this test will be shown, regardless of | |
the value of (for instance) ``embedded``. | |
Note that this parameter might not work as intended if you do not | |
make the links absolute before doing the cleaning. | |
Note that you may also need to set ``whitelist_tags``. | |
``whitelist_tags``: | |
A set of tags that can be included with ``host_whitelist``. | |
The default is ``iframe`` and ``embed``; you may wish to | |
include other tags like ``script``, or you may want to | |
implement ``allow_embedded_url`` for more control. Set to None to | |
include all tags. | |
This modifies the document *in place*. | |
""" | |
scripts = True | |
javascript = True | |
comments = True | |
style = False | |
inline_style = None | |
links = True | |
meta = True | |
page_structure = True | |
processing_instructions = True | |
embedded = True | |
frames = True | |
forms = True | |
annoying_tags = True | |
remove_tags = None | |
allow_tags = None | |
kill_tags = None | |
remove_unknown_tags = True | |
safe_attrs_only = True | |
safe_attrs = defs.safe_attrs | |
add_nofollow = False | |
host_whitelist = () | |
whitelist_tags = {'iframe', 'embed'} | |
def __init__(self, **kw): | |
for name, value in kw.items(): | |
if not hasattr(self, name): | |
raise TypeError( | |
"Unknown parameter: %s=%r" % (name, value)) | |
setattr(self, name, value) | |
if self.inline_style is None and 'inline_style' not in kw: | |
self.inline_style = self.style | |
# Used to lookup the primary URL for a given tag that is up for | |
# removal: | |
_tag_link_attrs = dict( | |
script='src', | |
link='href', | |
# From: http://java.sun.com/j2se/1.4.2/docs/guide/misc/applet.html | |
# From what I can tell, both attributes can contain a link: | |
applet=['code', 'object'], | |
iframe='src', | |
embed='src', | |
layer='src', | |
# FIXME: there doesn't really seem like a general way to figure out what | |
# links an <object> tag uses; links often go in <param> tags with values | |
# that we don't really know. You'd have to have knowledge about specific | |
# kinds of plugins (probably keyed off classid), and match against those. | |
##object=?, | |
# FIXME: not looking at the action currently, because it is more complex | |
# than than -- if you keep the form, you should keep the form controls. | |
##form='action', | |
a='href', | |
) | |
def __call__(self, doc): | |
""" | |
Cleans the document. | |
""" | |
if hasattr(doc, 'getroot'): | |
# ElementTree instance, instead of an element | |
doc = doc.getroot() | |
# convert XHTML to HTML | |
xhtml_to_html(doc) | |
# Normalize a case that IE treats <image> like <img>, and that | |
# can confuse either this step or later steps. | |
for el in doc.iter('image'): | |
el.tag = 'img' | |
if not self.comments: | |
# Of course, if we were going to kill comments anyway, we don't | |
# need to worry about this | |
self.kill_conditional_comments(doc) | |
kill_tags = set(self.kill_tags or ()) | |
remove_tags = set(self.remove_tags or ()) | |
allow_tags = set(self.allow_tags or ()) | |
if self.scripts: | |
kill_tags.add('script') | |
if self.safe_attrs_only: | |
safe_attrs = set(self.safe_attrs) | |
for el in doc.iter(etree.Element): | |
attrib = el.attrib | |
for aname in attrib.keys(): | |
if aname not in safe_attrs: | |
del attrib[aname] | |
if self.javascript: | |
if not (self.safe_attrs_only and | |
self.safe_attrs == defs.safe_attrs): | |
# safe_attrs handles events attributes itself | |
for el in doc.iter(etree.Element): | |
attrib = el.attrib | |
for aname in attrib.keys(): | |
if aname.startswith('on'): | |
del attrib[aname] | |
doc.rewrite_links(self._remove_javascript_link, | |
resolve_base_href=False) | |
# If we're deleting style then we don't have to remove JS links | |
# from styles, otherwise... | |
if not self.inline_style: | |
for el in _find_styled_elements(doc): | |
old = el.get('style') | |
new = _css_javascript_re.sub('', old) | |
new = _css_import_re.sub('', new) | |
if self._has_sneaky_javascript(new): | |
# Something tricky is going on... | |
del el.attrib['style'] | |
elif new != old: | |
el.set('style', new) | |
if not self.style: | |
for el in list(doc.iter('style')): | |
if el.get('type', '').lower().strip() == 'text/javascript': | |
el.drop_tree() | |
continue | |
old = el.text or '' | |
new = _css_javascript_re.sub('', old) | |
# The imported CSS can do anything; we just can't allow: | |
new = _css_import_re.sub('', old) | |
if self._has_sneaky_javascript(new): | |
# Something tricky is going on... | |
el.text = '/* deleted */' | |
elif new != old: | |
el.text = new | |
if self.comments or self.processing_instructions: | |
# FIXME: why either? I feel like there's some obscure reason | |
# because you can put PIs in comments...? But I've already | |
# forgotten it | |
kill_tags.add(etree.Comment) | |
if self.processing_instructions: | |
kill_tags.add(etree.ProcessingInstruction) | |
if self.style: | |
kill_tags.add('style') | |
if self.inline_style: | |
etree.strip_attributes(doc, 'style') | |
if self.links: | |
kill_tags.add('link') | |
elif self.style or self.javascript: | |
# We must get rid of included stylesheets if Javascript is not | |
# allowed, as you can put Javascript in them | |
for el in list(doc.iter('link')): | |
if 'stylesheet' in el.get('rel', '').lower(): | |
# Note this kills alternate stylesheets as well | |
if not self.allow_element(el): | |
el.drop_tree() | |
if self.meta: | |
kill_tags.add('meta') | |
if self.page_structure: | |
remove_tags.update(('head', 'html', 'title')) | |
if self.embedded: | |
# FIXME: is <layer> really embedded? | |
# We should get rid of any <param> tags not inside <applet>; | |
# These are not really valid anyway. | |
for el in list(doc.iter('param')): | |
found_parent = False | |
parent = el.getparent() | |
while parent is not None and parent.tag not in ('applet', 'object'): | |
parent = parent.getparent() | |
if parent is None: | |
el.drop_tree() | |
kill_tags.update(('applet',)) | |
# The alternate contents that are in an iframe are a good fallback: | |
remove_tags.update(('iframe', 'embed', 'layer', 'object', 'param')) | |
if self.frames: | |
# FIXME: ideally we should look at the frame links, but | |
# generally frames don't mix properly with an HTML | |
# fragment anyway. | |
kill_tags.update(defs.frame_tags) | |
if self.forms: | |
remove_tags.add('form') | |
kill_tags.update(('button', 'input', 'select', 'textarea')) | |
if self.annoying_tags: | |
remove_tags.update(('blink', 'marquee')) | |
_remove = [] | |
_kill = [] | |
for el in doc.iter(): | |
if el.tag in kill_tags: | |
if self.allow_element(el): | |
continue | |
_kill.append(el) | |
elif el.tag in remove_tags: | |
if self.allow_element(el): | |
continue | |
_remove.append(el) | |
if _remove and _remove[0] == doc: | |
# We have to drop the parent-most tag, which we can't | |
# do. Instead we'll rewrite it: | |
el = _remove.pop(0) | |
el.tag = 'div' | |
el.attrib.clear() | |
elif _kill and _kill[0] == doc: | |
# We have to drop the parent-most element, which we can't | |
# do. Instead we'll clear it: | |
el = _kill.pop(0) | |
if el.tag != 'html': | |
el.tag = 'div' | |
el.clear() | |
_kill.reverse() # start with innermost tags | |
for el in _kill: | |
el.drop_tree() | |
for el in _remove: | |
el.drop_tag() | |
if self.remove_unknown_tags: | |
if allow_tags: | |
raise ValueError( | |
"It does not make sense to pass in both allow_tags and remove_unknown_tags") | |
allow_tags = set(defs.tags) | |
if allow_tags: | |
bad = [] | |
for el in doc.iter(): | |
if el.tag not in allow_tags: | |
bad.append(el) | |
if bad: | |
if bad[0] is doc: | |
el = bad.pop(0) | |
el.tag = 'div' | |
el.attrib.clear() | |
for el in bad: | |
el.drop_tag() | |
if self.add_nofollow: | |
for el in _find_external_links(doc): | |
if not self.allow_follow(el): | |
rel = el.get('rel') | |
if rel: | |
if ('nofollow' in rel | |
and ' nofollow ' in (' %s ' % rel)): | |
continue | |
rel = '%s nofollow' % rel | |
else: | |
rel = 'nofollow' | |
el.set('rel', rel) | |
def allow_follow(self, anchor): | |
""" | |
Override to suppress rel="nofollow" on some anchors. | |
""" | |
return False | |
def allow_element(self, el): | |
if el.tag not in self._tag_link_attrs: | |
return False | |
attr = self._tag_link_attrs[el.tag] | |
if isinstance(attr, (list, tuple)): | |
for one_attr in attr: | |
url = el.get(one_attr) | |
if not url: | |
return False | |
if not self.allow_embedded_url(el, url): | |
return False | |
return True | |
else: | |
url = el.get(attr) | |
if not url: | |
return False | |
return self.allow_embedded_url(el, url) | |
def allow_embedded_url(self, el, url): | |
if (self.whitelist_tags is not None | |
and el.tag not in self.whitelist_tags): | |
return False | |
scheme, netloc, path, query, fragment = urlsplit(url) | |
netloc = netloc.lower().split(':', 1)[0] | |
if scheme not in ('http', 'https'): | |
return False | |
if netloc in self.host_whitelist: | |
return True | |
return False | |
def kill_conditional_comments(self, doc): | |
""" | |
IE conditional comments basically embed HTML that the parser | |
doesn't normally see. We can't allow anything like that, so | |
we'll kill any comments that could be conditional. | |
""" | |
bad = [] | |
self._kill_elements( | |
doc, lambda el: _conditional_comment_re.search(el.text), | |
etree.Comment) | |
def _kill_elements(self, doc, condition, iterate=None): | |
bad = [] | |
for el in doc.iter(iterate): | |
if condition(el): | |
bad.append(el) | |
for el in bad: | |
el.drop_tree() | |
def _remove_javascript_link(self, link): | |
# links like "j a v a s c r i p t:" might be interpreted in IE | |
new = _substitute_whitespace('', unquote_plus(link)) | |
if _is_javascript_scheme(new): | |
# FIXME: should this be None to delete? | |
return '' | |
return link | |
_substitute_comments = re.compile(r'/\*.*?\*/', re.S).sub | |
def _has_sneaky_javascript(self, style): | |
""" | |
Depending on the browser, stuff like ``e x p r e s s i o n(...)`` | |
can get interpreted, or ``expre/* stuff */ssion(...)``. This | |
checks for attempt to do stuff like this. | |
Typically the response will be to kill the entire style; if you | |
have just a bit of Javascript in the style another rule will catch | |
that and remove only the Javascript from the style; this catches | |
more sneaky attempts. | |
""" | |
style = self._substitute_comments('', style) | |
style = style.replace('\\', '') | |
style = _substitute_whitespace('', style) | |
style = style.lower() | |
if 'javascript:' in style: | |
return True | |
if 'expression(' in style: | |
return True | |
return False | |
def clean_html(self, html): | |
result_type = type(html) | |
if isinstance(html, basestring): | |
doc = fromstring(html) | |
else: | |
doc = copy.deepcopy(html) | |
self(doc) | |
return _transform_result(result_type, doc) | |
clean = Cleaner() | |
clean_html = clean.clean_html | |
############################################################ | |
## Autolinking | |
############################################################ | |
_link_regexes = [ | |
re.compile(r'(?P<body>https?://(?P<host>[a-z0-9._-]+)(?:/[/\-_.,a-z0-9%&?;=~]*)?(?:\([/\-_.,a-z0-9%&?;=~]*\))?)', re.I), | |
# This is conservative, but autolinking can be a bit conservative: | |
re.compile(r'mailto:(?P<body>[a-z0-9._-]+@(?P<host>[a-z0-9_.-]+[a-z]))', re.I), | |
] | |
_avoid_elements = ['textarea', 'pre', 'code', 'head', 'select', 'a'] | |
_avoid_hosts = [ | |
re.compile(r'^localhost', re.I), | |
re.compile(r'\bexample\.(?:com|org|net)$', re.I), | |
re.compile(r'^127\.0\.0\.1$'), | |
] | |
_avoid_classes = ['nolink'] | |
def autolink(el, link_regexes=_link_regexes, | |
avoid_elements=_avoid_elements, | |
avoid_hosts=_avoid_hosts, | |
avoid_classes=_avoid_classes): | |
""" | |
Turn any URLs into links. | |
It will search for links identified by the given regular | |
expressions (by default mailto and http(s) links). | |
It won't link text in an element in avoid_elements, or an element | |
with a class in avoid_classes. It won't link to anything with a | |
host that matches one of the regular expressions in avoid_hosts | |
(default localhost and 127.0.0.1). | |
If you pass in an element, the element's tail will not be | |
substituted, only the contents of the element. | |
""" | |
if el.tag in avoid_elements: | |
return | |
class_name = el.get('class') | |
if class_name: | |
class_name = class_name.split() | |
for match_class in avoid_classes: | |
if match_class in class_name: | |
return | |
for child in list(el): | |
autolink(child, link_regexes=link_regexes, | |
avoid_elements=avoid_elements, | |
avoid_hosts=avoid_hosts, | |
avoid_classes=avoid_classes) | |
if child.tail: | |
text, tail_children = _link_text( | |
child.tail, link_regexes, avoid_hosts, factory=el.makeelement) | |
if tail_children: | |
child.tail = text | |
index = el.index(child) | |
el[index+1:index+1] = tail_children | |
if el.text: | |
text, pre_children = _link_text( | |
el.text, link_regexes, avoid_hosts, factory=el.makeelement) | |
if pre_children: | |
el.text = text | |
el[:0] = pre_children | |
def _link_text(text, link_regexes, avoid_hosts, factory): | |
leading_text = '' | |
links = [] | |
last_pos = 0 | |
while 1: | |
best_match, best_pos = None, None | |
for regex in link_regexes: | |
regex_pos = last_pos | |
while 1: | |
match = regex.search(text, pos=regex_pos) | |
if match is None: | |
break | |
host = match.group('host') | |
for host_regex in avoid_hosts: | |
if host_regex.search(host): | |
regex_pos = match.end() | |
break | |
else: | |
break | |
if match is None: | |
continue | |
if best_pos is None or match.start() < best_pos: | |
best_match = match | |
best_pos = match.start() | |
if best_match is None: | |
# No more matches | |
if links: | |
assert not links[-1].tail | |
links[-1].tail = text | |
else: | |
assert not leading_text | |
leading_text = text | |
break | |
link = best_match.group(0) | |
end = best_match.end() | |
if link.endswith('.') or link.endswith(','): | |
# These punctuation marks shouldn't end a link | |
end -= 1 | |
link = link[:-1] | |
prev_text = text[:best_match.start()] | |
if links: | |
assert not links[-1].tail | |
links[-1].tail = prev_text | |
else: | |
assert not leading_text | |
leading_text = prev_text | |
anchor = factory('a') | |
anchor.set('href', link) | |
body = best_match.group('body') | |
if not body: | |
body = link | |
if body.endswith('.') or body.endswith(','): | |
body = body[:-1] | |
anchor.text = body | |
links.append(anchor) | |
text = text[end:] | |
return leading_text, links | |
def autolink_html(html, *args, **kw): | |
result_type = type(html) | |
if isinstance(html, basestring): | |
doc = fromstring(html) | |
else: | |
doc = copy.deepcopy(html) | |
autolink(doc, *args, **kw) | |
return _transform_result(result_type, doc) | |
autolink_html.__doc__ = autolink.__doc__ | |
############################################################ | |
## Word wrapping | |
############################################################ | |
_avoid_word_break_elements = ['pre', 'textarea', 'code'] | |
_avoid_word_break_classes = ['nobreak'] | |
def word_break(el, max_width=40, | |
avoid_elements=_avoid_word_break_elements, | |
avoid_classes=_avoid_word_break_classes, | |
break_character=unichr(0x200b)): | |
""" | |
Breaks any long words found in the body of the text (not attributes). | |
Doesn't effect any of the tags in avoid_elements, by default | |
``<textarea>`` and ``<pre>`` | |
Breaks words by inserting ​, which is a unicode character | |
for Zero Width Space character. This generally takes up no space | |
in rendering, but does copy as a space, and in monospace contexts | |
usually takes up space. | |
See http://www.cs.tut.fi/~jkorpela/html/nobr.html for a discussion | |
""" | |
# Character suggestion of ​ comes from: | |
# http://www.cs.tut.fi/~jkorpela/html/nobr.html | |
if el.tag in _avoid_word_break_elements: | |
return | |
class_name = el.get('class') | |
if class_name: | |
dont_break = False | |
class_name = class_name.split() | |
for avoid in avoid_classes: | |
if avoid in class_name: | |
dont_break = True | |
break | |
if dont_break: | |
return | |
if el.text: | |
el.text = _break_text(el.text, max_width, break_character) | |
for child in el: | |
word_break(child, max_width=max_width, | |
avoid_elements=avoid_elements, | |
avoid_classes=avoid_classes, | |
break_character=break_character) | |
if child.tail: | |
child.tail = _break_text(child.tail, max_width, break_character) | |
def word_break_html(html, *args, **kw): | |
result_type = type(html) | |
doc = fromstring(html) | |
word_break(doc, *args, **kw) | |
return _transform_result(result_type, doc) | |
def _break_text(text, max_width, break_character): | |
words = text.split() | |
for word in words: | |
if len(word) > max_width: | |
replacement = _insert_break(word, max_width, break_character) | |
text = text.replace(word, replacement) | |
return text | |
_break_prefer_re = re.compile(r'[^a-z]', re.I) | |
def _insert_break(word, width, break_character): | |
orig_word = word | |
result = '' | |
while len(word) > width: | |
start = word[:width] | |
breaks = list(_break_prefer_re.finditer(start)) | |
if breaks: | |
last_break = breaks[-1] | |
# Only walk back up to 10 characters to find a nice break: | |
if last_break.end() > width-10: | |
# FIXME: should the break character be at the end of the | |
# chunk, or the beginning of the next chunk? | |
start = word[:last_break.end()] | |
result += start + break_character | |
word = word[len(start):] | |
result += word | |
return result | |
# FIXME: this should all be confirmed against what a DTD says | |
# (probably in a test; this may not match the DTD exactly, but we | |
# should document just how it differs). | |
# Data taken from http://www.w3.org/TR/html401/index/elements.html | |
# and http://www.w3.org/community/webed/wiki/HTML/New_HTML5_Elements | |
# for html5_tags. | |
empty_tags = frozenset([ | |
'area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', | |
'img', 'input', 'isindex', 'link', 'meta', 'param', 'source', 'track']) | |
deprecated_tags = frozenset([ | |
'applet', 'basefont', 'center', 'dir', 'font', 'isindex', | |
'menu', 's', 'strike', 'u']) | |
# archive actually takes a space-separated list of URIs | |
link_attrs = frozenset([ | |
'action', 'archive', 'background', 'cite', 'classid', | |
'codebase', 'data', 'href', 'longdesc', 'profile', 'src', | |
'usemap', | |
# Not standard: | |
'dynsrc', 'lowsrc', | |
]) | |
# Not in the HTML 4 spec: | |
# onerror, onresize | |
event_attrs = frozenset([ | |
'onblur', 'onchange', 'onclick', 'ondblclick', 'onerror', | |
'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', | |
'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', | |
'onmouseup', 'onreset', 'onresize', 'onselect', 'onsubmit', | |
'onunload', | |
]) | |
safe_attrs = frozenset([ | |
'abbr', 'accept', 'accept-charset', 'accesskey', 'action', 'align', | |
'alt', 'axis', 'border', 'cellpadding', 'cellspacing', 'char', 'charoff', | |
'charset', 'checked', 'cite', 'class', 'clear', 'cols', 'colspan', | |
'color', 'compact', 'coords', 'datetime', 'dir', 'disabled', 'enctype', | |
'for', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', | |
'ismap', 'label', 'lang', 'longdesc', 'maxlength', 'media', 'method', | |
'multiple', 'name', 'nohref', 'noshade', 'nowrap', 'prompt', 'readonly', | |
'rel', 'rev', 'rows', 'rowspan', 'rules', 'scope', 'selected', 'shape', | |
'size', 'span', 'src', 'start', 'summary', 'tabindex', 'target', 'title', | |
'type', 'usemap', 'valign', 'value', 'vspace', 'width']) | |
# From http://htmlhelp.com/reference/html40/olist.html | |
top_level_tags = frozenset([ | |
'html', 'head', 'body', 'frameset', | |
]) | |
head_tags = frozenset([ | |
'base', 'isindex', 'link', 'meta', 'script', 'style', 'title', | |
]) | |
general_block_tags = frozenset([ | |
'address', | |
'blockquote', | |
'center', | |
'del', | |
'div', | |
'h1', | |
'h2', | |
'h3', | |
'h4', | |
'h5', | |
'h6', | |
'hr', | |
'ins', | |
'isindex', | |
'noscript', | |
'p', | |
'pre', | |
]) | |
list_tags = frozenset([ | |
'dir', 'dl', 'dt', 'dd', 'li', 'menu', 'ol', 'ul', | |
]) | |
table_tags = frozenset([ | |
'table', 'caption', 'colgroup', 'col', | |
'thead', 'tfoot', 'tbody', 'tr', 'td', 'th', | |
]) | |
# just this one from | |
# http://www.georgehernandez.com/h/XComputers/HTML/2BlockLevel.htm | |
block_tags = general_block_tags | list_tags | table_tags | frozenset([ | |
# Partial form tags | |
'fieldset', 'form', 'legend', 'optgroup', 'option', | |
]) | |
form_tags = frozenset([ | |
'form', 'button', 'fieldset', 'legend', 'input', 'label', | |
'select', 'optgroup', 'option', 'textarea', | |
]) | |
special_inline_tags = frozenset([ | |
'a', 'applet', 'basefont', 'bdo', 'br', 'embed', 'font', 'iframe', | |
'img', 'map', 'area', 'object', 'param', 'q', 'script', | |
'span', 'sub', 'sup', | |
]) | |
phrase_tags = frozenset([ | |
'abbr', 'acronym', 'cite', 'code', 'del', 'dfn', 'em', | |
'ins', 'kbd', 'samp', 'strong', 'var', | |
]) | |
font_style_tags = frozenset([ | |
'b', 'big', 'i', 's', 'small', 'strike', 'tt', 'u', | |
]) | |
frame_tags = frozenset([ | |
'frameset', 'frame', 'noframes', | |
]) | |
html5_tags = frozenset([ | |
'article', 'aside', 'audio', 'canvas', 'command', 'datalist', | |
'details', 'embed', 'figcaption', 'figure', 'footer', 'header', | |
'hgroup', 'keygen', 'mark', 'math', 'meter', 'nav', 'output', | |
'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary', | |
'svg', 'time', 'track', 'video', 'wbr' | |
]) | |
# These tags aren't standard | |
nonstandard_tags = frozenset(['blink', 'marquee']) | |
tags = (top_level_tags | head_tags | general_block_tags | list_tags | |
| table_tags | form_tags | special_inline_tags | phrase_tags | |
| font_style_tags | nonstandard_tags | html5_tags) |
# cython: language_level=3 | |
from __future__ import absolute_import | |
import difflib | |
from lxml import etree | |
from lxml.html import fragment_fromstring | |
import re | |
__all__ = ['html_annotate', 'htmldiff'] | |
try: | |
from html import escape as html_escape | |
except ImportError: | |
from cgi import escape as html_escape | |
try: | |
_unicode = unicode | |
except NameError: | |
# Python 3 | |
_unicode = str | |
try: | |
basestring | |
except NameError: | |
# Python 3 | |
basestring = str | |
############################################################ | |
## Annotation | |
############################################################ | |
def default_markup(text, version): | |
return '<span title="%s">%s</span>' % ( | |
html_escape(_unicode(version), 1), text) | |
def html_annotate(doclist, markup=default_markup): | |
""" | |
doclist should be ordered from oldest to newest, like:: | |
>>> version1 = 'Hello World' | |
>>> version2 = 'Goodbye World' | |
>>> print(html_annotate([(version1, 'version 1'), | |
... (version2, 'version 2')])) | |
<span title="version 2">Goodbye</span> <span title="version 1">World</span> | |
The documents must be *fragments* (str/UTF8 or unicode), not | |
complete documents | |
The markup argument is a function to markup the spans of words. | |
This function is called like markup('Hello', 'version 2'), and | |
returns HTML. The first argument is text and never includes any | |
markup. The default uses a span with a title: | |
>>> print(default_markup('Some Text', 'by Joe')) | |
<span title="by Joe">Some Text</span> | |
""" | |
# The basic strategy we have is to split the documents up into | |
# logical tokens (which are words with attached markup). We then | |
# do diffs of each of the versions to track when a token first | |
# appeared in the document; the annotation attached to the token | |
# is the version where it first appeared. | |
tokenlist = [tokenize_annotated(doc, version) | |
for doc, version in doclist] | |
cur_tokens = tokenlist[0] | |
for tokens in tokenlist[1:]: | |
html_annotate_merge_annotations(cur_tokens, tokens) | |
cur_tokens = tokens | |
# After we've tracked all the tokens, we can combine spans of text | |
# that are adjacent and have the same annotation | |
cur_tokens = compress_tokens(cur_tokens) | |
# And finally add markup | |
result = markup_serialize_tokens(cur_tokens, markup) | |
return ''.join(result).strip() | |
def tokenize_annotated(doc, annotation): | |
"""Tokenize a document and add an annotation attribute to each token | |
""" | |
tokens = tokenize(doc, include_hrefs=False) | |
for tok in tokens: | |
tok.annotation = annotation | |
return tokens | |
def html_annotate_merge_annotations(tokens_old, tokens_new): | |
"""Merge the annotations from tokens_old into tokens_new, when the | |
tokens in the new document already existed in the old document. | |
""" | |
s = InsensitiveSequenceMatcher(a=tokens_old, b=tokens_new) | |
commands = s.get_opcodes() | |
for command, i1, i2, j1, j2 in commands: | |
if command == 'equal': | |
eq_old = tokens_old[i1:i2] | |
eq_new = tokens_new[j1:j2] | |
copy_annotations(eq_old, eq_new) | |
def copy_annotations(src, dest): | |
""" | |
Copy annotations from the tokens listed in src to the tokens in dest | |
""" | |
assert len(src) == len(dest) | |
for src_tok, dest_tok in zip(src, dest): | |
dest_tok.annotation = src_tok.annotation | |
def compress_tokens(tokens): | |
""" | |
Combine adjacent tokens when there is no HTML between the tokens, | |
and they share an annotation | |
""" | |
result = [tokens[0]] | |
for tok in tokens[1:]: | |
if (not result[-1].post_tags and | |
not tok.pre_tags and | |
result[-1].annotation == tok.annotation): | |
compress_merge_back(result, tok) | |
else: | |
result.append(tok) | |
return result | |
def compress_merge_back(tokens, tok): | |
""" Merge tok into the last element of tokens (modifying the list of | |
tokens in-place). """ | |
last = tokens[-1] | |
if type(last) is not token or type(tok) is not token: | |
tokens.append(tok) | |
else: | |
text = _unicode(last) | |
if last.trailing_whitespace: | |
text += last.trailing_whitespace | |
text += tok | |
merged = token(text, | |
pre_tags=last.pre_tags, | |
post_tags=tok.post_tags, | |
trailing_whitespace=tok.trailing_whitespace) | |
merged.annotation = last.annotation | |
tokens[-1] = merged | |
def markup_serialize_tokens(tokens, markup_func): | |
""" | |
Serialize the list of tokens into a list of text chunks, calling | |
markup_func around text to add annotations. | |
""" | |
for token in tokens: | |
for pre in token.pre_tags: | |
yield pre | |
html = token.html() | |
html = markup_func(html, token.annotation) | |
if token.trailing_whitespace: | |
html += token.trailing_whitespace | |
yield html | |
for post in token.post_tags: | |
yield post | |
############################################################ | |
## HTML Diffs | |
############################################################ | |
def htmldiff(old_html, new_html): | |
## FIXME: this should take parsed documents too, and use their body | |
## or other content. | |
""" Do a diff of the old and new document. The documents are HTML | |
*fragments* (str/UTF8 or unicode), they are not complete documents | |
(i.e., no <html> tag). | |
Returns HTML with <ins> and <del> tags added around the | |
appropriate text. | |
Markup is generally ignored, with the markup from new_html | |
preserved, and possibly some markup from old_html (though it is | |
considered acceptable to lose some of the old markup). Only the | |
words in the HTML are diffed. The exception is <img> tags, which | |
are treated like words, and the href attribute of <a> tags, which | |
are noted inside the tag itself when there are changes. | |
""" | |
old_html_tokens = tokenize(old_html) | |
new_html_tokens = tokenize(new_html) | |
result = htmldiff_tokens(old_html_tokens, new_html_tokens) | |
result = ''.join(result).strip() | |
return fixup_ins_del_tags(result) | |
def htmldiff_tokens(html1_tokens, html2_tokens): | |
""" Does a diff on the tokens themselves, returning a list of text | |
chunks (not tokens). | |
""" | |
# There are several passes as we do the differences. The tokens | |
# isolate the portion of the content we care to diff; difflib does | |
# all the actual hard work at that point. | |
# | |
# Then we must create a valid document from pieces of both the old | |
# document and the new document. We generally prefer to take | |
# markup from the new document, and only do a best effort attempt | |
# to keep markup from the old document; anything that we can't | |
# resolve we throw away. Also we try to put the deletes as close | |
# to the location where we think they would have been -- because | |
# we are only keeping the markup from the new document, it can be | |
# fuzzy where in the new document the old text would have gone. | |
# Again we just do a best effort attempt. | |
s = InsensitiveSequenceMatcher(a=html1_tokens, b=html2_tokens) | |
commands = s.get_opcodes() | |
result = [] | |
for command, i1, i2, j1, j2 in commands: | |
if command == 'equal': | |
result.extend(expand_tokens(html2_tokens[j1:j2], equal=True)) | |
continue | |
if command == 'insert' or command == 'replace': | |
ins_tokens = expand_tokens(html2_tokens[j1:j2]) | |
merge_insert(ins_tokens, result) | |
if command == 'delete' or command == 'replace': | |
del_tokens = expand_tokens(html1_tokens[i1:i2]) | |
merge_delete(del_tokens, result) | |
# If deletes were inserted directly as <del> then we'd have an | |
# invalid document at this point. Instead we put in special | |
# markers, and when the complete diffed document has been created | |
# we try to move the deletes around and resolve any problems. | |
result = cleanup_delete(result) | |
return result | |
def expand_tokens(tokens, equal=False): | |
"""Given a list of tokens, return a generator of the chunks of | |
text for the data in the tokens. | |
""" | |
for token in tokens: | |
for pre in token.pre_tags: | |
yield pre | |
if not equal or not token.hide_when_equal: | |
if token.trailing_whitespace: | |
yield token.html() + token.trailing_whitespace | |
else: | |
yield token.html() | |
for post in token.post_tags: | |
yield post | |
def merge_insert(ins_chunks, doc): | |
""" doc is the already-handled document (as a list of text chunks); | |
here we add <ins>ins_chunks</ins> to the end of that. """ | |
# Though we don't throw away unbalanced_start or unbalanced_end | |
# (we assume there is accompanying markup later or earlier in the | |
# document), we only put <ins> around the balanced portion. | |
unbalanced_start, balanced, unbalanced_end = split_unbalanced(ins_chunks) | |
doc.extend(unbalanced_start) | |
if doc and not doc[-1].endswith(' '): | |
# Fix up the case where the word before the insert didn't end with | |
# a space | |
doc[-1] += ' ' | |
doc.append('<ins>') | |
if balanced and balanced[-1].endswith(' '): | |
# We move space outside of </ins> | |
balanced[-1] = balanced[-1][:-1] | |
doc.extend(balanced) | |
doc.append('</ins> ') | |
doc.extend(unbalanced_end) | |
# These are sentinals to represent the start and end of a <del> | |
# segment, until we do the cleanup phase to turn them into proper | |
# markup: | |
class DEL_START: | |
pass | |
class DEL_END: | |
pass | |
class NoDeletes(Exception): | |
""" Raised when the document no longer contains any pending deletes | |
(DEL_START/DEL_END) """ | |
def merge_delete(del_chunks, doc): | |
""" Adds the text chunks in del_chunks to the document doc (another | |
list of text chunks) with marker to show it is a delete. | |
cleanup_delete later resolves these markers into <del> tags.""" | |
doc.append(DEL_START) | |
doc.extend(del_chunks) | |
doc.append(DEL_END) | |
def cleanup_delete(chunks): | |
""" Cleans up any DEL_START/DEL_END markers in the document, replacing | |
them with <del></del>. To do this while keeping the document | |
valid, it may need to drop some tags (either start or end tags). | |
It may also move the del into adjacent tags to try to move it to a | |
similar location where it was originally located (e.g., moving a | |
delete into preceding <div> tag, if the del looks like (DEL_START, | |
'Text</div>', DEL_END)""" | |
while 1: | |
# Find a pending DEL_START/DEL_END, splitting the document | |
# into stuff-preceding-DEL_START, stuff-inside, and | |
# stuff-following-DEL_END | |
try: | |
pre_delete, delete, post_delete = split_delete(chunks) | |
except NoDeletes: | |
# Nothing found, we've cleaned up the entire doc | |
break | |
# The stuff-inside-DEL_START/END may not be well balanced | |
# markup. First we figure out what unbalanced portions there are: | |
unbalanced_start, balanced, unbalanced_end = split_unbalanced(delete) | |
# Then we move the span forward and/or backward based on these | |
# unbalanced portions: | |
locate_unbalanced_start(unbalanced_start, pre_delete, post_delete) | |
locate_unbalanced_end(unbalanced_end, pre_delete, post_delete) | |
doc = pre_delete | |
if doc and not doc[-1].endswith(' '): | |
# Fix up case where the word before us didn't have a trailing space | |
doc[-1] += ' ' | |
doc.append('<del>') | |
if balanced and balanced[-1].endswith(' '): | |
# We move space outside of </del> | |
balanced[-1] = balanced[-1][:-1] | |
doc.extend(balanced) | |
doc.append('</del> ') | |
doc.extend(post_delete) | |
chunks = doc | |
return chunks | |
def split_unbalanced(chunks): | |
"""Return (unbalanced_start, balanced, unbalanced_end), where each is | |
a list of text and tag chunks. | |
unbalanced_start is a list of all the tags that are opened, but | |
not closed in this span. Similarly, unbalanced_end is a list of | |
tags that are closed but were not opened. Extracting these might | |
mean some reordering of the chunks.""" | |
start = [] | |
end = [] | |
tag_stack = [] | |
balanced = [] | |
for chunk in chunks: | |
if not chunk.startswith('<'): | |
balanced.append(chunk) | |
continue | |
endtag = chunk[1] == '/' | |
name = chunk.split()[0].strip('<>/') | |
if name in empty_tags: | |
balanced.append(chunk) | |
continue | |
if endtag: | |
if tag_stack and tag_stack[-1][0] == name: | |
balanced.append(chunk) | |
name, pos, tag = tag_stack.pop() | |
balanced[pos] = tag | |
elif tag_stack: | |
start.extend([tag for name, pos, tag in tag_stack]) | |
tag_stack = [] | |
end.append(chunk) | |
else: | |
end.append(chunk) | |
else: | |
tag_stack.append((name, len(balanced), chunk)) | |
balanced.append(None) | |
start.extend( | |
[chunk for name, pos, chunk in tag_stack]) | |
balanced = [chunk for chunk in balanced if chunk is not None] | |
return start, balanced, end | |
def split_delete(chunks): | |
""" Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END, | |
stuff_after_DEL_END). Returns the first case found (there may be | |
more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if | |
there's no DEL_START found. """ | |
try: | |
pos = chunks.index(DEL_START) | |
except ValueError: | |
raise NoDeletes | |
pos2 = chunks.index(DEL_END) | |
return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:] | |
def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete): | |
""" pre_delete and post_delete implicitly point to a place in the | |
document (where the two were split). This moves that point (by | |
popping items from one and pushing them onto the other). It moves | |
the point to try to find a place where unbalanced_start applies. | |
As an example:: | |
>>> unbalanced_start = ['<div>'] | |
>>> doc = ['<p>', 'Text', '</p>', '<div>', 'More Text', '</div>'] | |
>>> pre, post = doc[:3], doc[3:] | |
>>> pre, post | |
(['<p>', 'Text', '</p>'], ['<div>', 'More Text', '</div>']) | |
>>> locate_unbalanced_start(unbalanced_start, pre, post) | |
>>> pre, post | |
(['<p>', 'Text', '</p>', '<div>'], ['More Text', '</div>']) | |
As you can see, we moved the point so that the dangling <div> that | |
we found will be effectively replaced by the div in the original | |
document. If this doesn't work out, we just throw away | |
unbalanced_start without doing anything. | |
""" | |
while 1: | |
if not unbalanced_start: | |
# We have totally succeeded in finding the position | |
break | |
finding = unbalanced_start[0] | |
finding_name = finding.split()[0].strip('<>') | |
if not post_delete: | |
break | |
next = post_delete[0] | |
if next is DEL_START or not next.startswith('<'): | |
# Reached a word, we can't move the delete text forward | |
break | |
if next[1] == '/': | |
# Reached a closing tag, can we go further? Maybe not... | |
break | |
name = next.split()[0].strip('<>') | |
if name == 'ins': | |
# Can't move into an insert | |
break | |
assert name != 'del', ( | |
"Unexpected delete tag: %r" % next) | |
if name == finding_name: | |
unbalanced_start.pop(0) | |
pre_delete.append(post_delete.pop(0)) | |
else: | |
# Found a tag that doesn't match | |
break | |
def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete): | |
""" like locate_unbalanced_start, except handling end tags and | |
possibly moving the point earlier in the document. """ | |
while 1: | |
if not unbalanced_end: | |
# Success | |
break | |
finding = unbalanced_end[-1] | |
finding_name = finding.split()[0].strip('<>/') | |
if not pre_delete: | |
break | |
next = pre_delete[-1] | |
if next is DEL_END or not next.startswith('</'): | |
# A word or a start tag | |
break | |
name = next.split()[0].strip('<>/') | |
if name == 'ins' or name == 'del': | |
# Can't move into an insert or delete | |
break | |
if name == finding_name: | |
unbalanced_end.pop() | |
post_delete.insert(0, pre_delete.pop()) | |
else: | |
# Found a tag that doesn't match | |
break | |
class token(_unicode): | |
""" Represents a diffable token, generally a word that is displayed to | |
the user. Opening tags are attached to this token when they are | |
adjacent (pre_tags) and closing tags that follow the word | |
(post_tags). Some exceptions occur when there are empty tags | |
adjacent to a word, so there may be close tags in pre_tags, or | |
open tags in post_tags. | |
We also keep track of whether the word was originally followed by | |
whitespace, even though we do not want to treat the word as | |
equivalent to a similar word that does not have a trailing | |
space.""" | |
# When this is true, the token will be eliminated from the | |
# displayed diff if no change has occurred: | |
hide_when_equal = False | |
def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""): | |
obj = _unicode.__new__(cls, text) | |
if pre_tags is not None: | |
obj.pre_tags = pre_tags | |
else: | |
obj.pre_tags = [] | |
if post_tags is not None: | |
obj.post_tags = post_tags | |
else: | |
obj.post_tags = [] | |
obj.trailing_whitespace = trailing_whitespace | |
return obj | |
def __repr__(self): | |
return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags, | |
self.post_tags, self.trailing_whitespace) | |
def html(self): | |
return _unicode(self) | |
class tag_token(token): | |
""" Represents a token that is actually a tag. Currently this is just | |
the <img> tag, which takes up visible space just like a word but | |
is only represented in a document by a tag. """ | |
def __new__(cls, tag, data, html_repr, pre_tags=None, | |
post_tags=None, trailing_whitespace=""): | |
obj = token.__new__(cls, "%s: %s" % (type, data), | |
pre_tags=pre_tags, | |
post_tags=post_tags, | |
trailing_whitespace=trailing_whitespace) | |
obj.tag = tag | |
obj.data = data | |
obj.html_repr = html_repr | |
return obj | |
def __repr__(self): | |
return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % ( | |
self.tag, | |
self.data, | |
self.html_repr, | |
self.pre_tags, | |
self.post_tags, | |
self.trailing_whitespace) | |
def html(self): | |
return self.html_repr | |
class href_token(token): | |
""" Represents the href in an anchor tag. Unlike other words, we only | |
show the href when it changes. """ | |
hide_when_equal = True | |
def html(self): | |
return ' Link: %s' % self | |
def tokenize(html, include_hrefs=True): | |
""" | |
Parse the given HTML and returns token objects (words with attached tags). | |
This parses only the content of a page; anything in the head is | |
ignored, and the <head> and <body> elements are themselves | |
optional. The content is then parsed by lxml, which ensures the | |
validity of the resulting parsed document (though lxml may make | |
incorrect guesses when the markup is particular bad). | |
<ins> and <del> tags are also eliminated from the document, as | |
that gets confusing. | |
If include_hrefs is true, then the href attribute of <a> tags is | |
included as a special kind of diffable token.""" | |
if etree.iselement(html): | |
body_el = html | |
else: | |
body_el = parse_html(html, cleanup=True) | |
# Then we split the document into text chunks for each tag, word, and end tag: | |
chunks = flatten_el(body_el, skip_tag=True, include_hrefs=include_hrefs) | |
# Finally re-joining them into token objects: | |
return fixup_chunks(chunks) | |
def parse_html(html, cleanup=True): | |
""" | |
Parses an HTML fragment, returning an lxml element. Note that the HTML will be | |
wrapped in a <div> tag that was not in the original document. | |
If cleanup is true, make sure there's no <head> or <body>, and get | |
rid of any <ins> and <del> tags. | |
""" | |
if cleanup: | |
# This removes any extra markup or structure like <head>: | |
html = cleanup_html(html) | |
return fragment_fromstring(html, create_parent=True) | |
_body_re = re.compile(r'<body.*?>', re.I|re.S) | |
_end_body_re = re.compile(r'</body.*?>', re.I|re.S) | |
_ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S) | |
def cleanup_html(html): | |
""" This 'cleans' the HTML, meaning that any page structure is removed | |
(only the contents of <body> are used, if there is any <body). | |
Also <ins> and <del> tags are removed. """ | |
match = _body_re.search(html) | |
if match: | |
html = html[match.end():] | |
match = _end_body_re.search(html) | |
if match: | |
html = html[:match.start()] | |
html = _ins_del_re.sub('', html) | |
return html | |
end_whitespace_re = re.compile(r'[ \t\n\r]$') | |
def split_trailing_whitespace(word): | |
""" | |
This function takes a word, such as 'test\n\n' and returns ('test','\n\n') | |
""" | |
stripped_length = len(word.rstrip()) | |
return word[0:stripped_length], word[stripped_length:] | |
def fixup_chunks(chunks): | |
""" | |
This function takes a list of chunks and produces a list of tokens. | |
""" | |
tag_accum = [] | |
cur_word = None | |
result = [] | |
for chunk in chunks: | |
if isinstance(chunk, tuple): | |
if chunk[0] == 'img': | |
src = chunk[1] | |
tag, trailing_whitespace = split_trailing_whitespace(chunk[2]) | |
cur_word = tag_token('img', src, html_repr=tag, | |
pre_tags=tag_accum, | |
trailing_whitespace=trailing_whitespace) | |
tag_accum = [] | |
result.append(cur_word) | |
elif chunk[0] == 'href': | |
href = chunk[1] | |
cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ") | |
tag_accum = [] | |
result.append(cur_word) | |
continue | |
if is_word(chunk): | |
chunk, trailing_whitespace = split_trailing_whitespace(chunk) | |
cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace) | |
tag_accum = [] | |
result.append(cur_word) | |
elif is_start_tag(chunk): | |
tag_accum.append(chunk) | |
elif is_end_tag(chunk): | |
if tag_accum: | |
tag_accum.append(chunk) | |
else: | |
assert cur_word, ( | |
"Weird state, cur_word=%r, result=%r, chunks=%r of %r" | |
% (cur_word, result, chunk, chunks)) | |
cur_word.post_tags.append(chunk) | |
else: | |
assert False | |
if not result: | |
return [token('', pre_tags=tag_accum)] | |
else: | |
result[-1].post_tags.extend(tag_accum) | |
return result | |
# All the tags in HTML that don't require end tags: | |
empty_tags = ( | |
'param', 'img', 'area', 'br', 'basefont', 'input', | |
'base', 'meta', 'link', 'col') | |
block_level_tags = ( | |
'address', | |
'blockquote', | |
'center', | |
'dir', | |
'div', | |
'dl', | |
'fieldset', | |
'form', | |
'h1', | |
'h2', | |
'h3', | |
'h4', | |
'h5', | |
'h6', | |
'hr', | |
'isindex', | |
'menu', | |
'noframes', | |
'noscript', | |
'ol', | |
'p', | |
'pre', | |
'table', | |
'ul', | |
) | |
block_level_container_tags = ( | |
'dd', | |
'dt', | |
'frameset', | |
'li', | |
'tbody', | |
'td', | |
'tfoot', | |
'th', | |
'thead', | |
'tr', | |
) | |
def flatten_el(el, include_hrefs, skip_tag=False): | |
""" Takes an lxml element el, and generates all the text chunks for | |
that tag. Each start tag is a chunk, each word is a chunk, and each | |
end tag is a chunk. | |
If skip_tag is true, then the outermost container tag is | |
not returned (just its contents).""" | |
if not skip_tag: | |
if el.tag == 'img': | |
yield ('img', el.get('src'), start_tag(el)) | |
else: | |
yield start_tag(el) | |
if el.tag in empty_tags and not el.text and not len(el) and not el.tail: | |
return | |
start_words = split_words(el.text) | |
for word in start_words: | |
yield html_escape(word) | |
for child in el: | |
for item in flatten_el(child, include_hrefs=include_hrefs): | |
yield item | |
if el.tag == 'a' and el.get('href') and include_hrefs: | |
yield ('href', el.get('href')) | |
if not skip_tag: | |
yield end_tag(el) | |
end_words = split_words(el.tail) | |
for word in end_words: | |
yield html_escape(word) | |
split_words_re = re.compile(r'\S+(?:\s+|$)', re.U) | |
def split_words(text): | |
""" Splits some text into words. Includes trailing whitespace | |
on each word when appropriate. """ | |
if not text or not text.strip(): | |
return [] | |
words = split_words_re.findall(text) | |
return words | |
start_whitespace_re = re.compile(r'^[ \t\n\r]') | |
def start_tag(el): | |
""" | |
The text representation of the start tag for a tag. | |
""" | |
return '<%s%s>' % ( | |
el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True)) | |
for name, value in el.attrib.items()])) | |
def end_tag(el): | |
""" The text representation of an end tag for a tag. Includes | |
trailing whitespace when appropriate. """ | |
if el.tail and start_whitespace_re.search(el.tail): | |
extra = ' ' | |
else: | |
extra = '' | |
return '</%s>%s' % (el.tag, extra) | |
def is_word(tok): | |
return not tok.startswith('<') | |
def is_end_tag(tok): | |
return tok.startswith('</') | |
def is_start_tag(tok): | |
return tok.startswith('<') and not tok.startswith('</') | |
def fixup_ins_del_tags(html): | |
""" Given an html string, move any <ins> or <del> tags inside of any | |
block-level elements, e.g. transform <ins><p>word</p></ins> to | |
<p><ins>word</ins></p> """ | |
doc = parse_html(html, cleanup=False) | |
_fixup_ins_del_tags(doc) | |
html = serialize_html_fragment(doc, skip_outer=True) | |
return html | |
def serialize_html_fragment(el, skip_outer=False): | |
""" Serialize a single lxml element as HTML. The serialized form | |
includes the elements tail. | |
If skip_outer is true, then don't serialize the outermost tag | |
""" | |
assert not isinstance(el, basestring), ( | |
"You should pass in an element, not a string like %r" % el) | |
html = etree.tostring(el, method="html", encoding=_unicode) | |
if skip_outer: | |
# Get rid of the extra starting tag: | |
html = html[html.find('>')+1:] | |
# Get rid of the extra end tag: | |
html = html[:html.rfind('<')] | |
return html.strip() | |
else: | |
return html | |
def _fixup_ins_del_tags(doc): | |
"""fixup_ins_del_tags that works on an lxml document in-place | |
""" | |
for tag in ['ins', 'del']: | |
for el in doc.xpath('descendant-or-self::%s' % tag): | |
if not _contains_block_level_tag(el): | |
continue | |
_move_el_inside_block(el, tag=tag) | |
el.drop_tag() | |
#_merge_element_contents(el) | |
def _contains_block_level_tag(el): | |
"""True if the element contains any block-level elements, like <p>, <td>, etc. | |
""" | |
if el.tag in block_level_tags or el.tag in block_level_container_tags: | |
return True | |
for child in el: | |
if _contains_block_level_tag(child): | |
return True | |
return False | |
def _move_el_inside_block(el, tag): | |
""" helper for _fixup_ins_del_tags; actually takes the <ins> etc tags | |
and moves them inside any block-level tags. """ | |
for child in el: | |
if _contains_block_level_tag(child): | |
break | |
else: | |
# No block-level tags in any child | |
children_tag = etree.Element(tag) | |
children_tag.text = el.text | |
el.text = None | |
children_tag.extend(list(el)) | |
el[:] = [children_tag] | |
return | |
for child in list(el): | |
if _contains_block_level_tag(child): | |
_move_el_inside_block(child, tag) | |
if child.tail: | |
tail_tag = etree.Element(tag) | |
tail_tag.text = child.tail | |
child.tail = None | |
el.insert(el.index(child)+1, tail_tag) | |
else: | |
child_tag = etree.Element(tag) | |
el.replace(child, child_tag) | |
child_tag.append(child) | |
if el.text: | |
text_tag = etree.Element(tag) | |
text_tag.text = el.text | |
el.text = None | |
el.insert(0, text_tag) | |
def _merge_element_contents(el): | |
""" | |
Removes an element, but merges its contents into its place, e.g., | |
given <p>Hi <i>there!</i></p>, if you remove the <i> element you get | |
<p>Hi there!</p> | |
""" | |
parent = el.getparent() | |
text = el.text or '' | |
if el.tail: | |
if not len(el): | |
text += el.tail | |
else: | |
if el[-1].tail: | |
el[-1].tail += el.tail | |
else: | |
el[-1].tail = el.tail | |
index = parent.index(el) | |
if text: | |
if index == 0: | |
previous = None | |
else: | |
previous = parent[index-1] | |
if previous is None: | |
if parent.text: | |
parent.text += text | |
else: | |
parent.text = text | |
else: | |
if previous.tail: | |
previous.tail += text | |
else: | |
previous.tail = text | |
parent[index:index+1] = el.getchildren() | |
class InsensitiveSequenceMatcher(difflib.SequenceMatcher): | |
""" | |
Acts like SequenceMatcher, but tries not to find very small equal | |
blocks amidst large spans of changes | |
""" | |
threshold = 2 | |
def get_matching_blocks(self): | |
size = min(len(self.b), len(self.b)) | |
threshold = min(self.threshold, size / 4) | |
actual = difflib.SequenceMatcher.get_matching_blocks(self) | |
return [item for item in actual | |
if item[2] > threshold | |
or not item[2]] | |
if __name__ == '__main__': | |
from lxml.html import _diffcommand | |
_diffcommand.main() | |
__doc__ = """Legacy interface to the BeautifulSoup HTML parser. | |
""" | |
__all__ = ["parse", "convert_tree"] | |
from soupparser import convert_tree, parse as _parse | |
def parse(file, beautifulsoup=None, makeelement=None): | |
root = _parse(file, beautifulsoup=beautifulsoup, makeelement=makeelement) | |
return root.getroot() |
from lxml.etree import XPath, ElementBase | |
from lxml.html import fromstring, XHTML_NAMESPACE | |
from lxml.html import _forms_xpath, _options_xpath, _nons, _transform_result | |
from lxml.html import defs | |
import copy | |
try: | |
basestring | |
except NameError: | |
# Python 3 | |
basestring = str | |
__all__ = ['FormNotFound', 'fill_form', 'fill_form_html', | |
'insert_errors', 'insert_errors_html', | |
'DefaultErrorCreator'] | |
class FormNotFound(LookupError): | |
""" | |
Raised when no form can be found | |
""" | |
_form_name_xpath = XPath('descendant-or-self::form[name=$name]|descendant-or-self::x:form[name=$name]', namespaces={'x':XHTML_NAMESPACE}) | |
_input_xpath = XPath('|'.join(['descendant-or-self::'+_tag for _tag in ('input','select','textarea','x:input','x:select','x:textarea')]), | |
namespaces={'x':XHTML_NAMESPACE}) | |
_label_for_xpath = XPath('//label[@for=$for_id]|//x:label[@for=$for_id]', | |
namespaces={'x':XHTML_NAMESPACE}) | |
_name_xpath = XPath('descendant-or-self::*[@name=$name]') | |
def fill_form( | |
el, | |
values, | |
form_id=None, | |
form_index=None, | |
): | |
el = _find_form(el, form_id=form_id, form_index=form_index) | |
_fill_form(el, values) | |
def fill_form_html(html, values, form_id=None, form_index=None): | |
result_type = type(html) | |
if isinstance(html, basestring): | |
doc = fromstring(html) | |
else: | |
doc = copy.deepcopy(html) | |
fill_form(doc, values, form_id=form_id, form_index=form_index) | |
return _transform_result(result_type, doc) | |
def _fill_form(el, values): | |
counts = {} | |
if hasattr(values, 'mixed'): | |
# For Paste request parameters | |
values = values.mixed() | |
inputs = _input_xpath(el) | |
for input in inputs: | |
name = input.get('name') | |
if not name: | |
continue | |
if _takes_multiple(input): | |
value = values.get(name, []) | |
if not isinstance(value, (list, tuple)): | |
value = [value] | |
_fill_multiple(input, value) | |
elif name not in values: | |
continue | |
else: | |
index = counts.get(name, 0) | |
counts[name] = index + 1 | |
value = values[name] | |
if isinstance(value, (list, tuple)): | |
try: | |
value = value[index] | |
except IndexError: | |
continue | |
elif index > 0: | |
continue | |
_fill_single(input, value) | |
def _takes_multiple(input): | |
if _nons(input.tag) == 'select' and input.get('multiple'): | |
# FIXME: multiple="0"? | |
return True | |
type = input.get('type', '').lower() | |
if type in ('radio', 'checkbox'): | |
return True | |
return False | |
def _fill_multiple(input, value): | |
type = input.get('type', '').lower() | |
if type == 'checkbox': | |
v = input.get('value') | |
if v is None: | |
if not value: | |
result = False | |
else: | |
result = value[0] | |
if isinstance(value, basestring): | |
# The only valid "on" value for an unnamed checkbox is 'on' | |
result = result == 'on' | |
_check(input, result) | |
else: | |
_check(input, v in value) | |
elif type == 'radio': | |
v = input.get('value') | |
_check(input, v in value) | |
else: | |
assert _nons(input.tag) == 'select' | |
for option in _options_xpath(input): | |
v = option.get('value') | |
if v is None: | |
# This seems to be the default, at least on IE | |
# FIXME: but I'm not sure | |
v = option.text_content() | |
_select(option, v in value) | |
def _check(el, check): | |
if check: | |
el.set('checked', '') | |
else: | |
if 'checked' in el.attrib: | |
del el.attrib['checked'] | |
def _select(el, select): | |
if select: | |
el.set('selected', '') | |
else: | |
if 'selected' in el.attrib: | |
del el.attrib['selected'] | |
def _fill_single(input, value): | |
if _nons(input.tag) == 'textarea': | |
input.text = value | |
else: | |
input.set('value', value) | |
def _find_form(el, form_id=None, form_index=None): | |
if form_id is None and form_index is None: | |
forms = _forms_xpath(el) | |
for form in forms: | |
return form | |
raise FormNotFound( | |
"No forms in page") | |
if form_id is not None: | |
form = el.get_element_by_id(form_id) | |
if form is not None: | |
return form | |
forms = _form_name_xpath(el, name=form_id) | |
if forms: | |
return forms[0] | |
else: | |
raise FormNotFound( | |
"No form with the name or id of %r (forms: %s)" | |
% (id, ', '.join(_find_form_ids(el)))) | |
if form_index is not None: | |
forms = _forms_xpath(el) | |
try: | |
return forms[form_index] | |
except IndexError: | |
raise FormNotFound( | |
"There is no form with the index %r (%i forms found)" | |
% (form_index, len(forms))) | |
def _find_form_ids(el): | |
forms = _forms_xpath(el) | |
if not forms: | |
yield '(no forms)' | |
return | |
for index, form in enumerate(forms): | |
if form.get('id'): | |
if form.get('name'): | |
yield '%s or %s' % (form.get('id'), | |
form.get('name')) | |
else: | |
yield form.get('id') | |
elif form.get('name'): | |
yield form.get('name') | |
else: | |
yield '(unnamed form %s)' % index | |
############################################################ | |
## Error filling | |
############################################################ | |
class DefaultErrorCreator(object): | |
insert_before = True | |
block_inside = True | |
error_container_tag = 'div' | |
error_message_class = 'error-message' | |
error_block_class = 'error-block' | |
default_message = "Invalid" | |
def __init__(self, **kw): | |
for name, value in kw.items(): | |
if not hasattr(self, name): | |
raise TypeError( | |
"Unexpected keyword argument: %s" % name) | |
setattr(self, name, value) | |
def __call__(self, el, is_block, message): | |
error_el = el.makeelement(self.error_container_tag) | |
if self.error_message_class: | |
error_el.set('class', self.error_message_class) | |
if is_block and self.error_block_class: | |
error_el.set('class', error_el.get('class', '')+' '+self.error_block_class) | |
if message is None or message == '': | |
message = self.default_message | |
if isinstance(message, ElementBase): | |
error_el.append(message) | |
else: | |
assert isinstance(message, basestring), ( | |
"Bad message; should be a string or element: %r" % message) | |
error_el.text = message or self.default_message | |
if is_block and self.block_inside: | |
if self.insert_before: | |
error_el.tail = el.text | |
el.text = None | |
el.insert(0, error_el) | |
else: | |
el.append(error_el) | |
else: | |
parent = el.getparent() | |
pos = parent.index(el) | |
if self.insert_before: | |
parent.insert(pos, error_el) | |
else: | |
error_el.tail = el.tail | |
el.tail = None | |
parent.insert(pos+1, error_el) | |
default_error_creator = DefaultErrorCreator() | |
def insert_errors( | |
el, | |
errors, | |
form_id=None, | |
form_index=None, | |
error_class="error", | |
error_creator=default_error_creator, | |
): | |
el = _find_form(el, form_id=form_id, form_index=form_index) | |
for name, error in errors.items(): | |
if error is None: | |
continue | |
for error_el, message in _find_elements_for_name(el, name, error): | |
assert isinstance(message, (basestring, type(None), ElementBase)), ( | |
"Bad message: %r" % message) | |
_insert_error(error_el, message, error_class, error_creator) | |
def insert_errors_html(html, values, **kw): | |
result_type = type(html) | |
if isinstance(html, basestring): | |
doc = fromstring(html) | |
else: | |
doc = copy.deepcopy(html) | |
insert_errors(doc, values, **kw) | |
return _transform_result(result_type, doc) | |
def _insert_error(el, error, error_class, error_creator): | |
if _nons(el.tag) in defs.empty_tags or _nons(el.tag) == 'textarea': | |
is_block = False | |
else: | |
is_block = True | |
if _nons(el.tag) != 'form' and error_class: | |
_add_class(el, error_class) | |
if el.get('id'): | |
labels = _label_for_xpath(el, for_id=el.get('id')) | |
if labels: | |
for label in labels: | |
_add_class(label, error_class) | |
error_creator(el, is_block, error) | |
def _add_class(el, class_name): | |
if el.get('class'): | |
el.set('class', el.get('class')+' '+class_name) | |
else: | |
el.set('class', class_name) | |
def _find_elements_for_name(form, name, error): | |
if name is None: | |
# An error for the entire form | |
yield form, error | |
return | |
if name.startswith('#'): | |
# By id | |
el = form.get_element_by_id(name[1:]) | |
if el is not None: | |
yield el, error | |
return | |
els = _name_xpath(form, name=name) | |
if not els: | |
# FIXME: should this raise an exception? | |
return | |
if not isinstance(error, (list, tuple)): | |
yield els[0], error | |
return | |
# FIXME: if error is longer than els, should it raise an error? | |
for el, err in zip(els, error): | |
if err is None: | |
continue | |
yield el, err |
""" | |
An interface to html5lib that mimics the lxml.html interface. | |
""" | |
import sys | |
import string | |
from html5lib import HTMLParser as _HTMLParser | |
from html5lib.treebuilders.etree_lxml import TreeBuilder | |
from lxml import etree | |
from lxml.html import Element, XHTML_NAMESPACE, _contains_block_level_tag | |
# python3 compatibility | |
try: | |
_strings = basestring | |
except NameError: | |
_strings = (bytes, str) | |
try: | |
from urllib2 import urlopen | |
except ImportError: | |
from urllib.request import urlopen | |
try: | |
from urlparse import urlparse | |
except ImportError: | |
from urllib.parse import urlparse | |
class HTMLParser(_HTMLParser): | |
"""An html5lib HTML parser with lxml as tree.""" | |
def __init__(self, strict=False, **kwargs): | |
_HTMLParser.__init__(self, strict=strict, tree=TreeBuilder, **kwargs) | |
try: | |
from html5lib import XHTMLParser as _XHTMLParser | |
except ImportError: | |
pass | |
else: | |
class XHTMLParser(_XHTMLParser): | |
"""An html5lib XHTML Parser with lxml as tree.""" | |
def __init__(self, strict=False, **kwargs): | |
_XHTMLParser.__init__(self, strict=strict, tree=TreeBuilder, **kwargs) | |
xhtml_parser = XHTMLParser() | |
def _find_tag(tree, tag): | |
elem = tree.find(tag) | |
if elem is not None: | |
return elem | |
return tree.find('{%s}%s' % (XHTML_NAMESPACE, tag)) | |
def document_fromstring(html, guess_charset=None, parser=None): | |
""" | |
Parse a whole document into a string. | |
If `guess_charset` is true, or if the input is not Unicode but a | |
byte string, the `chardet` library will perform charset guessing | |
on the string. | |
""" | |
if not isinstance(html, _strings): | |
raise TypeError('string required') | |
if parser is None: | |
parser = html_parser | |
options = {} | |
if guess_charset is None and isinstance(html, bytes): | |
# html5lib does not accept useChardet as an argument, if it | |
# detected the html argument would produce unicode objects. | |
guess_charset = True | |
if guess_charset is not None: | |
options['useChardet'] = guess_charset | |
return parser.parse(html, **options).getroot() | |
def fragments_fromstring(html, no_leading_text=False, | |
guess_charset=None, parser=None): | |
"""Parses several HTML elements, returning a list of elements. | |
The first item in the list may be a string. If no_leading_text is true, | |
then it will be an error if there is leading text, and it will always be | |
a list of only elements. | |
If `guess_charset` is true, the `chardet` library will perform charset | |
guessing on the string. | |
""" | |
if not isinstance(html, _strings): | |
raise TypeError('string required') | |
if parser is None: | |
parser = html_parser | |
options = {} | |
if guess_charset is None and isinstance(html, bytes): | |
# html5lib does not accept useChardet as an argument, if it | |
# detected the html argument would produce unicode objects. | |
guess_charset = False | |
if guess_charset is not None: | |
options['useChardet'] = guess_charset | |
children = parser.parseFragment(html, 'div', **options) | |
if children and isinstance(children[0], _strings): | |
if no_leading_text: | |
if children[0].strip(): | |
raise etree.ParserError('There is leading text: %r' % | |
children[0]) | |
del children[0] | |
return children | |
def fragment_fromstring(html, create_parent=False, | |
guess_charset=None, parser=None): | |
"""Parses a single HTML element; it is an error if there is more than | |
one element, or if anything but whitespace precedes or follows the | |
element. | |
If 'create_parent' is true (or is a tag name) then a parent node | |
will be created to encapsulate the HTML in a single element. In | |
this case, leading or trailing text is allowed. | |
If `guess_charset` is true, the `chardet` library will perform charset | |
guessing on the string. | |
""" | |
if not isinstance(html, _strings): | |
raise TypeError('string required') | |
accept_leading_text = bool(create_parent) | |
elements = fragments_fromstring( | |
html, guess_charset=guess_charset, parser=parser, | |
no_leading_text=not accept_leading_text) | |
if create_parent: | |
if not isinstance(create_parent, _strings): | |
create_parent = 'div' | |
new_root = Element(create_parent) | |
if elements: | |
if isinstance(elements[0], _strings): | |
new_root.text = elements[0] | |
del elements[0] | |
new_root.extend(elements) | |
return new_root | |
if not elements: | |
raise etree.ParserError('No elements found') | |
if len(elements) > 1: | |
raise etree.ParserError('Multiple elements found') | |
result = elements[0] | |
if result.tail and result.tail.strip(): | |
raise etree.ParserError('Element followed by text: %r' % result.tail) | |
result.tail = None | |
return result | |
def fromstring(html, guess_charset=None, parser=None): | |
"""Parse the html, returning a single element/document. | |
This tries to minimally parse the chunk of text, without knowing if it | |
is a fragment or a document. | |
'base_url' will set the document's base_url attribute (and the tree's | |
docinfo.URL) | |
If `guess_charset` is true, or if the input is not Unicode but a | |
byte string, the `chardet` library will perform charset guessing | |
on the string. | |
""" | |
if not isinstance(html, _strings): | |
raise TypeError('string required') | |
doc = document_fromstring(html, parser=parser, | |
guess_charset=guess_charset) | |
# document starts with doctype or <html>, full document! | |
start = html[:50] | |
if isinstance(start, bytes): | |
# Allow text comparison in python3. | |
# Decode as ascii, that also covers latin-1 and utf-8 for the | |
# characters we need. | |
start = start.decode('ascii', 'replace') | |
start = start.lstrip().lower() | |
if start.startswith('<html') or start.startswith('<!doctype'): | |
return doc | |
head = _find_tag(doc, 'head') | |
# if the head is not empty we have a full document | |
if len(head): | |
return doc | |
body = _find_tag(doc, 'body') | |
# The body has just one element, so it was probably a single | |
# element passed in | |
if (len(body) == 1 and (not body.text or not body.text.strip()) | |
and (not body[-1].tail or not body[-1].tail.strip())): | |
return body[0] | |
# Now we have a body which represents a bunch of tags which have the | |
# content that was passed in. We will create a fake container, which | |
# is the body tag, except <body> implies too much structure. | |
if _contains_block_level_tag(body): | |
body.tag = 'div' | |
else: | |
body.tag = 'span' | |
return body | |
def parse(filename_url_or_file, guess_charset=None, parser=None): | |
"""Parse a filename, URL, or file-like object into an HTML document | |
tree. Note: this returns a tree, not an element. Use | |
``parse(...).getroot()`` to get the document root. | |
If ``guess_charset`` is true, the ``useChardet`` option is passed into | |
html5lib to enable character detection. This option is on by default | |
when parsing from URLs, off by default when parsing from file(-like) | |
objects (which tend to return Unicode more often than not), and on by | |
default when parsing from a file path (which is read in binary mode). | |
""" | |
if parser is None: | |
parser = html_parser | |
if not isinstance(filename_url_or_file, _strings): | |
fp = filename_url_or_file | |
if guess_charset is None: | |
# assume that file-like objects return Unicode more often than bytes | |
guess_charset = False | |
elif _looks_like_url(filename_url_or_file): | |
fp = urlopen(filename_url_or_file) | |
if guess_charset is None: | |
# assume that URLs return bytes | |
guess_charset = True | |
else: | |
fp = open(filename_url_or_file, 'rb') | |
if guess_charset is None: | |
guess_charset = True | |
options = {} | |
# html5lib does not accept useChardet as an argument, if it | |
# detected the html argument would produce unicode objects. | |
if guess_charset: | |
options['useChardet'] = guess_charset | |
return parser.parse(fp, **options) | |
def _looks_like_url(str): | |
scheme = urlparse(str)[0] | |
if not scheme: | |
return False | |
elif (sys.platform == 'win32' and | |
scheme in string.ascii_letters | |
and len(scheme) == 1): | |
# looks like a 'normal' absolute path | |
return False | |
else: | |
return True | |
html_parser = HTMLParser() |
"""External interface to the BeautifulSoup HTML parser. | |
""" | |
__all__ = ["fromstring", "parse", "convert_tree"] | |
import re | |
from lxml import etree, html | |
try: | |
from bs4 import ( | |
BeautifulSoup, Tag, Comment, ProcessingInstruction, NavigableString, | |
Declaration, Doctype) | |
_DECLARATION_OR_DOCTYPE = (Declaration, Doctype) | |
except ImportError: | |
from BeautifulSoup import ( | |
BeautifulSoup, Tag, Comment, ProcessingInstruction, NavigableString, | |
Declaration) | |
_DECLARATION_OR_DOCTYPE = Declaration | |
def fromstring(data, beautifulsoup=None, makeelement=None, **bsargs): | |
"""Parse a string of HTML data into an Element tree using the | |
BeautifulSoup parser. | |
Returns the root ``<html>`` Element of the tree. | |
You can pass a different BeautifulSoup parser through the | |
`beautifulsoup` keyword, and a diffent Element factory function | |
through the `makeelement` keyword. By default, the standard | |
``BeautifulSoup`` class and the default factory of `lxml.html` are | |
used. | |
""" | |
return _parse(data, beautifulsoup, makeelement, **bsargs) | |
def parse(file, beautifulsoup=None, makeelement=None, **bsargs): | |
"""Parse a file into an ElemenTree using the BeautifulSoup parser. | |
You can pass a different BeautifulSoup parser through the | |
`beautifulsoup` keyword, and a diffent Element factory function | |
through the `makeelement` keyword. By default, the standard | |
``BeautifulSoup`` class and the default factory of `lxml.html` are | |
used. | |
""" | |
if not hasattr(file, 'read'): | |
file = open(file) | |
root = _parse(file, beautifulsoup, makeelement, **bsargs) | |
return etree.ElementTree(root) | |
def convert_tree(beautiful_soup_tree, makeelement=None): | |
"""Convert a BeautifulSoup tree to a list of Element trees. | |
Returns a list instead of a single root Element to support | |
HTML-like soup with more than one root element. | |
You can pass a different Element factory through the `makeelement` | |
keyword. | |
""" | |
root = _convert_tree(beautiful_soup_tree, makeelement) | |
children = root.getchildren() | |
for child in children: | |
root.remove(child) | |
return children | |
# helpers | |
def _parse(source, beautifulsoup, makeelement, **bsargs): | |
if beautifulsoup is None: | |
beautifulsoup = BeautifulSoup | |
if hasattr(beautifulsoup, "HTML_ENTITIES"): # bs3 | |
if 'convertEntities' not in bsargs: | |
bsargs['convertEntities'] = 'html' | |
if hasattr(beautifulsoup, "DEFAULT_BUILDER_FEATURES"): # bs4 | |
if 'features' not in bsargs: | |
bsargs['features'] = 'html.parser' # use Python html parser | |
tree = beautifulsoup(source, **bsargs) | |
root = _convert_tree(tree, makeelement) | |
# from ET: wrap the document in a html root element, if necessary | |
if len(root) == 1 and root[0].tag == "html": | |
return root[0] | |
root.tag = "html" | |
return root | |
_parse_doctype_declaration = re.compile( | |
r'(?:\s|[<!])*DOCTYPE\s*HTML' | |
r'(?:\s+PUBLIC)?(?:\s+(\'[^\']*\'|"[^"]*"))?' | |
r'(?:\s+(\'[^\']*\'|"[^"]*"))?', | |
re.IGNORECASE).match | |
class _PseudoTag: | |
# Minimal imitation of BeautifulSoup.Tag | |
def __init__(self, contents): | |
self.name = 'html' | |
self.attrs = [] | |
self.contents = contents | |
def __iter__(self): | |
return self.contents.__iter__() | |
def _convert_tree(beautiful_soup_tree, makeelement): | |
if makeelement is None: | |
makeelement = html.html_parser.makeelement | |
# Split the tree into three parts: | |
# i) everything before the root element: document type | |
# declaration, comments, processing instructions, whitespace | |
# ii) the root(s), | |
# iii) everything after the root: comments, processing | |
# instructions, whitespace | |
first_element_idx = last_element_idx = None | |
html_root = declaration = None | |
for i, e in enumerate(beautiful_soup_tree): | |
if isinstance(e, Tag): | |
if first_element_idx is None: | |
first_element_idx = i | |
last_element_idx = i | |
if html_root is None and e.name and e.name.lower() == 'html': | |
html_root = e | |
elif declaration is None and isinstance(e, _DECLARATION_OR_DOCTYPE): | |
declaration = e | |
# For a nice, well-formatted document, the variable roots below is | |
# a list consisting of a single <html> element. However, the document | |
# may be a soup like '<meta><head><title>Hello</head><body>Hi | |
# all<\p>'. In this example roots is a list containing meta, head | |
# and body elements. | |
if first_element_idx is None: | |
pre_root = post_root = [] | |
roots = beautiful_soup_tree.contents | |
else: | |
pre_root = beautiful_soup_tree.contents[:first_element_idx] | |
roots = beautiful_soup_tree.contents[first_element_idx:last_element_idx+1] | |
post_root = beautiful_soup_tree.contents[last_element_idx+1:] | |
# Reorganize so that there is one <html> root... | |
if html_root is not None: | |
# ... use existing one if possible, ... | |
i = roots.index(html_root) | |
html_root.contents = roots[:i] + html_root.contents + roots[i+1:] | |
else: | |
# ... otherwise create a new one. | |
html_root = _PseudoTag(roots) | |
convert_node = _init_node_converters(makeelement) | |
# Process pre_root | |
res_root = convert_node(html_root) | |
prev = res_root | |
for e in reversed(pre_root): | |
converted = convert_node(e) | |
if converted is not None: | |
prev.addprevious(converted) | |
prev = converted | |
# ditto for post_root | |
prev = res_root | |
for e in post_root: | |
converted = convert_node(e) | |
if converted is not None: | |
prev.addnext(converted) | |
prev = converted | |
if declaration is not None: | |
try: | |
# bs4 provides full Doctype string | |
doctype_string = declaration.output_ready() | |
except AttributeError: | |
doctype_string = declaration.string | |
match = _parse_doctype_declaration(doctype_string) | |
if not match: | |
# Something is wrong if we end up in here. Since soupparser should | |
# tolerate errors, do not raise Exception, just let it pass. | |
pass | |
else: | |
external_id, sys_uri = match.groups() | |
docinfo = res_root.getroottree().docinfo | |
# strip quotes and update DOCTYPE values (any of None, '', '...') | |
docinfo.public_id = external_id and external_id[1:-1] | |
docinfo.system_url = sys_uri and sys_uri[1:-1] | |
return res_root | |
def _init_node_converters(makeelement): | |
converters = {} | |
ordered_node_types = [] | |
def converter(*types): | |
def add(handler): | |
for t in types: | |
converters[t] = handler | |
ordered_node_types.append(t) | |
return handler | |
return add | |
def find_best_converter(node): | |
for t in ordered_node_types: | |
if isinstance(node, t): | |
return converters[t] | |
return None | |
def convert_node(bs_node, parent=None): | |
# duplicated in convert_tag() below | |
try: | |
handler = converters[type(bs_node)] | |
except KeyError: | |
handler = converters[type(bs_node)] = find_best_converter(bs_node) | |
if handler is None: | |
return None | |
return handler(bs_node, parent) | |
def map_attrs(bs_attrs): | |
if isinstance(bs_attrs, dict): # bs4 | |
attribs = {} | |
for k, v in bs_attrs.items(): | |
if isinstance(v, list): | |
v = " ".join(v) | |
attribs[k] = unescape(v) | |
else: | |
attribs = dict((k, unescape(v)) for k, v in bs_attrs) | |
return attribs | |
def append_text(parent, text): | |
if len(parent) == 0: | |
parent.text = (parent.text or '') + text | |
else: | |
parent[-1].tail = (parent[-1].tail or '') + text | |
# converters are tried in order of their definition | |
@converter(Tag, _PseudoTag) | |
def convert_tag(bs_node, parent): | |
attrs = bs_node.attrs | |
if parent is not None: | |
attribs = map_attrs(attrs) if attrs else None | |
res = etree.SubElement(parent, bs_node.name, attrib=attribs) | |
else: | |
attribs = map_attrs(attrs) if attrs else {} | |
res = makeelement(bs_node.name, attrib=attribs) | |
for child in bs_node: | |
# avoid double recursion by inlining convert_node(), see above | |
try: | |
handler = converters[type(child)] | |
except KeyError: | |
pass | |
else: | |
if handler is not None: | |
handler(child, res) | |
continue | |
convert_node(child, res) | |
return res | |
@converter(Comment) | |
def convert_comment(bs_node, parent): | |
res = html.HtmlComment(bs_node) | |
if parent is not None: | |
parent.append(res) | |
return res | |
@converter(ProcessingInstruction) | |
def convert_pi(bs_node, parent): | |
if bs_node.endswith('?'): | |
# The PI is of XML style (<?as df?>) but BeautifulSoup | |
# interpreted it as being SGML style (<?as df>). Fix. | |
bs_node = bs_node[:-1] | |
res = etree.ProcessingInstruction(*bs_node.split(' ', 1)) | |
if parent is not None: | |
parent.append(res) | |
return res | |
@converter(NavigableString) | |
def convert_text(bs_node, parent): | |
if parent is not None: | |
append_text(parent, unescape(bs_node)) | |
return None | |
return convert_node | |
# copied from ET's ElementSoup | |
try: | |
from html.entities import name2codepoint # Python 3 | |
except ImportError: | |
from htmlentitydefs import name2codepoint | |
handle_entities = re.compile(r"&(\w+);").sub | |
try: | |
unichr | |
except NameError: | |
# Python 3 | |
unichr = chr | |
def unescape(string): | |
if not string: | |
return '' | |
# work around oddities in BeautifulSoup's entity handling | |
def unescape_entity(m): | |
try: | |
return unichr(name2codepoint[m.group(1)]) | |
except KeyError: | |
return m.group(0) # use as is | |
return handle_entities(unescape_entity, string) |
"""Doctest module for HTML comparison. | |
Usage:: | |
>>> import lxml.html.usedoctest | |
>>> # now do your HTML doctests ... | |
See `lxml.doctestcompare`. | |
""" | |
from lxml import doctestcompare | |
doctestcompare.temp_install(html=True, del_module=__name__) |
from lxml.includes.tree cimport xmlDoc, xmlOutputBuffer, xmlChar | |
from lxml.includes.xpath cimport xmlNodeSet | |
cdef extern from "libxml/c14n.h": | |
cdef int xmlC14NDocDumpMemory(xmlDoc* doc, | |
xmlNodeSet* nodes, | |
int exclusive, | |
xmlChar** inclusive_ns_prefixes, | |
int with_comments, | |
xmlChar** doc_txt_ptr) nogil | |
cdef int xmlC14NDocSave(xmlDoc* doc, | |
xmlNodeSet* nodes, | |
int exclusive, | |
xmlChar** inclusive_ns_prefixes, | |
int with_comments, | |
char* filename, | |
int compression) nogil | |
cdef int xmlC14NDocSaveTo(xmlDoc* doc, | |
xmlNodeSet* nodes, | |
int exclusive, | |
xmlChar** inclusive_ns_prefixes, | |
int with_comments, | |
xmlOutputBuffer* buffer) nogil | |
cdef extern from "etree_defs.h": | |
cdef bint ENABLE_THREADING | |
cdef bint ENABLE_SCHEMATRON |
from lxml.includes cimport tree | |
from lxml.includes.tree cimport xmlDoc, xmlDtd | |
cdef extern from "libxml/valid.h" nogil: | |
ctypedef void (*xmlValidityErrorFunc)(void * ctx, const char * msg, ...) | |
ctypedef void (*xmlValidityWarningFunc)(void * ctx, const char * msg, ...) | |
ctypedef struct xmlValidCtxt: | |
void *userData | |
xmlValidityErrorFunc error | |
xmlValidityWarningFunc warning | |
cdef xmlValidCtxt* xmlNewValidCtxt() | |
cdef void xmlFreeValidCtxt(xmlValidCtxt* cur) | |
cdef int xmlValidateDtd(xmlValidCtxt* ctxt, xmlDoc* doc, xmlDtd* dtd) | |
cdef tree.xmlElement* xmlGetDtdElementDesc( | |
xmlDtd* dtd, tree.const_xmlChar* name) |
#ifndef HAS_ETREE_DEFS_H | |
#define HAS_ETREE_DEFS_H | |
/* quick check for Python/libxml2/libxslt devel setup */ | |
#include "Python.h" | |
#ifndef PY_VERSION_HEX | |
# error the development package of Python (header files etc.) is not installed correctly | |
#else | |
# if PY_VERSION_HEX < 0x02070000 || PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x03050000 | |
# error this version of lxml requires Python 2.7, 3.5 or later | |
# endif | |
#endif | |
#include "libxml/xmlversion.h" | |
#ifndef LIBXML_VERSION | |
# error the development package of libxml2 (header files etc.) is not installed correctly | |
#else | |
#if LIBXML_VERSION < 20700 | |
# error minimum required version of libxml2 is 2.7.0 | |
#endif | |
#endif | |
#include "libxslt/xsltconfig.h" | |
#ifndef LIBXSLT_VERSION | |
# error the development package of libxslt (header files etc.) is not installed correctly | |
#else | |
#if LIBXSLT_VERSION < 10123 | |
# error minimum required version of libxslt is 1.1.23 | |
#endif | |
#endif | |
/* v_arg functions */ | |
#define va_int(ap) va_arg(ap, int) | |
#define va_charptr(ap) va_arg(ap, char *) | |
#ifdef PYPY_VERSION | |
# define IS_PYPY 1 | |
#else | |
# define IS_PYPY 0 | |
#endif | |
#if PY_MAJOR_VERSION >= 3 | |
# define IS_PYTHON2 0 /* prefer for special casing Python 2.x */ | |
# define IS_PYTHON3 1 /* avoid */ | |
#else | |
# define IS_PYTHON2 1 | |
# define IS_PYTHON3 0 | |
#endif | |
#if IS_PYTHON2 | |
#ifndef LXML_UNICODE_STRINGS | |
#define LXML_UNICODE_STRINGS 0 | |
#endif | |
#else | |
#undef LXML_UNICODE_STRINGS | |
#define LXML_UNICODE_STRINGS 1 | |
#endif | |
#if !IS_PYPY | |
# define PyWeakref_LockObject(obj) (NULL) | |
#endif | |
/* Threading is not currently supported by PyPy */ | |
#if IS_PYPY | |
# ifndef WITHOUT_THREADING | |
# define WITHOUT_THREADING | |
# endif | |
#endif | |
#if IS_PYPY | |
# undef PyFile_AsFile | |
# define PyFile_AsFile(o) (NULL) | |
# undef PyByteArray_Check | |
# define PyByteArray_Check(o) (0) | |
#elif !IS_PYTHON2 | |
/* Python 3+ doesn't have PyFile_*() anymore */ | |
# define PyFile_AsFile(o) (NULL) | |
#endif | |
#if PY_VERSION_HEX <= 0x03030000 && !(defined(CYTHON_PEP393_ENABLED) && CYTHON_PEP393_ENABLED) | |
#define PyUnicode_IS_READY(op) (0) | |
#define PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) | |
#define PyUnicode_KIND(u) (sizeof(Py_UNICODE)) | |
#define PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) | |
#endif | |
#if IS_PYPY | |
# ifndef PyUnicode_FromFormat | |
# define PyUnicode_FromFormat PyString_FromFormat | |
# endif | |
# if !IS_PYTHON2 && !defined(PyBytes_FromFormat) | |
# ifdef PyString_FromFormat | |
# define PyBytes_FromFormat PyString_FromFormat | |
# else | |
#include <stdarg.h> | |
static PyObject* PyBytes_FromFormat(const char* format, ...) { | |
PyObject *string; | |
va_list vargs; | |
#ifdef HAVE_STDARG_PROTOTYPES | |
va_start(vargs, format); | |
#else | |
va_start(vargs); | |
#endif | |
string = PyUnicode_FromFormatV(format, vargs); | |
va_end(vargs); | |
if (string && PyUnicode_Check(string)) { | |
PyObject *bstring = PyUnicode_AsUTF8String(string); | |
Py_DECREF(string); | |
string = bstring; | |
} | |
if (string && !PyBytes_CheckExact(string)) { | |
Py_DECREF(string); | |
string = NULL; | |
PyErr_SetString(PyExc_TypeError, "String formatting and encoding failed to return bytes object"); | |
} | |
return string; | |
} | |
# endif | |
# endif | |
#endif | |
/* PySlice_GetIndicesEx() has wrong signature in Py<=3.1 */ | |
#if PY_VERSION_HEX >= 0x03020000 | |
# define _lx_PySlice_GetIndicesEx(o, l, b, e, s, sl) PySlice_GetIndicesEx(o, l, b, e, s, sl) | |
#else | |
# define _lx_PySlice_GetIndicesEx(o, l, b, e, s, sl) PySlice_GetIndicesEx(((PySliceObject*)o), l, b, e, s, sl) | |
#endif | |
#ifdef WITHOUT_THREADING | |
# undef PyEval_SaveThread | |
# define PyEval_SaveThread() (NULL) | |
# undef PyEval_RestoreThread | |
# define PyEval_RestoreThread(state) if (state); else {} | |
# undef PyGILState_Ensure | |
# define PyGILState_Ensure() (PyGILState_UNLOCKED) | |
# undef PyGILState_Release | |
# define PyGILState_Release(state) if (state); else {} | |
# undef Py_UNBLOCK_THREADS | |
# define Py_UNBLOCK_THREADS _save = NULL; | |
# undef Py_BLOCK_THREADS | |
# define Py_BLOCK_THREADS if (_save); else {} | |
#endif | |
#ifdef WITHOUT_THREADING | |
# define ENABLE_THREADING 0 | |
#else | |
# define ENABLE_THREADING 1 | |
#endif | |
#if LIBXML_VERSION < 20704 | |
/* FIXME: hack to make new error reporting compile in old libxml2 versions */ | |
# define xmlStructuredErrorContext NULL | |
# define xmlXIncludeProcessTreeFlagsData(n,o,d) xmlXIncludeProcessTreeFlags(n,o) | |
#endif | |
/* schematron was added in libxml2 2.6.21 */ | |
#ifdef LIBXML_SCHEMATRON_ENABLED | |
# define ENABLE_SCHEMATRON 1 | |
#else | |
# define ENABLE_SCHEMATRON 0 | |
# define XML_SCHEMATRON_OUT_QUIET 0 | |
# define XML_SCHEMATRON_OUT_XML 0 | |
# define XML_SCHEMATRON_OUT_ERROR 0 | |
typedef void xmlSchematron; | |
typedef void xmlSchematronParserCtxt; | |
typedef void xmlSchematronValidCtxt; | |
# define xmlSchematronNewDocParserCtxt(doc) NULL | |
# define xmlSchematronNewParserCtxt(file) NULL | |
# define xmlSchematronParse(ctxt) NULL | |
# define xmlSchematronFreeParserCtxt(ctxt) | |
# define xmlSchematronFree(schema) | |
# define xmlSchematronNewValidCtxt(schema, options) NULL | |
# define xmlSchematronValidateDoc(ctxt, doc) 0 | |
# define xmlSchematronFreeValidCtxt(ctxt) | |
# define xmlSchematronSetValidStructuredErrors(ctxt, errorfunc, data) | |
#endif | |
#if LIBXML_VERSION < 20708 | |
# define HTML_PARSE_NODEFDTD 4 | |
#endif | |
#if LIBXML_VERSION < 20900 | |
# define XML_PARSE_BIG_LINES 4194304 | |
#endif | |
#include "libxml/tree.h" | |
#ifndef LIBXML2_NEW_BUFFER | |
typedef xmlBuffer xmlBuf; | |
# define xmlBufContent(buf) xmlBufferContent(buf) | |
# define xmlBufUse(buf) xmlBufferLength(buf) | |
#endif | |
/* libexslt 1.1.25+ support EXSLT functions in XPath */ | |
#if LIBXSLT_VERSION < 10125 | |
#define exsltDateXpathCtxtRegister(ctxt, prefix) | |
#define exsltSetsXpathCtxtRegister(ctxt, prefix) | |
#define exsltMathXpathCtxtRegister(ctxt, prefix) | |
#define exsltStrXpathCtxtRegister(ctxt, prefix) | |
#endif | |
#define LXML_GET_XSLT_ENCODING(result_var, style) XSLT_GET_IMPORT_PTR(result_var, style, encoding) | |
/* work around MSDEV 6.0 */ | |
#if (_MSC_VER == 1200) && (WINVER < 0x0500) | |
long _ftol( double ); //defined by VC6 C libs | |
long _ftol2( double dblSource ) { return _ftol( dblSource ); } | |
#endif | |
#ifdef __GNUC__ | |
/* Test for GCC > 2.95 */ | |
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) | |
#define unlikely_condition(x) __builtin_expect((x), 0) | |
#else /* __GNUC__ > 2 ... */ | |
#define unlikely_condition(x) (x) | |
#endif /* __GNUC__ > 2 ... */ | |
#else /* __GNUC__ */ | |
#define unlikely_condition(x) (x) | |
#endif /* __GNUC__ */ | |
#ifndef Py_TYPE | |
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) | |
#endif | |
#define PY_NEW(T) \ | |
(((PyTypeObject*)(T))->tp_new( \ | |
(PyTypeObject*)(T), __pyx_empty_tuple, NULL)) | |
#define _fqtypename(o) ((Py_TYPE(o))->tp_name) | |
#define lxml_malloc(count, item_size) \ | |
(unlikely_condition((size_t)(count) > (size_t) (PY_SSIZE_T_MAX / item_size)) ? NULL : \ | |
(PyMem_Malloc((count) * item_size))) | |
#define lxml_realloc(mem, count, item_size) \ | |
(unlikely_condition((size_t)(count) > (size_t) (PY_SSIZE_T_MAX / item_size)) ? NULL : \ | |
(PyMem_Realloc(mem, (count) * item_size))) | |
#define lxml_free(mem) PyMem_Free(mem) | |
#if PY_MAJOR_VERSION < 3 | |
#define _isString(obj) (PyString_CheckExact(obj) || \ | |
PyUnicode_CheckExact(obj) || \ | |
PyType_IsSubtype(Py_TYPE(obj), &PyBaseString_Type)) | |
#else | |
/* builtin subtype type checks are almost as fast as exact checks in Py2.7+ | |
* and Unicode is more common in Py3 */ | |
#define _isString(obj) (PyUnicode_Check(obj) || PyBytes_Check(obj)) | |
#endif | |
#define _isElement(c_node) \ | |
(((c_node)->type == XML_ELEMENT_NODE) || \ | |
((c_node)->type == XML_COMMENT_NODE) || \ | |
((c_node)->type == XML_ENTITY_REF_NODE) || \ | |
((c_node)->type == XML_PI_NODE)) | |
#define _isElementOrXInclude(c_node) \ | |
(_isElement(c_node) || \ | |
((c_node)->type == XML_XINCLUDE_START) || \ | |
((c_node)->type == XML_XINCLUDE_END)) | |
#define _getNs(c_node) \ | |
(((c_node)->ns == 0) ? 0 : ((c_node)->ns->href)) | |
#include "string.h" | |
static void* lxml_unpack_xmldoc_capsule(PyObject* capsule, int* is_owned) { | |
xmlDoc *c_doc; | |
void *context; | |
*is_owned = 0; | |
if (unlikely_condition(!PyCapsule_IsValid(capsule, (const char*)"libxml2:xmlDoc"))) { | |
PyErr_SetString( | |
PyExc_TypeError, | |
"Not a valid capsule. The capsule argument must be a capsule object with name libxml2:xmlDoc"); | |
return NULL; | |
} | |
c_doc = (xmlDoc*) PyCapsule_GetPointer(capsule, (const char*)"libxml2:xmlDoc"); | |
if (unlikely_condition(!c_doc)) return NULL; | |
if (unlikely_condition(c_doc->type != XML_DOCUMENT_NODE && c_doc->type != XML_HTML_DOCUMENT_NODE)) { | |
PyErr_Format( | |
PyExc_ValueError, | |
"Illegal document provided: expected XML or HTML, found %d", (int)c_doc->type); | |
return NULL; | |
} | |
context = PyCapsule_GetContext(capsule); | |
if (unlikely_condition(!context && PyErr_Occurred())) return NULL; | |
if (context && strcmp((const char*) context, "destructor:xmlFreeDoc") == 0) { | |
/* take ownership by setting destructor to NULL */ | |
if (PyCapsule_SetDestructor(capsule, NULL) == 0) { | |
/* ownership transferred => invalidate capsule by clearing its name */ | |
if (unlikely_condition(PyCapsule_SetName(capsule, NULL))) { | |
/* this should never happen since everything above succeeded */ | |
xmlFreeDoc(c_doc); | |
return NULL; | |
} | |
*is_owned = 1; | |
} | |
} | |
return c_doc; | |
} | |
/* Macro pair implementation of a depth first tree walker | |
* | |
* Calls the code block between the BEGIN and END macros for all elements | |
* below c_tree_top (exclusively), starting at c_node (inclusively iff | |
* 'inclusive' is 1). The _ELEMENT_ variants will only stop on nodes | |
* that match _isElement(), the normal variant will stop on every node | |
* except text nodes. | |
* | |
* To traverse the node and all of its children and siblings in Pyrex, call | |
* cdef xmlNode* some_node | |
* BEGIN_FOR_EACH_ELEMENT_FROM(some_node.parent, some_node, 1) | |
* # do something with some_node | |
* END_FOR_EACH_ELEMENT_FROM(some_node) | |
* | |
* To traverse only the children and siblings of a node, call | |
* cdef xmlNode* some_node | |
* BEGIN_FOR_EACH_ELEMENT_FROM(some_node.parent, some_node, 0) | |
* # do something with some_node | |
* END_FOR_EACH_ELEMENT_FROM(some_node) | |
* | |
* To traverse only the children, do: | |
* cdef xmlNode* some_node | |
* some_node = parent_node.children | |
* BEGIN_FOR_EACH_ELEMENT_FROM(parent_node, some_node, 1) | |
* # do something with some_node | |
* END_FOR_EACH_ELEMENT_FROM(some_node) | |
* | |
* NOTE: 'some_node' MUST be a plain 'xmlNode*' ! | |
* | |
* NOTE: parent modification during the walk can divert the iterator, but | |
* should not segfault ! | |
*/ | |
#define _LX__ELEMENT_MATCH(c_node, only_elements) \ | |
((only_elements) ? (_isElement(c_node)) : 1) | |
#define _LX__ADVANCE_TO_NEXT(c_node, only_elements) \ | |
while ((c_node != 0) && (!_LX__ELEMENT_MATCH(c_node, only_elements))) \ | |
c_node = c_node->next; | |
#define _LX__TRAVERSE_TO_NEXT(c_stop_node, c_node, only_elements) \ | |
{ \ | |
/* walk through children first */ \ | |
xmlNode* _lx__next = c_node->children; \ | |
if (_lx__next != 0) { \ | |
if (c_node->type == XML_ENTITY_REF_NODE || c_node->type == XML_DTD_NODE) { \ | |
_lx__next = 0; \ | |
} else { \ | |
_LX__ADVANCE_TO_NEXT(_lx__next, only_elements) \ | |
} \ | |
} \ | |
if ((_lx__next == 0) && (c_node != c_stop_node)) { \ | |
/* try siblings */ \ | |
_lx__next = c_node->next; \ | |
_LX__ADVANCE_TO_NEXT(_lx__next, only_elements) \ | |
/* back off through parents */ \ | |
while (_lx__next == 0) { \ | |
c_node = c_node->parent; \ | |
if (c_node == 0) \ | |
break; \ | |
if (c_node == c_stop_node) \ | |
break; \ | |
if ((only_elements) && !_isElement(c_node)) \ | |
break; \ | |
/* we already traversed the parents -> siblings */ \ | |
_lx__next = c_node->next; \ | |
_LX__ADVANCE_TO_NEXT(_lx__next, only_elements) \ | |
} \ | |
} \ | |
c_node = _lx__next; \ | |
} | |
#define _LX__BEGIN_FOR_EACH_FROM(c_tree_top, c_node, inclusive, only_elements) \ | |
{ \ | |
if (c_node != 0) { \ | |
const xmlNode* _lx__tree_top = (c_tree_top); \ | |
const int _lx__only_elements = (only_elements); \ | |
/* make sure we start at an element */ \ | |
if (!_LX__ELEMENT_MATCH(c_node, _lx__only_elements)) { \ | |
/* we skip the node, so 'inclusive' is irrelevant */ \ | |
if (c_node == _lx__tree_top) \ | |
c_node = 0; /* nothing to traverse */ \ | |
else { \ | |
c_node = c_node->next; \ | |
_LX__ADVANCE_TO_NEXT(c_node, _lx__only_elements) \ | |
} \ | |
} else if (! (inclusive)) { \ | |
/* skip the first node */ \ | |
_LX__TRAVERSE_TO_NEXT(_lx__tree_top, c_node, _lx__only_elements) \ | |
} \ | |
\ | |
/* now run the user code on the elements we find */ \ | |
while (c_node != 0) { \ | |
/* here goes the code to be run for each element */ | |
#define _LX__END_FOR_EACH_FROM(c_node) \ | |
_LX__TRAVERSE_TO_NEXT(_lx__tree_top, c_node, _lx__only_elements) \ | |
} \ | |
} \ | |
} | |
#define BEGIN_FOR_EACH_ELEMENT_FROM(c_tree_top, c_node, inclusive) \ | |
_LX__BEGIN_FOR_EACH_FROM(c_tree_top, c_node, inclusive, 1) | |
#define END_FOR_EACH_ELEMENT_FROM(c_node) \ | |
_LX__END_FOR_EACH_FROM(c_node) | |
#define BEGIN_FOR_EACH_FROM(c_tree_top, c_node, inclusive) \ | |
_LX__BEGIN_FOR_EACH_FROM(c_tree_top, c_node, inclusive, 0) | |
#define END_FOR_EACH_FROM(c_node) \ | |
_LX__END_FOR_EACH_FROM(c_node) | |
#endif /* HAS_ETREE_DEFS_H */ |
# public Cython/C interface to lxml.etree | |
from lxml.includes cimport tree | |
from lxml.includes.tree cimport const_xmlChar | |
cdef extern from "lxml-version.h": | |
cdef char* LXML_VERSION_STRING | |
cdef extern from "etree_defs.h": | |
# test if c_node is considered an Element (i.e. Element, Comment, etc.) | |
cdef bint _isElement(tree.xmlNode* c_node) nogil | |
# return the namespace URI of the node or NULL | |
cdef const_xmlChar* _getNs(tree.xmlNode* node) nogil | |
# pair of macros for tree traversal | |
cdef void BEGIN_FOR_EACH_ELEMENT_FROM(tree.xmlNode* tree_top, | |
tree.xmlNode* start_node, | |
int start_node_inclusive) nogil | |
cdef void END_FOR_EACH_ELEMENT_FROM(tree.xmlNode* start_node) nogil | |
cdef extern from "etree_api.h": | |
# first function to call! | |
cdef int import_lxml__etree() except -1 | |
########################################################################## | |
# public ElementTree API classes | |
cdef class lxml.etree._Document [ object LxmlDocument ]: | |
cdef tree.xmlDoc* _c_doc | |
cdef class lxml.etree._Element [ object LxmlElement ]: | |
cdef _Document _doc | |
cdef tree.xmlNode* _c_node | |
cdef class lxml.etree.ElementBase(_Element) [ object LxmlElementBase ]: | |
pass | |
cdef class lxml.etree._ElementTree [ object LxmlElementTree ]: | |
cdef _Document _doc | |
cdef _Element _context_node | |
cdef class lxml.etree.ElementClassLookup [ object LxmlElementClassLookup ]: | |
cdef object (*_lookup_function)(object, _Document, tree.xmlNode*) | |
cdef class lxml.etree.FallbackElementClassLookup(ElementClassLookup) \ | |
[ object LxmlFallbackElementClassLookup ]: | |
cdef ElementClassLookup fallback | |
cdef object (*_fallback_function)(object, _Document, tree.xmlNode*) | |
########################################################################## | |
# creating Element objects | |
# create an Element for a C-node in the Document | |
cdef _Element elementFactory(_Document doc, tree.xmlNode* c_node) | |
# create an ElementTree for an Element | |
cdef _ElementTree elementTreeFactory(_Element context_node) | |
# create an ElementTree subclass for an Element | |
cdef _ElementTree newElementTree(_Element context_node, object subclass) | |
# create an ElementTree from an external document | |
cdef _ElementTree adoptExternalDocument(tree.xmlDoc* c_doc, parser, bint is_owned) | |
# create a new Element for an existing or new document (doc = None) | |
# builds Python object after setting text, tail, namespaces and attributes | |
cdef _Element makeElement(tag, _Document doc, parser, | |
text, tail, attrib, nsmap) | |
# create a new SubElement for an existing parent | |
# builds Python object after setting text, tail, namespaces and attributes | |
cdef _Element makeSubElement(_Element parent, tag, text, tail, | |
attrib, nsmap) | |
# deep copy a node to include it in the Document | |
cdef _Element deepcopyNodeToDocument(_Document doc, tree.xmlNode* c_root) | |
# set the internal lookup function for Element/Comment/PI classes | |
# use setElementClassLookupFunction(NULL, None) to reset it | |
# note that the lookup function *must always* return an _Element subclass! | |
cdef void setElementClassLookupFunction( | |
object (*function)(object, _Document, tree.xmlNode*), object state) | |
# lookup function that always returns the default Element class | |
# note that the first argument is expected to be None! | |
cdef object lookupDefaultElementClass(_1, _Document _2, | |
tree.xmlNode* c_node) | |
# lookup function for namespace/tag specific Element classes | |
# note that the first argument is expected to be None! | |
cdef object lookupNamespaceElementClass(_1, _Document _2, | |
tree.xmlNode* c_node) | |
# call the fallback lookup function of a FallbackElementClassLookup | |
cdef object callLookupFallback(FallbackElementClassLookup lookup, | |
_Document doc, tree.xmlNode* c_node) | |
########################################################################## | |
# XML attribute access | |
# return an attribute value for a C attribute on a C element node | |
cdef object attributeValue(tree.xmlNode* c_element, | |
tree.xmlAttr* c_attrib_node) | |
# return the value of the attribute with 'ns' and 'name' (or None) | |
cdef object attributeValueFromNsName(tree.xmlNode* c_element, | |
const_xmlChar* c_ns, const_xmlChar* c_name) | |
# return the value of attribute "{ns}name", or the default value | |
cdef object getAttributeValue(_Element element, key, default) | |
# return an iterator over attribute names (1), values (2) or items (3) | |
# attributes must not be removed during iteration! | |
cdef object iterattributes(_Element element, int keysvalues) | |
# return the list of all attribute names (1), values (2) or items (3) | |
cdef list collectAttributes(tree.xmlNode* c_element, int keysvalues) | |
# set an attribute value on an element | |
# on failure, sets an exception and returns -1 | |
cdef int setAttributeValue(_Element element, key, value) except -1 | |
# delete an attribute | |
# on failure, sets an exception and returns -1 | |
cdef int delAttribute(_Element element, key) except -1 | |
# delete an attribute based on name and namespace URI | |
# returns -1 if the attribute was not found (no exception) | |
cdef int delAttributeFromNsName(tree.xmlNode* c_element, | |
const_xmlChar* c_href, const_xmlChar* c_name) | |
########################################################################## | |
# XML node helper functions | |
# check if the element has at least one child | |
cdef bint hasChild(tree.xmlNode* c_node) nogil | |
# find child element number 'index' (supports negative indexes) | |
cdef tree.xmlNode* findChild(tree.xmlNode* c_node, | |
Py_ssize_t index) nogil | |
# find child element number 'index' starting at first one | |
cdef tree.xmlNode* findChildForwards(tree.xmlNode* c_node, | |
Py_ssize_t index) nogil | |
# find child element number 'index' starting at last one | |
cdef tree.xmlNode* findChildBackwards(tree.xmlNode* c_node, | |
Py_ssize_t index) nogil | |
# return next/previous sibling element of the node | |
cdef tree.xmlNode* nextElement(tree.xmlNode* c_node) nogil | |
cdef tree.xmlNode* previousElement(tree.xmlNode* c_node) nogil | |
########################################################################## | |
# iterators (DEPRECATED API, don't use in new code!) | |
cdef class lxml.etree._ElementTagMatcher [ object LxmlElementTagMatcher ]: | |
cdef char* _href | |
cdef char* _name | |
# store "{ns}tag" (or None) filter for this matcher or element iterator | |
# ** unless _href *and* _name are set up 'by hand', this function *must* | |
# ** be called when subclassing the iterator below! | |
cdef void initTagMatch(_ElementTagMatcher matcher, tag) | |
cdef class lxml.etree._ElementIterator(_ElementTagMatcher) [ | |
object LxmlElementIterator ]: | |
cdef _Element _node | |
cdef tree.xmlNode* (*_next_element)(tree.xmlNode*) | |
# store the initial node of the iterator if it matches the required tag | |
# or its next matching sibling if not | |
cdef void iteratorStoreNext(_ElementIterator iterator, _Element node) | |
########################################################################## | |
# other helper functions | |
# check if a C node matches a tag name and namespace | |
# (NULL allowed for each => always matches) | |
cdef int tagMatches(tree.xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) | |
# convert a UTF-8 char* to a Python string or unicode string | |
cdef object pyunicode(const_xmlChar* s) | |
# convert the string to UTF-8 using the normal lxml.etree semantics | |
cdef bytes utf8(object s) | |
# split a tag into a (URI, name) tuple, return None as URI for '{}tag' | |
cdef tuple getNsTag(object tag) | |
# split a tag into a (URI, name) tuple, return b'' as URI for '{}tag' | |
cdef tuple getNsTagWithEmptyNs(object tag) | |
# get the "{ns}tag" string for a C node | |
cdef object namespacedName(tree.xmlNode* c_node) | |
# get the "{ns}tag" string for a href/tagname pair (c_ns may be NULL) | |
cdef object namespacedNameFromNsName(const_xmlChar* c_ns, const_xmlChar* c_tag) | |
# check if the node has a text value (which may be '') | |
cdef bint hasText(tree.xmlNode* c_node) nogil | |
# check if the node has a tail value (which may be '') | |
cdef bint hasTail(tree.xmlNode* c_node) nogil | |
# get the text content of an element (or None) | |
cdef object textOf(tree.xmlNode* c_node) | |
# get the tail content of an element (or None) | |
cdef object tailOf(tree.xmlNode* c_node) | |
# set the text value of an element | |
cdef int setNodeText(tree.xmlNode* c_node, text) except -1 | |
# set the tail text value of an element | |
cdef int setTailText(tree.xmlNode* c_node, text) except -1 | |
# append an element to the children of a parent element | |
# deprecated: don't use, does not propagate exceptions! | |
# use appendChildToElement() instead | |
cdef void appendChild(_Element parent, _Element child) | |
# added in lxml 3.3 as a safe replacement for appendChild() | |
# return -1 for exception, 0 for ok | |
cdef int appendChildToElement(_Element parent, _Element child) except -1 | |
# recursively lookup a namespace in element or ancestors, or create it | |
cdef tree.xmlNs* findOrBuildNodeNsPrefix( | |
_Document doc, tree.xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) | |
# find the Document of an Element, ElementTree or Document (itself!) | |
cdef _Document documentOrRaise(object input) | |
# find the root Element of an Element (itself!), ElementTree or Document | |
cdef _Element rootNodeOrRaise(object input) |
from libc.string cimport const_char | |
from lxml.includes.tree cimport xmlDoc | |
from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback | |
from lxml.includes.xmlparser cimport xmlParserCtxt, xmlSAXHandler, xmlSAXHandlerV1 | |
cdef extern from "libxml/HTMLparser.h": | |
ctypedef enum htmlParserOption: | |
HTML_PARSE_NOERROR # suppress error reports | |
HTML_PARSE_NOWARNING # suppress warning reports | |
HTML_PARSE_PEDANTIC # pedantic error reporting | |
HTML_PARSE_NOBLANKS # remove blank nodes | |
HTML_PARSE_NONET # Forbid network access | |
# libxml2 2.6.21+ only: | |
HTML_PARSE_RECOVER # Relaxed parsing | |
HTML_PARSE_COMPACT # compact small text nodes | |
# libxml2 2.7.7+ only: | |
HTML_PARSE_NOIMPLIED # Do not add implied html/body... elements | |
# libxml2 2.7.8+ only: | |
HTML_PARSE_NODEFDTD # do not default a doctype if not found | |
# libxml2 2.8.0+ only: | |
XML_PARSE_IGNORE_ENC # ignore internal document encoding hint | |
xmlSAXHandlerV1 htmlDefaultSAXHandler | |
cdef xmlParserCtxt* htmlCreateMemoryParserCtxt( | |
char* buffer, int size) nogil | |
cdef xmlParserCtxt* htmlCreateFileParserCtxt( | |
char* filename, char* encoding) nogil | |
cdef xmlParserCtxt* htmlCreatePushParserCtxt(xmlSAXHandler* sax, | |
void* user_data, | |
char* chunk, int size, | |
char* filename, int enc) nogil | |
cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil | |
cdef void htmlCtxtReset(xmlParserCtxt* ctxt) nogil | |
cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil | |
cdef int htmlParseDocument(xmlParserCtxt* ctxt) nogil | |
cdef int htmlParseChunk(xmlParserCtxt* ctxt, | |
char* chunk, int size, int terminate) nogil | |
cdef xmlDoc* htmlCtxtReadFile(xmlParserCtxt* ctxt, | |
char* filename, const_char* encoding, | |
int options) nogil | |
cdef xmlDoc* htmlCtxtReadDoc(xmlParserCtxt* ctxt, | |
char* buffer, char* URL, const_char* encoding, | |
int options) nogil | |
cdef xmlDoc* htmlCtxtReadIO(xmlParserCtxt* ctxt, | |
xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void* ioctx, | |
char* URL, const_char* encoding, | |
int options) nogil | |
cdef xmlDoc* htmlCtxtReadMemory(xmlParserCtxt* ctxt, | |
char* buffer, int size, | |
char* filename, const_char* encoding, | |
int options) nogil |
#ifndef __EXSLT_H__ | |
#define __EXSLT_H__ | |
#include <libxml/tree.h> | |
#include <libxml/xpath.h> | |
#include "exsltexports.h" | |
#include <libexslt/exsltconfig.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
EXSLTPUBVAR const char *exsltLibraryVersion; | |
EXSLTPUBVAR const int exsltLibexsltVersion; | |
EXSLTPUBVAR const int exsltLibxsltVersion; | |
EXSLTPUBVAR const int exsltLibxmlVersion; | |
/** | |
* EXSLT_COMMON_NAMESPACE: | |
* | |
* Namespace for EXSLT common functions | |
*/ | |
#define EXSLT_COMMON_NAMESPACE ((const xmlChar *) "http://exslt.org/common") | |
/** | |
* EXSLT_CRYPTO_NAMESPACE: | |
* | |
* Namespace for EXSLT crypto functions | |
*/ | |
#define EXSLT_CRYPTO_NAMESPACE ((const xmlChar *) "http://exslt.org/crypto") | |
/** | |
* EXSLT_MATH_NAMESPACE: | |
* | |
* Namespace for EXSLT math functions | |
*/ | |
#define EXSLT_MATH_NAMESPACE ((const xmlChar *) "http://exslt.org/math") | |
/** | |
* EXSLT_SETS_NAMESPACE: | |
* | |
* Namespace for EXSLT set functions | |
*/ | |
#define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets") | |
/** | |
* EXSLT_FUNCTIONS_NAMESPACE: | |
* | |
* Namespace for EXSLT functions extension functions | |
*/ | |
#define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions") | |
/** | |
* EXSLT_STRINGS_NAMESPACE: | |
* | |
* Namespace for EXSLT strings functions | |
*/ | |
#define EXSLT_STRINGS_NAMESPACE ((const xmlChar *) "http://exslt.org/strings") | |
/** | |
* EXSLT_DATE_NAMESPACE: | |
* | |
* Namespace for EXSLT date functions | |
*/ | |
#define EXSLT_DATE_NAMESPACE ((const xmlChar *) "http://exslt.org/dates-and-times") | |
/** | |
* EXSLT_DYNAMIC_NAMESPACE: | |
* | |
* Namespace for EXSLT dynamic functions | |
*/ | |
#define EXSLT_DYNAMIC_NAMESPACE ((const xmlChar *) "http://exslt.org/dynamic") | |
/** | |
* SAXON_NAMESPACE: | |
* | |
* Namespace for SAXON extensions functions | |
*/ | |
#define SAXON_NAMESPACE ((const xmlChar *) "http://icl.com/saxon") | |
EXSLTPUBFUN void EXSLTCALL exsltCommonRegister (void); | |
#ifdef EXSLT_CRYPTO_ENABLED | |
EXSLTPUBFUN void EXSLTCALL exsltCryptoRegister (void); | |
#endif | |
EXSLTPUBFUN void EXSLTCALL exsltMathRegister (void); | |
EXSLTPUBFUN void EXSLTCALL exsltSetsRegister (void); | |
EXSLTPUBFUN void EXSLTCALL exsltFuncRegister (void); | |
EXSLTPUBFUN void EXSLTCALL exsltStrRegister (void); | |
EXSLTPUBFUN void EXSLTCALL exsltDateRegister (void); | |
EXSLTPUBFUN void EXSLTCALL exsltSaxonRegister (void); | |
EXSLTPUBFUN void EXSLTCALL exsltDynRegister(void); | |
EXSLTPUBFUN void EXSLTCALL exsltRegisterAll (void); | |
EXSLTPUBFUN int EXSLTCALL exsltDateXpathCtxtRegister (xmlXPathContextPtr ctxt, | |
const xmlChar *prefix); | |
EXSLTPUBFUN int EXSLTCALL exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, | |
const xmlChar *prefix); | |
EXSLTPUBFUN int EXSLTCALL exsltSetsXpathCtxtRegister (xmlXPathContextPtr ctxt, | |
const xmlChar *prefix); | |
EXSLTPUBFUN int EXSLTCALL exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, | |
const xmlChar *prefix); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __EXSLT_H__ */ | |
/* | |
* exsltconfig.h: compile-time version informations for the EXSLT library | |
* | |
* See Copyright for the status of this software. | |
* | |
* daniel@veillard.com | |
*/ | |
#ifndef __XML_EXSLTCONFIG_H__ | |
#define __XML_EXSLTCONFIG_H__ | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* LIBEXSLT_DOTTED_VERSION: | |
* | |
* the version string like "1.2.3" | |
*/ | |
#define LIBEXSLT_DOTTED_VERSION "0.8.18" | |
/** | |
* LIBEXSLT_VERSION: | |
* | |
* the version number: 1.2.3 value is 10203 | |
*/ | |
#define LIBEXSLT_VERSION 818 | |
/** | |
* LIBEXSLT_VERSION_STRING: | |
* | |
* the version number string, 1.2.3 value is "10203" | |
*/ | |
#define LIBEXSLT_VERSION_STRING "818" | |
/** | |
* LIBEXSLT_VERSION_EXTRA: | |
* | |
* extra version information, used to show a CVS compilation | |
*/ | |
#define LIBEXSLT_VERSION_EXTRA "" | |
/** | |
* WITH_CRYPTO: | |
* | |
* Whether crypto support is configured into exslt | |
*/ | |
#if 1 | |
#define EXSLT_CRYPTO_ENABLED | |
#endif | |
/** | |
* ATTRIBUTE_UNUSED: | |
* | |
* This macro is used to flag unused function parameters to GCC | |
*/ | |
#ifdef __GNUC__ | |
#ifdef HAVE_ANSIDECL_H | |
#include <ansidecl.h> | |
#endif | |
#ifndef ATTRIBUTE_UNUSED | |
#define ATTRIBUTE_UNUSED __attribute__((unused)) | |
#endif | |
#else | |
#define ATTRIBUTE_UNUSED | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_EXSLTCONFIG_H__ */ |
/* | |
* exsltexports.h : macros for marking symbols as exportable/importable. | |
* | |
* See Copyright for the status of this software. | |
* | |
* igor@zlatkovic.com | |
*/ | |
#ifndef __EXSLT_EXPORTS_H__ | |
#define __EXSLT_EXPORTS_H__ | |
/** | |
* EXSLTPUBFUN, EXSLTPUBVAR, EXSLTCALL | |
* | |
* Macros which declare an exportable function, an exportable variable and | |
* the calling convention used for functions. | |
* | |
* Please use an extra block for every platform/compiler combination when | |
* modifying this, rather than overlong #ifdef lines. This helps | |
* readability as well as the fact that different compilers on the same | |
* platform might need different definitions. | |
*/ | |
/** | |
* EXSLTPUBFUN: | |
* | |
* Macros which declare an exportable function | |
*/ | |
#define EXSLTPUBFUN | |
/** | |
* EXSLTPUBVAR: | |
* | |
* Macros which declare an exportable variable | |
*/ | |
#define EXSLTPUBVAR extern | |
/** | |
* EXSLTCALL: | |
* | |
* Macros which declare the called convention for exported functions | |
*/ | |
#define EXSLTCALL | |
/** DOC_DISABLE */ | |
/* Windows platform with MS compiler */ | |
#if defined(_WIN32) && defined(_MSC_VER) | |
#undef EXSLTPUBFUN | |
#undef EXSLTPUBVAR | |
#undef EXSLTCALL | |
#if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBFUN __declspec(dllexport) | |
#define EXSLTPUBVAR __declspec(dllexport) | |
#else | |
#define EXSLTPUBFUN | |
#if !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define EXSLTPUBVAR extern | |
#endif | |
#endif | |
#define EXSLTCALL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Windows platform with Borland compiler */ | |
#if defined(_WIN32) && defined(__BORLANDC__) | |
#undef EXSLTPUBFUN | |
#undef EXSLTPUBVAR | |
#undef EXSLTCALL | |
#if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBFUN __declspec(dllexport) | |
#define EXSLTPUBVAR __declspec(dllexport) extern | |
#else | |
#define EXSLTPUBFUN | |
#if !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define EXSLTPUBVAR extern | |
#endif | |
#endif | |
#define EXSLTCALL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Windows platform with GNU compiler (Mingw) */ | |
#if defined(_WIN32) && defined(__MINGW32__) | |
#undef EXSLTPUBFUN | |
#undef EXSLTPUBVAR | |
#undef EXSLTCALL | |
/* | |
#if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) | |
*/ | |
#if !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBFUN __declspec(dllexport) | |
#define EXSLTPUBVAR __declspec(dllexport) extern | |
#else | |
#define EXSLTPUBFUN | |
#if !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define EXSLTPUBVAR extern | |
#endif | |
#endif | |
#define EXSLTCALL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Cygwin platform, GNU compiler */ | |
#if defined(_WIN32) && defined(__CYGWIN__) | |
#undef EXSLTPUBFUN | |
#undef EXSLTPUBVAR | |
#undef EXSLTCALL | |
#if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBFUN __declspec(dllexport) | |
#define EXSLTPUBVAR __declspec(dllexport) | |
#else | |
#define EXSLTPUBFUN | |
#if !defined(LIBEXSLT_STATIC) | |
#define EXSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define EXSLTPUBVAR | |
#endif | |
#endif | |
#define EXSLTCALL __cdecl | |
#endif | |
/* Compatibility */ | |
#if !defined(LIBEXSLT_PUBLIC) | |
#define LIBEXSLT_PUBLIC EXSLTPUBVAR | |
#endif | |
#endif /* __EXSLT_EXPORTS_H__ */ | |
/* | |
* libexslt.h: internal header only used during the compilation of libexslt | |
* | |
* See COPYRIGHT for the status of this software | |
* | |
* Author: daniel@veillard.com | |
*/ | |
#ifndef __XSLT_LIBEXSLT_H__ | |
#define __XSLT_LIBEXSLT_H__ | |
#if defined(WIN32) && !defined (__CYGWIN__) && !defined (__MINGW32__) | |
#include <win32config.h> | |
#else | |
#include "config.h" | |
#endif | |
#include <libxslt/xsltconfig.h> | |
#include <libxml/xmlversion.h> | |
#if !defined LIBEXSLT_PUBLIC | |
#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBEXSLT && !defined LIBEXSLT_STATIC | |
#define LIBEXSLT_PUBLIC __declspec(dllimport) | |
#else | |
#define LIBEXSLT_PUBLIC | |
#endif | |
#endif | |
#endif /* ! __XSLT_LIBEXSLT_H__ */ |
/* | |
* Summary: Provide Canonical XML and Exclusive XML Canonicalization | |
* Description: the c14n modules provides a | |
* | |
* "Canonical XML" implementation | |
* http://www.w3.org/TR/xml-c14n | |
* | |
* and an | |
* | |
* "Exclusive XML Canonicalization" implementation | |
* http://www.w3.org/TR/xml-exc-c14n | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Aleksey Sanin <aleksey@aleksey.com> | |
*/ | |
#ifndef __XML_C14N_H__ | |
#define __XML_C14N_H__ | |
#ifdef LIBXML_C14N_ENABLED | |
#ifdef LIBXML_OUTPUT_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif /* __cplusplus */ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#include <libxml/xpath.h> | |
/* | |
* XML Canonicazation | |
* http://www.w3.org/TR/xml-c14n | |
* | |
* Exclusive XML Canonicazation | |
* http://www.w3.org/TR/xml-exc-c14n | |
* | |
* Canonical form of an XML document could be created if and only if | |
* a) default attributes (if any) are added to all nodes | |
* b) all character and parsed entity references are resolved | |
* In order to achive this in libxml2 the document MUST be loaded with | |
* following global setings: | |
* | |
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | |
* xmlSubstituteEntitiesDefault(1); | |
* | |
* or corresponding parser context setting: | |
* xmlParserCtxtPtr ctxt; | |
* | |
* ... | |
* ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | |
* ctxt->replaceEntities = 1; | |
* ... | |
*/ | |
/* | |
* xmlC14NMode: | |
* | |
* Predefined values for C14N modes | |
* | |
*/ | |
typedef enum { | |
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ | |
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ | |
XML_C14N_1_1 = 2 /* C14N 1.1 spec */ | |
} xmlC14NMode; | |
XMLPUBFUN int XMLCALL | |
xmlC14NDocSaveTo (xmlDocPtr doc, | |
xmlNodeSetPtr nodes, | |
int mode, /* a xmlC14NMode */ | |
xmlChar **inclusive_ns_prefixes, | |
int with_comments, | |
xmlOutputBufferPtr buf); | |
XMLPUBFUN int XMLCALL | |
xmlC14NDocDumpMemory (xmlDocPtr doc, | |
xmlNodeSetPtr nodes, | |
int mode, /* a xmlC14NMode */ | |
xmlChar **inclusive_ns_prefixes, | |
int with_comments, | |
xmlChar **doc_txt_ptr); | |
XMLPUBFUN int XMLCALL | |
xmlC14NDocSave (xmlDocPtr doc, | |
xmlNodeSetPtr nodes, | |
int mode, /* a xmlC14NMode */ | |
xmlChar **inclusive_ns_prefixes, | |
int with_comments, | |
const char* filename, | |
int compression); | |
/** | |
* This is the core C14N function | |
*/ | |
/** | |
* xmlC14NIsVisibleCallback: | |
* @user_data: user data | |
* @node: the curent node | |
* @parent: the parent node | |
* | |
* Signature for a C14N callback on visible nodes | |
* | |
* Returns 1 if the node should be included | |
*/ | |
typedef int (*xmlC14NIsVisibleCallback) (void* user_data, | |
xmlNodePtr node, | |
xmlNodePtr parent); | |
XMLPUBFUN int XMLCALL | |
xmlC14NExecute (xmlDocPtr doc, | |
xmlC14NIsVisibleCallback is_visible_callback, | |
void* user_data, | |
int mode, /* a xmlC14NMode */ | |
xmlChar **inclusive_ns_prefixes, | |
int with_comments, | |
xmlOutputBufferPtr buf); | |
#ifdef __cplusplus | |
} | |
#endif /* __cplusplus */ | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
#endif /* LIBXML_C14N_ENABLED */ | |
#endif /* __XML_C14N_H__ */ | |
/** | |
* Summary: interfaces to the Catalog handling system | |
* Description: the catalog module implements the support for | |
* XML Catalogs and SGML catalogs | |
* | |
* SGML Open Technical Resolution TR9401:1997. | |
* http://www.jclark.com/sp/catalog.htm | |
* | |
* XML Catalogs Working Draft 06 August 2001 | |
* http://www.oasis-open.org/committees/entity/spec-2001-08-06.html | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_CATALOG_H__ | |
#define __XML_CATALOG_H__ | |
#include <stdio.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/xmlstring.h> | |
#include <libxml/tree.h> | |
#ifdef LIBXML_CATALOG_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XML_CATALOGS_NAMESPACE: | |
* | |
* The namespace for the XML Catalogs elements. | |
*/ | |
#define XML_CATALOGS_NAMESPACE \ | |
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" | |
/** | |
* XML_CATALOG_PI: | |
* | |
* The specific XML Catalog Processing Instuction name. | |
*/ | |
#define XML_CATALOG_PI \ | |
(const xmlChar *) "oasis-xml-catalog" | |
/* | |
* The API is voluntarily limited to general cataloging. | |
*/ | |
typedef enum { | |
XML_CATA_PREFER_NONE = 0, | |
XML_CATA_PREFER_PUBLIC = 1, | |
XML_CATA_PREFER_SYSTEM | |
} xmlCatalogPrefer; | |
typedef enum { | |
XML_CATA_ALLOW_NONE = 0, | |
XML_CATA_ALLOW_GLOBAL = 1, | |
XML_CATA_ALLOW_DOCUMENT = 2, | |
XML_CATA_ALLOW_ALL = 3 | |
} xmlCatalogAllow; | |
typedef struct _xmlCatalog xmlCatalog; | |
typedef xmlCatalog *xmlCatalogPtr; | |
/* | |
* Operations on a given catalog. | |
*/ | |
XMLPUBFUN xmlCatalogPtr XMLCALL | |
xmlNewCatalog (int sgml); | |
XMLPUBFUN xmlCatalogPtr XMLCALL | |
xmlLoadACatalog (const char *filename); | |
XMLPUBFUN xmlCatalogPtr XMLCALL | |
xmlLoadSGMLSuperCatalog (const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlConvertSGMLCatalog (xmlCatalogPtr catal); | |
XMLPUBFUN int XMLCALL | |
xmlACatalogAdd (xmlCatalogPtr catal, | |
const xmlChar *type, | |
const xmlChar *orig, | |
const xmlChar *replace); | |
XMLPUBFUN int XMLCALL | |
xmlACatalogRemove (xmlCatalogPtr catal, | |
const xmlChar *value); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlACatalogResolve (xmlCatalogPtr catal, | |
const xmlChar *pubID, | |
const xmlChar *sysID); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlACatalogResolveSystem(xmlCatalogPtr catal, | |
const xmlChar *sysID); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlACatalogResolvePublic(xmlCatalogPtr catal, | |
const xmlChar *pubID); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlACatalogResolveURI (xmlCatalogPtr catal, | |
const xmlChar *URI); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlACatalogDump (xmlCatalogPtr catal, | |
FILE *out); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlFreeCatalog (xmlCatalogPtr catal); | |
XMLPUBFUN int XMLCALL | |
xmlCatalogIsEmpty (xmlCatalogPtr catal); | |
/* | |
* Global operations. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlInitializeCatalog (void); | |
XMLPUBFUN int XMLCALL | |
xmlLoadCatalog (const char *filename); | |
XMLPUBFUN void XMLCALL | |
xmlLoadCatalogs (const char *paths); | |
XMLPUBFUN void XMLCALL | |
xmlCatalogCleanup (void); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlCatalogDump (FILE *out); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCatalogResolve (const xmlChar *pubID, | |
const xmlChar *sysID); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCatalogResolveSystem (const xmlChar *sysID); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCatalogResolvePublic (const xmlChar *pubID); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCatalogResolveURI (const xmlChar *URI); | |
XMLPUBFUN int XMLCALL | |
xmlCatalogAdd (const xmlChar *type, | |
const xmlChar *orig, | |
const xmlChar *replace); | |
XMLPUBFUN int XMLCALL | |
xmlCatalogRemove (const xmlChar *value); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlParseCatalogFile (const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlCatalogConvert (void); | |
/* | |
* Strictly minimal interfaces for per-document catalogs used | |
* by the parser. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlCatalogFreeLocal (void *catalogs); | |
XMLPUBFUN void * XMLCALL | |
xmlCatalogAddLocal (void *catalogs, | |
const xmlChar *URL); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCatalogLocalResolve (void *catalogs, | |
const xmlChar *pubID, | |
const xmlChar *sysID); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCatalogLocalResolveURI(void *catalogs, | |
const xmlChar *URI); | |
/* | |
* Preference settings. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlCatalogSetDebug (int level); | |
XMLPUBFUN xmlCatalogPrefer XMLCALL | |
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); | |
XMLPUBFUN void XMLCALL | |
xmlCatalogSetDefaults (xmlCatalogAllow allow); | |
XMLPUBFUN xmlCatalogAllow XMLCALL | |
xmlCatalogGetDefaults (void); | |
/* DEPRECATED interfaces */ | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlCatalogGetSystem (const xmlChar *sysID); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlCatalogGetPublic (const xmlChar *pubID); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_CATALOG_ENABLED */ | |
#endif /* __XML_CATALOG_H__ */ |
/* | |
* Summary: Unicode character range checking | |
* Description: this module exports interfaces for the character | |
* range validation APIs | |
* | |
* This file is automatically generated from the cvs source | |
* definition files using the genChRanges.py Python script | |
* | |
* Generation date: Mon Mar 27 11:09:48 2006 | |
* Sources: chvalid.def | |
* Author: William Brack <wbrack@mmm.com.hk> | |
*/ | |
#ifndef __XML_CHVALID_H__ | |
#define __XML_CHVALID_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/xmlstring.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Define our typedefs and structures | |
* | |
*/ | |
typedef struct _xmlChSRange xmlChSRange; | |
typedef xmlChSRange *xmlChSRangePtr; | |
struct _xmlChSRange { | |
unsigned short low; | |
unsigned short high; | |
}; | |
typedef struct _xmlChLRange xmlChLRange; | |
typedef xmlChLRange *xmlChLRangePtr; | |
struct _xmlChLRange { | |
unsigned int low; | |
unsigned int high; | |
}; | |
typedef struct _xmlChRangeGroup xmlChRangeGroup; | |
typedef xmlChRangeGroup *xmlChRangeGroupPtr; | |
struct _xmlChRangeGroup { | |
int nbShortRange; | |
int nbLongRange; | |
const xmlChSRange *shortRange; /* points to an array of ranges */ | |
const xmlChLRange *longRange; | |
}; | |
/** | |
* Range checking routine | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); | |
/** | |
* xmlIsBaseChar_ch: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ | |
((0x61 <= (c)) && ((c) <= 0x7a)) || \ | |
((0xc0 <= (c)) && ((c) <= 0xd6)) || \ | |
((0xd8 <= (c)) && ((c) <= 0xf6)) || \ | |
(0xf8 <= (c))) | |
/** | |
* xmlIsBaseCharQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ | |
xmlIsBaseChar_ch((c)) : \ | |
xmlCharInRange((c), &xmlIsBaseCharGroup)) | |
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; | |
/** | |
* xmlIsBlank_ch: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsBlank_ch(c) (((c) == 0x20) || \ | |
((0x9 <= (c)) && ((c) <= 0xa)) || \ | |
((c) == 0xd)) | |
/** | |
* xmlIsBlankQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsBlankQ(c) (((c) < 0x100) ? \ | |
xmlIsBlank_ch((c)) : 0) | |
/** | |
* xmlIsChar_ch: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ | |
((c) == 0xd) || \ | |
(0x20 <= (c))) | |
/** | |
* xmlIsCharQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsCharQ(c) (((c) < 0x100) ? \ | |
xmlIsChar_ch((c)) :\ | |
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ | |
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ | |
((0x10000 <= (c)) && ((c) <= 0x10ffff)))) | |
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; | |
/** | |
* xmlIsCombiningQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ | |
0 : \ | |
xmlCharInRange((c), &xmlIsCombiningGroup)) | |
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; | |
/** | |
* xmlIsDigit_ch: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) | |
/** | |
* xmlIsDigitQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsDigitQ(c) (((c) < 0x100) ? \ | |
xmlIsDigit_ch((c)) : \ | |
xmlCharInRange((c), &xmlIsDigitGroup)) | |
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; | |
/** | |
* xmlIsExtender_ch: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsExtender_ch(c) (((c) == 0xb7)) | |
/** | |
* xmlIsExtenderQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ | |
xmlIsExtender_ch((c)) : \ | |
xmlCharInRange((c), &xmlIsExtenderGroup)) | |
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; | |
/** | |
* xmlIsIdeographicQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ | |
0 :\ | |
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ | |
((c) == 0x3007) || \ | |
((0x3021 <= (c)) && ((c) <= 0x3029)))) | |
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; | |
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; | |
/** | |
* xmlIsPubidChar_ch: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) | |
/** | |
* xmlIsPubidCharQ: | |
* @c: char to validate | |
* | |
* Automatically generated by genChRanges.py | |
*/ | |
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ | |
xmlIsPubidChar_ch((c)) : 0) | |
XMLPUBFUN int XMLCALL | |
xmlIsBaseChar(unsigned int ch); | |
XMLPUBFUN int XMLCALL | |
xmlIsBlank(unsigned int ch); | |
XMLPUBFUN int XMLCALL | |
xmlIsChar(unsigned int ch); | |
XMLPUBFUN int XMLCALL | |
xmlIsCombining(unsigned int ch); | |
XMLPUBFUN int XMLCALL | |
xmlIsDigit(unsigned int ch); | |
XMLPUBFUN int XMLCALL | |
xmlIsExtender(unsigned int ch); | |
XMLPUBFUN int XMLCALL | |
xmlIsIdeographic(unsigned int ch); | |
XMLPUBFUN int XMLCALL | |
xmlIsPubidChar(unsigned int ch); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_CHVALID_H__ */ |
/* | |
* Summary: Tree debugging APIs | |
* Description: Interfaces to a set of routines used for debugging the tree | |
* produced by the XML parser. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __DEBUG_XML__ | |
#define __DEBUG_XML__ | |
#include <stdio.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#ifdef LIBXML_DEBUG_ENABLED | |
#include <libxml/xpath.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* The standard Dump routines. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpString (FILE *output, | |
const xmlChar *str); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpAttr (FILE *output, | |
xmlAttrPtr attr, | |
int depth); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpAttrList (FILE *output, | |
xmlAttrPtr attr, | |
int depth); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpOneNode (FILE *output, | |
xmlNodePtr node, | |
int depth); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpNode (FILE *output, | |
xmlNodePtr node, | |
int depth); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpNodeList (FILE *output, | |
xmlNodePtr node, | |
int depth); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpDocumentHead(FILE *output, | |
xmlDocPtr doc); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpDocument (FILE *output, | |
xmlDocPtr doc); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpDTD (FILE *output, | |
xmlDtdPtr dtd); | |
XMLPUBFUN void XMLCALL | |
xmlDebugDumpEntities (FILE *output, | |
xmlDocPtr doc); | |
/**************************************************************** | |
* * | |
* Checking routines * | |
* * | |
****************************************************************/ | |
XMLPUBFUN int XMLCALL | |
xmlDebugCheckDocument (FILE * output, | |
xmlDocPtr doc); | |
/**************************************************************** | |
* * | |
* XML shell helpers * | |
* * | |
****************************************************************/ | |
XMLPUBFUN void XMLCALL | |
xmlLsOneNode (FILE *output, xmlNodePtr node); | |
XMLPUBFUN int XMLCALL | |
xmlLsCountNode (xmlNodePtr node); | |
XMLPUBFUN const char * XMLCALL | |
xmlBoolToText (int boolval); | |
/**************************************************************** | |
* * | |
* The XML shell related structures and functions * | |
* * | |
****************************************************************/ | |
#ifdef LIBXML_XPATH_ENABLED | |
/** | |
* xmlShellReadlineFunc: | |
* @prompt: a string prompt | |
* | |
* This is a generic signature for the XML shell input function. | |
* | |
* Returns a string which will be freed by the Shell. | |
*/ | |
typedef char * (* xmlShellReadlineFunc)(char *prompt); | |
/** | |
* xmlShellCtxt: | |
* | |
* A debugging shell context. | |
* TODO: add the defined function tables. | |
*/ | |
typedef struct _xmlShellCtxt xmlShellCtxt; | |
typedef xmlShellCtxt *xmlShellCtxtPtr; | |
struct _xmlShellCtxt { | |
char *filename; | |
xmlDocPtr doc; | |
xmlNodePtr node; | |
xmlXPathContextPtr pctxt; | |
int loaded; | |
FILE *output; | |
xmlShellReadlineFunc input; | |
}; | |
/** | |
* xmlShellCmd: | |
* @ctxt: a shell context | |
* @arg: a string argument | |
* @node: a first node | |
* @node2: a second node | |
* | |
* This is a generic signature for the XML shell functions. | |
* | |
* Returns an int, negative returns indicating errors. | |
*/ | |
typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, | |
char *arg, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
XMLPUBFUN void XMLCALL | |
xmlShellPrintXPathError (int errorType, | |
const char *arg); | |
XMLPUBFUN void XMLCALL | |
xmlShellPrintXPathResult(xmlXPathObjectPtr list); | |
XMLPUBFUN int XMLCALL | |
xmlShellList (xmlShellCtxtPtr ctxt, | |
char *arg, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
XMLPUBFUN int XMLCALL | |
xmlShellBase (xmlShellCtxtPtr ctxt, | |
char *arg, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
XMLPUBFUN int XMLCALL | |
xmlShellDir (xmlShellCtxtPtr ctxt, | |
char *arg, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
XMLPUBFUN int XMLCALL | |
xmlShellLoad (xmlShellCtxtPtr ctxt, | |
char *filename, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlShellPrintNode (xmlNodePtr node); | |
XMLPUBFUN int XMLCALL | |
xmlShellCat (xmlShellCtxtPtr ctxt, | |
char *arg, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
XMLPUBFUN int XMLCALL | |
xmlShellWrite (xmlShellCtxtPtr ctxt, | |
char *filename, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
XMLPUBFUN int XMLCALL | |
xmlShellSave (xmlShellCtxtPtr ctxt, | |
char *filename, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
#ifdef LIBXML_VALID_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlShellValidate (xmlShellCtxtPtr ctxt, | |
char *dtd, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
#endif /* LIBXML_VALID_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
xmlShellDu (xmlShellCtxtPtr ctxt, | |
char *arg, | |
xmlNodePtr tree, | |
xmlNodePtr node2); | |
XMLPUBFUN int XMLCALL | |
xmlShellPwd (xmlShellCtxtPtr ctxt, | |
char *buffer, | |
xmlNodePtr node, | |
xmlNodePtr node2); | |
/* | |
* The Shell interface. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlShell (xmlDocPtr doc, | |
char *filename, | |
xmlShellReadlineFunc input, | |
FILE *output); | |
#endif /* LIBXML_XPATH_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_DEBUG_ENABLED */ | |
#endif /* __DEBUG_XML__ */ |
/* | |
* Summary: string dictionary | |
* Description: dictionary of reusable strings, just used to avoid allocation | |
* and freeing operations. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_DICT_H__ | |
#define __XML_DICT_H__ | |
#ifdef __cplusplus | |
#define __XML_EXTERNC extern "C" | |
#else | |
#define __XML_EXTERNC | |
#endif | |
/* | |
* The dictionary. | |
*/ | |
__XML_EXTERNC typedef struct _xmlDict xmlDict; | |
__XML_EXTERNC typedef xmlDict *xmlDictPtr; | |
#include <limits.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Initializer | |
*/ | |
XMLPUBFUN int XMLCALL xmlInitializeDict(void); | |
/* | |
* Constructor and destructor. | |
*/ | |
XMLPUBFUN xmlDictPtr XMLCALL | |
xmlDictCreate (void); | |
XMLPUBFUN size_t XMLCALL | |
xmlDictSetLimit (xmlDictPtr dict, | |
size_t limit); | |
XMLPUBFUN size_t XMLCALL | |
xmlDictGetUsage (xmlDictPtr dict); | |
XMLPUBFUN xmlDictPtr XMLCALL | |
xmlDictCreateSub(xmlDictPtr sub); | |
XMLPUBFUN int XMLCALL | |
xmlDictReference(xmlDictPtr dict); | |
XMLPUBFUN void XMLCALL | |
xmlDictFree (xmlDictPtr dict); | |
/* | |
* Lookup of entry in the dictionary. | |
*/ | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlDictLookup (xmlDictPtr dict, | |
const xmlChar *name, | |
int len); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlDictExists (xmlDictPtr dict, | |
const xmlChar *name, | |
int len); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlDictQLookup (xmlDictPtr dict, | |
const xmlChar *prefix, | |
const xmlChar *name); | |
XMLPUBFUN int XMLCALL | |
xmlDictOwns (xmlDictPtr dict, | |
const xmlChar *str); | |
XMLPUBFUN int XMLCALL | |
xmlDictSize (xmlDictPtr dict); | |
/* | |
* Cleanup function | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlDictCleanup (void); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* ! __XML_DICT_H__ */ |
/* | |
* Summary: old DocBook SGML parser | |
* Description: interface for a DocBook SGML non-verifying parser | |
* This code is DEPRECATED, and should not be used anymore. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __DOCB_PARSER_H__ | |
#define __DOCB_PARSER_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_DOCB_ENABLED | |
#include <libxml/parser.h> | |
#include <libxml/parserInternals.h> | |
#ifndef IN_LIBXML | |
#ifdef __GNUC__ | |
#warning "The DOCBparser module has been deprecated in libxml2-2.6.0" | |
#endif | |
#endif | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Most of the back-end structures from XML and SGML are shared. | |
*/ | |
typedef xmlParserCtxt docbParserCtxt; | |
typedef xmlParserCtxtPtr docbParserCtxtPtr; | |
typedef xmlSAXHandler docbSAXHandler; | |
typedef xmlSAXHandlerPtr docbSAXHandlerPtr; | |
typedef xmlParserInput docbParserInput; | |
typedef xmlParserInputPtr docbParserInputPtr; | |
typedef xmlDocPtr docbDocPtr; | |
/* | |
* There is only few public functions. | |
*/ | |
XMLPUBFUN int XMLCALL | |
docbEncodeEntities(unsigned char *out, | |
int *outlen, | |
const unsigned char *in, | |
int *inlen, int quoteChar); | |
XMLPUBFUN docbDocPtr XMLCALL | |
docbSAXParseDoc (xmlChar *cur, | |
const char *encoding, | |
docbSAXHandlerPtr sax, | |
void *userData); | |
XMLPUBFUN docbDocPtr XMLCALL | |
docbParseDoc (xmlChar *cur, | |
const char *encoding); | |
XMLPUBFUN docbDocPtr XMLCALL | |
docbSAXParseFile (const char *filename, | |
const char *encoding, | |
docbSAXHandlerPtr sax, | |
void *userData); | |
XMLPUBFUN docbDocPtr XMLCALL | |
docbParseFile (const char *filename, | |
const char *encoding); | |
/** | |
* Interfaces for the Push mode. | |
*/ | |
XMLPUBFUN void XMLCALL | |
docbFreeParserCtxt (docbParserCtxtPtr ctxt); | |
XMLPUBFUN docbParserCtxtPtr XMLCALL | |
docbCreatePushParserCtxt(docbSAXHandlerPtr sax, | |
void *user_data, | |
const char *chunk, | |
int size, | |
const char *filename, | |
xmlCharEncoding enc); | |
XMLPUBFUN int XMLCALL | |
docbParseChunk (docbParserCtxtPtr ctxt, | |
const char *chunk, | |
int size, | |
int terminate); | |
XMLPUBFUN docbParserCtxtPtr XMLCALL | |
docbCreateFileParserCtxt(const char *filename, | |
const char *encoding); | |
XMLPUBFUN int XMLCALL | |
docbParseDocument (docbParserCtxtPtr ctxt); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_DOCB_ENABLED */ | |
#endif /* __DOCB_PARSER_H__ */ |
/* | |
* Summary: interface for the encoding conversion functions | |
* Description: interface for the encoding conversion functions needed for | |
* XML basic encoding and iconv() support. | |
* | |
* Related specs are | |
* rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies | |
* [ISO-10646] UTF-8 and UTF-16 in Annexes | |
* [ISO-8859-1] ISO Latin-1 characters codes. | |
* [UNICODE] The Unicode Consortium, "The Unicode Standard -- | |
* Worldwide Character Encoding -- Version 1.0", Addison- | |
* Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is | |
* described in Unicode Technical Report #4. | |
* [US-ASCII] Coded Character Set--7-bit American Standard Code for | |
* Information Interchange, ANSI X3.4-1986. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_CHAR_ENCODING_H__ | |
#define __XML_CHAR_ENCODING_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_ICONV_ENABLED | |
#include <iconv.h> | |
#endif | |
#ifdef LIBXML_ICU_ENABLED | |
#include <unicode/ucnv.h> | |
#endif | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* xmlCharEncoding: | |
* | |
* Predefined values for some standard encodings. | |
* Libxml does not do beforehand translation on UTF8 and ISOLatinX. | |
* It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. | |
* | |
* Anything else would have to be translated to UTF8 before being | |
* given to the parser itself. The BOM for UTF16 and the encoding | |
* declaration are looked at and a converter is looked for at that | |
* point. If not found the parser stops here as asked by the XML REC. A | |
* converter can be registered by the user using xmlRegisterCharEncodingHandler | |
* but the current form doesn't allow stateful transcoding (a serious | |
* problem agreed !). If iconv has been found it will be used | |
* automatically and allow stateful transcoding, the simplest is then | |
* to be sure to enable iconv and to provide iconv libs for the encoding | |
* support needed. | |
* | |
* Note that the generic "UTF-16" is not a predefined value. Instead, only | |
* the specific UTF-16LE and UTF-16BE are present. | |
*/ | |
typedef enum { | |
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ | |
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ | |
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ | |
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ | |
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ | |
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ | |
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ | |
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ | |
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ | |
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ | |
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ | |
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ | |
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ | |
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ | |
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ | |
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ | |
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ | |
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ | |
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ | |
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ | |
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ | |
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ | |
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ | |
XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ | |
} xmlCharEncoding; | |
/** | |
* xmlCharEncodingInputFunc: | |
* @out: a pointer to an array of bytes to store the UTF-8 result | |
* @outlen: the length of @out | |
* @in: a pointer to an array of chars in the original encoding | |
* @inlen: the length of @in | |
* | |
* Take a block of chars in the original encoding and try to convert | |
* it to an UTF-8 block of chars out. | |
* | |
* Returns the number of bytes written, -1 if lack of space, or -2 | |
* if the transcoding failed. | |
* The value of @inlen after return is the number of octets consumed | |
* if the return value is positive, else unpredictiable. | |
* The value of @outlen after return is the number of octets consumed. | |
*/ | |
typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, | |
const unsigned char *in, int *inlen); | |
/** | |
* xmlCharEncodingOutputFunc: | |
* @out: a pointer to an array of bytes to store the result | |
* @outlen: the length of @out | |
* @in: a pointer to an array of UTF-8 chars | |
* @inlen: the length of @in | |
* | |
* Take a block of UTF-8 chars in and try to convert it to another | |
* encoding. | |
* Note: a first call designed to produce heading info is called with | |
* in = NULL. If stateful this should also initialize the encoder state. | |
* | |
* Returns the number of bytes written, -1 if lack of space, or -2 | |
* if the transcoding failed. | |
* The value of @inlen after return is the number of octets consumed | |
* if the return value is positive, else unpredictiable. | |
* The value of @outlen after return is the number of octets produced. | |
*/ | |
typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, | |
const unsigned char *in, int *inlen); | |
/* | |
* Block defining the handlers for non UTF-8 encodings. | |
* If iconv is supported, there are two extra fields. | |
*/ | |
#ifdef LIBXML_ICU_ENABLED | |
struct _uconv_t { | |
UConverter *uconv; /* for conversion between an encoding and UTF-16 */ | |
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ | |
}; | |
typedef struct _uconv_t uconv_t; | |
#endif | |
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; | |
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; | |
struct _xmlCharEncodingHandler { | |
char *name; | |
xmlCharEncodingInputFunc input; | |
xmlCharEncodingOutputFunc output; | |
#ifdef LIBXML_ICONV_ENABLED | |
iconv_t iconv_in; | |
iconv_t iconv_out; | |
#endif /* LIBXML_ICONV_ENABLED */ | |
#ifdef LIBXML_ICU_ENABLED | |
uconv_t *uconv_in; | |
uconv_t *uconv_out; | |
#endif /* LIBXML_ICU_ENABLED */ | |
}; | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/tree.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Interfaces for encoding handlers. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlInitCharEncodingHandlers (void); | |
XMLPUBFUN void XMLCALL | |
xmlCleanupCharEncodingHandlers (void); | |
XMLPUBFUN void XMLCALL | |
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); | |
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | |
xmlGetCharEncodingHandler (xmlCharEncoding enc); | |
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | |
xmlFindCharEncodingHandler (const char *name); | |
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | |
xmlNewCharEncodingHandler (const char *name, | |
xmlCharEncodingInputFunc input, | |
xmlCharEncodingOutputFunc output); | |
/* | |
* Interfaces for encoding names and aliases. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlAddEncodingAlias (const char *name, | |
const char *alias); | |
XMLPUBFUN int XMLCALL | |
xmlDelEncodingAlias (const char *alias); | |
XMLPUBFUN const char * XMLCALL | |
xmlGetEncodingAlias (const char *alias); | |
XMLPUBFUN void XMLCALL | |
xmlCleanupEncodingAliases (void); | |
XMLPUBFUN xmlCharEncoding XMLCALL | |
xmlParseCharEncoding (const char *name); | |
XMLPUBFUN const char * XMLCALL | |
xmlGetCharEncodingName (xmlCharEncoding enc); | |
/* | |
* Interfaces directly used by the parsers. | |
*/ | |
XMLPUBFUN xmlCharEncoding XMLCALL | |
xmlDetectCharEncoding (const unsigned char *in, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlCharEncOutFunc (xmlCharEncodingHandler *handler, | |
xmlBufferPtr out, | |
xmlBufferPtr in); | |
XMLPUBFUN int XMLCALL | |
xmlCharEncInFunc (xmlCharEncodingHandler *handler, | |
xmlBufferPtr out, | |
xmlBufferPtr in); | |
XMLPUBFUN int XMLCALL | |
xmlCharEncFirstLine (xmlCharEncodingHandler *handler, | |
xmlBufferPtr out, | |
xmlBufferPtr in); | |
XMLPUBFUN int XMLCALL | |
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); | |
/* | |
* Export a few useful functions | |
*/ | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN int XMLCALL | |
UTF8Toisolat1 (unsigned char *out, | |
int *outlen, | |
const unsigned char *in, | |
int *inlen); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
isolat1ToUTF8 (unsigned char *out, | |
int *outlen, | |
const unsigned char *in, | |
int *inlen); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_CHAR_ENCODING_H__ */ |
/* | |
* Summary: interface for the XML entities handling | |
* Description: this module provides some of the entity API needed | |
* for the parser and applications. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_ENTITIES_H__ | |
#define __XML_ENTITIES_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* The different valid entity types. | |
*/ | |
typedef enum { | |
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 | |
} xmlEntityType; | |
/* | |
* An unit of storage for an entity, contains the string, the value | |
* and the linkind data needed for the linking in the hash table. | |
*/ | |
struct _xmlEntity { | |
void *_private; /* application data */ | |
xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ | |
const xmlChar *name; /* Entity name */ | |
struct _xmlNode *children; /* First child link */ | |
struct _xmlNode *last; /* Last child link */ | |
struct _xmlDtd *parent; /* -> DTD */ | |
struct _xmlNode *next; /* next sibling link */ | |
struct _xmlNode *prev; /* previous sibling link */ | |
struct _xmlDoc *doc; /* the containing document */ | |
xmlChar *orig; /* content without ref substitution */ | |
xmlChar *content; /* content or ndata if unparsed */ | |
int length; /* the content length */ | |
xmlEntityType etype; /* The entity type */ | |
const xmlChar *ExternalID; /* External identifier for PUBLIC */ | |
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ | |
struct _xmlEntity *nexte; /* unused */ | |
const xmlChar *URI; /* the full URI as computed */ | |
int owner; /* does the entity own the childrens */ | |
int checked; /* was the entity content checked */ | |
/* this is also used to count entities | |
* references done from that entity | |
* and if it contains '<' */ | |
}; | |
/* | |
* All entities are stored in an hash table. | |
* There is 2 separate hash tables for global and parameter entities. | |
*/ | |
typedef struct _xmlHashTable xmlEntitiesTable; | |
typedef xmlEntitiesTable *xmlEntitiesTablePtr; | |
/* | |
* External functions: | |
*/ | |
#ifdef LIBXML_LEGACY_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlInitializePredefinedEntities (void); | |
#endif /* LIBXML_LEGACY_ENABLED */ | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlNewEntity (xmlDocPtr doc, | |
const xmlChar *name, | |
int type, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID, | |
const xmlChar *content); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlAddDocEntity (xmlDocPtr doc, | |
const xmlChar *name, | |
int type, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID, | |
const xmlChar *content); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlAddDtdEntity (xmlDocPtr doc, | |
const xmlChar *name, | |
int type, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID, | |
const xmlChar *content); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlGetPredefinedEntity (const xmlChar *name); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlGetDocEntity (const xmlDoc *doc, | |
const xmlChar *name); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlGetDtdEntity (xmlDocPtr doc, | |
const xmlChar *name); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlGetParameterEntity (xmlDocPtr doc, | |
const xmlChar *name); | |
#ifdef LIBXML_LEGACY_ENABLED | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlEncodeEntities (xmlDocPtr doc, | |
const xmlChar *input); | |
#endif /* LIBXML_LEGACY_ENABLED */ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlEncodeEntitiesReentrant(xmlDocPtr doc, | |
const xmlChar *input); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlEncodeSpecialChars (const xmlDoc *doc, | |
const xmlChar *input); | |
XMLPUBFUN xmlEntitiesTablePtr XMLCALL | |
xmlCreateEntitiesTable (void); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlEntitiesTablePtr XMLCALL | |
xmlCopyEntitiesTable (xmlEntitiesTablePtr table); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlFreeEntitiesTable (xmlEntitiesTablePtr table); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlDumpEntitiesTable (xmlBufferPtr buf, | |
xmlEntitiesTablePtr table); | |
XMLPUBFUN void XMLCALL | |
xmlDumpEntityDecl (xmlBufferPtr buf, | |
xmlEntityPtr ent); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
#ifdef LIBXML_LEGACY_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlCleanupPredefinedEntities(void); | |
#endif /* LIBXML_LEGACY_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
# endif /* __XML_ENTITIES_H__ */ |
/* | |
* Summary: interface for all global variables of the library | |
* Description: all the global variables and thread handling for | |
* those variables is handled by this module. | |
* | |
* The bottom of this file is automatically generated by build_glob.py | |
* based on the description file global.data | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard | |
*/ | |
#ifndef __XML_GLOBALS_H | |
#define __XML_GLOBALS_H | |
#include <libxml/xmlversion.h> | |
#include <libxml/parser.h> | |
#include <libxml/xmlerror.h> | |
#include <libxml/SAX.h> | |
#include <libxml/SAX2.h> | |
#include <libxml/xmlmemory.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XMLPUBFUN void XMLCALL xmlInitGlobals(void); | |
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); | |
/** | |
* xmlParserInputBufferCreateFilenameFunc: | |
* @URI: the URI to read from | |
* @enc: the requested source encoding | |
* | |
* Signature for the function doing the lookup for a suitable input method | |
* corresponding to an URI. | |
* | |
* Returns the new xmlParserInputBufferPtr in case of success or NULL if no | |
* method was found. | |
*/ | |
typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, | |
xmlCharEncoding enc); | |
/** | |
* xmlOutputBufferCreateFilenameFunc: | |
* @URI: the URI to write to | |
* @enc: the requested target encoding | |
* | |
* Signature for the function doing the lookup for a suitable output method | |
* corresponding to an URI. | |
* | |
* Returns the new xmlOutputBufferPtr in case of success or NULL if no | |
* method was found. | |
*/ | |
typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, | |
xmlCharEncodingHandlerPtr encoder, | |
int compression); | |
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc | |
XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); | |
XMLPUBFUN xmlOutputBufferCreateFilenameFunc | |
XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func); | |
/* | |
* Externally global symbols which need to be protected for backwards | |
* compatibility support. | |
*/ | |
#undef docbDefaultSAXHandler | |
#undef htmlDefaultSAXHandler | |
#undef oldXMLWDcompatibility | |
#undef xmlBufferAllocScheme | |
#undef xmlDefaultBufferSize | |
#undef xmlDefaultSAXHandler | |
#undef xmlDefaultSAXLocator | |
#undef xmlDoValidityCheckingDefaultValue | |
#undef xmlFree | |
#undef xmlGenericError | |
#undef xmlStructuredError | |
#undef xmlGenericErrorContext | |
#undef xmlStructuredErrorContext | |
#undef xmlGetWarningsDefaultValue | |
#undef xmlIndentTreeOutput | |
#undef xmlTreeIndentString | |
#undef xmlKeepBlanksDefaultValue | |
#undef xmlLineNumbersDefaultValue | |
#undef xmlLoadExtDtdDefaultValue | |
#undef xmlMalloc | |
#undef xmlMallocAtomic | |
#undef xmlMemStrdup | |
#undef xmlParserDebugEntities | |
#undef xmlParserVersion | |
#undef xmlPedanticParserDefaultValue | |
#undef xmlRealloc | |
#undef xmlSaveNoEmptyTags | |
#undef xmlSubstituteEntitiesDefaultValue | |
#undef xmlRegisterNodeDefaultValue | |
#undef xmlDeregisterNodeDefaultValue | |
#undef xmlLastError | |
#undef xmlParserInputBufferCreateFilenameValue | |
#undef xmlOutputBufferCreateFilenameValue | |
/** | |
* xmlRegisterNodeFunc: | |
* @node: the current node | |
* | |
* Signature for the registration callback of a created node | |
*/ | |
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); | |
/** | |
* xmlDeregisterNodeFunc: | |
* @node: the current node | |
* | |
* Signature for the deregistration callback of a discarded node | |
*/ | |
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); | |
typedef struct _xmlGlobalState xmlGlobalState; | |
typedef xmlGlobalState *xmlGlobalStatePtr; | |
struct _xmlGlobalState | |
{ | |
const char *xmlParserVersion; | |
xmlSAXLocator xmlDefaultSAXLocator; | |
xmlSAXHandlerV1 xmlDefaultSAXHandler; | |
xmlSAXHandlerV1 docbDefaultSAXHandler; | |
xmlSAXHandlerV1 htmlDefaultSAXHandler; | |
xmlFreeFunc xmlFree; | |
xmlMallocFunc xmlMalloc; | |
xmlStrdupFunc xmlMemStrdup; | |
xmlReallocFunc xmlRealloc; | |
xmlGenericErrorFunc xmlGenericError; | |
xmlStructuredErrorFunc xmlStructuredError; | |
void *xmlGenericErrorContext; | |
int oldXMLWDcompatibility; | |
xmlBufferAllocationScheme xmlBufferAllocScheme; | |
int xmlDefaultBufferSize; | |
int xmlSubstituteEntitiesDefaultValue; | |
int xmlDoValidityCheckingDefaultValue; | |
int xmlGetWarningsDefaultValue; | |
int xmlKeepBlanksDefaultValue; | |
int xmlLineNumbersDefaultValue; | |
int xmlLoadExtDtdDefaultValue; | |
int xmlParserDebugEntities; | |
int xmlPedanticParserDefaultValue; | |
int xmlSaveNoEmptyTags; | |
int xmlIndentTreeOutput; | |
const char *xmlTreeIndentString; | |
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; | |
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; | |
xmlMallocFunc xmlMallocAtomic; | |
xmlError xmlLastError; | |
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; | |
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; | |
void *xmlStructuredErrorContext; | |
}; | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/threads.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); | |
XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); | |
XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); | |
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func); | |
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); | |
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); | |
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); | |
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL | |
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); | |
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL | |
xmlThrDefParserInputBufferCreateFilenameDefault( | |
xmlParserInputBufferCreateFilenameFunc func); | |
/** DOC_DISABLE */ | |
/* | |
* In general the memory allocation entry points are not kept | |
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED | |
* - xmlMalloc | |
* - xmlMallocAtomic | |
* - xmlRealloc | |
* - xmlMemStrdup | |
* - xmlFree | |
*/ | |
#ifdef LIBXML_THREAD_ALLOC_ENABLED | |
#ifdef LIBXML_THREAD_ENABLED | |
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void); | |
#define xmlMalloc \ | |
(*(__xmlMalloc())) | |
#else | |
XMLPUBVAR xmlMallocFunc xmlMalloc; | |
#endif | |
#ifdef LIBXML_THREAD_ENABLED | |
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void); | |
#define xmlMallocAtomic \ | |
(*(__xmlMallocAtomic())) | |
#else | |
XMLPUBVAR xmlMallocFunc xmlMallocAtomic; | |
#endif | |
#ifdef LIBXML_THREAD_ENABLED | |
XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void); | |
#define xmlRealloc \ | |
(*(__xmlRealloc())) | |
#else | |
XMLPUBVAR xmlReallocFunc xmlRealloc; | |
#endif | |
#ifdef LIBXML_THREAD_ENABLED | |
XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void); | |
#define xmlFree \ | |
(*(__xmlFree())) | |
#else | |
XMLPUBVAR xmlFreeFunc xmlFree; | |
#endif | |
#ifdef LIBXML_THREAD_ENABLED | |
XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void); | |
#define xmlMemStrdup \ | |
(*(__xmlMemStrdup())) | |
#else | |
XMLPUBVAR xmlStrdupFunc xmlMemStrdup; | |
#endif | |
#else /* !LIBXML_THREAD_ALLOC_ENABLED */ | |
XMLPUBVAR xmlMallocFunc xmlMalloc; | |
XMLPUBVAR xmlMallocFunc xmlMallocAtomic; | |
XMLPUBVAR xmlReallocFunc xmlRealloc; | |
XMLPUBVAR xmlFreeFunc xmlFree; | |
XMLPUBVAR xmlStrdupFunc xmlMemStrdup; | |
#endif /* LIBXML_THREAD_ALLOC_ENABLED */ | |
#ifdef LIBXML_DOCB_ENABLED | |
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define docbDefaultSAXHandler \ | |
(*(__docbDefaultSAXHandler())) | |
#else | |
XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler; | |
#endif | |
#endif | |
#ifdef LIBXML_HTML_ENABLED | |
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define htmlDefaultSAXHandler \ | |
(*(__htmlDefaultSAXHandler())) | |
#else | |
XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler; | |
#endif | |
#endif | |
XMLPUBFUN xmlError * XMLCALL __xmlLastError(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlLastError \ | |
(*(__xmlLastError())) | |
#else | |
XMLPUBVAR xmlError xmlLastError; | |
#endif | |
/* | |
* Everything starting from the line below is | |
* Automatically generated by build_glob.py. | |
* Do not modify the previous line. | |
*/ | |
XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define oldXMLWDcompatibility \ | |
(*(__oldXMLWDcompatibility())) | |
#else | |
XMLPUBVAR int oldXMLWDcompatibility; | |
#endif | |
XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlBufferAllocScheme \ | |
(*(__xmlBufferAllocScheme())) | |
#else | |
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; | |
#endif | |
XMLPUBFUN xmlBufferAllocationScheme XMLCALL | |
xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); | |
XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlDefaultBufferSize \ | |
(*(__xmlDefaultBufferSize())) | |
#else | |
XMLPUBVAR int xmlDefaultBufferSize; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v); | |
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlDefaultSAXHandler \ | |
(*(__xmlDefaultSAXHandler())) | |
#else | |
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler; | |
#endif | |
XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlDefaultSAXLocator \ | |
(*(__xmlDefaultSAXLocator())) | |
#else | |
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator; | |
#endif | |
XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlDoValidityCheckingDefaultValue \ | |
(*(__xmlDoValidityCheckingDefaultValue())) | |
#else | |
XMLPUBVAR int xmlDoValidityCheckingDefaultValue; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v); | |
XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlGenericError \ | |
(*(__xmlGenericError())) | |
#else | |
XMLPUBVAR xmlGenericErrorFunc xmlGenericError; | |
#endif | |
XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlStructuredError \ | |
(*(__xmlStructuredError())) | |
#else | |
XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError; | |
#endif | |
XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlGenericErrorContext \ | |
(*(__xmlGenericErrorContext())) | |
#else | |
XMLPUBVAR void * xmlGenericErrorContext; | |
#endif | |
XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlStructuredErrorContext \ | |
(*(__xmlStructuredErrorContext())) | |
#else | |
XMLPUBVAR void * xmlStructuredErrorContext; | |
#endif | |
XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlGetWarningsDefaultValue \ | |
(*(__xmlGetWarningsDefaultValue())) | |
#else | |
XMLPUBVAR int xmlGetWarningsDefaultValue; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v); | |
XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlIndentTreeOutput \ | |
(*(__xmlIndentTreeOutput())) | |
#else | |
XMLPUBVAR int xmlIndentTreeOutput; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v); | |
XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlTreeIndentString \ | |
(*(__xmlTreeIndentString())) | |
#else | |
XMLPUBVAR const char * xmlTreeIndentString; | |
#endif | |
XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v); | |
XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlKeepBlanksDefaultValue \ | |
(*(__xmlKeepBlanksDefaultValue())) | |
#else | |
XMLPUBVAR int xmlKeepBlanksDefaultValue; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v); | |
XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlLineNumbersDefaultValue \ | |
(*(__xmlLineNumbersDefaultValue())) | |
#else | |
XMLPUBVAR int xmlLineNumbersDefaultValue; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v); | |
XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlLoadExtDtdDefaultValue \ | |
(*(__xmlLoadExtDtdDefaultValue())) | |
#else | |
XMLPUBVAR int xmlLoadExtDtdDefaultValue; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v); | |
XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlParserDebugEntities \ | |
(*(__xmlParserDebugEntities())) | |
#else | |
XMLPUBVAR int xmlParserDebugEntities; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v); | |
XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlParserVersion \ | |
(*(__xmlParserVersion())) | |
#else | |
XMLPUBVAR const char * xmlParserVersion; | |
#endif | |
XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlPedanticParserDefaultValue \ | |
(*(__xmlPedanticParserDefaultValue())) | |
#else | |
XMLPUBVAR int xmlPedanticParserDefaultValue; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v); | |
XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlSaveNoEmptyTags \ | |
(*(__xmlSaveNoEmptyTags())) | |
#else | |
XMLPUBVAR int xmlSaveNoEmptyTags; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v); | |
XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlSubstituteEntitiesDefaultValue \ | |
(*(__xmlSubstituteEntitiesDefaultValue())) | |
#else | |
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue; | |
#endif | |
XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v); | |
XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlRegisterNodeDefaultValue \ | |
(*(__xmlRegisterNodeDefaultValue())) | |
#else | |
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; | |
#endif | |
XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlDeregisterNodeDefaultValue \ | |
(*(__xmlDeregisterNodeDefaultValue())) | |
#else | |
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; | |
#endif | |
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \ | |
__xmlParserInputBufferCreateFilenameValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlParserInputBufferCreateFilenameValue \ | |
(*(__xmlParserInputBufferCreateFilenameValue())) | |
#else | |
XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; | |
#endif | |
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void); | |
#ifdef LIBXML_THREAD_ENABLED | |
#define xmlOutputBufferCreateFilenameValue \ | |
(*(__xmlOutputBufferCreateFilenameValue())) | |
#else | |
XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_GLOBALS_H */ |
/* | |
* Summary: Chained hash tables | |
* Description: This module implements the hash table support used in | |
* various places in the library. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Bjorn Reese <bjorn.reese@systematic.dk> | |
*/ | |
#ifndef __XML_HASH_H__ | |
#define __XML_HASH_H__ | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* The hash table. | |
*/ | |
typedef struct _xmlHashTable xmlHashTable; | |
typedef xmlHashTable *xmlHashTablePtr; | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/xmlversion.h> | |
#include <libxml/parser.h> | |
#include <libxml/dict.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Recent version of gcc produce a warning when a function pointer is assigned | |
* to an object pointer, or vice versa. The following macro is a dirty hack | |
* to allow suppression of the warning. If your architecture has function | |
* pointers which are a different size than a void pointer, there may be some | |
* serious trouble within the library. | |
*/ | |
/** | |
* XML_CAST_FPTR: | |
* @fptr: pointer to a function | |
* | |
* Macro to do a casting from an object pointer to a | |
* function pointer without encountering a warning from | |
* gcc | |
* | |
* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) | |
* This macro violated ISO C aliasing rules (gcc4 on s390 broke) | |
* so it is disabled now | |
*/ | |
#define XML_CAST_FPTR(fptr) fptr | |
/* | |
* function types: | |
*/ | |
/** | |
* xmlHashDeallocator: | |
* @payload: the data in the hash | |
* @name: the name associated | |
* | |
* Callback to free data from a hash. | |
*/ | |
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); | |
/** | |
* xmlHashCopier: | |
* @payload: the data in the hash | |
* @name: the name associated | |
* | |
* Callback to copy data from a hash. | |
* | |
* Returns a copy of the data or NULL in case of error. | |
*/ | |
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); | |
/** | |
* xmlHashScanner: | |
* @payload: the data in the hash | |
* @data: extra scannner data | |
* @name: the name associated | |
* | |
* Callback when scanning data in a hash with the simple scanner. | |
*/ | |
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); | |
/** | |
* xmlHashScannerFull: | |
* @payload: the data in the hash | |
* @data: extra scannner data | |
* @name: the name associated | |
* @name2: the second name associated | |
* @name3: the third name associated | |
* | |
* Callback when scanning data in a hash with the full scanner. | |
*/ | |
typedef void (*xmlHashScannerFull)(void *payload, void *data, | |
const xmlChar *name, const xmlChar *name2, | |
const xmlChar *name3); | |
/* | |
* Constructor and destructor. | |
*/ | |
XMLPUBFUN xmlHashTablePtr XMLCALL | |
xmlHashCreate (int size); | |
XMLPUBFUN xmlHashTablePtr XMLCALL | |
xmlHashCreateDict(int size, | |
xmlDictPtr dict); | |
XMLPUBFUN void XMLCALL | |
xmlHashFree (xmlHashTablePtr table, | |
xmlHashDeallocator f); | |
/* | |
* Add a new entry to the hash table. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlHashAddEntry (xmlHashTablePtr table, | |
const xmlChar *name, | |
void *userdata); | |
XMLPUBFUN int XMLCALL | |
xmlHashUpdateEntry(xmlHashTablePtr table, | |
const xmlChar *name, | |
void *userdata, | |
xmlHashDeallocator f); | |
XMLPUBFUN int XMLCALL | |
xmlHashAddEntry2(xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2, | |
void *userdata); | |
XMLPUBFUN int XMLCALL | |
xmlHashUpdateEntry2(xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2, | |
void *userdata, | |
xmlHashDeallocator f); | |
XMLPUBFUN int XMLCALL | |
xmlHashAddEntry3(xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2, | |
const xmlChar *name3, | |
void *userdata); | |
XMLPUBFUN int XMLCALL | |
xmlHashUpdateEntry3(xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2, | |
const xmlChar *name3, | |
void *userdata, | |
xmlHashDeallocator f); | |
/* | |
* Remove an entry from the hash table. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, | |
xmlHashDeallocator f); | |
XMLPUBFUN int XMLCALL | |
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, | |
const xmlChar *name2, xmlHashDeallocator f); | |
XMLPUBFUN int XMLCALL | |
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, | |
const xmlChar *name2, const xmlChar *name3, | |
xmlHashDeallocator f); | |
/* | |
* Retrieve the userdata. | |
*/ | |
XMLPUBFUN void * XMLCALL | |
xmlHashLookup (xmlHashTablePtr table, | |
const xmlChar *name); | |
XMLPUBFUN void * XMLCALL | |
xmlHashLookup2 (xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2); | |
XMLPUBFUN void * XMLCALL | |
xmlHashLookup3 (xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2, | |
const xmlChar *name3); | |
XMLPUBFUN void * XMLCALL | |
xmlHashQLookup (xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *prefix); | |
XMLPUBFUN void * XMLCALL | |
xmlHashQLookup2 (xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *prefix, | |
const xmlChar *name2, | |
const xmlChar *prefix2); | |
XMLPUBFUN void * XMLCALL | |
xmlHashQLookup3 (xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *prefix, | |
const xmlChar *name2, | |
const xmlChar *prefix2, | |
const xmlChar *name3, | |
const xmlChar *prefix3); | |
/* | |
* Helpers. | |
*/ | |
XMLPUBFUN xmlHashTablePtr XMLCALL | |
xmlHashCopy (xmlHashTablePtr table, | |
xmlHashCopier f); | |
XMLPUBFUN int XMLCALL | |
xmlHashSize (xmlHashTablePtr table); | |
XMLPUBFUN void XMLCALL | |
xmlHashScan (xmlHashTablePtr table, | |
xmlHashScanner f, | |
void *data); | |
XMLPUBFUN void XMLCALL | |
xmlHashScan3 (xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2, | |
const xmlChar *name3, | |
xmlHashScanner f, | |
void *data); | |
XMLPUBFUN void XMLCALL | |
xmlHashScanFull (xmlHashTablePtr table, | |
xmlHashScannerFull f, | |
void *data); | |
XMLPUBFUN void XMLCALL | |
xmlHashScanFull3(xmlHashTablePtr table, | |
const xmlChar *name, | |
const xmlChar *name2, | |
const xmlChar *name3, | |
xmlHashScannerFull f, | |
void *data); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* ! __XML_HASH_H__ */ |
/* | |
* Summary: interface for an HTML 4.0 non-verifying parser | |
* Description: this module implements an HTML 4.0 non-verifying parser | |
* with API compatible with the XML parser ones. It should | |
* be able to parse "real world" HTML, even if severely | |
* broken from a specification point of view. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __HTML_PARSER_H__ | |
#define __HTML_PARSER_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/parser.h> | |
#ifdef LIBXML_HTML_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Most of the back-end structures from XML and HTML are shared. | |
*/ | |
typedef xmlParserCtxt htmlParserCtxt; | |
typedef xmlParserCtxtPtr htmlParserCtxtPtr; | |
typedef xmlParserNodeInfo htmlParserNodeInfo; | |
typedef xmlSAXHandler htmlSAXHandler; | |
typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; | |
typedef xmlParserInput htmlParserInput; | |
typedef xmlParserInputPtr htmlParserInputPtr; | |
typedef xmlDocPtr htmlDocPtr; | |
typedef xmlNodePtr htmlNodePtr; | |
/* | |
* Internal description of an HTML element, representing HTML 4.01 | |
* and XHTML 1.0 (which share the same structure). | |
*/ | |
typedef struct _htmlElemDesc htmlElemDesc; | |
typedef htmlElemDesc *htmlElemDescPtr; | |
struct _htmlElemDesc { | |
const char *name; /* The tag name */ | |
char startTag; /* Whether the start tag can be implied */ | |
char endTag; /* Whether the end tag can be implied */ | |
char saveEndTag; /* Whether the end tag should be saved */ | |
char empty; /* Is this an empty element ? */ | |
char depr; /* Is this a deprecated element ? */ | |
char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ | |
char isinline; /* is this a block 0 or inline 1 element */ | |
const char *desc; /* the description */ | |
/* NRK Jan.2003 | |
* New fields encapsulating HTML structure | |
* | |
* Bugs: | |
* This is a very limited representation. It fails to tell us when | |
* an element *requires* subelements (we only have whether they're | |
* allowed or not), and it doesn't tell us where CDATA and PCDATA | |
* are allowed. Some element relationships are not fully represented: | |
* these are flagged with the word MODIFIER | |
*/ | |
const char** subelts; /* allowed sub-elements of this element */ | |
const char* defaultsubelt; /* subelement for suggested auto-repair | |
if necessary or NULL */ | |
const char** attrs_opt; /* Optional Attributes */ | |
const char** attrs_depr; /* Additional deprecated attributes */ | |
const char** attrs_req; /* Required attributes */ | |
}; | |
/* | |
* Internal description of an HTML entity. | |
*/ | |
typedef struct _htmlEntityDesc htmlEntityDesc; | |
typedef htmlEntityDesc *htmlEntityDescPtr; | |
struct _htmlEntityDesc { | |
unsigned int value; /* the UNICODE value for the character */ | |
const char *name; /* The entity name */ | |
const char *desc; /* the description */ | |
}; | |
/* | |
* There is only few public functions. | |
*/ | |
XMLPUBFUN const htmlElemDesc * XMLCALL | |
htmlTagLookup (const xmlChar *tag); | |
XMLPUBFUN const htmlEntityDesc * XMLCALL | |
htmlEntityLookup(const xmlChar *name); | |
XMLPUBFUN const htmlEntityDesc * XMLCALL | |
htmlEntityValueLookup(unsigned int value); | |
XMLPUBFUN int XMLCALL | |
htmlIsAutoClosed(htmlDocPtr doc, | |
htmlNodePtr elem); | |
XMLPUBFUN int XMLCALL | |
htmlAutoCloseTag(htmlDocPtr doc, | |
const xmlChar *name, | |
htmlNodePtr elem); | |
XMLPUBFUN const htmlEntityDesc * XMLCALL | |
htmlParseEntityRef(htmlParserCtxtPtr ctxt, | |
const xmlChar **str); | |
XMLPUBFUN int XMLCALL | |
htmlParseCharRef(htmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
htmlParseElement(htmlParserCtxtPtr ctxt); | |
XMLPUBFUN htmlParserCtxtPtr XMLCALL | |
htmlNewParserCtxt(void); | |
XMLPUBFUN htmlParserCtxtPtr XMLCALL | |
htmlCreateMemoryParserCtxt(const char *buffer, | |
int size); | |
XMLPUBFUN int XMLCALL | |
htmlParseDocument(htmlParserCtxtPtr ctxt); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlSAXParseDoc (const xmlChar *cur, | |
const char *encoding, | |
htmlSAXHandlerPtr sax, | |
void *userData); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlParseDoc (const xmlChar *cur, | |
const char *encoding); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlSAXParseFile(const char *filename, | |
const char *encoding, | |
htmlSAXHandlerPtr sax, | |
void *userData); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlParseFile (const char *filename, | |
const char *encoding); | |
XMLPUBFUN int XMLCALL | |
UTF8ToHtml (unsigned char *out, | |
int *outlen, | |
const unsigned char *in, | |
int *inlen); | |
XMLPUBFUN int XMLCALL | |
htmlEncodeEntities(unsigned char *out, | |
int *outlen, | |
const unsigned char *in, | |
int *inlen, int quoteChar); | |
XMLPUBFUN int XMLCALL | |
htmlIsScriptAttribute(const xmlChar *name); | |
XMLPUBFUN int XMLCALL | |
htmlHandleOmittedElem(int val); | |
#ifdef LIBXML_PUSH_ENABLED | |
/** | |
* Interfaces for the Push mode. | |
*/ | |
XMLPUBFUN htmlParserCtxtPtr XMLCALL | |
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, | |
void *user_data, | |
const char *chunk, | |
int size, | |
const char *filename, | |
xmlCharEncoding enc); | |
XMLPUBFUN int XMLCALL | |
htmlParseChunk (htmlParserCtxtPtr ctxt, | |
const char *chunk, | |
int size, | |
int terminate); | |
#endif /* LIBXML_PUSH_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); | |
/* | |
* New set of simpler/more flexible APIs | |
*/ | |
/** | |
* xmlParserOption: | |
* | |
* This is the set of XML parser options that can be passed down | |
* to the xmlReadDoc() and similar calls. | |
*/ | |
typedef enum { | |
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ | |
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ | |
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ | |
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ | |
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ | |
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ | |
HTML_PARSE_NONET = 1<<11,/* Forbid network access */ | |
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ | |
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ | |
HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */ | |
} htmlParserOption; | |
XMLPUBFUN void XMLCALL | |
htmlCtxtReset (htmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlReadDoc (const xmlChar *cur, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlReadFile (const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlReadMemory (const char *buffer, | |
int size, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlReadFd (int fd, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlReadIO (xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, | |
const xmlChar *cur, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlCtxtReadFile (xmlParserCtxtPtr ctxt, | |
const char *filename, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, | |
const char *buffer, | |
int size, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlCtxtReadFd (xmlParserCtxtPtr ctxt, | |
int fd, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlCtxtReadIO (xmlParserCtxtPtr ctxt, | |
xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
const char *URL, | |
const char *encoding, | |
int options); | |
/* NRK/Jan2003: further knowledge of HTML structure | |
*/ | |
typedef enum { | |
HTML_NA = 0 , /* something we don't check at all */ | |
HTML_INVALID = 0x1 , | |
HTML_DEPRECATED = 0x2 , | |
HTML_VALID = 0x4 , | |
HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ | |
} htmlStatus ; | |
/* Using htmlElemDesc rather than name here, to emphasise the fact | |
that otherwise there's a lookup overhead | |
*/ | |
XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; | |
XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; | |
XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; | |
XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ; | |
/** | |
* htmlDefaultSubelement: | |
* @elt: HTML element | |
* | |
* Returns the default subelement for this element | |
*/ | |
#define htmlDefaultSubelement(elt) elt->defaultsubelt | |
/** | |
* htmlElementAllowedHereDesc: | |
* @parent: HTML parent element | |
* @elt: HTML element | |
* | |
* Checks whether an HTML element description may be a | |
* direct child of the specified element. | |
* | |
* Returns 1 if allowed; 0 otherwise. | |
*/ | |
#define htmlElementAllowedHereDesc(parent,elt) \ | |
htmlElementAllowedHere((parent), (elt)->name) | |
/** | |
* htmlRequiredAttrs: | |
* @elt: HTML element | |
* | |
* Returns the attributes required for the specified element. | |
*/ | |
#define htmlRequiredAttrs(elt) (elt)->attrs_req | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_HTML_ENABLED */ | |
#endif /* __HTML_PARSER_H__ */ |
/* | |
* Summary: specific APIs to process HTML tree, especially serialization | |
* Description: this module implements a few function needed to process | |
* tree in an HTML specific way. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __HTML_TREE_H__ | |
#define __HTML_TREE_H__ | |
#include <stdio.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#include <libxml/HTMLparser.h> | |
#ifdef LIBXML_HTML_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* HTML_TEXT_NODE: | |
* | |
* Macro. A text node in a HTML document is really implemented | |
* the same way as a text node in an XML document. | |
*/ | |
#define HTML_TEXT_NODE XML_TEXT_NODE | |
/** | |
* HTML_ENTITY_REF_NODE: | |
* | |
* Macro. An entity reference in a HTML document is really implemented | |
* the same way as an entity reference in an XML document. | |
*/ | |
#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE | |
/** | |
* HTML_COMMENT_NODE: | |
* | |
* Macro. A comment in a HTML document is really implemented | |
* the same way as a comment in an XML document. | |
*/ | |
#define HTML_COMMENT_NODE XML_COMMENT_NODE | |
/** | |
* HTML_PRESERVE_NODE: | |
* | |
* Macro. A preserved node in a HTML document is really implemented | |
* the same way as a CDATA section in an XML document. | |
*/ | |
#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE | |
/** | |
* HTML_PI_NODE: | |
* | |
* Macro. A processing instruction in a HTML document is really implemented | |
* the same way as a processing instruction in an XML document. | |
*/ | |
#define HTML_PI_NODE XML_PI_NODE | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlNewDoc (const xmlChar *URI, | |
const xmlChar *ExternalID); | |
XMLPUBFUN htmlDocPtr XMLCALL | |
htmlNewDocNoDtD (const xmlChar *URI, | |
const xmlChar *ExternalID); | |
XMLPUBFUN const xmlChar * XMLCALL | |
htmlGetMetaEncoding (htmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
htmlSetMetaEncoding (htmlDocPtr doc, | |
const xmlChar *encoding); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
htmlDocDumpMemory (xmlDocPtr cur, | |
xmlChar **mem, | |
int *size); | |
XMLPUBFUN void XMLCALL | |
htmlDocDumpMemoryFormat (xmlDocPtr cur, | |
xmlChar **mem, | |
int *size, | |
int format); | |
XMLPUBFUN int XMLCALL | |
htmlDocDump (FILE *f, | |
xmlDocPtr cur); | |
XMLPUBFUN int XMLCALL | |
htmlSaveFile (const char *filename, | |
xmlDocPtr cur); | |
XMLPUBFUN int XMLCALL | |
htmlNodeDump (xmlBufferPtr buf, | |
xmlDocPtr doc, | |
xmlNodePtr cur); | |
XMLPUBFUN void XMLCALL | |
htmlNodeDumpFile (FILE *out, | |
xmlDocPtr doc, | |
xmlNodePtr cur); | |
XMLPUBFUN int XMLCALL | |
htmlNodeDumpFileFormat (FILE *out, | |
xmlDocPtr doc, | |
xmlNodePtr cur, | |
const char *encoding, | |
int format); | |
XMLPUBFUN int XMLCALL | |
htmlSaveFileEnc (const char *filename, | |
xmlDocPtr cur, | |
const char *encoding); | |
XMLPUBFUN int XMLCALL | |
htmlSaveFileFormat (const char *filename, | |
xmlDocPtr cur, | |
const char *encoding, | |
int format); | |
XMLPUBFUN void XMLCALL | |
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, | |
xmlDocPtr doc, | |
xmlNodePtr cur, | |
const char *encoding, | |
int format); | |
XMLPUBFUN void XMLCALL | |
htmlDocContentDumpOutput(xmlOutputBufferPtr buf, | |
xmlDocPtr cur, | |
const char *encoding); | |
XMLPUBFUN void XMLCALL | |
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, | |
xmlDocPtr cur, | |
const char *encoding, | |
int format); | |
XMLPUBFUN void XMLCALL | |
htmlNodeDumpOutput (xmlOutputBufferPtr buf, | |
xmlDocPtr doc, | |
xmlNodePtr cur, | |
const char *encoding); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
htmlIsBooleanAttr (const xmlChar *name); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_HTML_ENABLED */ | |
#endif /* __HTML_TREE_H__ */ | |
/* | |
* Summary: lists interfaces | |
* Description: this module implement the list support used in | |
* various place in the library. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Gary Pennington <Gary.Pennington@uk.sun.com> | |
*/ | |
#ifndef __XML_LINK_INCLUDE__ | |
#define __XML_LINK_INCLUDE__ | |
#include <libxml/xmlversion.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
typedef struct _xmlLink xmlLink; | |
typedef xmlLink *xmlLinkPtr; | |
typedef struct _xmlList xmlList; | |
typedef xmlList *xmlListPtr; | |
/** | |
* xmlListDeallocator: | |
* @lk: the data to deallocate | |
* | |
* Callback function used to free data from a list. | |
*/ | |
typedef void (*xmlListDeallocator) (xmlLinkPtr lk); | |
/** | |
* xmlListDataCompare: | |
* @data0: the first data | |
* @data1: the second data | |
* | |
* Callback function used to compare 2 data. | |
* | |
* Returns 0 is equality, -1 or 1 otherwise depending on the ordering. | |
*/ | |
typedef int (*xmlListDataCompare) (const void *data0, const void *data1); | |
/** | |
* xmlListWalker: | |
* @data: the data found in the list | |
* @user: extra user provided data to the walker | |
* | |
* Callback function used when walking a list with xmlListWalk(). | |
* | |
* Returns 0 to stop walking the list, 1 otherwise. | |
*/ | |
typedef int (*xmlListWalker) (const void *data, const void *user); | |
/* Creation/Deletion */ | |
XMLPUBFUN xmlListPtr XMLCALL | |
xmlListCreate (xmlListDeallocator deallocator, | |
xmlListDataCompare compare); | |
XMLPUBFUN void XMLCALL | |
xmlListDelete (xmlListPtr l); | |
/* Basic Operators */ | |
XMLPUBFUN void * XMLCALL | |
xmlListSearch (xmlListPtr l, | |
void *data); | |
XMLPUBFUN void * XMLCALL | |
xmlListReverseSearch (xmlListPtr l, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlListInsert (xmlListPtr l, | |
void *data) ; | |
XMLPUBFUN int XMLCALL | |
xmlListAppend (xmlListPtr l, | |
void *data) ; | |
XMLPUBFUN int XMLCALL | |
xmlListRemoveFirst (xmlListPtr l, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlListRemoveLast (xmlListPtr l, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlListRemoveAll (xmlListPtr l, | |
void *data); | |
XMLPUBFUN void XMLCALL | |
xmlListClear (xmlListPtr l); | |
XMLPUBFUN int XMLCALL | |
xmlListEmpty (xmlListPtr l); | |
XMLPUBFUN xmlLinkPtr XMLCALL | |
xmlListFront (xmlListPtr l); | |
XMLPUBFUN xmlLinkPtr XMLCALL | |
xmlListEnd (xmlListPtr l); | |
XMLPUBFUN int XMLCALL | |
xmlListSize (xmlListPtr l); | |
XMLPUBFUN void XMLCALL | |
xmlListPopFront (xmlListPtr l); | |
XMLPUBFUN void XMLCALL | |
xmlListPopBack (xmlListPtr l); | |
XMLPUBFUN int XMLCALL | |
xmlListPushFront (xmlListPtr l, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlListPushBack (xmlListPtr l, | |
void *data); | |
/* Advanced Operators */ | |
XMLPUBFUN void XMLCALL | |
xmlListReverse (xmlListPtr l); | |
XMLPUBFUN void XMLCALL | |
xmlListSort (xmlListPtr l); | |
XMLPUBFUN void XMLCALL | |
xmlListWalk (xmlListPtr l, | |
xmlListWalker walker, | |
const void *user); | |
XMLPUBFUN void XMLCALL | |
xmlListReverseWalk (xmlListPtr l, | |
xmlListWalker walker, | |
const void *user); | |
XMLPUBFUN void XMLCALL | |
xmlListMerge (xmlListPtr l1, | |
xmlListPtr l2); | |
XMLPUBFUN xmlListPtr XMLCALL | |
xmlListDup (const xmlListPtr old); | |
XMLPUBFUN int XMLCALL | |
xmlListCopy (xmlListPtr cur, | |
const xmlListPtr old); | |
/* Link operators */ | |
XMLPUBFUN void * XMLCALL | |
xmlLinkGetData (xmlLinkPtr lk); | |
/* xmlListUnique() */ | |
/* xmlListSwap */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_LINK_INCLUDE__ */ |
/* | |
* Summary: minimal FTP implementation | |
* Description: minimal FTP implementation allowing to fetch resources | |
* like external subset. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __NANO_FTP_H__ | |
#define __NANO_FTP_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_FTP_ENABLED | |
/* Needed for portability to Windows 64 bits */ | |
#if defined(__MINGW32__) || defined(_WIN32_WCE) | |
#include <winsock2.h> | |
#else | |
/** | |
* SOCKET: | |
* | |
* macro used to provide portability of code to windows sockets | |
*/ | |
#define SOCKET int | |
/** | |
* INVALID_SOCKET: | |
* | |
* macro used to provide portability of code to windows sockets | |
* the value to be used when the socket is not valid | |
*/ | |
#undef INVALID_SOCKET | |
#define INVALID_SOCKET (-1) | |
#endif | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* ftpListCallback: | |
* @userData: user provided data for the callback | |
* @filename: the file name (including "->" when links are shown) | |
* @attrib: the attribute string | |
* @owner: the owner string | |
* @group: the group string | |
* @size: the file size | |
* @links: the link count | |
* @year: the year | |
* @month: the month | |
* @day: the day | |
* @hour: the hour | |
* @minute: the minute | |
* | |
* A callback for the xmlNanoFTPList command. | |
* Note that only one of year and day:minute are specified. | |
*/ | |
typedef void (*ftpListCallback) (void *userData, | |
const char *filename, const char *attrib, | |
const char *owner, const char *group, | |
unsigned long size, int links, int year, | |
const char *month, int day, int hour, | |
int minute); | |
/** | |
* ftpDataCallback: | |
* @userData: the user provided context | |
* @data: the data received | |
* @len: its size in bytes | |
* | |
* A callback for the xmlNanoFTPGet command. | |
*/ | |
typedef void (*ftpDataCallback) (void *userData, | |
const char *data, | |
int len); | |
/* | |
* Init | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlNanoFTPInit (void); | |
XMLPUBFUN void XMLCALL | |
xmlNanoFTPCleanup (void); | |
/* | |
* Creating/freeing contexts. | |
*/ | |
XMLPUBFUN void * XMLCALL | |
xmlNanoFTPNewCtxt (const char *URL); | |
XMLPUBFUN void XMLCALL | |
xmlNanoFTPFreeCtxt (void * ctx); | |
XMLPUBFUN void * XMLCALL | |
xmlNanoFTPConnectTo (const char *server, | |
int port); | |
/* | |
* Opening/closing session connections. | |
*/ | |
XMLPUBFUN void * XMLCALL | |
xmlNanoFTPOpen (const char *URL); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPConnect (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPClose (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPQuit (void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlNanoFTPScanProxy (const char *URL); | |
XMLPUBFUN void XMLCALL | |
xmlNanoFTPProxy (const char *host, | |
int port, | |
const char *user, | |
const char *passwd, | |
int type); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPUpdateURL (void *ctx, | |
const char *URL); | |
/* | |
* Rather internal commands. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPGetResponse (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPCheckResponse (void *ctx); | |
/* | |
* CD/DIR/GET handlers. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPCwd (void *ctx, | |
const char *directory); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPDele (void *ctx, | |
const char *file); | |
XMLPUBFUN SOCKET XMLCALL | |
xmlNanoFTPGetConnection (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPCloseConnection(void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPList (void *ctx, | |
ftpListCallback callback, | |
void *userData, | |
const char *filename); | |
XMLPUBFUN SOCKET XMLCALL | |
xmlNanoFTPGetSocket (void *ctx, | |
const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPGet (void *ctx, | |
ftpDataCallback callback, | |
void *userData, | |
const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlNanoFTPRead (void *ctx, | |
void *dest, | |
int len); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_FTP_ENABLED */ | |
#endif /* __NANO_FTP_H__ */ |
/* | |
* Summary: minimal HTTP implementation | |
* Description: minimal HTTP implementation allowing to fetch resources | |
* like external subset. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __NANO_HTTP_H__ | |
#define __NANO_HTTP_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_HTTP_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XMLPUBFUN void XMLCALL | |
xmlNanoHTTPInit (void); | |
XMLPUBFUN void XMLCALL | |
xmlNanoHTTPCleanup (void); | |
XMLPUBFUN void XMLCALL | |
xmlNanoHTTPScanProxy (const char *URL); | |
XMLPUBFUN int XMLCALL | |
xmlNanoHTTPFetch (const char *URL, | |
const char *filename, | |
char **contentType); | |
XMLPUBFUN void * XMLCALL | |
xmlNanoHTTPMethod (const char *URL, | |
const char *method, | |
const char *input, | |
char **contentType, | |
const char *headers, | |
int ilen); | |
XMLPUBFUN void * XMLCALL | |
xmlNanoHTTPMethodRedir (const char *URL, | |
const char *method, | |
const char *input, | |
char **contentType, | |
char **redir, | |
const char *headers, | |
int ilen); | |
XMLPUBFUN void * XMLCALL | |
xmlNanoHTTPOpen (const char *URL, | |
char **contentType); | |
XMLPUBFUN void * XMLCALL | |
xmlNanoHTTPOpenRedir (const char *URL, | |
char **contentType, | |
char **redir); | |
XMLPUBFUN int XMLCALL | |
xmlNanoHTTPReturnCode (void *ctx); | |
XMLPUBFUN const char * XMLCALL | |
xmlNanoHTTPAuthHeader (void *ctx); | |
XMLPUBFUN const char * XMLCALL | |
xmlNanoHTTPRedir (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlNanoHTTPContentLength( void * ctx ); | |
XMLPUBFUN const char * XMLCALL | |
xmlNanoHTTPEncoding (void *ctx); | |
XMLPUBFUN const char * XMLCALL | |
xmlNanoHTTPMimeType (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlNanoHTTPRead (void *ctx, | |
void *dest, | |
int len); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlNanoHTTPSave (void *ctxt, | |
const char *filename); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlNanoHTTPClose (void *ctx); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_HTTP_ENABLED */ | |
#endif /* __NANO_HTTP_H__ */ |
/* | |
* Summary: the core parser module | |
* Description: Interfaces, constants and types related to the XML parser | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_PARSER_H__ | |
#define __XML_PARSER_H__ | |
#include <stdarg.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#include <libxml/dict.h> | |
#include <libxml/hash.h> | |
#include <libxml/valid.h> | |
#include <libxml/entities.h> | |
#include <libxml/xmlerror.h> | |
#include <libxml/xmlstring.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XML_DEFAULT_VERSION: | |
* | |
* The default version of XML used: 1.0 | |
*/ | |
#define XML_DEFAULT_VERSION "1.0" | |
/** | |
* xmlParserInput: | |
* | |
* An xmlParserInput is an input flow for the XML processor. | |
* Each entity parsed is associated an xmlParserInput (except the | |
* few predefined ones). This is the case both for internal entities | |
* - in which case the flow is already completely in memory - or | |
* external entities - in which case we use the buf structure for | |
* progressive reading and I18N conversions to the internal UTF-8 format. | |
*/ | |
/** | |
* xmlParserInputDeallocate: | |
* @str: the string to deallocate | |
* | |
* Callback for freeing some parser input allocations. | |
*/ | |
typedef void (* xmlParserInputDeallocate)(xmlChar *str); | |
struct _xmlParserInput { | |
/* Input buffer */ | |
xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ | |
const char *filename; /* The file analyzed, if any */ | |
const char *directory; /* the directory/base of the file */ | |
const xmlChar *base; /* Base of the array to parse */ | |
const xmlChar *cur; /* Current char being parsed */ | |
const xmlChar *end; /* end of the array to parse */ | |
int length; /* length if known */ | |
int line; /* Current line */ | |
int col; /* Current column */ | |
/* | |
* NOTE: consumed is only tested for equality in the parser code, | |
* so even if there is an overflow this should not give troubles | |
* for parsing very large instances. | |
*/ | |
unsigned long consumed; /* How many xmlChars already consumed */ | |
xmlParserInputDeallocate free; /* function to deallocate the base */ | |
const xmlChar *encoding; /* the encoding string for entity */ | |
const xmlChar *version; /* the version string for entity */ | |
int standalone; /* Was that entity marked standalone */ | |
int id; /* an unique identifier for the entity */ | |
}; | |
/** | |
* xmlParserNodeInfo: | |
* | |
* The parser can be asked to collect Node informations, i.e. at what | |
* place in the file they were detected. | |
* NOTE: This is off by default and not very well tested. | |
*/ | |
typedef struct _xmlParserNodeInfo xmlParserNodeInfo; | |
typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; | |
struct _xmlParserNodeInfo { | |
const struct _xmlNode* node; | |
/* Position & line # that text that created the node begins & ends on */ | |
unsigned long begin_pos; | |
unsigned long begin_line; | |
unsigned long end_pos; | |
unsigned long end_line; | |
}; | |
typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; | |
typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; | |
struct _xmlParserNodeInfoSeq { | |
unsigned long maximum; | |
unsigned long length; | |
xmlParserNodeInfo* buffer; | |
}; | |
/** | |
* xmlParserInputState: | |
* | |
* The parser is now working also as a state based parser. | |
* The recursive one use the state info for entities processing. | |
*/ | |
typedef enum { | |
XML_PARSER_EOF = -1, /* nothing is to be parsed */ | |
XML_PARSER_START = 0, /* nothing has been parsed */ | |
XML_PARSER_MISC, /* Misc* before int subset */ | |
XML_PARSER_PI, /* Within a processing instruction */ | |
XML_PARSER_DTD, /* within some DTD content */ | |
XML_PARSER_PROLOG, /* Misc* after internal subset */ | |
XML_PARSER_COMMENT, /* within a comment */ | |
XML_PARSER_START_TAG, /* within a start tag */ | |
XML_PARSER_CONTENT, /* within the content */ | |
XML_PARSER_CDATA_SECTION, /* within a CDATA section */ | |
XML_PARSER_END_TAG, /* within a closing tag */ | |
XML_PARSER_ENTITY_DECL, /* within an entity declaration */ | |
XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ | |
XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ | |
XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ | |
XML_PARSER_EPILOG, /* the Misc* after the last end tag */ | |
XML_PARSER_IGNORE, /* within an IGNORED section */ | |
XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ | |
} xmlParserInputState; | |
/** | |
* XML_DETECT_IDS: | |
* | |
* Bit in the loadsubset context field to tell to do ID/REFs lookups. | |
* Use it to initialize xmlLoadExtDtdDefaultValue. | |
*/ | |
#define XML_DETECT_IDS 2 | |
/** | |
* XML_COMPLETE_ATTRS: | |
* | |
* Bit in the loadsubset context field to tell to do complete the | |
* elements attributes lists with the ones defaulted from the DTDs. | |
* Use it to initialize xmlLoadExtDtdDefaultValue. | |
*/ | |
#define XML_COMPLETE_ATTRS 4 | |
/** | |
* XML_SKIP_IDS: | |
* | |
* Bit in the loadsubset context field to tell to not do ID/REFs registration. | |
* Used to initialize xmlLoadExtDtdDefaultValue in some special cases. | |
*/ | |
#define XML_SKIP_IDS 8 | |
/** | |
* xmlParserMode: | |
* | |
* A parser can operate in various modes | |
*/ | |
typedef enum { | |
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 | |
} xmlParserMode; | |
/** | |
* xmlParserCtxt: | |
* | |
* The parser context. | |
* NOTE This doesn't completely define the parser state, the (current ?) | |
* design of the parser uses recursive function calls since this allow | |
* and easy mapping from the production rules of the specification | |
* to the actual code. The drawback is that the actual function call | |
* also reflect the parser state. However most of the parsing routines | |
* takes as the only argument the parser context pointer, so migrating | |
* to a state based parser for progressive parsing shouldn't be too hard. | |
*/ | |
struct _xmlParserCtxt { | |
struct _xmlSAXHandler *sax; /* The SAX handler */ | |
void *userData; /* For SAX interface only, used by DOM build */ | |
xmlDocPtr myDoc; /* the document being built */ | |
int wellFormed; /* is the document well formed */ | |
int replaceEntities; /* shall we replace entities ? */ | |
const xmlChar *version; /* the XML version string */ | |
const xmlChar *encoding; /* the declared encoding, if any */ | |
int standalone; /* standalone document */ | |
int html; /* an HTML(1)/Docbook(2) document | |
* 3 is HTML after <head> | |
* 10 is HTML after <body> | |
*/ | |
/* Input stream stack */ | |
xmlParserInputPtr input; /* Current input stream */ | |
int inputNr; /* Number of current input streams */ | |
int inputMax; /* Max number of input streams */ | |
xmlParserInputPtr *inputTab; /* stack of inputs */ | |
/* Node analysis stack only used for DOM building */ | |
xmlNodePtr node; /* Current parsed Node */ | |
int nodeNr; /* Depth of the parsing stack */ | |
int nodeMax; /* Max depth of the parsing stack */ | |
xmlNodePtr *nodeTab; /* array of nodes */ | |
int record_info; /* Whether node info should be kept */ | |
xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ | |
int errNo; /* error code */ | |
int hasExternalSubset; /* reference and external subset */ | |
int hasPErefs; /* the internal subset has PE refs */ | |
int external; /* are we parsing an external entity */ | |
int valid; /* is the document valid */ | |
int validate; /* shall we try to validate ? */ | |
xmlValidCtxt vctxt; /* The validity context */ | |
xmlParserInputState instate; /* current type of input */ | |
int token; /* next char look-ahead */ | |
char *directory; /* the data directory */ | |
/* Node name stack */ | |
const xmlChar *name; /* Current parsed Node */ | |
int nameNr; /* Depth of the parsing stack */ | |
int nameMax; /* Max depth of the parsing stack */ | |
const xmlChar * *nameTab; /* array of nodes */ | |
long nbChars; /* number of xmlChar processed */ | |
long checkIndex; /* used by progressive parsing lookup */ | |
int keepBlanks; /* ugly but ... */ | |
int disableSAX; /* SAX callbacks are disabled */ | |
int inSubset; /* Parsing is in int 1/ext 2 subset */ | |
const xmlChar * intSubName; /* name of subset */ | |
xmlChar * extSubURI; /* URI of external subset */ | |
xmlChar * extSubSystem; /* SYSTEM ID of external subset */ | |
/* xml:space values */ | |
int * space; /* Should the parser preserve spaces */ | |
int spaceNr; /* Depth of the parsing stack */ | |
int spaceMax; /* Max depth of the parsing stack */ | |
int * spaceTab; /* array of space infos */ | |
int depth; /* to prevent entity substitution loops */ | |
xmlParserInputPtr entity; /* used to check entities boundaries */ | |
int charset; /* encoding of the in-memory content | |
actually an xmlCharEncoding */ | |
int nodelen; /* Those two fields are there to */ | |
int nodemem; /* Speed up large node parsing */ | |
int pedantic; /* signal pedantic warnings */ | |
void *_private; /* For user data, libxml won't touch it */ | |
int loadsubset; /* should the external subset be loaded */ | |
int linenumbers; /* set line number in element content */ | |
void *catalogs; /* document's own catalog */ | |
int recovery; /* run in recovery mode */ | |
int progressive; /* is this a progressive parsing */ | |
xmlDictPtr dict; /* dictionary for the parser */ | |
const xmlChar * *atts; /* array for the attributes callbacks */ | |
int maxatts; /* the size of the array */ | |
int docdict; /* use strings from dict to build tree */ | |
/* | |
* pre-interned strings | |
*/ | |
const xmlChar *str_xml; | |
const xmlChar *str_xmlns; | |
const xmlChar *str_xml_ns; | |
/* | |
* Everything below is used only by the new SAX mode | |
*/ | |
int sax2; /* operating in the new SAX mode */ | |
int nsNr; /* the number of inherited namespaces */ | |
int nsMax; /* the size of the arrays */ | |
const xmlChar * *nsTab; /* the array of prefix/namespace name */ | |
int *attallocs; /* which attribute were allocated */ | |
void * *pushTab; /* array of data for push */ | |
xmlHashTablePtr attsDefault; /* defaulted attributes if any */ | |
xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ | |
int nsWellFormed; /* is the document XML Nanespace okay */ | |
int options; /* Extra options */ | |
/* | |
* Those fields are needed only for treaming parsing so far | |
*/ | |
int dictNames; /* Use dictionary names for the tree */ | |
int freeElemsNr; /* number of freed element nodes */ | |
xmlNodePtr freeElems; /* List of freed element nodes */ | |
int freeAttrsNr; /* number of freed attributes nodes */ | |
xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ | |
/* | |
* the complete error informations for the last error. | |
*/ | |
xmlError lastError; | |
xmlParserMode parseMode; /* the parser mode */ | |
unsigned long nbentities; /* number of entities references */ | |
unsigned long sizeentities; /* size of parsed entities */ | |
/* for use by HTML non-recursive parser */ | |
xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ | |
int nodeInfoNr; /* Depth of the parsing stack */ | |
int nodeInfoMax; /* Max depth of the parsing stack */ | |
xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ | |
int input_id; /* we need to label inputs */ | |
unsigned long sizeentcopy; /* volume of entity copy */ | |
}; | |
/** | |
* xmlSAXLocator: | |
* | |
* A SAX Locator. | |
*/ | |
struct _xmlSAXLocator { | |
const xmlChar *(*getPublicId)(void *ctx); | |
const xmlChar *(*getSystemId)(void *ctx); | |
int (*getLineNumber)(void *ctx); | |
int (*getColumnNumber)(void *ctx); | |
}; | |
/** | |
* xmlSAXHandler: | |
* | |
* A SAX handler is bunch of callbacks called by the parser when processing | |
* of the input generate data or structure informations. | |
*/ | |
/** | |
* resolveEntitySAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @publicId: The public ID of the entity | |
* @systemId: The system ID of the entity | |
* | |
* Callback: | |
* The entity loader, to control the loading of external entities, | |
* the application can either: | |
* - override this resolveEntity() callback in the SAX block | |
* - or better use the xmlSetExternalEntityLoader() function to | |
* set up it's own entity resolution routine | |
* | |
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. | |
*/ | |
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, | |
const xmlChar *publicId, | |
const xmlChar *systemId); | |
/** | |
* internalSubsetSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: the root element name | |
* @ExternalID: the external ID | |
* @SystemID: the SYSTEM ID (e.g. filename or URL) | |
* | |
* Callback on internal subset declaration. | |
*/ | |
typedef void (*internalSubsetSAXFunc) (void *ctx, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
/** | |
* externalSubsetSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: the root element name | |
* @ExternalID: the external ID | |
* @SystemID: the SYSTEM ID (e.g. filename or URL) | |
* | |
* Callback on external subset declaration. | |
*/ | |
typedef void (*externalSubsetSAXFunc) (void *ctx, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
/** | |
* getEntitySAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The entity name | |
* | |
* Get an entity by name. | |
* | |
* Returns the xmlEntityPtr if found. | |
*/ | |
typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, | |
const xmlChar *name); | |
/** | |
* getParameterEntitySAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The entity name | |
* | |
* Get a parameter entity by name. | |
* | |
* Returns the xmlEntityPtr if found. | |
*/ | |
typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, | |
const xmlChar *name); | |
/** | |
* entityDeclSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: the entity name | |
* @type: the entity type | |
* @publicId: The public ID of the entity | |
* @systemId: The system ID of the entity | |
* @content: the entity value (without processing). | |
* | |
* An entity definition has been parsed. | |
*/ | |
typedef void (*entityDeclSAXFunc) (void *ctx, | |
const xmlChar *name, | |
int type, | |
const xmlChar *publicId, | |
const xmlChar *systemId, | |
xmlChar *content); | |
/** | |
* notationDeclSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The name of the notation | |
* @publicId: The public ID of the entity | |
* @systemId: The system ID of the entity | |
* | |
* What to do when a notation declaration has been parsed. | |
*/ | |
typedef void (*notationDeclSAXFunc)(void *ctx, | |
const xmlChar *name, | |
const xmlChar *publicId, | |
const xmlChar *systemId); | |
/** | |
* attributeDeclSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @elem: the name of the element | |
* @fullname: the attribute name | |
* @type: the attribute type | |
* @def: the type of default value | |
* @defaultValue: the attribute default value | |
* @tree: the tree of enumerated value set | |
* | |
* An attribute definition has been parsed. | |
*/ | |
typedef void (*attributeDeclSAXFunc)(void *ctx, | |
const xmlChar *elem, | |
const xmlChar *fullname, | |
int type, | |
int def, | |
const xmlChar *defaultValue, | |
xmlEnumerationPtr tree); | |
/** | |
* elementDeclSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: the element name | |
* @type: the element type | |
* @content: the element value tree | |
* | |
* An element definition has been parsed. | |
*/ | |
typedef void (*elementDeclSAXFunc)(void *ctx, | |
const xmlChar *name, | |
int type, | |
xmlElementContentPtr content); | |
/** | |
* unparsedEntityDeclSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The name of the entity | |
* @publicId: The public ID of the entity | |
* @systemId: The system ID of the entity | |
* @notationName: the name of the notation | |
* | |
* What to do when an unparsed entity declaration is parsed. | |
*/ | |
typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, | |
const xmlChar *name, | |
const xmlChar *publicId, | |
const xmlChar *systemId, | |
const xmlChar *notationName); | |
/** | |
* setDocumentLocatorSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @loc: A SAX Locator | |
* | |
* Receive the document locator at startup, actually xmlDefaultSAXLocator. | |
* Everything is available on the context, so this is useless in our case. | |
*/ | |
typedef void (*setDocumentLocatorSAXFunc) (void *ctx, | |
xmlSAXLocatorPtr loc); | |
/** | |
* startDocumentSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* | |
* Called when the document start being processed. | |
*/ | |
typedef void (*startDocumentSAXFunc) (void *ctx); | |
/** | |
* endDocumentSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* | |
* Called when the document end has been detected. | |
*/ | |
typedef void (*endDocumentSAXFunc) (void *ctx); | |
/** | |
* startElementSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The element name, including namespace prefix | |
* @atts: An array of name/value attributes pairs, NULL terminated | |
* | |
* Called when an opening tag has been processed. | |
*/ | |
typedef void (*startElementSAXFunc) (void *ctx, | |
const xmlChar *name, | |
const xmlChar **atts); | |
/** | |
* endElementSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The element name | |
* | |
* Called when the end of an element has been detected. | |
*/ | |
typedef void (*endElementSAXFunc) (void *ctx, | |
const xmlChar *name); | |
/** | |
* attributeSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The attribute name, including namespace prefix | |
* @value: The attribute value | |
* | |
* Handle an attribute that has been read by the parser. | |
* The default handling is to convert the attribute into an | |
* DOM subtree and past it in a new xmlAttr element added to | |
* the element. | |
*/ | |
typedef void (*attributeSAXFunc) (void *ctx, | |
const xmlChar *name, | |
const xmlChar *value); | |
/** | |
* referenceSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @name: The entity name | |
* | |
* Called when an entity reference is detected. | |
*/ | |
typedef void (*referenceSAXFunc) (void *ctx, | |
const xmlChar *name); | |
/** | |
* charactersSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @ch: a xmlChar string | |
* @len: the number of xmlChar | |
* | |
* Receiving some chars from the parser. | |
*/ | |
typedef void (*charactersSAXFunc) (void *ctx, | |
const xmlChar *ch, | |
int len); | |
/** | |
* ignorableWhitespaceSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @ch: a xmlChar string | |
* @len: the number of xmlChar | |
* | |
* Receiving some ignorable whitespaces from the parser. | |
* UNUSED: by default the DOM building will use characters. | |
*/ | |
typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, | |
const xmlChar *ch, | |
int len); | |
/** | |
* processingInstructionSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @target: the target name | |
* @data: the PI data's | |
* | |
* A processing instruction has been parsed. | |
*/ | |
typedef void (*processingInstructionSAXFunc) (void *ctx, | |
const xmlChar *target, | |
const xmlChar *data); | |
/** | |
* commentSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @value: the comment content | |
* | |
* A comment has been parsed. | |
*/ | |
typedef void (*commentSAXFunc) (void *ctx, | |
const xmlChar *value); | |
/** | |
* cdataBlockSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* @value: The pcdata content | |
* @len: the block length | |
* | |
* Called when a pcdata block has been parsed. | |
*/ | |
typedef void (*cdataBlockSAXFunc) ( | |
void *ctx, | |
const xmlChar *value, | |
int len); | |
/** | |
* warningSAXFunc: | |
* @ctx: an XML parser context | |
* @msg: the message to display/transmit | |
* @...: extra parameters for the message display | |
* | |
* Display and format a warning messages, callback. | |
*/ | |
typedef void (XMLCDECL *warningSAXFunc) (void *ctx, | |
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* errorSAXFunc: | |
* @ctx: an XML parser context | |
* @msg: the message to display/transmit | |
* @...: extra parameters for the message display | |
* | |
* Display and format an error messages, callback. | |
*/ | |
typedef void (XMLCDECL *errorSAXFunc) (void *ctx, | |
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* fatalErrorSAXFunc: | |
* @ctx: an XML parser context | |
* @msg: the message to display/transmit | |
* @...: extra parameters for the message display | |
* | |
* Display and format fatal error messages, callback. | |
* Note: so far fatalError() SAX callbacks are not used, error() | |
* get all the callbacks for errors. | |
*/ | |
typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, | |
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* isStandaloneSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* | |
* Is this document tagged standalone? | |
* | |
* Returns 1 if true | |
*/ | |
typedef int (*isStandaloneSAXFunc) (void *ctx); | |
/** | |
* hasInternalSubsetSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* | |
* Does this document has an internal subset. | |
* | |
* Returns 1 if true | |
*/ | |
typedef int (*hasInternalSubsetSAXFunc) (void *ctx); | |
/** | |
* hasExternalSubsetSAXFunc: | |
* @ctx: the user data (XML parser context) | |
* | |
* Does this document has an external subset? | |
* | |
* Returns 1 if true | |
*/ | |
typedef int (*hasExternalSubsetSAXFunc) (void *ctx); | |
/************************************************************************ | |
* * | |
* The SAX version 2 API extensions * | |
* * | |
************************************************************************/ | |
/** | |
* XML_SAX2_MAGIC: | |
* | |
* Special constant found in SAX2 blocks initialized fields | |
*/ | |
#define XML_SAX2_MAGIC 0xDEEDBEAF | |
/** | |
* startElementNsSAX2Func: | |
* @ctx: the user data (XML parser context) | |
* @localname: the local name of the element | |
* @prefix: the element namespace prefix if available | |
* @URI: the element namespace name if available | |
* @nb_namespaces: number of namespace definitions on that node | |
* @namespaces: pointer to the array of prefix/URI pairs namespace definitions | |
* @nb_attributes: the number of attributes on that node | |
* @nb_defaulted: the number of defaulted attributes. The defaulted | |
* ones are at the end of the array | |
* @attributes: pointer to the array of (localname/prefix/URI/value/end) | |
* attribute values. | |
* | |
* SAX2 callback when an element start has been detected by the parser. | |
* It provides the namespace informations for the element, as well as | |
* the new namespace declarations on the element. | |
*/ | |
typedef void (*startElementNsSAX2Func) (void *ctx, | |
const xmlChar *localname, | |
const xmlChar *prefix, | |
const xmlChar *URI, | |
int nb_namespaces, | |
const xmlChar **namespaces, | |
int nb_attributes, | |
int nb_defaulted, | |
const xmlChar **attributes); | |
/** | |
* endElementNsSAX2Func: | |
* @ctx: the user data (XML parser context) | |
* @localname: the local name of the element | |
* @prefix: the element namespace prefix if available | |
* @URI: the element namespace name if available | |
* | |
* SAX2 callback when an element end has been detected by the parser. | |
* It provides the namespace informations for the element. | |
*/ | |
typedef void (*endElementNsSAX2Func) (void *ctx, | |
const xmlChar *localname, | |
const xmlChar *prefix, | |
const xmlChar *URI); | |
struct _xmlSAXHandler { | |
internalSubsetSAXFunc internalSubset; | |
isStandaloneSAXFunc isStandalone; | |
hasInternalSubsetSAXFunc hasInternalSubset; | |
hasExternalSubsetSAXFunc hasExternalSubset; | |
resolveEntitySAXFunc resolveEntity; | |
getEntitySAXFunc getEntity; | |
entityDeclSAXFunc entityDecl; | |
notationDeclSAXFunc notationDecl; | |
attributeDeclSAXFunc attributeDecl; | |
elementDeclSAXFunc elementDecl; | |
unparsedEntityDeclSAXFunc unparsedEntityDecl; | |
setDocumentLocatorSAXFunc setDocumentLocator; | |
startDocumentSAXFunc startDocument; | |
endDocumentSAXFunc endDocument; | |
startElementSAXFunc startElement; | |
endElementSAXFunc endElement; | |
referenceSAXFunc reference; | |
charactersSAXFunc characters; | |
ignorableWhitespaceSAXFunc ignorableWhitespace; | |
processingInstructionSAXFunc processingInstruction; | |
commentSAXFunc comment; | |
warningSAXFunc warning; | |
errorSAXFunc error; | |
fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ | |
getParameterEntitySAXFunc getParameterEntity; | |
cdataBlockSAXFunc cdataBlock; | |
externalSubsetSAXFunc externalSubset; | |
unsigned int initialized; | |
/* The following fields are extensions available only on version 2 */ | |
void *_private; | |
startElementNsSAX2Func startElementNs; | |
endElementNsSAX2Func endElementNs; | |
xmlStructuredErrorFunc serror; | |
}; | |
/* | |
* SAX Version 1 | |
*/ | |
typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; | |
typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; | |
struct _xmlSAXHandlerV1 { | |
internalSubsetSAXFunc internalSubset; | |
isStandaloneSAXFunc isStandalone; | |
hasInternalSubsetSAXFunc hasInternalSubset; | |
hasExternalSubsetSAXFunc hasExternalSubset; | |
resolveEntitySAXFunc resolveEntity; | |
getEntitySAXFunc getEntity; | |
entityDeclSAXFunc entityDecl; | |
notationDeclSAXFunc notationDecl; | |
attributeDeclSAXFunc attributeDecl; | |
elementDeclSAXFunc elementDecl; | |
unparsedEntityDeclSAXFunc unparsedEntityDecl; | |
setDocumentLocatorSAXFunc setDocumentLocator; | |
startDocumentSAXFunc startDocument; | |
endDocumentSAXFunc endDocument; | |
startElementSAXFunc startElement; | |
endElementSAXFunc endElement; | |
referenceSAXFunc reference; | |
charactersSAXFunc characters; | |
ignorableWhitespaceSAXFunc ignorableWhitespace; | |
processingInstructionSAXFunc processingInstruction; | |
commentSAXFunc comment; | |
warningSAXFunc warning; | |
errorSAXFunc error; | |
fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ | |
getParameterEntitySAXFunc getParameterEntity; | |
cdataBlockSAXFunc cdataBlock; | |
externalSubsetSAXFunc externalSubset; | |
unsigned int initialized; | |
}; | |
/** | |
* xmlExternalEntityLoader: | |
* @URL: The System ID of the resource requested | |
* @ID: The Public ID of the resource requested | |
* @context: the XML parser context | |
* | |
* External entity loaders types. | |
* | |
* Returns the entity input parser. | |
*/ | |
typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, | |
const char *ID, | |
xmlParserCtxtPtr context); | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/encoding.h> | |
#include <libxml/xmlIO.h> | |
#include <libxml/globals.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Init/Cleanup | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlInitParser (void); | |
XMLPUBFUN void XMLCALL | |
xmlCleanupParser (void); | |
/* | |
* Input functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlParserInputRead (xmlParserInputPtr in, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlParserInputGrow (xmlParserInputPtr in, | |
int len); | |
/* | |
* Basic parsing Interfaces | |
*/ | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlParseDoc (const xmlChar *cur); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlParseFile (const char *filename); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlParseMemory (const char *buffer, | |
int size); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
xmlSubstituteEntitiesDefault(int val); | |
XMLPUBFUN int XMLCALL | |
xmlKeepBlanksDefault (int val); | |
XMLPUBFUN void XMLCALL | |
xmlStopParser (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlPedanticParserDefault(int val); | |
XMLPUBFUN int XMLCALL | |
xmlLineNumbersDefault (int val); | |
#ifdef LIBXML_SAX1_ENABLED | |
/* | |
* Recovery mode | |
*/ | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlRecoverDoc (const xmlChar *cur); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlRecoverMemory (const char *buffer, | |
int size); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlRecoverFile (const char *filename); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
/* | |
* Less common routines and SAX interfaces | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlParseDocument (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlSAXUserParseFile (xmlSAXHandlerPtr sax, | |
void *user_data, | |
const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, | |
void *user_data, | |
const char *buffer, | |
int size); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlSAXParseDoc (xmlSAXHandlerPtr sax, | |
const xmlChar *cur, | |
int recovery); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlSAXParseMemory (xmlSAXHandlerPtr sax, | |
const char *buffer, | |
int size, | |
int recovery); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, | |
const char *buffer, | |
int size, | |
int recovery, | |
void *data); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlSAXParseFile (xmlSAXHandlerPtr sax, | |
const char *filename, | |
int recovery); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, | |
const char *filename, | |
int recovery, | |
void *data); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlSAXParseEntity (xmlSAXHandlerPtr sax, | |
const char *filename); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlParseEntity (const char *filename); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
#ifdef LIBXML_VALID_ENABLED | |
XMLPUBFUN xmlDtdPtr XMLCALL | |
xmlSAXParseDTD (xmlSAXHandlerPtr sax, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN xmlDtdPtr XMLCALL | |
xmlParseDTD (const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN xmlDtdPtr XMLCALL | |
xmlIOParseDTD (xmlSAXHandlerPtr sax, | |
xmlParserInputBufferPtr input, | |
xmlCharEncoding enc); | |
#endif /* LIBXML_VALID_ENABLE */ | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlParseBalancedChunkMemory(xmlDocPtr doc, | |
xmlSAXHandlerPtr sax, | |
void *user_data, | |
int depth, | |
const xmlChar *string, | |
xmlNodePtr *lst); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
XMLPUBFUN xmlParserErrors XMLCALL | |
xmlParseInNodeContext (xmlNodePtr node, | |
const char *data, | |
int datalen, | |
int options, | |
xmlNodePtr *lst); | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, | |
xmlSAXHandlerPtr sax, | |
void *user_data, | |
int depth, | |
const xmlChar *string, | |
xmlNodePtr *lst, | |
int recover); | |
XMLPUBFUN int XMLCALL | |
xmlParseExternalEntity (xmlDocPtr doc, | |
xmlSAXHandlerPtr sax, | |
void *user_data, | |
int depth, | |
const xmlChar *URL, | |
const xmlChar *ID, | |
xmlNodePtr *lst); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, | |
const xmlChar *URL, | |
const xmlChar *ID, | |
xmlNodePtr *lst); | |
/* | |
* Parser contexts handling. | |
*/ | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlNewParserCtxt (void); | |
XMLPUBFUN int XMLCALL | |
xmlInitParserCtxt (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlClearParserCtxt (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, | |
const xmlChar* buffer, | |
const char *filename); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlCreateDocParserCtxt (const xmlChar *cur); | |
#ifdef LIBXML_LEGACY_ENABLED | |
/* | |
* Reading/setting optional parsing features. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlGetFeaturesList (int *len, | |
const char **result); | |
XMLPUBFUN int XMLCALL | |
xmlGetFeature (xmlParserCtxtPtr ctxt, | |
const char *name, | |
void *result); | |
XMLPUBFUN int XMLCALL | |
xmlSetFeature (xmlParserCtxtPtr ctxt, | |
const char *name, | |
void *value); | |
#endif /* LIBXML_LEGACY_ENABLED */ | |
#ifdef LIBXML_PUSH_ENABLED | |
/* | |
* Interfaces for the Push mode. | |
*/ | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, | |
void *user_data, | |
const char *chunk, | |
int size, | |
const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlParseChunk (xmlParserCtxtPtr ctxt, | |
const char *chunk, | |
int size, | |
int terminate); | |
#endif /* LIBXML_PUSH_ENABLED */ | |
/* | |
* Special I/O mode. | |
*/ | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, | |
void *user_data, | |
xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
xmlCharEncoding enc); | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlNewIOInputStream (xmlParserCtxtPtr ctxt, | |
xmlParserInputBufferPtr input, | |
xmlCharEncoding enc); | |
/* | |
* Node infos. | |
*/ | |
XMLPUBFUN const xmlParserNodeInfo* XMLCALL | |
xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, | |
const xmlNodePtr node); | |
XMLPUBFUN void XMLCALL | |
xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); | |
XMLPUBFUN void XMLCALL | |
xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); | |
XMLPUBFUN unsigned long XMLCALL | |
xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, | |
const xmlNodePtr node); | |
XMLPUBFUN void XMLCALL | |
xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, | |
const xmlParserNodeInfoPtr info); | |
/* | |
* External entities handling actually implemented in xmlIO. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlSetExternalEntityLoader(xmlExternalEntityLoader f); | |
XMLPUBFUN xmlExternalEntityLoader XMLCALL | |
xmlGetExternalEntityLoader(void); | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlLoadExternalEntity (const char *URL, | |
const char *ID, | |
xmlParserCtxtPtr ctxt); | |
/* | |
* Index lookup, actually implemented in the encoding module | |
*/ | |
XMLPUBFUN long XMLCALL | |
xmlByteConsumed (xmlParserCtxtPtr ctxt); | |
/* | |
* New set of simpler/more flexible APIs | |
*/ | |
/** | |
* xmlParserOption: | |
* | |
* This is the set of XML parser options that can be passed down | |
* to the xmlReadDoc() and similar calls. | |
*/ | |
typedef enum { | |
XML_PARSE_RECOVER = 1<<0, /* recover on errors */ | |
XML_PARSE_NOENT = 1<<1, /* substitute entities */ | |
XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ | |
XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ | |
XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ | |
XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ | |
XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ | |
XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ | |
XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ | |
XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ | |
XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ | |
XML_PARSE_NONET = 1<<11,/* Forbid network access */ | |
XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */ | |
XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ | |
XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ | |
XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ | |
XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of | |
the tree allowed afterwards (will possibly | |
crash if you try to modify the tree) */ | |
XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ | |
XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ | |
XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ | |
XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ | |
XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */ | |
XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */ | |
} xmlParserOption; | |
XMLPUBFUN void XMLCALL | |
xmlCtxtReset (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlCtxtResetPush (xmlParserCtxtPtr ctxt, | |
const char *chunk, | |
int size, | |
const char *filename, | |
const char *encoding); | |
XMLPUBFUN int XMLCALL | |
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlReadDoc (const xmlChar *cur, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlReadFile (const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlReadMemory (const char *buffer, | |
int size, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlReadFd (int fd, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlReadIO (xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, | |
const xmlChar *cur, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlCtxtReadFile (xmlParserCtxtPtr ctxt, | |
const char *filename, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, | |
const char *buffer, | |
int size, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlCtxtReadFd (xmlParserCtxtPtr ctxt, | |
int fd, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlCtxtReadIO (xmlParserCtxtPtr ctxt, | |
xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
const char *URL, | |
const char *encoding, | |
int options); | |
/* | |
* Library wide options | |
*/ | |
/** | |
* xmlFeature: | |
* | |
* Used to examine the existance of features that can be enabled | |
* or disabled at compile-time. | |
* They used to be called XML_FEATURE_xxx but this clashed with Expat | |
*/ | |
typedef enum { | |
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 /* just to be sure of allocation size */ | |
} xmlFeature; | |
XMLPUBFUN int XMLCALL | |
xmlHasFeature (xmlFeature feature); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_PARSER_H__ */ |
/* | |
* Summary: internals routines and limits exported by the parser. | |
* Description: this module exports a number of internal parsing routines | |
* they are not really all intended for applications but | |
* can prove useful doing low level processing. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_PARSER_INTERNALS_H__ | |
#define __XML_PARSER_INTERNALS_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/parser.h> | |
#include <libxml/HTMLparser.h> | |
#include <libxml/chvalid.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlParserMaxDepth: | |
* | |
* arbitrary depth limit for the XML documents that we allow to | |
* process. This is not a limitation of the parser but a safety | |
* boundary feature, use XML_PARSE_HUGE option to override it. | |
*/ | |
XMLPUBVAR unsigned int xmlParserMaxDepth; | |
/** | |
* XML_MAX_TEXT_LENGTH: | |
* | |
* Maximum size allowed for a single text node when building a tree. | |
* This is not a limitation of the parser but a safety boundary feature, | |
* use XML_PARSE_HUGE option to override it. | |
* Introduced in 2.9.0 | |
*/ | |
#define XML_MAX_TEXT_LENGTH 10000000 | |
/** | |
* XML_MAX_NAME_LENGTH: | |
* | |
* Maximum size allowed for a markup identitier | |
* This is not a limitation of the parser but a safety boundary feature, | |
* use XML_PARSE_HUGE option to override it. | |
* Note that with the use of parsing dictionaries overriding the limit | |
* may result in more runtime memory usage in face of "unfriendly' content | |
* Introduced in 2.9.0 | |
*/ | |
#define XML_MAX_NAME_LENGTH 50000 | |
/** | |
* XML_MAX_DICTIONARY_LIMIT: | |
* | |
* Maximum size allowed by the parser for a dictionary by default | |
* This is not a limitation of the parser but a safety boundary feature, | |
* use XML_PARSE_HUGE option to override it. | |
* Introduced in 2.9.0 | |
*/ | |
#define XML_MAX_DICTIONARY_LIMIT 10000000 | |
/** | |
* XML_MAX_LOOKUP_LIMIT: | |
* | |
* Maximum size allowed by the parser for ahead lookup | |
* This is an upper boundary enforced by the parser to avoid bad | |
* behaviour on "unfriendly' content | |
* Introduced in 2.9.0 | |
*/ | |
#define XML_MAX_LOOKUP_LIMIT 10000000 | |
/** | |
* XML_MAX_NAMELEN: | |
* | |
* Identifiers can be longer, but this will be more costly | |
* at runtime. | |
*/ | |
#define XML_MAX_NAMELEN 100 | |
/** | |
* INPUT_CHUNK: | |
* | |
* The parser tries to always have that amount of input ready. | |
* One of the point is providing context when reporting errors. | |
*/ | |
#define INPUT_CHUNK 250 | |
/************************************************************************ | |
* * | |
* UNICODE version of the macros. * | |
* * | |
************************************************************************/ | |
/** | |
* IS_BYTE_CHAR: | |
* @c: an byte value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* [2] Char ::= #x9 | #xA | #xD | [#x20...] | |
* any byte character in the accepted range | |
*/ | |
#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) | |
/** | |
* IS_CHAR: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | |
* | [#x10000-#x10FFFF] | |
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. | |
*/ | |
#define IS_CHAR(c) xmlIsCharQ(c) | |
/** | |
* IS_CHAR_CH: | |
* @c: an xmlChar (usually an unsigned char) | |
* | |
* Behaves like IS_CHAR on single-byte value | |
*/ | |
#define IS_CHAR_CH(c) xmlIsChar_ch(c) | |
/** | |
* IS_BLANK: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* [3] S ::= (#x20 | #x9 | #xD | #xA)+ | |
*/ | |
#define IS_BLANK(c) xmlIsBlankQ(c) | |
/** | |
* IS_BLANK_CH: | |
* @c: an xmlChar value (normally unsigned char) | |
* | |
* Behaviour same as IS_BLANK | |
*/ | |
#define IS_BLANK_CH(c) xmlIsBlank_ch(c) | |
/** | |
* IS_BASECHAR: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* [85] BaseChar ::= ... long list see REC ... | |
*/ | |
#define IS_BASECHAR(c) xmlIsBaseCharQ(c) | |
/** | |
* IS_DIGIT: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* [88] Digit ::= ... long list see REC ... | |
*/ | |
#define IS_DIGIT(c) xmlIsDigitQ(c) | |
/** | |
* IS_DIGIT_CH: | |
* @c: an xmlChar value (usually an unsigned char) | |
* | |
* Behaves like IS_DIGIT but with a single byte argument | |
*/ | |
#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) | |
/** | |
* IS_COMBINING: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* [87] CombiningChar ::= ... long list see REC ... | |
*/ | |
#define IS_COMBINING(c) xmlIsCombiningQ(c) | |
/** | |
* IS_COMBINING_CH: | |
* @c: an xmlChar (usually an unsigned char) | |
* | |
* Always false (all combining chars > 0xff) | |
*/ | |
#define IS_COMBINING_CH(c) 0 | |
/** | |
* IS_EXTENDER: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* | |
* [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | | |
* #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | | |
* [#x309D-#x309E] | [#x30FC-#x30FE] | |
*/ | |
#define IS_EXTENDER(c) xmlIsExtenderQ(c) | |
/** | |
* IS_EXTENDER_CH: | |
* @c: an xmlChar value (usually an unsigned char) | |
* | |
* Behaves like IS_EXTENDER but with a single-byte argument | |
*/ | |
#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) | |
/** | |
* IS_IDEOGRAPHIC: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* | |
* [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] | |
*/ | |
#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) | |
/** | |
* IS_LETTER: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* | |
* [84] Letter ::= BaseChar | Ideographic | |
*/ | |
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) | |
/** | |
* IS_LETTER_CH: | |
* @c: an xmlChar value (normally unsigned char) | |
* | |
* Macro behaves like IS_LETTER, but only check base chars | |
* | |
*/ | |
#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) | |
/** | |
* IS_ASCII_LETTER: | |
* @c: an xmlChar value | |
* | |
* Macro to check [a-zA-Z] | |
* | |
*/ | |
#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ | |
((0x61 <= (c)) && ((c) <= 0x7a))) | |
/** | |
* IS_ASCII_DIGIT: | |
* @c: an xmlChar value | |
* | |
* Macro to check [0-9] | |
* | |
*/ | |
#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) | |
/** | |
* IS_PUBIDCHAR: | |
* @c: an UNICODE value (int) | |
* | |
* Macro to check the following production in the XML spec: | |
* | |
* | |
* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] | |
*/ | |
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) | |
/** | |
* IS_PUBIDCHAR_CH: | |
* @c: an xmlChar value (normally unsigned char) | |
* | |
* Same as IS_PUBIDCHAR but for single-byte value | |
*/ | |
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) | |
/** | |
* SKIP_EOL: | |
* @p: and UTF8 string pointer | |
* | |
* Skips the end of line chars. | |
*/ | |
#define SKIP_EOL(p) \ | |
if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ | |
if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } | |
/** | |
* MOVETO_ENDTAG: | |
* @p: and UTF8 string pointer | |
* | |
* Skips to the next '>' char. | |
*/ | |
#define MOVETO_ENDTAG(p) \ | |
while ((*p) && (*(p) != '>')) (p)++ | |
/** | |
* MOVETO_STARTTAG: | |
* @p: and UTF8 string pointer | |
* | |
* Skips to the next '<' char. | |
*/ | |
#define MOVETO_STARTTAG(p) \ | |
while ((*p) && (*(p) != '<')) (p)++ | |
/** | |
* Global variables used for predefined strings. | |
*/ | |
XMLPUBVAR const xmlChar xmlStringText[]; | |
XMLPUBVAR const xmlChar xmlStringTextNoenc[]; | |
XMLPUBVAR const xmlChar xmlStringComment[]; | |
/* | |
* Function to finish the work of the macros where needed. | |
*/ | |
XMLPUBFUN int XMLCALL xmlIsLetter (int c); | |
/** | |
* Parser context. | |
*/ | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlCreateFileParserCtxt (const char *filename); | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlCreateURLParserCtxt (const char *filename, | |
int options); | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlCreateMemoryParserCtxt(const char *buffer, | |
int size); | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlCreateEntityParserCtxt(const xmlChar *URL, | |
const xmlChar *ID, | |
const xmlChar *base); | |
XMLPUBFUN int XMLCALL | |
xmlSwitchEncoding (xmlParserCtxtPtr ctxt, | |
xmlCharEncoding enc); | |
XMLPUBFUN int XMLCALL | |
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, | |
xmlCharEncodingHandlerPtr handler); | |
XMLPUBFUN int XMLCALL | |
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, | |
xmlParserInputPtr input, | |
xmlCharEncodingHandlerPtr handler); | |
#ifdef IN_LIBXML | |
/* internal error reporting */ | |
XMLPUBFUN void XMLCALL | |
__xmlErrEncoding (xmlParserCtxtPtr ctxt, | |
xmlParserErrors xmlerr, | |
const char *msg, | |
const xmlChar * str1, | |
const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0); | |
#endif | |
/** | |
* Input Streams. | |
*/ | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlNewStringInputStream (xmlParserCtxtPtr ctxt, | |
const xmlChar *buffer); | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, | |
xmlEntityPtr entity); | |
XMLPUBFUN int XMLCALL | |
xmlPushInput (xmlParserCtxtPtr ctxt, | |
xmlParserInputPtr input); | |
XMLPUBFUN xmlChar XMLCALL | |
xmlPopInput (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlFreeInputStream (xmlParserInputPtr input); | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlNewInputFromFile (xmlParserCtxtPtr ctxt, | |
const char *filename); | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlNewInputStream (xmlParserCtxtPtr ctxt); | |
/** | |
* Namespaces. | |
*/ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlSplitQName (xmlParserCtxtPtr ctxt, | |
const xmlChar *name, | |
xmlChar **prefix); | |
/** | |
* Generic production rules. | |
*/ | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlParseName (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseNmtoken (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseEntityValue (xmlParserCtxtPtr ctxt, | |
xmlChar **orig); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseAttValue (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseCharData (xmlParserCtxtPtr ctxt, | |
int cdata); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseExternalID (xmlParserCtxtPtr ctxt, | |
xmlChar **publicID, | |
int strict); | |
XMLPUBFUN void XMLCALL | |
xmlParseComment (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlParsePITarget (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParsePI (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseNotationDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseEntityDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, | |
xmlChar **value); | |
XMLPUBFUN xmlEnumerationPtr XMLCALL | |
xmlParseNotationType (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlEnumerationPtr XMLCALL | |
xmlParseEnumerationType (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, | |
xmlEnumerationPtr *tree); | |
XMLPUBFUN int XMLCALL | |
xmlParseAttributeType (xmlParserCtxtPtr ctxt, | |
xmlEnumerationPtr *tree); | |
XMLPUBFUN void XMLCALL | |
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlElementContentPtr XMLCALL | |
xmlParseElementMixedContentDecl | |
(xmlParserCtxtPtr ctxt, | |
int inputchk); | |
XMLPUBFUN xmlElementContentPtr XMLCALL | |
xmlParseElementChildrenContentDecl | |
(xmlParserCtxtPtr ctxt, | |
int inputchk); | |
XMLPUBFUN int XMLCALL | |
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, | |
const xmlChar *name, | |
xmlElementContentPtr *result); | |
XMLPUBFUN int XMLCALL | |
xmlParseElementDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlParseCharRef (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlParseEntityRef (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseReference (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParsePEReference (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlParseAttribute (xmlParserCtxtPtr ctxt, | |
xmlChar **value); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlParseStartTag (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseEndTag (xmlParserCtxtPtr ctxt); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlParseCDSect (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseContent (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseElement (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseVersionNum (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseVersionInfo (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseEncName (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlParseSDDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseXMLDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseTextDecl (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseMisc (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseExternalSubset (xmlParserCtxtPtr ctxt, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
/** | |
* XML_SUBSTITUTE_NONE: | |
* | |
* If no entities need to be substituted. | |
*/ | |
#define XML_SUBSTITUTE_NONE 0 | |
/** | |
* XML_SUBSTITUTE_REF: | |
* | |
* Whether general entities need to be substituted. | |
*/ | |
#define XML_SUBSTITUTE_REF 1 | |
/** | |
* XML_SUBSTITUTE_PEREF: | |
* | |
* Whether parameter entities need to be substituted. | |
*/ | |
#define XML_SUBSTITUTE_PEREF 2 | |
/** | |
* XML_SUBSTITUTE_BOTH: | |
* | |
* Both general and parameter entities need to be substituted. | |
*/ | |
#define XML_SUBSTITUTE_BOTH 3 | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, | |
const xmlChar *str, | |
int what, | |
xmlChar end, | |
xmlChar end2, | |
xmlChar end3); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, | |
const xmlChar *str, | |
int len, | |
int what, | |
xmlChar end, | |
xmlChar end2, | |
xmlChar end3); | |
/* | |
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. | |
*/ | |
XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, | |
xmlNodePtr value); | |
XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, | |
xmlParserInputPtr value); | |
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, | |
const xmlChar *value); | |
/* | |
* other commodities shared between parser.c and parserInternals. | |
*/ | |
XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, | |
const xmlChar *cur, | |
int *len); | |
XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); | |
/* | |
* Really core function shared with HTML parser. | |
*/ | |
XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, | |
int *len); | |
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, | |
int val); | |
XMLPUBFUN int XMLCALL xmlCopyChar (int len, | |
xmlChar *out, | |
int val); | |
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); | |
#ifdef LIBXML_HTML_ENABLED | |
/* | |
* Actually comes from the HTML parser but launched from the init stuff. | |
*/ | |
XMLPUBFUN void XMLCALL htmlInitAutoClose (void); | |
XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, | |
const char *encoding); | |
#endif | |
/* | |
* Specific function to keep track of entities references | |
* and used by the XSLT debugger. | |
*/ | |
#ifdef LIBXML_LEGACY_ENABLED | |
/** | |
* xmlEntityReferenceFunc: | |
* @ent: the entity | |
* @firstNode: the fist node in the chunk | |
* @lastNode: the last nod in the chunk | |
* | |
* Callback function used when one needs to be able to track back the | |
* provenance of a chunk of nodes inherited from an entity replacement. | |
*/ | |
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, | |
xmlNodePtr firstNode, | |
xmlNodePtr lastNode); | |
XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlParseQuotedString (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlParseNamespace (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlScanName (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, | |
xmlChar **prefix); | |
/** | |
* Entities | |
*/ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlDecodeEntities (xmlParserCtxtPtr ctxt, | |
int len, | |
int what, | |
xmlChar end, | |
xmlChar end2, | |
xmlChar end3); | |
XMLPUBFUN void XMLCALL | |
xmlHandleEntity (xmlParserCtxtPtr ctxt, | |
xmlEntityPtr entity); | |
#endif /* LIBXML_LEGACY_ENABLED */ | |
#ifdef IN_LIBXML | |
/* | |
* internal only | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlErrMemory (xmlParserCtxtPtr ctxt, | |
const char *extra); | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_PARSER_INTERNALS_H__ */ |
/* | |
* Summary: pattern expression handling | |
* Description: allows to compile and test pattern expressions for nodes | |
* either in a tree or based on a parser state. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_PATTERN_H__ | |
#define __XML_PATTERN_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#include <libxml/dict.h> | |
#ifdef LIBXML_PATTERN_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlPattern: | |
* | |
* A compiled (XPath based) pattern to select nodes | |
*/ | |
typedef struct _xmlPattern xmlPattern; | |
typedef xmlPattern *xmlPatternPtr; | |
/** | |
* xmlPatternFlags: | |
* | |
* This is the set of options affecting the behaviour of pattern | |
* matching with this module | |
* | |
*/ | |
typedef enum { | |
XML_PATTERN_DEFAULT = 0, /* simple pattern match */ | |
XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */ | |
XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */ | |
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */ | |
} xmlPatternFlags; | |
XMLPUBFUN void XMLCALL | |
xmlFreePattern (xmlPatternPtr comp); | |
XMLPUBFUN void XMLCALL | |
xmlFreePatternList (xmlPatternPtr comp); | |
XMLPUBFUN xmlPatternPtr XMLCALL | |
xmlPatterncompile (const xmlChar *pattern, | |
xmlDict *dict, | |
int flags, | |
const xmlChar **namespaces); | |
XMLPUBFUN int XMLCALL | |
xmlPatternMatch (xmlPatternPtr comp, | |
xmlNodePtr node); | |
/* streaming interfaces */ | |
typedef struct _xmlStreamCtxt xmlStreamCtxt; | |
typedef xmlStreamCtxt *xmlStreamCtxtPtr; | |
XMLPUBFUN int XMLCALL | |
xmlPatternStreamable (xmlPatternPtr comp); | |
XMLPUBFUN int XMLCALL | |
xmlPatternMaxDepth (xmlPatternPtr comp); | |
XMLPUBFUN int XMLCALL | |
xmlPatternMinDepth (xmlPatternPtr comp); | |
XMLPUBFUN int XMLCALL | |
xmlPatternFromRoot (xmlPatternPtr comp); | |
XMLPUBFUN xmlStreamCtxtPtr XMLCALL | |
xmlPatternGetStreamCtxt (xmlPatternPtr comp); | |
XMLPUBFUN void XMLCALL | |
xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); | |
XMLPUBFUN int XMLCALL | |
xmlStreamPushNode (xmlStreamCtxtPtr stream, | |
const xmlChar *name, | |
const xmlChar *ns, | |
int nodeType); | |
XMLPUBFUN int XMLCALL | |
xmlStreamPush (xmlStreamCtxtPtr stream, | |
const xmlChar *name, | |
const xmlChar *ns); | |
XMLPUBFUN int XMLCALL | |
xmlStreamPushAttr (xmlStreamCtxtPtr stream, | |
const xmlChar *name, | |
const xmlChar *ns); | |
XMLPUBFUN int XMLCALL | |
xmlStreamPop (xmlStreamCtxtPtr stream); | |
XMLPUBFUN int XMLCALL | |
xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_PATTERN_ENABLED */ | |
#endif /* __XML_PATTERN_H__ */ |
/* | |
* Summary: implementation of the Relax-NG validation | |
* Description: implementation of the Relax-NG validation | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_RELAX_NG__ | |
#define __XML_RELAX_NG__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/hash.h> | |
#include <libxml/xmlstring.h> | |
#ifdef LIBXML_SCHEMAS_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
typedef struct _xmlRelaxNG xmlRelaxNG; | |
typedef xmlRelaxNG *xmlRelaxNGPtr; | |
/** | |
* xmlRelaxNGValidityErrorFunc: | |
* @ctx: the validation context | |
* @msg: the message | |
* @...: extra arguments | |
* | |
* Signature of an error callback from a Relax-NG validation | |
*/ | |
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* xmlRelaxNGValidityWarningFunc: | |
* @ctx: the validation context | |
* @msg: the message | |
* @...: extra arguments | |
* | |
* Signature of a warning callback from a Relax-NG validation | |
*/ | |
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* A schemas validation context | |
*/ | |
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt; | |
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr; | |
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt; | |
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr; | |
/* | |
* xmlRelaxNGValidErr: | |
* | |
* List of possible Relax NG validation errors | |
*/ | |
typedef enum { | |
XML_RELAXNG_OK = 0, | |
XML_RELAXNG_ERR_MEMORY, | |
XML_RELAXNG_ERR_TYPE, | |
XML_RELAXNG_ERR_TYPEVAL, | |
XML_RELAXNG_ERR_DUPID, | |
XML_RELAXNG_ERR_TYPECMP, | |
XML_RELAXNG_ERR_NOSTATE, | |
XML_RELAXNG_ERR_NODEFINE, | |
XML_RELAXNG_ERR_LISTEXTRA, | |
XML_RELAXNG_ERR_LISTEMPTY, | |
XML_RELAXNG_ERR_INTERNODATA, | |
XML_RELAXNG_ERR_INTERSEQ, | |
XML_RELAXNG_ERR_INTEREXTRA, | |
XML_RELAXNG_ERR_ELEMNAME, | |
XML_RELAXNG_ERR_ATTRNAME, | |
XML_RELAXNG_ERR_ELEMNONS, | |
XML_RELAXNG_ERR_ATTRNONS, | |
XML_RELAXNG_ERR_ELEMWRONGNS, | |
XML_RELAXNG_ERR_ATTRWRONGNS, | |
XML_RELAXNG_ERR_ELEMEXTRANS, | |
XML_RELAXNG_ERR_ATTREXTRANS, | |
XML_RELAXNG_ERR_ELEMNOTEMPTY, | |
XML_RELAXNG_ERR_NOELEM, | |
XML_RELAXNG_ERR_NOTELEM, | |
XML_RELAXNG_ERR_ATTRVALID, | |
XML_RELAXNG_ERR_CONTENTVALID, | |
XML_RELAXNG_ERR_EXTRACONTENT, | |
XML_RELAXNG_ERR_INVALIDATTR, | |
XML_RELAXNG_ERR_DATAELEM, | |
XML_RELAXNG_ERR_VALELEM, | |
XML_RELAXNG_ERR_LISTELEM, | |
XML_RELAXNG_ERR_DATATYPE, | |
XML_RELAXNG_ERR_VALUE, | |
XML_RELAXNG_ERR_LIST, | |
XML_RELAXNG_ERR_NOGRAMMAR, | |
XML_RELAXNG_ERR_EXTRADATA, | |
XML_RELAXNG_ERR_LACKDATA, | |
XML_RELAXNG_ERR_INTERNAL, | |
XML_RELAXNG_ERR_ELEMWRONG, | |
XML_RELAXNG_ERR_TEXTWRONG | |
} xmlRelaxNGValidErr; | |
/* | |
* xmlRelaxNGParserFlags: | |
* | |
* List of possible Relax NG Parser flags | |
*/ | |
typedef enum { | |
XML_RELAXNGP_NONE = 0, | |
XML_RELAXNGP_FREE_DOC = 1, | |
XML_RELAXNGP_CRNG = 2 | |
} xmlRelaxNGParserFlag; | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGInitTypes (void); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGCleanupTypes (void); | |
/* | |
* Interfaces for parsing. | |
*/ | |
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL | |
xmlRelaxNGNewParserCtxt (const char *URL); | |
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL | |
xmlRelaxNGNewMemParserCtxt (const char *buffer, | |
int size); | |
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL | |
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, | |
int flag); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, | |
xmlRelaxNGValidityErrorFunc err, | |
xmlRelaxNGValidityWarningFunc warn, | |
void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, | |
xmlRelaxNGValidityErrorFunc *err, | |
xmlRelaxNGValidityWarningFunc *warn, | |
void **ctx); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGSetParserStructuredErrors( | |
xmlRelaxNGParserCtxtPtr ctxt, | |
xmlStructuredErrorFunc serror, | |
void *ctx); | |
XMLPUBFUN xmlRelaxNGPtr XMLCALL | |
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGFree (xmlRelaxNGPtr schema); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGDump (FILE *output, | |
xmlRelaxNGPtr schema); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGDumpTree (FILE * output, | |
xmlRelaxNGPtr schema); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* | |
* Interfaces for validating | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, | |
xmlRelaxNGValidityErrorFunc err, | |
xmlRelaxNGValidityWarningFunc warn, | |
void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, | |
xmlRelaxNGValidityErrorFunc *err, | |
xmlRelaxNGValidityWarningFunc *warn, | |
void **ctx); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, | |
xmlStructuredErrorFunc serror, void *ctx); | |
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL | |
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); | |
XMLPUBFUN void XMLCALL | |
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, | |
xmlDocPtr doc); | |
/* | |
* Interfaces for progressive validation when possible | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem); | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, | |
const xmlChar *data, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem); | |
XMLPUBFUN int XMLCALL | |
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_SCHEMAS_ENABLED */ | |
#endif /* __XML_RELAX_NG__ */ |
/* | |
* Summary: Old SAX version 1 handler, deprecated | |
* Description: DEPRECATED set of SAX version 1 interfaces used to | |
* build the DOM tree. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_SAX_H__ | |
#define __XML_SAX_H__ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/parser.h> | |
#include <libxml/xlink.h> | |
#ifdef LIBXML_LEGACY_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XMLPUBFUN const xmlChar * XMLCALL | |
getPublicId (void *ctx); | |
XMLPUBFUN const xmlChar * XMLCALL | |
getSystemId (void *ctx); | |
XMLPUBFUN void XMLCALL | |
setDocumentLocator (void *ctx, | |
xmlSAXLocatorPtr loc); | |
XMLPUBFUN int XMLCALL | |
getLineNumber (void *ctx); | |
XMLPUBFUN int XMLCALL | |
getColumnNumber (void *ctx); | |
XMLPUBFUN int XMLCALL | |
isStandalone (void *ctx); | |
XMLPUBFUN int XMLCALL | |
hasInternalSubset (void *ctx); | |
XMLPUBFUN int XMLCALL | |
hasExternalSubset (void *ctx); | |
XMLPUBFUN void XMLCALL | |
internalSubset (void *ctx, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN void XMLCALL | |
externalSubset (void *ctx, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
getEntity (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
getParameterEntity (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
resolveEntity (void *ctx, | |
const xmlChar *publicId, | |
const xmlChar *systemId); | |
XMLPUBFUN void XMLCALL | |
entityDecl (void *ctx, | |
const xmlChar *name, | |
int type, | |
const xmlChar *publicId, | |
const xmlChar *systemId, | |
xmlChar *content); | |
XMLPUBFUN void XMLCALL | |
attributeDecl (void *ctx, | |
const xmlChar *elem, | |
const xmlChar *fullname, | |
int type, | |
int def, | |
const xmlChar *defaultValue, | |
xmlEnumerationPtr tree); | |
XMLPUBFUN void XMLCALL | |
elementDecl (void *ctx, | |
const xmlChar *name, | |
int type, | |
xmlElementContentPtr content); | |
XMLPUBFUN void XMLCALL | |
notationDecl (void *ctx, | |
const xmlChar *name, | |
const xmlChar *publicId, | |
const xmlChar *systemId); | |
XMLPUBFUN void XMLCALL | |
unparsedEntityDecl (void *ctx, | |
const xmlChar *name, | |
const xmlChar *publicId, | |
const xmlChar *systemId, | |
const xmlChar *notationName); | |
XMLPUBFUN void XMLCALL | |
startDocument (void *ctx); | |
XMLPUBFUN void XMLCALL | |
endDocument (void *ctx); | |
XMLPUBFUN void XMLCALL | |
attribute (void *ctx, | |
const xmlChar *fullname, | |
const xmlChar *value); | |
XMLPUBFUN void XMLCALL | |
startElement (void *ctx, | |
const xmlChar *fullname, | |
const xmlChar **atts); | |
XMLPUBFUN void XMLCALL | |
endElement (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN void XMLCALL | |
reference (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN void XMLCALL | |
characters (void *ctx, | |
const xmlChar *ch, | |
int len); | |
XMLPUBFUN void XMLCALL | |
ignorableWhitespace (void *ctx, | |
const xmlChar *ch, | |
int len); | |
XMLPUBFUN void XMLCALL | |
processingInstruction (void *ctx, | |
const xmlChar *target, | |
const xmlChar *data); | |
XMLPUBFUN void XMLCALL | |
globalNamespace (void *ctx, | |
const xmlChar *href, | |
const xmlChar *prefix); | |
XMLPUBFUN void XMLCALL | |
setNamespace (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN xmlNsPtr XMLCALL | |
getNamespace (void *ctx); | |
XMLPUBFUN int XMLCALL | |
checkNamespace (void *ctx, | |
xmlChar *nameSpace); | |
XMLPUBFUN void XMLCALL | |
namespaceDecl (void *ctx, | |
const xmlChar *href, | |
const xmlChar *prefix); | |
XMLPUBFUN void XMLCALL | |
comment (void *ctx, | |
const xmlChar *value); | |
XMLPUBFUN void XMLCALL | |
cdataBlock (void *ctx, | |
const xmlChar *value, | |
int len); | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN void XMLCALL | |
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, | |
int warning); | |
#ifdef LIBXML_HTML_ENABLED | |
XMLPUBFUN void XMLCALL | |
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); | |
#endif | |
#ifdef LIBXML_DOCB_ENABLED | |
XMLPUBFUN void XMLCALL | |
initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); | |
#endif | |
#endif /* LIBXML_SAX1_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_LEGACY_ENABLED */ | |
#endif /* __XML_SAX_H__ */ |
/* | |
* Summary: SAX2 parser interface used to build the DOM tree | |
* Description: those are the default SAX2 interfaces used by | |
* the library when building DOM tree. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_SAX2_H__ | |
#define __XML_SAX2_H__ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/parser.h> | |
#include <libxml/xlink.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlSAX2GetPublicId (void *ctx); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlSAX2GetSystemId (void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2SetDocumentLocator (void *ctx, | |
xmlSAXLocatorPtr loc); | |
XMLPUBFUN int XMLCALL | |
xmlSAX2GetLineNumber (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSAX2GetColumnNumber (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSAX2IsStandalone (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSAX2HasInternalSubset (void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSAX2HasExternalSubset (void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2InternalSubset (void *ctx, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2ExternalSubset (void *ctx, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlSAX2GetEntity (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN xmlEntityPtr XMLCALL | |
xmlSAX2GetParameterEntity (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlSAX2ResolveEntity (void *ctx, | |
const xmlChar *publicId, | |
const xmlChar *systemId); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2EntityDecl (void *ctx, | |
const xmlChar *name, | |
int type, | |
const xmlChar *publicId, | |
const xmlChar *systemId, | |
xmlChar *content); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2AttributeDecl (void *ctx, | |
const xmlChar *elem, | |
const xmlChar *fullname, | |
int type, | |
int def, | |
const xmlChar *defaultValue, | |
xmlEnumerationPtr tree); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2ElementDecl (void *ctx, | |
const xmlChar *name, | |
int type, | |
xmlElementContentPtr content); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2NotationDecl (void *ctx, | |
const xmlChar *name, | |
const xmlChar *publicId, | |
const xmlChar *systemId); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2UnparsedEntityDecl (void *ctx, | |
const xmlChar *name, | |
const xmlChar *publicId, | |
const xmlChar *systemId, | |
const xmlChar *notationName); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2StartDocument (void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2EndDocument (void *ctx); | |
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ | |
defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || \ | |
defined(LIBXML_LEGACY_ENABLED) | |
XMLPUBFUN void XMLCALL | |
xmlSAX2StartElement (void *ctx, | |
const xmlChar *fullname, | |
const xmlChar **atts); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2EndElement (void *ctx, | |
const xmlChar *name); | |
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlSAX2StartElementNs (void *ctx, | |
const xmlChar *localname, | |
const xmlChar *prefix, | |
const xmlChar *URI, | |
int nb_namespaces, | |
const xmlChar **namespaces, | |
int nb_attributes, | |
int nb_defaulted, | |
const xmlChar **attributes); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2EndElementNs (void *ctx, | |
const xmlChar *localname, | |
const xmlChar *prefix, | |
const xmlChar *URI); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2Reference (void *ctx, | |
const xmlChar *name); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2Characters (void *ctx, | |
const xmlChar *ch, | |
int len); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2IgnorableWhitespace (void *ctx, | |
const xmlChar *ch, | |
int len); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2ProcessingInstruction (void *ctx, | |
const xmlChar *target, | |
const xmlChar *data); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2Comment (void *ctx, | |
const xmlChar *value); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2CDataBlock (void *ctx, | |
const xmlChar *value, | |
int len); | |
#ifdef LIBXML_SAX1_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlSAXDefaultVersion (int version); | |
#endif /* LIBXML_SAX1_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
xmlSAXVersion (xmlSAXHandler *hdlr, | |
int version); | |
XMLPUBFUN void XMLCALL | |
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, | |
int warning); | |
#ifdef LIBXML_HTML_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); | |
XMLPUBFUN void XMLCALL | |
htmlDefaultSAXHandlerInit (void); | |
#endif | |
#ifdef LIBXML_DOCB_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); | |
XMLPUBFUN void XMLCALL | |
docbDefaultSAXHandlerInit (void); | |
#endif | |
XMLPUBFUN void XMLCALL | |
xmlDefaultSAXHandlerInit (void); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_SAX2_H__ */ |
/* | |
* Summary: internal interfaces for XML Schemas | |
* Description: internal interfaces for the XML Schemas handling | |
* and schema validity checking | |
* The Schemas development is a Work In Progress. | |
* Some of those interfaces are not guaranteed to be API or ABI stable ! | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_SCHEMA_INTERNALS_H__ | |
#define __XML_SCHEMA_INTERNALS_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_SCHEMAS_ENABLED | |
#include <libxml/xmlregexp.h> | |
#include <libxml/hash.h> | |
#include <libxml/dict.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
typedef enum { | |
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 | |
} xmlSchemaValType; | |
/* | |
* XML Schemas defines multiple type of types. | |
*/ | |
typedef enum { | |
XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ | |
XML_SCHEMA_TYPE_ANY, | |
XML_SCHEMA_TYPE_FACET, | |
XML_SCHEMA_TYPE_SIMPLE, | |
XML_SCHEMA_TYPE_COMPLEX, | |
XML_SCHEMA_TYPE_SEQUENCE = 6, | |
XML_SCHEMA_TYPE_CHOICE, | |
XML_SCHEMA_TYPE_ALL, | |
XML_SCHEMA_TYPE_SIMPLE_CONTENT, | |
XML_SCHEMA_TYPE_COMPLEX_CONTENT, | |
XML_SCHEMA_TYPE_UR, | |
XML_SCHEMA_TYPE_RESTRICTION, | |
XML_SCHEMA_TYPE_EXTENSION, | |
XML_SCHEMA_TYPE_ELEMENT, | |
XML_SCHEMA_TYPE_ATTRIBUTE, | |
XML_SCHEMA_TYPE_ATTRIBUTEGROUP, | |
XML_SCHEMA_TYPE_GROUP, | |
XML_SCHEMA_TYPE_NOTATION, | |
XML_SCHEMA_TYPE_LIST, | |
XML_SCHEMA_TYPE_UNION, | |
XML_SCHEMA_TYPE_ANY_ATTRIBUTE, | |
XML_SCHEMA_TYPE_IDC_UNIQUE, | |
XML_SCHEMA_TYPE_IDC_KEY, | |
XML_SCHEMA_TYPE_IDC_KEYREF, | |
XML_SCHEMA_TYPE_PARTICLE = 25, | |
XML_SCHEMA_TYPE_ATTRIBUTE_USE, | |
XML_SCHEMA_FACET_MININCLUSIVE = 1000, | |
XML_SCHEMA_FACET_MINEXCLUSIVE, | |
XML_SCHEMA_FACET_MAXINCLUSIVE, | |
XML_SCHEMA_FACET_MAXEXCLUSIVE, | |
XML_SCHEMA_FACET_TOTALDIGITS, | |
XML_SCHEMA_FACET_FRACTIONDIGITS, | |
XML_SCHEMA_FACET_PATTERN, | |
XML_SCHEMA_FACET_ENUMERATION, | |
XML_SCHEMA_FACET_WHITESPACE, | |
XML_SCHEMA_FACET_LENGTH, | |
XML_SCHEMA_FACET_MAXLENGTH, | |
XML_SCHEMA_FACET_MINLENGTH, | |
XML_SCHEMA_EXTRA_QNAMEREF = 2000, | |
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB | |
} xmlSchemaTypeType; | |
typedef enum { | |
XML_SCHEMA_CONTENT_UNKNOWN = 0, | |
XML_SCHEMA_CONTENT_EMPTY = 1, | |
XML_SCHEMA_CONTENT_ELEMENTS, | |
XML_SCHEMA_CONTENT_MIXED, | |
XML_SCHEMA_CONTENT_SIMPLE, | |
XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ | |
XML_SCHEMA_CONTENT_BASIC, | |
XML_SCHEMA_CONTENT_ANY | |
} xmlSchemaContentType; | |
typedef struct _xmlSchemaVal xmlSchemaVal; | |
typedef xmlSchemaVal *xmlSchemaValPtr; | |
typedef struct _xmlSchemaType xmlSchemaType; | |
typedef xmlSchemaType *xmlSchemaTypePtr; | |
typedef struct _xmlSchemaFacet xmlSchemaFacet; | |
typedef xmlSchemaFacet *xmlSchemaFacetPtr; | |
/** | |
* Annotation | |
*/ | |
typedef struct _xmlSchemaAnnot xmlSchemaAnnot; | |
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; | |
struct _xmlSchemaAnnot { | |
struct _xmlSchemaAnnot *next; | |
xmlNodePtr content; /* the annotation */ | |
}; | |
/** | |
* XML_SCHEMAS_ANYATTR_SKIP: | |
* | |
* Skip unknown attribute from validation | |
* Obsolete, not used anymore. | |
*/ | |
#define XML_SCHEMAS_ANYATTR_SKIP 1 | |
/** | |
* XML_SCHEMAS_ANYATTR_LAX: | |
* | |
* Ignore validation non definition on attributes | |
* Obsolete, not used anymore. | |
*/ | |
#define XML_SCHEMAS_ANYATTR_LAX 2 | |
/** | |
* XML_SCHEMAS_ANYATTR_STRICT: | |
* | |
* Apply strict validation rules on attributes | |
* Obsolete, not used anymore. | |
*/ | |
#define XML_SCHEMAS_ANYATTR_STRICT 3 | |
/** | |
* XML_SCHEMAS_ANY_SKIP: | |
* | |
* Skip unknown attribute from validation | |
*/ | |
#define XML_SCHEMAS_ANY_SKIP 1 | |
/** | |
* XML_SCHEMAS_ANY_LAX: | |
* | |
* Used by wildcards. | |
* Validate if type found, don't worry if not found | |
*/ | |
#define XML_SCHEMAS_ANY_LAX 2 | |
/** | |
* XML_SCHEMAS_ANY_STRICT: | |
* | |
* Used by wildcards. | |
* Apply strict validation rules | |
*/ | |
#define XML_SCHEMAS_ANY_STRICT 3 | |
/** | |
* XML_SCHEMAS_ATTR_USE_PROHIBITED: | |
* | |
* Used by wildcards. | |
* The attribute is prohibited. | |
*/ | |
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 | |
/** | |
* XML_SCHEMAS_ATTR_USE_REQUIRED: | |
* | |
* The attribute is required. | |
*/ | |
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1 | |
/** | |
* XML_SCHEMAS_ATTR_USE_OPTIONAL: | |
* | |
* The attribute is optional. | |
*/ | |
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 | |
/** | |
* XML_SCHEMAS_ATTR_GLOBAL: | |
* | |
* allow elements in no namespace | |
*/ | |
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 | |
/** | |
* XML_SCHEMAS_ATTR_NSDEFAULT: | |
* | |
* allow elements in no namespace | |
*/ | |
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 | |
/** | |
* XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: | |
* | |
* this is set when the "type" and "ref" references | |
* have been resolved. | |
*/ | |
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 | |
/** | |
* XML_SCHEMAS_ATTR_FIXED: | |
* | |
* the attribute has a fixed value | |
*/ | |
#define XML_SCHEMAS_ATTR_FIXED 1 << 9 | |
/** | |
* xmlSchemaAttribute: | |
* An attribute definition. | |
*/ | |
typedef struct _xmlSchemaAttribute xmlSchemaAttribute; | |
typedef xmlSchemaAttribute *xmlSchemaAttributePtr; | |
struct _xmlSchemaAttribute { | |
xmlSchemaTypeType type; | |
struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ | |
const xmlChar *name; /* the name of the declaration */ | |
const xmlChar *id; /* Deprecated; not used */ | |
const xmlChar *ref; /* Deprecated; not used */ | |
const xmlChar *refNs; /* Deprecated; not used */ | |
const xmlChar *typeName; /* the local name of the type definition */ | |
const xmlChar *typeNs; /* the ns URI of the type definition */ | |
xmlSchemaAnnotPtr annot; | |
xmlSchemaTypePtr base; /* Deprecated; not used */ | |
int occurs; /* Deprecated; not used */ | |
const xmlChar *defValue; /* The initial value of the value constraint */ | |
xmlSchemaTypePtr subtypes; /* the type definition */ | |
xmlNodePtr node; | |
const xmlChar *targetNamespace; | |
int flags; | |
const xmlChar *refPrefix; /* Deprecated; not used */ | |
xmlSchemaValPtr defVal; /* The compiled value constraint */ | |
xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ | |
}; | |
/** | |
* xmlSchemaAttributeLink: | |
* Used to build a list of attribute uses on complexType definitions. | |
* WARNING: Deprecated; not used. | |
*/ | |
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; | |
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; | |
struct _xmlSchemaAttributeLink { | |
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ | |
struct _xmlSchemaAttribute *attr;/* the linked attribute */ | |
}; | |
/** | |
* XML_SCHEMAS_WILDCARD_COMPLETE: | |
* | |
* If the wildcard is complete. | |
*/ | |
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 | |
/** | |
* xmlSchemaCharValueLink: | |
* Used to build a list of namespaces on wildcards. | |
*/ | |
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; | |
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; | |
struct _xmlSchemaWildcardNs { | |
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ | |
const xmlChar *value;/* the value */ | |
}; | |
/** | |
* xmlSchemaWildcard. | |
* A wildcard. | |
*/ | |
typedef struct _xmlSchemaWildcard xmlSchemaWildcard; | |
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; | |
struct _xmlSchemaWildcard { | |
xmlSchemaTypeType type; /* The kind of type */ | |
const xmlChar *id; /* Deprecated; not used */ | |
xmlSchemaAnnotPtr annot; | |
xmlNodePtr node; | |
int minOccurs; /* Deprecated; not used */ | |
int maxOccurs; /* Deprecated; not used */ | |
int processContents; | |
int any; /* Indicates if the ns constraint is of ##any */ | |
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ | |
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ | |
int flags; | |
}; | |
/** | |
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: | |
* | |
* The attribute wildcard has been already builded. | |
*/ | |
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 | |
/** | |
* XML_SCHEMAS_ATTRGROUP_GLOBAL: | |
* | |
* The attribute wildcard has been already builded. | |
*/ | |
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 | |
/** | |
* XML_SCHEMAS_ATTRGROUP_MARKED: | |
* | |
* Marks the attr group as marked; used for circular checks. | |
*/ | |
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 | |
/** | |
* XML_SCHEMAS_ATTRGROUP_REDEFINED: | |
* | |
* The attr group was redefined. | |
*/ | |
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 | |
/** | |
* XML_SCHEMAS_ATTRGROUP_HAS_REFS: | |
* | |
* Whether this attr. group contains attr. group references. | |
*/ | |
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 | |
/** | |
* An attribute group definition. | |
* | |
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures | |
* must be kept similar | |
*/ | |
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; | |
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; | |
struct _xmlSchemaAttributeGroup { | |
xmlSchemaTypeType type; /* The kind of type */ | |
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ | |
const xmlChar *name; | |
const xmlChar *id; | |
const xmlChar *ref; /* Deprecated; not used */ | |
const xmlChar *refNs; /* Deprecated; not used */ | |
xmlSchemaAnnotPtr annot; | |
xmlSchemaAttributePtr attributes; /* Deprecated; not used */ | |
xmlNodePtr node; | |
int flags; | |
xmlSchemaWildcardPtr attributeWildcard; | |
const xmlChar *refPrefix; /* Deprecated; not used */ | |
xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ | |
const xmlChar *targetNamespace; | |
void *attrUses; | |
}; | |
/** | |
* xmlSchemaTypeLink: | |
* Used to build a list of types (e.g. member types of | |
* simpleType with variety "union"). | |
*/ | |
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; | |
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; | |
struct _xmlSchemaTypeLink { | |
struct _xmlSchemaTypeLink *next;/* the next type link ... */ | |
xmlSchemaTypePtr type;/* the linked type */ | |
}; | |
/** | |
* xmlSchemaFacetLink: | |
* Used to build a list of facets. | |
*/ | |
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; | |
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; | |
struct _xmlSchemaFacetLink { | |
struct _xmlSchemaFacetLink *next;/* the next facet link ... */ | |
xmlSchemaFacetPtr facet;/* the linked facet */ | |
}; | |
/** | |
* XML_SCHEMAS_TYPE_MIXED: | |
* | |
* the element content type is mixed | |
*/ | |
#define XML_SCHEMAS_TYPE_MIXED 1 << 0 | |
/** | |
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: | |
* | |
* the simple or complex type has a derivation method of "extension". | |
*/ | |
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 | |
/** | |
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: | |
* | |
* the simple or complex type has a derivation method of "restriction". | |
*/ | |
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 | |
/** | |
* XML_SCHEMAS_TYPE_GLOBAL: | |
* | |
* the type is global | |
*/ | |
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 | |
/** | |
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: | |
* | |
* the complexType owns an attribute wildcard, i.e. | |
* it can be freed by the complexType | |
*/ | |
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ | |
/** | |
* XML_SCHEMAS_TYPE_VARIETY_ABSENT: | |
* | |
* the simpleType has a variety of "absent". | |
* TODO: Actually not necessary :-/, since if | |
* none of the variety flags occur then it's | |
* automatically absent. | |
*/ | |
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 | |
/** | |
* XML_SCHEMAS_TYPE_VARIETY_LIST: | |
* | |
* the simpleType has a variety of "list". | |
*/ | |
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 | |
/** | |
* XML_SCHEMAS_TYPE_VARIETY_UNION: | |
* | |
* the simpleType has a variety of "union". | |
*/ | |
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 | |
/** | |
* XML_SCHEMAS_TYPE_VARIETY_ATOMIC: | |
* | |
* the simpleType has a variety of "union". | |
*/ | |
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 | |
/** | |
* XML_SCHEMAS_TYPE_FINAL_EXTENSION: | |
* | |
* the complexType has a final of "extension". | |
*/ | |
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 | |
/** | |
* XML_SCHEMAS_TYPE_FINAL_RESTRICTION: | |
* | |
* the simpleType/complexType has a final of "restriction". | |
*/ | |
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 | |
/** | |
* XML_SCHEMAS_TYPE_FINAL_LIST: | |
* | |
* the simpleType has a final of "list". | |
*/ | |
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 | |
/** | |
* XML_SCHEMAS_TYPE_FINAL_UNION: | |
* | |
* the simpleType has a final of "union". | |
*/ | |
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 | |
/** | |
* XML_SCHEMAS_TYPE_FINAL_DEFAULT: | |
* | |
* the simpleType has a final of "default". | |
*/ | |
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 | |
/** | |
* XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: | |
* | |
* Marks the item as a builtin primitive. | |
*/ | |
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 | |
/** | |
* XML_SCHEMAS_TYPE_MARKED: | |
* | |
* Marks the item as marked; used for circular checks. | |
*/ | |
#define XML_SCHEMAS_TYPE_MARKED 1 << 16 | |
/** | |
* XML_SCHEMAS_TYPE_BLOCK_DEFAULT: | |
* | |
* the complexType did not specify 'block' so use the default of the | |
* <schema> item. | |
*/ | |
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 | |
/** | |
* XML_SCHEMAS_TYPE_BLOCK_EXTENSION: | |
* | |
* the complexType has a 'block' of "extension". | |
*/ | |
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 | |
/** | |
* XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: | |
* | |
* the complexType has a 'block' of "restriction". | |
*/ | |
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 | |
/** | |
* XML_SCHEMAS_TYPE_ABSTRACT: | |
* | |
* the simple/complexType is abstract. | |
*/ | |
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 | |
/** | |
* XML_SCHEMAS_TYPE_FACETSNEEDVALUE: | |
* | |
* indicates if the facets need a computed value | |
*/ | |
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 | |
/** | |
* XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: | |
* | |
* indicates that the type was typefixed | |
*/ | |
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 | |
/** | |
* XML_SCHEMAS_TYPE_INTERNAL_INVALID: | |
* | |
* indicates that the type is invalid | |
*/ | |
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 | |
/** | |
* XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE: | |
* | |
* a whitespace-facet value of "preserve" | |
*/ | |
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24 | |
/** | |
* XML_SCHEMAS_TYPE_WHITESPACE_REPLACE: | |
* | |
* a whitespace-facet value of "replace" | |
*/ | |
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25 | |
/** | |
* XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE: | |
* | |
* a whitespace-facet value of "collapse" | |
*/ | |
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26 | |
/** | |
* XML_SCHEMAS_TYPE_HAS_FACETS: | |
* | |
* has facets | |
*/ | |
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27 | |
/** | |
* XML_SCHEMAS_TYPE_NORMVALUENEEDED: | |
* | |
* indicates if the facets (pattern) need a normalized value | |
*/ | |
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28 | |
/** | |
* XML_SCHEMAS_TYPE_FIXUP_1: | |
* | |
* First stage of fixup was done. | |
*/ | |
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 | |
/** | |
* XML_SCHEMAS_TYPE_REDEFINED: | |
* | |
* The type was redefined. | |
*/ | |
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 | |
/** | |
* XML_SCHEMAS_TYPE_REDEFINING: | |
* | |
* The type redefines an other type. | |
*/ | |
/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ | |
/** | |
* _xmlSchemaType: | |
* | |
* Schemas type definition. | |
*/ | |
struct _xmlSchemaType { | |
xmlSchemaTypeType type; /* The kind of type */ | |
struct _xmlSchemaType *next; /* the next type if in a sequence ... */ | |
const xmlChar *name; | |
const xmlChar *id ; /* Deprecated; not used */ | |
const xmlChar *ref; /* Deprecated; not used */ | |
const xmlChar *refNs; /* Deprecated; not used */ | |
xmlSchemaAnnotPtr annot; | |
xmlSchemaTypePtr subtypes; | |
xmlSchemaAttributePtr attributes; /* Deprecated; not used */ | |
xmlNodePtr node; | |
int minOccurs; /* Deprecated; not used */ | |
int maxOccurs; /* Deprecated; not used */ | |
int flags; | |
xmlSchemaContentType contentType; | |
const xmlChar *base; /* Base type's local name */ | |
const xmlChar *baseNs; /* Base type's target namespace */ | |
xmlSchemaTypePtr baseType; /* The base type component */ | |
xmlSchemaFacetPtr facets; /* Local facets */ | |
struct _xmlSchemaType *redef; /* Deprecated; not used */ | |
int recurse; /* Obsolete */ | |
xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ | |
xmlSchemaWildcardPtr attributeWildcard; | |
int builtInType; /* Type of built-in types. */ | |
xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ | |
xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ | |
const xmlChar *refPrefix; /* Deprecated; not used */ | |
xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. | |
Could we use @subtypes for this? */ | |
xmlRegexpPtr contModel; /* Holds the automaton of the content model */ | |
const xmlChar *targetNamespace; | |
void *attrUses; | |
}; | |
/* | |
* xmlSchemaElement: | |
* An element definition. | |
* | |
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of | |
* structures must be kept similar | |
*/ | |
/** | |
* XML_SCHEMAS_ELEM_NILLABLE: | |
* | |
* the element is nillable | |
*/ | |
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 | |
/** | |
* XML_SCHEMAS_ELEM_GLOBAL: | |
* | |
* the element is global | |
*/ | |
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 | |
/** | |
* XML_SCHEMAS_ELEM_DEFAULT: | |
* | |
* the element has a default value | |
*/ | |
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 | |
/** | |
* XML_SCHEMAS_ELEM_FIXED: | |
* | |
* the element has a fixed value | |
*/ | |
#define XML_SCHEMAS_ELEM_FIXED 1 << 3 | |
/** | |
* XML_SCHEMAS_ELEM_ABSTRACT: | |
* | |
* the element is abstract | |
*/ | |
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 | |
/** | |
* XML_SCHEMAS_ELEM_TOPLEVEL: | |
* | |
* the element is top level | |
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead | |
*/ | |
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 | |
/** | |
* XML_SCHEMAS_ELEM_REF: | |
* | |
* the element is a reference to a type | |
*/ | |
#define XML_SCHEMAS_ELEM_REF 1 << 6 | |
/** | |
* XML_SCHEMAS_ELEM_NSDEFAULT: | |
* | |
* allow elements in no namespace | |
* Obsolete, not used anymore. | |
*/ | |
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 | |
/** | |
* XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: | |
* | |
* this is set when "type", "ref", "substitutionGroup" | |
* references have been resolved. | |
*/ | |
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 | |
/** | |
* XML_SCHEMAS_ELEM_CIRCULAR: | |
* | |
* a helper flag for the search of circular references. | |
*/ | |
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 | |
/** | |
* XML_SCHEMAS_ELEM_BLOCK_ABSENT: | |
* | |
* the "block" attribute is absent | |
*/ | |
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 | |
/** | |
* XML_SCHEMAS_ELEM_BLOCK_EXTENSION: | |
* | |
* disallowed substitutions are absent | |
*/ | |
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 | |
/** | |
* XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: | |
* | |
* disallowed substitutions: "restriction" | |
*/ | |
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 | |
/** | |
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: | |
* | |
* disallowed substitutions: "substituion" | |
*/ | |
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 | |
/** | |
* XML_SCHEMAS_ELEM_FINAL_ABSENT: | |
* | |
* substitution group exclusions are absent | |
*/ | |
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 | |
/** | |
* XML_SCHEMAS_ELEM_FINAL_EXTENSION: | |
* | |
* substitution group exclusions: "extension" | |
*/ | |
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 | |
/** | |
* XML_SCHEMAS_ELEM_FINAL_RESTRICTION: | |
* | |
* substitution group exclusions: "restriction" | |
*/ | |
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 | |
/** | |
* XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD: | |
* | |
* the declaration is a substitution group head | |
*/ | |
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17 | |
/** | |
* XML_SCHEMAS_ELEM_INTERNAL_CHECKED: | |
* | |
* this is set when the elem decl has been checked against | |
* all constraints | |
*/ | |
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18 | |
typedef struct _xmlSchemaElement xmlSchemaElement; | |
typedef xmlSchemaElement *xmlSchemaElementPtr; | |
struct _xmlSchemaElement { | |
xmlSchemaTypeType type; /* The kind of type */ | |
struct _xmlSchemaType *next; /* Not used? */ | |
const xmlChar *name; | |
const xmlChar *id; /* Deprecated; not used */ | |
const xmlChar *ref; /* Deprecated; not used */ | |
const xmlChar *refNs; /* Deprecated; not used */ | |
xmlSchemaAnnotPtr annot; | |
xmlSchemaTypePtr subtypes; /* the type definition */ | |
xmlSchemaAttributePtr attributes; | |
xmlNodePtr node; | |
int minOccurs; /* Deprecated; not used */ | |
int maxOccurs; /* Deprecated; not used */ | |
int flags; | |
const xmlChar *targetNamespace; | |
const xmlChar *namedType; | |
const xmlChar *namedTypeNs; | |
const xmlChar *substGroup; | |
const xmlChar *substGroupNs; | |
const xmlChar *scope; | |
const xmlChar *value; /* The original value of the value constraint. */ | |
struct _xmlSchemaElement *refDecl; /* This will now be used for the | |
substitution group affiliation */ | |
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ | |
xmlSchemaContentType contentType; | |
const xmlChar *refPrefix; /* Deprecated; not used */ | |
xmlSchemaValPtr defVal; /* The compiled value contraint. */ | |
void *idcs; /* The identity-constraint defs */ | |
}; | |
/* | |
* XML_SCHEMAS_FACET_UNKNOWN: | |
* | |
* unknown facet handling | |
*/ | |
#define XML_SCHEMAS_FACET_UNKNOWN 0 | |
/* | |
* XML_SCHEMAS_FACET_PRESERVE: | |
* | |
* preserve the type of the facet | |
*/ | |
#define XML_SCHEMAS_FACET_PRESERVE 1 | |
/* | |
* XML_SCHEMAS_FACET_REPLACE: | |
* | |
* replace the type of the facet | |
*/ | |
#define XML_SCHEMAS_FACET_REPLACE 2 | |
/* | |
* XML_SCHEMAS_FACET_COLLAPSE: | |
* | |
* collapse the types of the facet | |
*/ | |
#define XML_SCHEMAS_FACET_COLLAPSE 3 | |
/** | |
* A facet definition. | |
*/ | |
struct _xmlSchemaFacet { | |
xmlSchemaTypeType type; /* The kind of type */ | |
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ | |
const xmlChar *value; /* The original value */ | |
const xmlChar *id; /* Obsolete */ | |
xmlSchemaAnnotPtr annot; | |
xmlNodePtr node; | |
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ | |
int whitespace; | |
xmlSchemaValPtr val; /* The compiled value */ | |
xmlRegexpPtr regexp; /* The regex for patterns */ | |
}; | |
/** | |
* A notation definition. | |
*/ | |
typedef struct _xmlSchemaNotation xmlSchemaNotation; | |
typedef xmlSchemaNotation *xmlSchemaNotationPtr; | |
struct _xmlSchemaNotation { | |
xmlSchemaTypeType type; /* The kind of type */ | |
const xmlChar *name; | |
xmlSchemaAnnotPtr annot; | |
const xmlChar *identifier; | |
const xmlChar *targetNamespace; | |
}; | |
/* | |
* TODO: Actually all those flags used for the schema should sit | |
* on the schema parser context, since they are used only | |
* during parsing an XML schema document, and not available | |
* on the component level as per spec. | |
*/ | |
/** | |
* XML_SCHEMAS_QUALIF_ELEM: | |
* | |
* Reflects elementFormDefault == qualified in | |
* an XML schema document. | |
*/ | |
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 | |
/** | |
* XML_SCHEMAS_QUALIF_ATTR: | |
* | |
* Reflects attributeFormDefault == qualified in | |
* an XML schema document. | |
*/ | |
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 | |
/** | |
* XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: | |
* | |
* the schema has "extension" in the set of finalDefault. | |
*/ | |
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 | |
/** | |
* XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: | |
* | |
* the schema has "restriction" in the set of finalDefault. | |
*/ | |
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 | |
/** | |
* XML_SCHEMAS_FINAL_DEFAULT_LIST: | |
* | |
* the cshema has "list" in the set of finalDefault. | |
*/ | |
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 | |
/** | |
* XML_SCHEMAS_FINAL_DEFAULT_UNION: | |
* | |
* the schema has "union" in the set of finalDefault. | |
*/ | |
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 | |
/** | |
* XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: | |
* | |
* the schema has "extension" in the set of blockDefault. | |
*/ | |
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 | |
/** | |
* XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: | |
* | |
* the schema has "restriction" in the set of blockDefault. | |
*/ | |
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 | |
/** | |
* XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: | |
* | |
* the schema has "substitution" in the set of blockDefault. | |
*/ | |
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 | |
/** | |
* XML_SCHEMAS_INCLUDING_CONVERT_NS: | |
* | |
* the schema is currently including an other schema with | |
* no target namespace. | |
*/ | |
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 | |
/** | |
* _xmlSchema: | |
* | |
* A Schemas definition | |
*/ | |
struct _xmlSchema { | |
const xmlChar *name; /* schema name */ | |
const xmlChar *targetNamespace; /* the target namespace */ | |
const xmlChar *version; | |
const xmlChar *id; /* Obsolete */ | |
xmlDocPtr doc; | |
xmlSchemaAnnotPtr annot; | |
int flags; | |
xmlHashTablePtr typeDecl; | |
xmlHashTablePtr attrDecl; | |
xmlHashTablePtr attrgrpDecl; | |
xmlHashTablePtr elemDecl; | |
xmlHashTablePtr notaDecl; | |
xmlHashTablePtr schemasImports; | |
void *_private; /* unused by the library for users or bindings */ | |
xmlHashTablePtr groupDecl; | |
xmlDictPtr dict; | |
void *includes; /* the includes, this is opaque for now */ | |
int preserve; /* whether to free the document */ | |
int counter; /* used to give ononymous components unique names */ | |
xmlHashTablePtr idcDef; /* All identity-constraint defs. */ | |
void *volatiles; /* Obsolete */ | |
}; | |
XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); | |
XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_SCHEMAS_ENABLED */ | |
#endif /* __XML_SCHEMA_INTERNALS_H__ */ |
/* | |
* Summary: XML Schemastron implementation | |
* Description: interface to the XML Schematron validity checking. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_SCHEMATRON_H__ | |
#define __XML_SCHEMATRON_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_SCHEMATRON_ENABLED | |
#include <libxml/tree.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
typedef enum { | |
XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ | |
XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ | |
XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ | |
XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */ | |
XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ | |
XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ | |
XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ | |
} xmlSchematronValidOptions; | |
/** | |
* The schemas related types are kept internal | |
*/ | |
typedef struct _xmlSchematron xmlSchematron; | |
typedef xmlSchematron *xmlSchematronPtr; | |
/** | |
* xmlSchematronValidityErrorFunc: | |
* @ctx: the validation context | |
* @msg: the message | |
* @...: extra arguments | |
* | |
* Signature of an error callback from a Schematron validation | |
*/ | |
typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); | |
/** | |
* xmlSchematronValidityWarningFunc: | |
* @ctx: the validation context | |
* @msg: the message | |
* @...: extra arguments | |
* | |
* Signature of a warning callback from a Schematron validation | |
*/ | |
typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); | |
/** | |
* A schemas validation context | |
*/ | |
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; | |
typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; | |
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; | |
typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; | |
/* | |
* Interfaces for parsing. | |
*/ | |
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL | |
xmlSchematronNewParserCtxt (const char *URL); | |
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL | |
xmlSchematronNewMemParserCtxt(const char *buffer, | |
int size); | |
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL | |
xmlSchematronNewDocParserCtxt(xmlDocPtr doc); | |
XMLPUBFUN void XMLCALL | |
xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); | |
/***** | |
XMLPUBFUN void XMLCALL | |
xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, | |
xmlSchematronValidityErrorFunc err, | |
xmlSchematronValidityWarningFunc warn, | |
void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, | |
xmlSchematronValidityErrorFunc * err, | |
xmlSchematronValidityWarningFunc * warn, | |
void **ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); | |
*****/ | |
XMLPUBFUN xmlSchematronPtr XMLCALL | |
xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlSchematronFree (xmlSchematronPtr schema); | |
/* | |
* Interfaces for validating | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlSchematronSetValidStructuredErrors( | |
xmlSchematronValidCtxtPtr ctxt, | |
xmlStructuredErrorFunc serror, | |
void *ctx); | |
/****** | |
XMLPUBFUN void XMLCALL | |
xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, | |
xmlSchematronValidityErrorFunc err, | |
xmlSchematronValidityWarningFunc warn, | |
void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, | |
xmlSchematronValidityErrorFunc *err, | |
xmlSchematronValidityWarningFunc *warn, | |
void **ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, | |
xmlNodePtr elem); | |
*******/ | |
XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL | |
xmlSchematronNewValidCtxt (xmlSchematronPtr schema, | |
int options); | |
XMLPUBFUN void XMLCALL | |
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, | |
xmlDocPtr instance); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_SCHEMATRON_ENABLED */ | |
#endif /* __XML_SCHEMATRON_H__ */ |
/** | |
* Summary: interfaces for thread handling | |
* Description: set of generic threading related routines | |
* should work with pthreads, Windows native or TLS threads | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_THREADS_H__ | |
#define __XML_THREADS_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* xmlMutex are a simple mutual exception locks. | |
*/ | |
typedef struct _xmlMutex xmlMutex; | |
typedef xmlMutex *xmlMutexPtr; | |
/* | |
* xmlRMutex are reentrant mutual exception locks. | |
*/ | |
typedef struct _xmlRMutex xmlRMutex; | |
typedef xmlRMutex *xmlRMutexPtr; | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/globals.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XMLPUBFUN xmlMutexPtr XMLCALL | |
xmlNewMutex (void); | |
XMLPUBFUN void XMLCALL | |
xmlMutexLock (xmlMutexPtr tok); | |
XMLPUBFUN void XMLCALL | |
xmlMutexUnlock (xmlMutexPtr tok); | |
XMLPUBFUN void XMLCALL | |
xmlFreeMutex (xmlMutexPtr tok); | |
XMLPUBFUN xmlRMutexPtr XMLCALL | |
xmlNewRMutex (void); | |
XMLPUBFUN void XMLCALL | |
xmlRMutexLock (xmlRMutexPtr tok); | |
XMLPUBFUN void XMLCALL | |
xmlRMutexUnlock (xmlRMutexPtr tok); | |
XMLPUBFUN void XMLCALL | |
xmlFreeRMutex (xmlRMutexPtr tok); | |
/* | |
* Library wide APIs. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlInitThreads (void); | |
XMLPUBFUN void XMLCALL | |
xmlLockLibrary (void); | |
XMLPUBFUN void XMLCALL | |
xmlUnlockLibrary(void); | |
XMLPUBFUN int XMLCALL | |
xmlGetThreadId (void); | |
XMLPUBFUN int XMLCALL | |
xmlIsMainThread (void); | |
XMLPUBFUN void XMLCALL | |
xmlCleanupThreads(void); | |
XMLPUBFUN xmlGlobalStatePtr XMLCALL | |
xmlGetGlobalState(void); | |
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) | |
int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved); | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_THREADS_H__ */ |
/* | |
* Summary: interfaces for tree manipulation | |
* Description: this module describes the structures found in an tree resulting | |
* from an XML or HTML parsing, as well as the API provided for | |
* various processing on that tree | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_TREE_H__ | |
#define __XML_TREE_H__ | |
#include <stdio.h> | |
#include <limits.h> | |
#include <libxml/xmlversion.h> | |
#include <libxml/xmlstring.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Some of the basic types pointer to structures: | |
*/ | |
/* xmlIO.h */ | |
typedef struct _xmlParserInputBuffer xmlParserInputBuffer; | |
typedef xmlParserInputBuffer *xmlParserInputBufferPtr; | |
typedef struct _xmlOutputBuffer xmlOutputBuffer; | |
typedef xmlOutputBuffer *xmlOutputBufferPtr; | |
/* parser.h */ | |
typedef struct _xmlParserInput xmlParserInput; | |
typedef xmlParserInput *xmlParserInputPtr; | |
typedef struct _xmlParserCtxt xmlParserCtxt; | |
typedef xmlParserCtxt *xmlParserCtxtPtr; | |
typedef struct _xmlSAXLocator xmlSAXLocator; | |
typedef xmlSAXLocator *xmlSAXLocatorPtr; | |
typedef struct _xmlSAXHandler xmlSAXHandler; | |
typedef xmlSAXHandler *xmlSAXHandlerPtr; | |
/* entities.h */ | |
typedef struct _xmlEntity xmlEntity; | |
typedef xmlEntity *xmlEntityPtr; | |
/** | |
* BASE_BUFFER_SIZE: | |
* | |
* default buffer size 4000. | |
*/ | |
#define BASE_BUFFER_SIZE 4096 | |
/** | |
* LIBXML_NAMESPACE_DICT: | |
* | |
* Defines experimental behaviour: | |
* 1) xmlNs gets an additional field @context (a xmlDoc) | |
* 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. | |
*/ | |
/* #define LIBXML_NAMESPACE_DICT */ | |
/** | |
* xmlBufferAllocationScheme: | |
* | |
* A buffer allocation scheme can be defined to either match exactly the | |
* need or double it's allocated size each time it is found too small. | |
*/ | |
typedef enum { | |
XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ | |
XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ | |
XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ | |
XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ | |
XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */ | |
XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */ | |
} xmlBufferAllocationScheme; | |
/** | |
* xmlBuffer: | |
* | |
* A buffer structure, this old construct is limited to 2GB and | |
* is being deprecated, use API with xmlBuf instead | |
*/ | |
typedef struct _xmlBuffer xmlBuffer; | |
typedef xmlBuffer *xmlBufferPtr; | |
struct _xmlBuffer { | |
xmlChar *content; /* The buffer content UTF8 */ | |
unsigned int use; /* The buffer size used */ | |
unsigned int size; /* The buffer size */ | |
xmlBufferAllocationScheme alloc; /* The realloc method */ | |
xmlChar *contentIO; /* in IO mode we may have a different base */ | |
}; | |
/** | |
* xmlBuf: | |
* | |
* A buffer structure, new one, the actual structure internals are not public | |
*/ | |
typedef struct _xmlBuf xmlBuf; | |
/** | |
* xmlBufPtr: | |
* | |
* A pointer to a buffer structure, the actual structure internals are not | |
* public | |
*/ | |
typedef xmlBuf *xmlBufPtr; | |
/* | |
* A few public routines for xmlBuf. As those are expected to be used | |
* mostly internally the bulk of the routines are internal in buf.h | |
*/ | |
XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBuf* buf); | |
XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (xmlBufPtr buf); | |
XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf); | |
XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len); | |
/* | |
* LIBXML2_NEW_BUFFER: | |
* | |
* Macro used to express that the API use the new buffers for | |
* xmlParserInputBuffer and xmlOutputBuffer. The change was | |
* introduced in 2.9.0. | |
*/ | |
#define LIBXML2_NEW_BUFFER | |
/** | |
* XML_XML_NAMESPACE: | |
* | |
* This is the namespace for the special xml: prefix predefined in the | |
* XML Namespace specification. | |
*/ | |
#define XML_XML_NAMESPACE \ | |
(const xmlChar *) "http://www.w3.org/XML/1998/namespace" | |
/** | |
* XML_XML_ID: | |
* | |
* This is the name for the special xml:id attribute | |
*/ | |
#define XML_XML_ID (const xmlChar *) "xml:id" | |
/* | |
* The different element types carried by an XML tree. | |
* | |
* NOTE: This is synchronized with DOM Level1 values | |
* See http://www.w3.org/TR/REC-DOM-Level-1/ | |
* | |
* Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should | |
* be deprecated to use an XML_DTD_NODE. | |
*/ | |
typedef enum { | |
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 | |
#ifdef LIBXML_DOCB_ENABLED | |
,XML_DOCB_DOCUMENT_NODE= 21 | |
#endif | |
} xmlElementType; | |
/** | |
* xmlNotation: | |
* | |
* A DTD Notation definition. | |
*/ | |
typedef struct _xmlNotation xmlNotation; | |
typedef xmlNotation *xmlNotationPtr; | |
struct _xmlNotation { | |
const xmlChar *name; /* Notation name */ | |
const xmlChar *PublicID; /* Public identifier, if any */ | |
const xmlChar *SystemID; /* System identifier, if any */ | |
}; | |
/** | |
* xmlAttributeType: | |
* | |
* A DTD Attribute type definition. | |
*/ | |
typedef enum { | |
XML_ATTRIBUTE_CDATA = 1, | |
XML_ATTRIBUTE_ID, | |
XML_ATTRIBUTE_IDREF , | |
XML_ATTRIBUTE_IDREFS, | |
XML_ATTRIBUTE_ENTITY, | |
XML_ATTRIBUTE_ENTITIES, | |
XML_ATTRIBUTE_NMTOKEN, | |
XML_ATTRIBUTE_NMTOKENS, | |
XML_ATTRIBUTE_ENUMERATION, | |
XML_ATTRIBUTE_NOTATION | |
} xmlAttributeType; | |
/** | |
* xmlAttributeDefault: | |
* | |
* A DTD Attribute default definition. | |
*/ | |
typedef enum { | |
XML_ATTRIBUTE_NONE = 1, | |
XML_ATTRIBUTE_REQUIRED, | |
XML_ATTRIBUTE_IMPLIED, | |
XML_ATTRIBUTE_FIXED | |
} xmlAttributeDefault; | |
/** | |
* xmlEnumeration: | |
* | |
* List structure used when there is an enumeration in DTDs. | |
*/ | |
typedef struct _xmlEnumeration xmlEnumeration; | |
typedef xmlEnumeration *xmlEnumerationPtr; | |
struct _xmlEnumeration { | |
struct _xmlEnumeration *next; /* next one */ | |
const xmlChar *name; /* Enumeration name */ | |
}; | |
/** | |
* xmlAttribute: | |
* | |
* An Attribute declaration in a DTD. | |
*/ | |
typedef struct _xmlAttribute xmlAttribute; | |
typedef xmlAttribute *xmlAttributePtr; | |
struct _xmlAttribute { | |
void *_private; /* application data */ | |
xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ | |
const xmlChar *name; /* Attribute name */ | |
struct _xmlNode *children; /* NULL */ | |
struct _xmlNode *last; /* NULL */ | |
struct _xmlDtd *parent; /* -> DTD */ | |
struct _xmlNode *next; /* next sibling link */ | |
struct _xmlNode *prev; /* previous sibling link */ | |
struct _xmlDoc *doc; /* the containing document */ | |
struct _xmlAttribute *nexth; /* next in hash table */ | |
xmlAttributeType atype; /* The attribute type */ | |
xmlAttributeDefault def; /* the default */ | |
const xmlChar *defaultValue; /* or the default value */ | |
xmlEnumerationPtr tree; /* or the enumeration tree if any */ | |
const xmlChar *prefix; /* the namespace prefix if any */ | |
const xmlChar *elem; /* Element holding the attribute */ | |
}; | |
/** | |
* xmlElementContentType: | |
* | |
* Possible definitions of element content types. | |
*/ | |
typedef enum { | |
XML_ELEMENT_CONTENT_PCDATA = 1, | |
XML_ELEMENT_CONTENT_ELEMENT, | |
XML_ELEMENT_CONTENT_SEQ, | |
XML_ELEMENT_CONTENT_OR | |
} xmlElementContentType; | |
/** | |
* xmlElementContentOccur: | |
* | |
* Possible definitions of element content occurrences. | |
*/ | |
typedef enum { | |
XML_ELEMENT_CONTENT_ONCE = 1, | |
XML_ELEMENT_CONTENT_OPT, | |
XML_ELEMENT_CONTENT_MULT, | |
XML_ELEMENT_CONTENT_PLUS | |
} xmlElementContentOccur; | |
/** | |
* xmlElementContent: | |
* | |
* An XML Element content as stored after parsing an element definition | |
* in a DTD. | |
*/ | |
typedef struct _xmlElementContent xmlElementContent; | |
typedef xmlElementContent *xmlElementContentPtr; | |
struct _xmlElementContent { | |
xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ | |
xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ | |
const xmlChar *name; /* Element name */ | |
struct _xmlElementContent *c1; /* first child */ | |
struct _xmlElementContent *c2; /* second child */ | |
struct _xmlElementContent *parent; /* parent */ | |
const xmlChar *prefix; /* Namespace prefix */ | |
}; | |
/** | |
* xmlElementTypeVal: | |
* | |
* The different possibilities for an element content type. | |
*/ | |
typedef enum { | |
XML_ELEMENT_TYPE_UNDEFINED = 0, | |
XML_ELEMENT_TYPE_EMPTY = 1, | |
XML_ELEMENT_TYPE_ANY, | |
XML_ELEMENT_TYPE_MIXED, | |
XML_ELEMENT_TYPE_ELEMENT | |
} xmlElementTypeVal; | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/xmlregexp.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlElement: | |
* | |
* An XML Element declaration from a DTD. | |
*/ | |
typedef struct _xmlElement xmlElement; | |
typedef xmlElement *xmlElementPtr; | |
struct _xmlElement { | |
void *_private; /* application data */ | |
xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ | |
const xmlChar *name; /* Element name */ | |
struct _xmlNode *children; /* NULL */ | |
struct _xmlNode *last; /* NULL */ | |
struct _xmlDtd *parent; /* -> DTD */ | |
struct _xmlNode *next; /* next sibling link */ | |
struct _xmlNode *prev; /* previous sibling link */ | |
struct _xmlDoc *doc; /* the containing document */ | |
xmlElementTypeVal etype; /* The type */ | |
xmlElementContentPtr content; /* the allowed element content */ | |
xmlAttributePtr attributes; /* List of the declared attributes */ | |
const xmlChar *prefix; /* the namespace prefix if any */ | |
#ifdef LIBXML_REGEXP_ENABLED | |
xmlRegexpPtr contModel; /* the validating regexp */ | |
#else | |
void *contModel; | |
#endif | |
}; | |
/** | |
* XML_LOCAL_NAMESPACE: | |
* | |
* A namespace declaration node. | |
*/ | |
#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL | |
typedef xmlElementType xmlNsType; | |
/** | |
* xmlNs: | |
* | |
* An XML namespace. | |
* Note that prefix == NULL is valid, it defines the default namespace | |
* within the subtree (until overridden). | |
* | |
* xmlNsType is unified with xmlElementType. | |
*/ | |
typedef struct _xmlNs xmlNs; | |
typedef xmlNs *xmlNsPtr; | |
struct _xmlNs { | |
struct _xmlNs *next; /* next Ns link for this node */ | |
xmlNsType type; /* global or local */ | |
const xmlChar *href; /* URL for the namespace */ | |
const xmlChar *prefix; /* prefix for the namespace */ | |
void *_private; /* application data */ | |
struct _xmlDoc *context; /* normally an xmlDoc */ | |
}; | |
/** | |
* xmlDtd: | |
* | |
* An XML DTD, as defined by <!DOCTYPE ... There is actually one for | |
* the internal subset and for the external subset. | |
*/ | |
typedef struct _xmlDtd xmlDtd; | |
typedef xmlDtd *xmlDtdPtr; | |
struct _xmlDtd { | |
void *_private; /* application data */ | |
xmlElementType type; /* XML_DTD_NODE, must be second ! */ | |
const xmlChar *name; /* Name of the DTD */ | |
struct _xmlNode *children; /* the value of the property link */ | |
struct _xmlNode *last; /* last child link */ | |
struct _xmlDoc *parent; /* child->parent link */ | |
struct _xmlNode *next; /* next sibling link */ | |
struct _xmlNode *prev; /* previous sibling link */ | |
struct _xmlDoc *doc; /* the containing document */ | |
/* End of common part */ | |
void *notations; /* Hash table for notations if any */ | |
void *elements; /* Hash table for elements if any */ | |
void *attributes; /* Hash table for attributes if any */ | |
void *entities; /* Hash table for entities if any */ | |
const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ | |
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ | |
void *pentities; /* Hash table for param entities if any */ | |
}; | |
/** | |
* xmlAttr: | |
* | |
* An attribute on an XML node. | |
*/ | |
typedef struct _xmlAttr xmlAttr; | |
typedef xmlAttr *xmlAttrPtr; | |
struct _xmlAttr { | |
void *_private; /* application data */ | |
xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ | |
const xmlChar *name; /* the name of the property */ | |
struct _xmlNode *children; /* the value of the property */ | |
struct _xmlNode *last; /* NULL */ | |
struct _xmlNode *parent; /* child->parent link */ | |
struct _xmlAttr *next; /* next sibling link */ | |
struct _xmlAttr *prev; /* previous sibling link */ | |
struct _xmlDoc *doc; /* the containing document */ | |
xmlNs *ns; /* pointer to the associated namespace */ | |
xmlAttributeType atype; /* the attribute type if validating */ | |
void *psvi; /* for type/PSVI informations */ | |
}; | |
/** | |
* xmlID: | |
* | |
* An XML ID instance. | |
*/ | |
typedef struct _xmlID xmlID; | |
typedef xmlID *xmlIDPtr; | |
struct _xmlID { | |
struct _xmlID *next; /* next ID */ | |
const xmlChar *value; /* The ID name */ | |
xmlAttrPtr attr; /* The attribute holding it */ | |
const xmlChar *name; /* The attribute if attr is not available */ | |
int lineno; /* The line number if attr is not available */ | |
struct _xmlDoc *doc; /* The document holding the ID */ | |
}; | |
/** | |
* xmlRef: | |
* | |
* An XML IDREF instance. | |
*/ | |
typedef struct _xmlRef xmlRef; | |
typedef xmlRef *xmlRefPtr; | |
struct _xmlRef { | |
struct _xmlRef *next; /* next Ref */ | |
const xmlChar *value; /* The Ref name */ | |
xmlAttrPtr attr; /* The attribute holding it */ | |
const xmlChar *name; /* The attribute if attr is not available */ | |
int lineno; /* The line number if attr is not available */ | |
}; | |
/** | |
* xmlNode: | |
* | |
* A node in an XML tree. | |
*/ | |
typedef struct _xmlNode xmlNode; | |
typedef xmlNode *xmlNodePtr; | |
struct _xmlNode { | |
void *_private; /* application data */ | |
xmlElementType type; /* type number, must be second ! */ | |
const xmlChar *name; /* the name of the node, or the entity */ | |
struct _xmlNode *children; /* parent->childs link */ | |
struct _xmlNode *last; /* last child link */ | |
struct _xmlNode *parent; /* child->parent link */ | |
struct _xmlNode *next; /* next sibling link */ | |
struct _xmlNode *prev; /* previous sibling link */ | |
struct _xmlDoc *doc; /* the containing document */ | |
/* End of common part */ | |
xmlNs *ns; /* pointer to the associated namespace */ | |
xmlChar *content; /* the content */ | |
struct _xmlAttr *properties;/* properties list */ | |
xmlNs *nsDef; /* namespace definitions on this node */ | |
void *psvi; /* for type/PSVI informations */ | |
unsigned short line; /* line number */ | |
unsigned short extra; /* extra data for XPath/XSLT */ | |
}; | |
/** | |
* XML_GET_CONTENT: | |
* | |
* Macro to extract the content pointer of a node. | |
*/ | |
#define XML_GET_CONTENT(n) \ | |
((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) | |
/** | |
* XML_GET_LINE: | |
* | |
* Macro to extract the line number of an element node. | |
*/ | |
#define XML_GET_LINE(n) \ | |
(xmlGetLineNo(n)) | |
/** | |
* xmlDocProperty | |
* | |
* Set of properties of the document as found by the parser | |
* Some of them are linked to similary named xmlParserOption | |
*/ | |
typedef enum { | |
XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ | |
XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ | |
XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ | |
XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ | |
XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ | |
XML_DOC_USERBUILT = 1<<5, /* Document was built using the API | |
and not by parsing an instance */ | |
XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ | |
XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ | |
} xmlDocProperties; | |
/** | |
* xmlDoc: | |
* | |
* An XML document. | |
*/ | |
typedef struct _xmlDoc xmlDoc; | |
typedef xmlDoc *xmlDocPtr; | |
struct _xmlDoc { | |
void *_private; /* application data */ | |
xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ | |
char *name; /* name/filename/URI of the document */ | |
struct _xmlNode *children; /* the document tree */ | |
struct _xmlNode *last; /* last child link */ | |
struct _xmlNode *parent; /* child->parent link */ | |
struct _xmlNode *next; /* next sibling link */ | |
struct _xmlNode *prev; /* previous sibling link */ | |
struct _xmlDoc *doc; /* autoreference to itself */ | |
/* End of common part */ | |
int compression;/* level of zlib compression */ | |
int standalone; /* standalone document (no external refs) | |
1 if standalone="yes" | |
0 if standalone="no" | |
-1 if there is no XML declaration | |
-2 if there is an XML declaration, but no | |
standalone attribute was specified */ | |
struct _xmlDtd *intSubset; /* the document internal subset */ | |
struct _xmlDtd *extSubset; /* the document external subset */ | |
struct _xmlNs *oldNs; /* Global namespace, the old way */ | |
const xmlChar *version; /* the XML version string */ | |
const xmlChar *encoding; /* external initial encoding, if any */ | |
void *ids; /* Hash table for ID attributes if any */ | |
void *refs; /* Hash table for IDREFs attributes if any */ | |
const xmlChar *URL; /* The URI for that document */ | |
int charset; /* encoding of the in-memory content | |
actually an xmlCharEncoding */ | |
struct _xmlDict *dict; /* dict used to allocate names or NULL */ | |
void *psvi; /* for type/PSVI informations */ | |
int parseFlags; /* set of xmlParserOption used to parse the | |
document */ | |
int properties; /* set of xmlDocProperties for this document | |
set at the end of parsing */ | |
}; | |
typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; | |
typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; | |
/** | |
* xmlDOMWrapAcquireNsFunction: | |
* @ctxt: a DOM wrapper context | |
* @node: the context node (element or attribute) | |
* @nsName: the requested namespace name | |
* @nsPrefix: the requested namespace prefix | |
* | |
* A function called to acquire namespaces (xmlNs) from the wrapper. | |
* | |
* Returns an xmlNsPtr or NULL in case of an error. | |
*/ | |
typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, | |
xmlNodePtr node, | |
const xmlChar *nsName, | |
const xmlChar *nsPrefix); | |
/** | |
* xmlDOMWrapCtxt: | |
* | |
* Context for DOM wrapper-operations. | |
*/ | |
struct _xmlDOMWrapCtxt { | |
void * _private; | |
/* | |
* The type of this context, just in case we need specialized | |
* contexts in the future. | |
*/ | |
int type; | |
/* | |
* Internal namespace map used for various operations. | |
*/ | |
void * namespaceMap; | |
/* | |
* Use this one to acquire an xmlNsPtr intended for node->ns. | |
* (Note that this is not intended for elem->nsDef). | |
*/ | |
xmlDOMWrapAcquireNsFunction getNsForNodeFunc; | |
}; | |
/** | |
* xmlChildrenNode: | |
* | |
* Macro for compatibility naming layer with libxml1. Maps | |
* to "children." | |
*/ | |
#ifndef xmlChildrenNode | |
#define xmlChildrenNode children | |
#endif | |
/** | |
* xmlRootNode: | |
* | |
* Macro for compatibility naming layer with libxml1. Maps | |
* to "children". | |
*/ | |
#ifndef xmlRootNode | |
#define xmlRootNode children | |
#endif | |
/* | |
* Variables. | |
*/ | |
/* | |
* Some helper functions | |
*/ | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ | |
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || \ | |
defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \ | |
defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \ | |
defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) | |
XMLPUBFUN int XMLCALL | |
xmlValidateNCName (const xmlChar *value, | |
int space); | |
#endif | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN int XMLCALL | |
xmlValidateQName (const xmlChar *value, | |
int space); | |
XMLPUBFUN int XMLCALL | |
xmlValidateName (const xmlChar *value, | |
int space); | |
XMLPUBFUN int XMLCALL | |
xmlValidateNMToken (const xmlChar *value, | |
int space); | |
#endif | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlBuildQName (const xmlChar *ncname, | |
const xmlChar *prefix, | |
xmlChar *memory, | |
int len); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlSplitQName2 (const xmlChar *name, | |
xmlChar **prefix); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlSplitQName3 (const xmlChar *name, | |
int *len); | |
/* | |
* Handling Buffers, the old ones see @xmlBuf for the new ones. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); | |
XMLPUBFUN xmlBufferAllocationScheme XMLCALL | |
xmlGetBufferAllocationScheme(void); | |
XMLPUBFUN xmlBufferPtr XMLCALL | |
xmlBufferCreate (void); | |
XMLPUBFUN xmlBufferPtr XMLCALL | |
xmlBufferCreateSize (size_t size); | |
XMLPUBFUN xmlBufferPtr XMLCALL | |
xmlBufferCreateStatic (void *mem, | |
size_t size); | |
XMLPUBFUN int XMLCALL | |
xmlBufferResize (xmlBufferPtr buf, | |
unsigned int size); | |
XMLPUBFUN void XMLCALL | |
xmlBufferFree (xmlBufferPtr buf); | |
XMLPUBFUN int XMLCALL | |
xmlBufferDump (FILE *file, | |
xmlBufferPtr buf); | |
XMLPUBFUN int XMLCALL | |
xmlBufferAdd (xmlBufferPtr buf, | |
const xmlChar *str, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlBufferAddHead (xmlBufferPtr buf, | |
const xmlChar *str, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlBufferCat (xmlBufferPtr buf, | |
const xmlChar *str); | |
XMLPUBFUN int XMLCALL | |
xmlBufferCCat (xmlBufferPtr buf, | |
const char *str); | |
XMLPUBFUN int XMLCALL | |
xmlBufferShrink (xmlBufferPtr buf, | |
unsigned int len); | |
XMLPUBFUN int XMLCALL | |
xmlBufferGrow (xmlBufferPtr buf, | |
unsigned int len); | |
XMLPUBFUN void XMLCALL | |
xmlBufferEmpty (xmlBufferPtr buf); | |
XMLPUBFUN const xmlChar* XMLCALL | |
xmlBufferContent (const xmlBuffer *buf); | |
XMLPUBFUN xmlChar* XMLCALL | |
xmlBufferDetach (xmlBufferPtr buf); | |
XMLPUBFUN void XMLCALL | |
xmlBufferSetAllocationScheme(xmlBufferPtr buf, | |
xmlBufferAllocationScheme scheme); | |
XMLPUBFUN int XMLCALL | |
xmlBufferLength (const xmlBuffer *buf); | |
/* | |
* Creating/freeing new structures. | |
*/ | |
XMLPUBFUN xmlDtdPtr XMLCALL | |
xmlCreateIntSubset (xmlDocPtr doc, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN xmlDtdPtr XMLCALL | |
xmlNewDtd (xmlDocPtr doc, | |
const xmlChar *name, | |
const xmlChar *ExternalID, | |
const xmlChar *SystemID); | |
XMLPUBFUN xmlDtdPtr XMLCALL | |
xmlGetIntSubset (const xmlDoc *doc); | |
XMLPUBFUN void XMLCALL | |
xmlFreeDtd (xmlDtdPtr cur); | |
#ifdef LIBXML_LEGACY_ENABLED | |
XMLPUBFUN xmlNsPtr XMLCALL | |
xmlNewGlobalNs (xmlDocPtr doc, | |
const xmlChar *href, | |
const xmlChar *prefix); | |
#endif /* LIBXML_LEGACY_ENABLED */ | |
XMLPUBFUN xmlNsPtr XMLCALL | |
xmlNewNs (xmlNodePtr node, | |
const xmlChar *href, | |
const xmlChar *prefix); | |
XMLPUBFUN void XMLCALL | |
xmlFreeNs (xmlNsPtr cur); | |
XMLPUBFUN void XMLCALL | |
xmlFreeNsList (xmlNsPtr cur); | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlNewDoc (const xmlChar *version); | |
XMLPUBFUN void XMLCALL | |
xmlFreeDoc (xmlDocPtr cur); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlNewDocProp (xmlDocPtr doc, | |
const xmlChar *name, | |
const xmlChar *value); | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ | |
defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlNewProp (xmlNodePtr node, | |
const xmlChar *name, | |
const xmlChar *value); | |
#endif | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlNewNsProp (xmlNodePtr node, | |
xmlNsPtr ns, | |
const xmlChar *name, | |
const xmlChar *value); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlNewNsPropEatName (xmlNodePtr node, | |
xmlNsPtr ns, | |
xmlChar *name, | |
const xmlChar *value); | |
XMLPUBFUN void XMLCALL | |
xmlFreePropList (xmlAttrPtr cur); | |
XMLPUBFUN void XMLCALL | |
xmlFreeProp (xmlAttrPtr cur); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlCopyProp (xmlNodePtr target, | |
xmlAttrPtr cur); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlCopyPropList (xmlNodePtr target, | |
xmlAttrPtr cur); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlDtdPtr XMLCALL | |
xmlCopyDtd (xmlDtdPtr dtd); | |
#endif /* LIBXML_TREE_ENABLED */ | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlCopyDoc (xmlDocPtr doc, | |
int recursive); | |
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ | |
/* | |
* Creating new nodes. | |
*/ | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocNode (xmlDocPtr doc, | |
xmlNsPtr ns, | |
const xmlChar *name, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocNodeEatName (xmlDocPtr doc, | |
xmlNsPtr ns, | |
xmlChar *name, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewNode (xmlNsPtr ns, | |
const xmlChar *name); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewNodeEatName (xmlNsPtr ns, | |
xmlChar *name); | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewChild (xmlNodePtr parent, | |
xmlNsPtr ns, | |
const xmlChar *name, | |
const xmlChar *content); | |
#endif | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocText (const xmlDoc *doc, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewText (const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocPI (xmlDocPtr doc, | |
const xmlChar *name, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewPI (const xmlChar *name, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocTextLen (xmlDocPtr doc, | |
const xmlChar *content, | |
int len); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewTextLen (const xmlChar *content, | |
int len); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocComment (xmlDocPtr doc, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewComment (const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewCDataBlock (xmlDocPtr doc, | |
const xmlChar *content, | |
int len); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewCharRef (xmlDocPtr doc, | |
const xmlChar *name); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewReference (const xmlDoc *doc, | |
const xmlChar *name); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlCopyNode (xmlNodePtr node, | |
int recursive); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlDocCopyNode (xmlNodePtr node, | |
xmlDocPtr doc, | |
int recursive); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlDocCopyNodeList (xmlDocPtr doc, | |
xmlNodePtr node); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlCopyNodeList (xmlNodePtr node); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewTextChild (xmlNodePtr parent, | |
xmlNsPtr ns, | |
const xmlChar *name, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocRawNode (xmlDocPtr doc, | |
xmlNsPtr ns, | |
const xmlChar *name, | |
const xmlChar *content); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNewDocFragment (xmlDocPtr doc); | |
#endif /* LIBXML_TREE_ENABLED */ | |
/* | |
* Navigating. | |
*/ | |
XMLPUBFUN long XMLCALL | |
xmlGetLineNo (const xmlNode *node); | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlGetNodePath (const xmlNode *node); | |
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlDocGetRootElement (const xmlDoc *doc); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlGetLastChild (const xmlNode *parent); | |
XMLPUBFUN int XMLCALL | |
xmlNodeIsText (const xmlNode *node); | |
XMLPUBFUN int XMLCALL | |
xmlIsBlankNode (const xmlNode *node); | |
/* | |
* Changing the structure. | |
*/ | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlDocSetRootElement (xmlDocPtr doc, | |
xmlNodePtr root); | |
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlNodeSetName (xmlNodePtr cur, | |
const xmlChar *name); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlAddChild (xmlNodePtr parent, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlAddChildList (xmlNodePtr parent, | |
xmlNodePtr cur); | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlReplaceNode (xmlNodePtr old, | |
xmlNodePtr cur); | |
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ | |
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlAddPrevSibling (xmlNodePtr cur, | |
xmlNodePtr elem); | |
#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlAddSibling (xmlNodePtr cur, | |
xmlNodePtr elem); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlAddNextSibling (xmlNodePtr cur, | |
xmlNodePtr elem); | |
XMLPUBFUN void XMLCALL | |
xmlUnlinkNode (xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlTextMerge (xmlNodePtr first, | |
xmlNodePtr second); | |
XMLPUBFUN int XMLCALL | |
xmlTextConcat (xmlNodePtr node, | |
const xmlChar *content, | |
int len); | |
XMLPUBFUN void XMLCALL | |
xmlFreeNodeList (xmlNodePtr cur); | |
XMLPUBFUN void XMLCALL | |
xmlFreeNode (xmlNodePtr cur); | |
XMLPUBFUN void XMLCALL | |
xmlSetTreeDoc (xmlNodePtr tree, | |
xmlDocPtr doc); | |
XMLPUBFUN void XMLCALL | |
xmlSetListDoc (xmlNodePtr list, | |
xmlDocPtr doc); | |
/* | |
* Namespaces. | |
*/ | |
XMLPUBFUN xmlNsPtr XMLCALL | |
xmlSearchNs (xmlDocPtr doc, | |
xmlNodePtr node, | |
const xmlChar *nameSpace); | |
XMLPUBFUN xmlNsPtr XMLCALL | |
xmlSearchNsByHref (xmlDocPtr doc, | |
xmlNodePtr node, | |
const xmlChar *href); | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ | |
defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN xmlNsPtr * XMLCALL | |
xmlGetNsList (const xmlDoc *doc, | |
const xmlNode *node); | |
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ | |
XMLPUBFUN void XMLCALL | |
xmlSetNs (xmlNodePtr node, | |
xmlNsPtr ns); | |
XMLPUBFUN xmlNsPtr XMLCALL | |
xmlCopyNamespace (xmlNsPtr cur); | |
XMLPUBFUN xmlNsPtr XMLCALL | |
xmlCopyNamespaceList (xmlNsPtr cur); | |
/* | |
* Changing the content. | |
*/ | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ | |
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlSetProp (xmlNodePtr node, | |
const xmlChar *name, | |
const xmlChar *value); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlSetNsProp (xmlNodePtr node, | |
xmlNsPtr ns, | |
const xmlChar *name, | |
const xmlChar *value); | |
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ | |
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlGetNoNsProp (const xmlNode *node, | |
const xmlChar *name); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlGetProp (const xmlNode *node, | |
const xmlChar *name); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlHasProp (const xmlNode *node, | |
const xmlChar *name); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlHasNsProp (const xmlNode *node, | |
const xmlChar *name, | |
const xmlChar *nameSpace); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlGetNsProp (const xmlNode *node, | |
const xmlChar *name, | |
const xmlChar *nameSpace); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlStringGetNodeList (const xmlDoc *doc, | |
const xmlChar *value); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlStringLenGetNodeList (const xmlDoc *doc, | |
const xmlChar *value, | |
int len); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNodeListGetString (xmlDocPtr doc, | |
const xmlNode *list, | |
int inLine); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNodeListGetRawString (const xmlDoc *doc, | |
const xmlNode *list, | |
int inLine); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlNodeSetContent (xmlNodePtr cur, | |
const xmlChar *content); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlNodeSetContentLen (xmlNodePtr cur, | |
const xmlChar *content, | |
int len); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlNodeAddContent (xmlNodePtr cur, | |
const xmlChar *content); | |
XMLPUBFUN void XMLCALL | |
xmlNodeAddContentLen (xmlNodePtr cur, | |
const xmlChar *content, | |
int len); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNodeGetContent (const xmlNode *cur); | |
XMLPUBFUN int XMLCALL | |
xmlNodeBufGetContent (xmlBufferPtr buffer, | |
const xmlNode *cur); | |
XMLPUBFUN int XMLCALL | |
xmlBufGetNodeContent (xmlBufPtr buf, | |
const xmlNode *cur); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNodeGetLang (const xmlNode *cur); | |
XMLPUBFUN int XMLCALL | |
xmlNodeGetSpacePreserve (const xmlNode *cur); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlNodeSetLang (xmlNodePtr cur, | |
const xmlChar *lang); | |
XMLPUBFUN void XMLCALL | |
xmlNodeSetSpacePreserve (xmlNodePtr cur, | |
int val); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNodeGetBase (const xmlDoc *doc, | |
const xmlNode *cur); | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) | |
XMLPUBFUN void XMLCALL | |
xmlNodeSetBase (xmlNodePtr cur, | |
const xmlChar *uri); | |
#endif | |
/* | |
* Removing content. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlRemoveProp (xmlAttrPtr cur); | |
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN int XMLCALL | |
xmlUnsetNsProp (xmlNodePtr node, | |
xmlNsPtr ns, | |
const xmlChar *name); | |
XMLPUBFUN int XMLCALL | |
xmlUnsetProp (xmlNodePtr node, | |
const xmlChar *name); | |
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ | |
/* | |
* Internal, don't use. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlBufferWriteCHAR (xmlBufferPtr buf, | |
const xmlChar *string); | |
XMLPUBFUN void XMLCALL | |
xmlBufferWriteChar (xmlBufferPtr buf, | |
const char *string); | |
XMLPUBFUN void XMLCALL | |
xmlBufferWriteQuotedString(xmlBufferPtr buf, | |
const xmlChar *string); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, | |
xmlDocPtr doc, | |
xmlAttrPtr attr, | |
const xmlChar *string); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
#ifdef LIBXML_TREE_ENABLED | |
/* | |
* Namespace handling. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlReconciliateNs (xmlDocPtr doc, | |
xmlNodePtr tree); | |
#endif | |
#ifdef LIBXML_OUTPUT_ENABLED | |
/* | |
* Saving. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlDocDumpFormatMemory (xmlDocPtr cur, | |
xmlChar **mem, | |
int *size, | |
int format); | |
XMLPUBFUN void XMLCALL | |
xmlDocDumpMemory (xmlDocPtr cur, | |
xmlChar **mem, | |
int *size); | |
XMLPUBFUN void XMLCALL | |
xmlDocDumpMemoryEnc (xmlDocPtr out_doc, | |
xmlChar **doc_txt_ptr, | |
int * doc_txt_len, | |
const char *txt_encoding); | |
XMLPUBFUN void XMLCALL | |
xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, | |
xmlChar **doc_txt_ptr, | |
int * doc_txt_len, | |
const char *txt_encoding, | |
int format); | |
XMLPUBFUN int XMLCALL | |
xmlDocFormatDump (FILE *f, | |
xmlDocPtr cur, | |
int format); | |
XMLPUBFUN int XMLCALL | |
xmlDocDump (FILE *f, | |
xmlDocPtr cur); | |
XMLPUBFUN void XMLCALL | |
xmlElemDump (FILE *f, | |
xmlDocPtr doc, | |
xmlNodePtr cur); | |
XMLPUBFUN int XMLCALL | |
xmlSaveFile (const char *filename, | |
xmlDocPtr cur); | |
XMLPUBFUN int XMLCALL | |
xmlSaveFormatFile (const char *filename, | |
xmlDocPtr cur, | |
int format); | |
XMLPUBFUN size_t XMLCALL | |
xmlBufNodeDump (xmlBufPtr buf, | |
xmlDocPtr doc, | |
xmlNodePtr cur, | |
int level, | |
int format); | |
XMLPUBFUN int XMLCALL | |
xmlNodeDump (xmlBufferPtr buf, | |
xmlDocPtr doc, | |
xmlNodePtr cur, | |
int level, | |
int format); | |
XMLPUBFUN int XMLCALL | |
xmlSaveFileTo (xmlOutputBufferPtr buf, | |
xmlDocPtr cur, | |
const char *encoding); | |
XMLPUBFUN int XMLCALL | |
xmlSaveFormatFileTo (xmlOutputBufferPtr buf, | |
xmlDocPtr cur, | |
const char *encoding, | |
int format); | |
XMLPUBFUN void XMLCALL | |
xmlNodeDumpOutput (xmlOutputBufferPtr buf, | |
xmlDocPtr doc, | |
xmlNodePtr cur, | |
int level, | |
int format, | |
const char *encoding); | |
XMLPUBFUN int XMLCALL | |
xmlSaveFormatFileEnc (const char *filename, | |
xmlDocPtr cur, | |
const char *encoding, | |
int format); | |
XMLPUBFUN int XMLCALL | |
xmlSaveFileEnc (const char *filename, | |
xmlDocPtr cur, | |
const char *encoding); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* | |
* XHTML | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlIsXHTML (const xmlChar *systemID, | |
const xmlChar *publicID); | |
/* | |
* Compression. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlGetDocCompressMode (const xmlDoc *doc); | |
XMLPUBFUN void XMLCALL | |
xmlSetDocCompressMode (xmlDocPtr doc, | |
int mode); | |
XMLPUBFUN int XMLCALL | |
xmlGetCompressMode (void); | |
XMLPUBFUN void XMLCALL | |
xmlSetCompressMode (int mode); | |
/* | |
* DOM-wrapper helper functions. | |
*/ | |
XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL | |
xmlDOMWrapNewCtxt (void); | |
XMLPUBFUN void XMLCALL | |
xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, | |
xmlNodePtr elem, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, | |
xmlDocPtr sourceDoc, | |
xmlNodePtr node, | |
xmlDocPtr destDoc, | |
xmlNodePtr destParent, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr node, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, | |
xmlDocPtr sourceDoc, | |
xmlNodePtr node, | |
xmlNodePtr *clonedNode, | |
xmlDocPtr destDoc, | |
xmlNodePtr destParent, | |
int deep, | |
int options); | |
#ifdef LIBXML_TREE_ENABLED | |
/* | |
* 5 interfaces from DOM ElementTraversal, but different in entities | |
* traversal. | |
*/ | |
XMLPUBFUN unsigned long XMLCALL | |
xmlChildElementCount (xmlNodePtr parent); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlNextElementSibling (xmlNodePtr node); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlFirstElementChild (xmlNodePtr parent); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlLastElementChild (xmlNodePtr parent); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlPreviousElementSibling (xmlNodePtr node); | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#ifndef __XML_PARSER_H__ | |
#include <libxml/xmlmemory.h> | |
#endif | |
#endif /* __XML_TREE_H__ */ | |
/** | |
* Summary: library of generic URI related routines | |
* Description: library of generic URI related routines | |
* Implements RFC 2396 | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_URI_H__ | |
#define __XML_URI_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlURI: | |
* | |
* A parsed URI reference. This is a struct containing the various fields | |
* as described in RFC 2396 but separated for further processing. | |
* | |
* Note: query is a deprecated field which is incorrectly unescaped. | |
* query_raw takes precedence over query if the former is set. | |
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 | |
*/ | |
typedef struct _xmlURI xmlURI; | |
typedef xmlURI *xmlURIPtr; | |
struct _xmlURI { | |
char *scheme; /* the URI scheme */ | |
char *opaque; /* opaque part */ | |
char *authority; /* the authority part */ | |
char *server; /* the server part */ | |
char *user; /* the user part */ | |
int port; /* the port number */ | |
char *path; /* the path string */ | |
char *query; /* the query string (deprecated - use with caution) */ | |
char *fragment; /* the fragment identifier */ | |
int cleanup; /* parsing potentially unclean URI */ | |
char *query_raw; /* the query string (as it appears in the URI) */ | |
}; | |
/* | |
* This function is in tree.h: | |
* xmlChar * xmlNodeGetBase (xmlDocPtr doc, | |
* xmlNodePtr cur); | |
*/ | |
XMLPUBFUN xmlURIPtr XMLCALL | |
xmlCreateURI (void); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlBuildURI (const xmlChar *URI, | |
const xmlChar *base); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlBuildRelativeURI (const xmlChar *URI, | |
const xmlChar *base); | |
XMLPUBFUN xmlURIPtr XMLCALL | |
xmlParseURI (const char *str); | |
XMLPUBFUN xmlURIPtr XMLCALL | |
xmlParseURIRaw (const char *str, | |
int raw); | |
XMLPUBFUN int XMLCALL | |
xmlParseURIReference (xmlURIPtr uri, | |
const char *str); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlSaveUri (xmlURIPtr uri); | |
XMLPUBFUN void XMLCALL | |
xmlPrintURI (FILE *stream, | |
xmlURIPtr uri); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlURIEscapeStr (const xmlChar *str, | |
const xmlChar *list); | |
XMLPUBFUN char * XMLCALL | |
xmlURIUnescapeString (const char *str, | |
int len, | |
char *target); | |
XMLPUBFUN int XMLCALL | |
xmlNormalizeURIPath (char *path); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlURIEscape (const xmlChar *str); | |
XMLPUBFUN void XMLCALL | |
xmlFreeURI (xmlURIPtr uri); | |
XMLPUBFUN xmlChar* XMLCALL | |
xmlCanonicPath (const xmlChar *path); | |
XMLPUBFUN xmlChar* XMLCALL | |
xmlPathToURI (const xmlChar *path); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_URI_H__ */ |
/* | |
* Summary: The DTD validation | |
* Description: API for the DTD handling and the validity checking | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_VALID_H__ | |
#define __XML_VALID_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/xmlerror.h> | |
#include <libxml/tree.h> | |
#include <libxml/list.h> | |
#include <libxml/xmlautomata.h> | |
#include <libxml/xmlregexp.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Validation state added for non-determinist content model. | |
*/ | |
typedef struct _xmlValidState xmlValidState; | |
typedef xmlValidState *xmlValidStatePtr; | |
/** | |
* xmlValidityErrorFunc: | |
* @ctx: usually an xmlValidCtxtPtr to a validity error context, | |
* but comes from ctxt->userData (which normally contains such | |
* a pointer); ctxt->userData can be changed by the user. | |
* @msg: the string to format *printf like vararg | |
* @...: remaining arguments to the format | |
* | |
* Callback called when a validity error is found. This is a message | |
* oriented function similar to an *printf function. | |
*/ | |
typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* xmlValidityWarningFunc: | |
* @ctx: usually an xmlValidCtxtPtr to a validity error context, | |
* but comes from ctxt->userData (which normally contains such | |
* a pointer); ctxt->userData can be changed by the user. | |
* @msg: the string to format *printf like vararg | |
* @...: remaining arguments to the format | |
* | |
* Callback called when a validity warning is found. This is a message | |
* oriented function similar to an *printf function. | |
*/ | |
typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
#ifdef IN_LIBXML | |
/** | |
* XML_CTXT_FINISH_DTD_0: | |
* | |
* Special value for finishDtd field when embedded in an xmlParserCtxt | |
*/ | |
#define XML_CTXT_FINISH_DTD_0 0xabcd1234 | |
/** | |
* XML_CTXT_FINISH_DTD_1: | |
* | |
* Special value for finishDtd field when embedded in an xmlParserCtxt | |
*/ | |
#define XML_CTXT_FINISH_DTD_1 0xabcd1235 | |
#endif | |
/* | |
* xmlValidCtxt: | |
* An xmlValidCtxt is used for error reporting when validating. | |
*/ | |
typedef struct _xmlValidCtxt xmlValidCtxt; | |
typedef xmlValidCtxt *xmlValidCtxtPtr; | |
struct _xmlValidCtxt { | |
void *userData; /* user specific data block */ | |
xmlValidityErrorFunc error; /* the callback in case of errors */ | |
xmlValidityWarningFunc warning; /* the callback in case of warning */ | |
/* Node analysis stack used when validating within entities */ | |
xmlNodePtr node; /* Current parsed Node */ | |
int nodeNr; /* Depth of the parsing stack */ | |
int nodeMax; /* Max depth of the parsing stack */ | |
xmlNodePtr *nodeTab; /* array of nodes */ | |
unsigned int finishDtd; /* finished validating the Dtd ? */ | |
xmlDocPtr doc; /* the document */ | |
int valid; /* temporary validity check result */ | |
/* state state used for non-determinist content validation */ | |
xmlValidState *vstate; /* current state */ | |
int vstateNr; /* Depth of the validation stack */ | |
int vstateMax; /* Max depth of the validation stack */ | |
xmlValidState *vstateTab; /* array of validation states */ | |
#ifdef LIBXML_REGEXP_ENABLED | |
xmlAutomataPtr am; /* the automata */ | |
xmlAutomataStatePtr state; /* used to build the automata */ | |
#else | |
void *am; | |
void *state; | |
#endif | |
}; | |
/* | |
* ALL notation declarations are stored in a table. | |
* There is one table per DTD. | |
*/ | |
typedef struct _xmlHashTable xmlNotationTable; | |
typedef xmlNotationTable *xmlNotationTablePtr; | |
/* | |
* ALL element declarations are stored in a table. | |
* There is one table per DTD. | |
*/ | |
typedef struct _xmlHashTable xmlElementTable; | |
typedef xmlElementTable *xmlElementTablePtr; | |
/* | |
* ALL attribute declarations are stored in a table. | |
* There is one table per DTD. | |
*/ | |
typedef struct _xmlHashTable xmlAttributeTable; | |
typedef xmlAttributeTable *xmlAttributeTablePtr; | |
/* | |
* ALL IDs attributes are stored in a table. | |
* There is one table per document. | |
*/ | |
typedef struct _xmlHashTable xmlIDTable; | |
typedef xmlIDTable *xmlIDTablePtr; | |
/* | |
* ALL Refs attributes are stored in a table. | |
* There is one table per document. | |
*/ | |
typedef struct _xmlHashTable xmlRefTable; | |
typedef xmlRefTable *xmlRefTablePtr; | |
/* Notation */ | |
XMLPUBFUN xmlNotationPtr XMLCALL | |
xmlAddNotationDecl (xmlValidCtxtPtr ctxt, | |
xmlDtdPtr dtd, | |
const xmlChar *name, | |
const xmlChar *PublicID, | |
const xmlChar *SystemID); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlNotationTablePtr XMLCALL | |
xmlCopyNotationTable (xmlNotationTablePtr table); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlFreeNotationTable (xmlNotationTablePtr table); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlDumpNotationDecl (xmlBufferPtr buf, | |
xmlNotationPtr nota); | |
XMLPUBFUN void XMLCALL | |
xmlDumpNotationTable (xmlBufferPtr buf, | |
xmlNotationTablePtr table); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* Element Content */ | |
/* the non Doc version are being deprecated */ | |
XMLPUBFUN xmlElementContentPtr XMLCALL | |
xmlNewElementContent (const xmlChar *name, | |
xmlElementContentType type); | |
XMLPUBFUN xmlElementContentPtr XMLCALL | |
xmlCopyElementContent (xmlElementContentPtr content); | |
XMLPUBFUN void XMLCALL | |
xmlFreeElementContent (xmlElementContentPtr cur); | |
/* the new versions with doc argument */ | |
XMLPUBFUN xmlElementContentPtr XMLCALL | |
xmlNewDocElementContent (xmlDocPtr doc, | |
const xmlChar *name, | |
xmlElementContentType type); | |
XMLPUBFUN xmlElementContentPtr XMLCALL | |
xmlCopyDocElementContent(xmlDocPtr doc, | |
xmlElementContentPtr content); | |
XMLPUBFUN void XMLCALL | |
xmlFreeDocElementContent(xmlDocPtr doc, | |
xmlElementContentPtr cur); | |
XMLPUBFUN void XMLCALL | |
xmlSnprintfElementContent(char *buf, | |
int size, | |
xmlElementContentPtr content, | |
int englob); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
/* DEPRECATED */ | |
XMLPUBFUN void XMLCALL | |
xmlSprintfElementContent(char *buf, | |
xmlElementContentPtr content, | |
int englob); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* DEPRECATED */ | |
/* Element */ | |
XMLPUBFUN xmlElementPtr XMLCALL | |
xmlAddElementDecl (xmlValidCtxtPtr ctxt, | |
xmlDtdPtr dtd, | |
const xmlChar *name, | |
xmlElementTypeVal type, | |
xmlElementContentPtr content); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlElementTablePtr XMLCALL | |
xmlCopyElementTable (xmlElementTablePtr table); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlFreeElementTable (xmlElementTablePtr table); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlDumpElementTable (xmlBufferPtr buf, | |
xmlElementTablePtr table); | |
XMLPUBFUN void XMLCALL | |
xmlDumpElementDecl (xmlBufferPtr buf, | |
xmlElementPtr elem); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* Enumeration */ | |
XMLPUBFUN xmlEnumerationPtr XMLCALL | |
xmlCreateEnumeration (const xmlChar *name); | |
XMLPUBFUN void XMLCALL | |
xmlFreeEnumeration (xmlEnumerationPtr cur); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlEnumerationPtr XMLCALL | |
xmlCopyEnumeration (xmlEnumerationPtr cur); | |
#endif /* LIBXML_TREE_ENABLED */ | |
/* Attribute */ | |
XMLPUBFUN xmlAttributePtr XMLCALL | |
xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, | |
xmlDtdPtr dtd, | |
const xmlChar *elem, | |
const xmlChar *name, | |
const xmlChar *ns, | |
xmlAttributeType type, | |
xmlAttributeDefault def, | |
const xmlChar *defaultValue, | |
xmlEnumerationPtr tree); | |
#ifdef LIBXML_TREE_ENABLED | |
XMLPUBFUN xmlAttributeTablePtr XMLCALL | |
xmlCopyAttributeTable (xmlAttributeTablePtr table); | |
#endif /* LIBXML_TREE_ENABLED */ | |
XMLPUBFUN void XMLCALL | |
xmlFreeAttributeTable (xmlAttributeTablePtr table); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlDumpAttributeTable (xmlBufferPtr buf, | |
xmlAttributeTablePtr table); | |
XMLPUBFUN void XMLCALL | |
xmlDumpAttributeDecl (xmlBufferPtr buf, | |
xmlAttributePtr attr); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* IDs */ | |
XMLPUBFUN xmlIDPtr XMLCALL | |
xmlAddID (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
const xmlChar *value, | |
xmlAttrPtr attr); | |
XMLPUBFUN void XMLCALL | |
xmlFreeIDTable (xmlIDTablePtr table); | |
XMLPUBFUN xmlAttrPtr XMLCALL | |
xmlGetID (xmlDocPtr doc, | |
const xmlChar *ID); | |
XMLPUBFUN int XMLCALL | |
xmlIsID (xmlDocPtr doc, | |
xmlNodePtr elem, | |
xmlAttrPtr attr); | |
XMLPUBFUN int XMLCALL | |
xmlRemoveID (xmlDocPtr doc, | |
xmlAttrPtr attr); | |
/* IDREFs */ | |
XMLPUBFUN xmlRefPtr XMLCALL | |
xmlAddRef (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
const xmlChar *value, | |
xmlAttrPtr attr); | |
XMLPUBFUN void XMLCALL | |
xmlFreeRefTable (xmlRefTablePtr table); | |
XMLPUBFUN int XMLCALL | |
xmlIsRef (xmlDocPtr doc, | |
xmlNodePtr elem, | |
xmlAttrPtr attr); | |
XMLPUBFUN int XMLCALL | |
xmlRemoveRef (xmlDocPtr doc, | |
xmlAttrPtr attr); | |
XMLPUBFUN xmlListPtr XMLCALL | |
xmlGetRefs (xmlDocPtr doc, | |
const xmlChar *ID); | |
/** | |
* The public function calls related to validity checking. | |
*/ | |
#ifdef LIBXML_VALID_ENABLED | |
/* Allocate/Release Validation Contexts */ | |
XMLPUBFUN xmlValidCtxtPtr XMLCALL | |
xmlNewValidCtxt(void); | |
XMLPUBFUN void XMLCALL | |
xmlFreeValidCtxt(xmlValidCtxtPtr); | |
XMLPUBFUN int XMLCALL | |
xmlValidateRoot (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlValidateElementDecl (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlElementPtr elem); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlValidNormalizeAttributeValue(xmlDocPtr doc, | |
xmlNodePtr elem, | |
const xmlChar *name, | |
const xmlChar *value); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem, | |
const xmlChar *name, | |
const xmlChar *value); | |
XMLPUBFUN int XMLCALL | |
xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlAttributePtr attr); | |
XMLPUBFUN int XMLCALL | |
xmlValidateAttributeValue(xmlAttributeType type, | |
const xmlChar *value); | |
XMLPUBFUN int XMLCALL | |
xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNotationPtr nota); | |
XMLPUBFUN int XMLCALL | |
xmlValidateDtd (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlDtdPtr dtd); | |
XMLPUBFUN int XMLCALL | |
xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlValidateDocument (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlValidateElement (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem); | |
XMLPUBFUN int XMLCALL | |
xmlValidateOneElement (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem); | |
XMLPUBFUN int XMLCALL | |
xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem, | |
xmlAttrPtr attr, | |
const xmlChar *value); | |
XMLPUBFUN int XMLCALL | |
xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem, | |
const xmlChar *prefix, | |
xmlNsPtr ns, | |
const xmlChar *value); | |
XMLPUBFUN int XMLCALL | |
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc); | |
#endif /* LIBXML_VALID_ENABLED */ | |
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN int XMLCALL | |
xmlValidateNotationUse (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
const xmlChar *notationName); | |
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
xmlIsMixedElement (xmlDocPtr doc, | |
const xmlChar *name); | |
XMLPUBFUN xmlAttributePtr XMLCALL | |
xmlGetDtdAttrDesc (xmlDtdPtr dtd, | |
const xmlChar *elem, | |
const xmlChar *name); | |
XMLPUBFUN xmlAttributePtr XMLCALL | |
xmlGetDtdQAttrDesc (xmlDtdPtr dtd, | |
const xmlChar *elem, | |
const xmlChar *name, | |
const xmlChar *prefix); | |
XMLPUBFUN xmlNotationPtr XMLCALL | |
xmlGetDtdNotationDesc (xmlDtdPtr dtd, | |
const xmlChar *name); | |
XMLPUBFUN xmlElementPtr XMLCALL | |
xmlGetDtdQElementDesc (xmlDtdPtr dtd, | |
const xmlChar *name, | |
const xmlChar *prefix); | |
XMLPUBFUN xmlElementPtr XMLCALL | |
xmlGetDtdElementDesc (xmlDtdPtr dtd, | |
const xmlChar *name); | |
#ifdef LIBXML_VALID_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlValidGetPotentialChildren(xmlElementContent *ctree, | |
const xmlChar **names, | |
int *len, | |
int max); | |
XMLPUBFUN int XMLCALL | |
xmlValidGetValidElements(xmlNode *prev, | |
xmlNode *next, | |
const xmlChar **names, | |
int max); | |
XMLPUBFUN int XMLCALL | |
xmlValidateNameValue (const xmlChar *value); | |
XMLPUBFUN int XMLCALL | |
xmlValidateNamesValue (const xmlChar *value); | |
XMLPUBFUN int XMLCALL | |
xmlValidateNmtokenValue (const xmlChar *value); | |
XMLPUBFUN int XMLCALL | |
xmlValidateNmtokensValue(const xmlChar *value); | |
#ifdef LIBXML_REGEXP_ENABLED | |
/* | |
* Validation based on the regexp support | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, | |
xmlElementPtr elem); | |
XMLPUBFUN int XMLCALL | |
xmlValidatePushElement (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem, | |
const xmlChar *qname); | |
XMLPUBFUN int XMLCALL | |
xmlValidatePushCData (xmlValidCtxtPtr ctxt, | |
const xmlChar *data, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlValidatePopElement (xmlValidCtxtPtr ctxt, | |
xmlDocPtr doc, | |
xmlNodePtr elem, | |
const xmlChar *qname); | |
#endif /* LIBXML_REGEXP_ENABLED */ | |
#endif /* LIBXML_VALID_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_VALID_H__ */ |
/* | |
* Summary: implementation of XInclude | |
* Description: API to handle XInclude processing, | |
* implements the | |
* World Wide Web Consortium Last Call Working Draft 10 November 2003 | |
* http://www.w3.org/TR/2003/WD-xinclude-20031110 | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XINCLUDE_H__ | |
#define __XML_XINCLUDE_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#ifdef LIBXML_XINCLUDE_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XINCLUDE_NS: | |
* | |
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude | |
*/ | |
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude" | |
/** | |
* XINCLUDE_OLD_NS: | |
* | |
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude | |
*/ | |
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude" | |
/** | |
* XINCLUDE_NODE: | |
* | |
* Macro defining "include" | |
*/ | |
#define XINCLUDE_NODE (const xmlChar *) "include" | |
/** | |
* XINCLUDE_FALLBACK: | |
* | |
* Macro defining "fallback" | |
*/ | |
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback" | |
/** | |
* XINCLUDE_HREF: | |
* | |
* Macro defining "href" | |
*/ | |
#define XINCLUDE_HREF (const xmlChar *) "href" | |
/** | |
* XINCLUDE_PARSE: | |
* | |
* Macro defining "parse" | |
*/ | |
#define XINCLUDE_PARSE (const xmlChar *) "parse" | |
/** | |
* XINCLUDE_PARSE_XML: | |
* | |
* Macro defining "xml" | |
*/ | |
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml" | |
/** | |
* XINCLUDE_PARSE_TEXT: | |
* | |
* Macro defining "text" | |
*/ | |
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text" | |
/** | |
* XINCLUDE_PARSE_ENCODING: | |
* | |
* Macro defining "encoding" | |
*/ | |
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding" | |
/** | |
* XINCLUDE_PARSE_XPOINTER: | |
* | |
* Macro defining "xpointer" | |
*/ | |
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer" | |
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; | |
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; | |
/* | |
* standalone processing | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeProcess (xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeProcessFlags (xmlDocPtr doc, | |
int flags); | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeProcessFlagsData(xmlDocPtr doc, | |
int flags, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, | |
int flags, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeProcessTree (xmlNodePtr tree); | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeProcessTreeFlags(xmlNodePtr tree, | |
int flags); | |
/* | |
* contextual processing | |
*/ | |
XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL | |
xmlXIncludeNewContext (xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt, | |
int flags); | |
XMLPUBFUN void XMLCALL | |
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt, | |
xmlNodePtr tree); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_XINCLUDE_ENABLED */ | |
#endif /* __XML_XINCLUDE_H__ */ |
/* | |
* Summary: unfinished XLink detection module | |
* Description: unfinished XLink detection module | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XLINK_H__ | |
#define __XML_XLINK_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#ifdef LIBXML_XPTR_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* Various defines for the various Link properties. | |
* | |
* NOTE: the link detection layer will try to resolve QName expansion | |
* of namespaces. If "foo" is the prefix for "http://foo.com/" | |
* then the link detection layer will expand role="foo:myrole" | |
* to "http://foo.com/:myrole". | |
* NOTE: the link detection layer will expand URI-Refences found on | |
* href attributes by using the base mechanism if found. | |
*/ | |
typedef xmlChar *xlinkHRef; | |
typedef xmlChar *xlinkRole; | |
typedef xmlChar *xlinkTitle; | |
typedef enum { | |
XLINK_TYPE_NONE = 0, | |
XLINK_TYPE_SIMPLE, | |
XLINK_TYPE_EXTENDED, | |
XLINK_TYPE_EXTENDED_SET | |
} xlinkType; | |
typedef enum { | |
XLINK_SHOW_NONE = 0, | |
XLINK_SHOW_NEW, | |
XLINK_SHOW_EMBED, | |
XLINK_SHOW_REPLACE | |
} xlinkShow; | |
typedef enum { | |
XLINK_ACTUATE_NONE = 0, | |
XLINK_ACTUATE_AUTO, | |
XLINK_ACTUATE_ONREQUEST | |
} xlinkActuate; | |
/** | |
* xlinkNodeDetectFunc: | |
* @ctx: user data pointer | |
* @node: the node to check | |
* | |
* This is the prototype for the link detection routine. | |
* It calls the default link detection callbacks upon link detection. | |
*/ | |
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); | |
/* | |
* The link detection module interact with the upper layers using | |
* a set of callback registered at parsing time. | |
*/ | |
/** | |
* xlinkSimpleLinkFunk: | |
* @ctx: user data pointer | |
* @node: the node carrying the link | |
* @href: the target of the link | |
* @role: the role string | |
* @title: the link title | |
* | |
* This is the prototype for a simple link detection callback. | |
*/ | |
typedef void | |
(*xlinkSimpleLinkFunk) (void *ctx, | |
xmlNodePtr node, | |
const xlinkHRef href, | |
const xlinkRole role, | |
const xlinkTitle title); | |
/** | |
* xlinkExtendedLinkFunk: | |
* @ctx: user data pointer | |
* @node: the node carrying the link | |
* @nbLocators: the number of locators detected on the link | |
* @hrefs: pointer to the array of locator hrefs | |
* @roles: pointer to the array of locator roles | |
* @nbArcs: the number of arcs detected on the link | |
* @from: pointer to the array of source roles found on the arcs | |
* @to: pointer to the array of target roles found on the arcs | |
* @show: array of values for the show attributes found on the arcs | |
* @actuate: array of values for the actuate attributes found on the arcs | |
* @nbTitles: the number of titles detected on the link | |
* @title: array of titles detected on the link | |
* @langs: array of xml:lang values for the titles | |
* | |
* This is the prototype for a extended link detection callback. | |
*/ | |
typedef void | |
(*xlinkExtendedLinkFunk)(void *ctx, | |
xmlNodePtr node, | |
int nbLocators, | |
const xlinkHRef *hrefs, | |
const xlinkRole *roles, | |
int nbArcs, | |
const xlinkRole *from, | |
const xlinkRole *to, | |
xlinkShow *show, | |
xlinkActuate *actuate, | |
int nbTitles, | |
const xlinkTitle *titles, | |
const xmlChar **langs); | |
/** | |
* xlinkExtendedLinkSetFunk: | |
* @ctx: user data pointer | |
* @node: the node carrying the link | |
* @nbLocators: the number of locators detected on the link | |
* @hrefs: pointer to the array of locator hrefs | |
* @roles: pointer to the array of locator roles | |
* @nbTitles: the number of titles detected on the link | |
* @title: array of titles detected on the link | |
* @langs: array of xml:lang values for the titles | |
* | |
* This is the prototype for a extended link set detection callback. | |
*/ | |
typedef void | |
(*xlinkExtendedLinkSetFunk) (void *ctx, | |
xmlNodePtr node, | |
int nbLocators, | |
const xlinkHRef *hrefs, | |
const xlinkRole *roles, | |
int nbTitles, | |
const xlinkTitle *titles, | |
const xmlChar **langs); | |
/** | |
* This is the structure containing a set of Links detection callbacks. | |
* | |
* There is no default xlink callbacks, if one want to get link | |
* recognition activated, those call backs must be provided before parsing. | |
*/ | |
typedef struct _xlinkHandler xlinkHandler; | |
typedef xlinkHandler *xlinkHandlerPtr; | |
struct _xlinkHandler { | |
xlinkSimpleLinkFunk simple; | |
xlinkExtendedLinkFunk extended; | |
xlinkExtendedLinkSetFunk set; | |
}; | |
/* | |
* The default detection routine, can be overridden, they call the default | |
* detection callbacks. | |
*/ | |
XMLPUBFUN xlinkNodeDetectFunc XMLCALL | |
xlinkGetDefaultDetect (void); | |
XMLPUBFUN void XMLCALL | |
xlinkSetDefaultDetect (xlinkNodeDetectFunc func); | |
/* | |
* Routines to set/get the default handlers. | |
*/ | |
XMLPUBFUN xlinkHandlerPtr XMLCALL | |
xlinkGetDefaultHandler (void); | |
XMLPUBFUN void XMLCALL | |
xlinkSetDefaultHandler (xlinkHandlerPtr handler); | |
/* | |
* Link detection module itself. | |
*/ | |
XMLPUBFUN xlinkType XMLCALL | |
xlinkIsLink (xmlDocPtr doc, | |
xmlNodePtr node); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_XPTR_ENABLED */ | |
#endif /* __XML_XLINK_H__ */ |
/* | |
* Summary: API to build regexp automata | |
* Description: the API to build regexp automata | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_AUTOMATA_H__ | |
#define __XML_AUTOMATA_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#ifdef LIBXML_REGEXP_ENABLED | |
#ifdef LIBXML_AUTOMATA_ENABLED | |
#include <libxml/xmlregexp.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlAutomataPtr: | |
* | |
* A libxml automata description, It can be compiled into a regexp | |
*/ | |
typedef struct _xmlAutomata xmlAutomata; | |
typedef xmlAutomata *xmlAutomataPtr; | |
/** | |
* xmlAutomataStatePtr: | |
* | |
* A state int the automata description, | |
*/ | |
typedef struct _xmlAutomataState xmlAutomataState; | |
typedef xmlAutomataState *xmlAutomataStatePtr; | |
/* | |
* Building API | |
*/ | |
XMLPUBFUN xmlAutomataPtr XMLCALL | |
xmlNewAutomata (void); | |
XMLPUBFUN void XMLCALL | |
xmlFreeAutomata (xmlAutomataPtr am); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataGetInitState (xmlAutomataPtr am); | |
XMLPUBFUN int XMLCALL | |
xmlAutomataSetFinalState (xmlAutomataPtr am, | |
xmlAutomataStatePtr state); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewState (xmlAutomataPtr am); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewTransition (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
const xmlChar *token, | |
void *data); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewTransition2 (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
const xmlChar *token, | |
const xmlChar *token2, | |
void *data); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewNegTrans (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
const xmlChar *token, | |
const xmlChar *token2, | |
void *data); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewCountTrans (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
const xmlChar *token, | |
int min, | |
int max, | |
void *data); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewCountTrans2 (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
const xmlChar *token, | |
const xmlChar *token2, | |
int min, | |
int max, | |
void *data); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewOnceTrans (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
const xmlChar *token, | |
int min, | |
int max, | |
void *data); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
const xmlChar *token, | |
const xmlChar *token2, | |
int min, | |
int max, | |
void *data); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewAllTrans (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
int lax); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewEpsilon (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewCountedTrans (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
int counter); | |
XMLPUBFUN xmlAutomataStatePtr XMLCALL | |
xmlAutomataNewCounterTrans (xmlAutomataPtr am, | |
xmlAutomataStatePtr from, | |
xmlAutomataStatePtr to, | |
int counter); | |
XMLPUBFUN int XMLCALL | |
xmlAutomataNewCounter (xmlAutomataPtr am, | |
int min, | |
int max); | |
XMLPUBFUN xmlRegexpPtr XMLCALL | |
xmlAutomataCompile (xmlAutomataPtr am); | |
XMLPUBFUN int XMLCALL | |
xmlAutomataIsDeterminist (xmlAutomataPtr am); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_AUTOMATA_ENABLED */ | |
#endif /* LIBXML_REGEXP_ENABLED */ | |
#endif /* __XML_AUTOMATA_H__ */ |
/* | |
* Summary: error handling | |
* Description: the API used to report errors | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#include <libxml/parser.h> | |
#ifndef __XML_ERROR_H__ | |
#define __XML_ERROR_H__ | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlErrorLevel: | |
* | |
* Indicates the level of an error | |
*/ | |
typedef enum { | |
XML_ERR_NONE = 0, | |
XML_ERR_WARNING = 1, /* A simple warning */ | |
XML_ERR_ERROR = 2, /* A recoverable error */ | |
XML_ERR_FATAL = 3 /* A fatal error */ | |
} xmlErrorLevel; | |
/** | |
* xmlErrorDomain: | |
* | |
* Indicates where an error may have come from | |
*/ | |
typedef enum { | |
XML_FROM_NONE = 0, | |
XML_FROM_PARSER, /* The XML parser */ | |
XML_FROM_TREE, /* The tree module */ | |
XML_FROM_NAMESPACE, /* The XML Namespace module */ | |
XML_FROM_DTD, /* The XML DTD validation with parser context*/ | |
XML_FROM_HTML, /* The HTML parser */ | |
XML_FROM_MEMORY, /* The memory allocator */ | |
XML_FROM_OUTPUT, /* The serialization code */ | |
XML_FROM_IO, /* The Input/Output stack */ | |
XML_FROM_FTP, /* The FTP module */ | |
XML_FROM_HTTP, /* The HTTP module */ | |
XML_FROM_XINCLUDE, /* The XInclude processing */ | |
XML_FROM_XPATH, /* The XPath module */ | |
XML_FROM_XPOINTER, /* The XPointer module */ | |
XML_FROM_REGEXP, /* The regular expressions module */ | |
XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ | |
XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ | |
XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ | |
XML_FROM_RELAXNGP, /* The Relax-NG parser module */ | |
XML_FROM_RELAXNGV, /* The Relax-NG validator module */ | |
XML_FROM_CATALOG, /* The Catalog module */ | |
XML_FROM_C14N, /* The Canonicalization module */ | |
XML_FROM_XSLT, /* The XSLT engine from libxslt */ | |
XML_FROM_VALID, /* The XML DTD validation with valid context */ | |
XML_FROM_CHECK, /* The error checking module */ | |
XML_FROM_WRITER, /* The xmlwriter module */ | |
XML_FROM_MODULE, /* The dynamically loaded module module*/ | |
XML_FROM_I18N, /* The module handling character conversion */ | |
XML_FROM_SCHEMATRONV,/* The Schematron validator module */ | |
XML_FROM_BUFFER, /* The buffers module */ | |
XML_FROM_URI /* The URI module */ | |
} xmlErrorDomain; | |
/** | |
* xmlError: | |
* | |
* An XML Error instance. | |
*/ | |
typedef struct _xmlError xmlError; | |
typedef xmlError *xmlErrorPtr; | |
struct _xmlError { | |
int domain; /* What part of the library raised this error */ | |
int code; /* The error code, e.g. an xmlParserError */ | |
char *message;/* human-readable informative error message */ | |
xmlErrorLevel level;/* how consequent is the error */ | |
char *file; /* the filename */ | |
int line; /* the line number if available */ | |
char *str1; /* extra string information */ | |
char *str2; /* extra string information */ | |
char *str3; /* extra string information */ | |
int int1; /* extra number information */ | |
int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */ | |
void *ctxt; /* the parser context if available */ | |
void *node; /* the node in the tree */ | |
}; | |
/** | |
* xmlParserError: | |
* | |
* This is an error that the XML (or HTML) parser can generate | |
*/ | |
typedef enum { | |
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 non-W3C */ | |
XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */ | |
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, /* 3085 */ | |
XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ | |
XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ | |
XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ | |
XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ | |
XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ | |
XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ | |
XML_SCHEMATRONV_REPORT, | |
XML_MODULE_OPEN = 4900, /* 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 | |
} xmlParserErrors; | |
/** | |
* xmlGenericErrorFunc: | |
* @ctx: a parsing context | |
* @msg: the message | |
* @...: the extra arguments of the varags to format the message | |
* | |
* Signature of the function to use when there is an error and | |
* no parsing or validity context available . | |
*/ | |
typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* xmlStructuredErrorFunc: | |
* @userData: user provided data for the error callback | |
* @error: the error being raised. | |
* | |
* Signature of the function to use when there is an error and | |
* the module handles the new error reporting mechanism. | |
*/ | |
typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); | |
/* | |
* Use the following function to reset the two global variables | |
* xmlGenericError and xmlGenericErrorContext. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlSetGenericErrorFunc (void *ctx, | |
xmlGenericErrorFunc handler); | |
XMLPUBFUN void XMLCALL | |
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); | |
XMLPUBFUN void XMLCALL | |
xmlSetStructuredErrorFunc (void *ctx, | |
xmlStructuredErrorFunc handler); | |
/* | |
* Default message routines used by SAX and Valid context for error | |
* and warning reporting. | |
*/ | |
XMLPUBFUN void XMLCDECL | |
xmlParserError (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN void XMLCDECL | |
xmlParserWarning (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN void XMLCDECL | |
xmlParserValidityError (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN void XMLCDECL | |
xmlParserValidityWarning (void *ctx, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN void XMLCALL | |
xmlParserPrintFileInfo (xmlParserInputPtr input); | |
XMLPUBFUN void XMLCALL | |
xmlParserPrintFileContext (xmlParserInputPtr input); | |
/* | |
* Extended error information routines | |
*/ | |
XMLPUBFUN xmlErrorPtr XMLCALL | |
xmlGetLastError (void); | |
XMLPUBFUN void XMLCALL | |
xmlResetLastError (void); | |
XMLPUBFUN xmlErrorPtr XMLCALL | |
xmlCtxtGetLastError (void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlCtxtResetLastError (void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlResetError (xmlErrorPtr err); | |
XMLPUBFUN int XMLCALL | |
xmlCopyError (xmlErrorPtr from, | |
xmlErrorPtr to); | |
#ifdef IN_LIBXML | |
/* | |
* Internal callback reporting routine | |
*/ | |
XMLPUBFUN void XMLCALL | |
__xmlRaiseError (xmlStructuredErrorFunc schannel, | |
xmlGenericErrorFunc channel, | |
void *data, | |
void *ctx, | |
void *node, | |
int domain, | |
int code, | |
xmlErrorLevel level, | |
const char *file, | |
int line, | |
const char *str1, | |
const char *str2, | |
const char *str3, | |
int int1, | |
int col, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(16,17); | |
XMLPUBFUN void XMLCALL | |
__xmlSimpleError (int domain, | |
int code, | |
xmlNodePtr node, | |
const char *msg, | |
const char *extra) LIBXML_ATTR_FORMAT(4,0); | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_ERROR_H__ */ |
/* | |
* Summary: macros for marking symbols as exportable/importable. | |
* Description: macros for marking symbols as exportable/importable. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Igor Zlatovic <igor@zlatkovic.com> | |
*/ | |
#ifndef __XML_EXPORTS_H__ | |
#define __XML_EXPORTS_H__ | |
/** | |
* XMLPUBFUN, XMLPUBVAR, XMLCALL | |
* | |
* Macros which declare an exportable function, an exportable variable and | |
* the calling convention used for functions. | |
* | |
* Please use an extra block for every platform/compiler combination when | |
* modifying this, rather than overlong #ifdef lines. This helps | |
* readability as well as the fact that different compilers on the same | |
* platform might need different definitions. | |
*/ | |
/** | |
* XMLPUBFUN: | |
* | |
* Macros which declare an exportable function | |
*/ | |
#define XMLPUBFUN | |
/** | |
* XMLPUBVAR: | |
* | |
* Macros which declare an exportable variable | |
*/ | |
#define XMLPUBVAR extern | |
/** | |
* XMLCALL: | |
* | |
* Macros which declare the called convention for exported functions | |
*/ | |
#define XMLCALL | |
/** | |
* XMLCDECL: | |
* | |
* Macro which declares the calling convention for exported functions that | |
* use '...'. | |
*/ | |
#define XMLCDECL | |
/** DOC_DISABLE */ | |
/* Windows platform with MS compiler */ | |
#if defined(_WIN32) && defined(_MSC_VER) | |
#undef XMLPUBFUN | |
#undef XMLPUBVAR | |
#undef XMLCALL | |
#undef XMLCDECL | |
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC) | |
#define XMLPUBFUN __declspec(dllexport) | |
#define XMLPUBVAR __declspec(dllexport) | |
#else | |
#define XMLPUBFUN | |
#if !defined(LIBXML_STATIC) | |
#define XMLPUBVAR __declspec(dllimport) extern | |
#else | |
#define XMLPUBVAR extern | |
#endif | |
#endif | |
#if defined(LIBXML_FASTCALL) | |
#define XMLCALL __fastcall | |
#else | |
#define XMLCALL __cdecl | |
#endif | |
#define XMLCDECL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Windows platform with Borland compiler */ | |
#if defined(_WIN32) && defined(__BORLANDC__) | |
#undef XMLPUBFUN | |
#undef XMLPUBVAR | |
#undef XMLCALL | |
#undef XMLCDECL | |
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC) | |
#define XMLPUBFUN __declspec(dllexport) | |
#define XMLPUBVAR __declspec(dllexport) extern | |
#else | |
#define XMLPUBFUN | |
#if !defined(LIBXML_STATIC) | |
#define XMLPUBVAR __declspec(dllimport) extern | |
#else | |
#define XMLPUBVAR extern | |
#endif | |
#endif | |
#define XMLCALL __cdecl | |
#define XMLCDECL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Windows platform with GNU compiler (Mingw) */ | |
#if defined(_WIN32) && defined(__MINGW32__) | |
#undef XMLPUBFUN | |
#undef XMLPUBVAR | |
#undef XMLCALL | |
#undef XMLCDECL | |
/* | |
* if defined(IN_LIBXML) this raises problems on mingw with msys | |
* _imp__xmlFree listed as missing. Try to workaround the problem | |
* by also making that declaration when compiling client code. | |
*/ | |
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC) | |
#define XMLPUBFUN __declspec(dllexport) | |
#define XMLPUBVAR __declspec(dllexport) extern | |
#else | |
#define XMLPUBFUN | |
#if !defined(LIBXML_STATIC) | |
#define XMLPUBVAR __declspec(dllimport) extern | |
#else | |
#define XMLPUBVAR extern | |
#endif | |
#endif | |
#define XMLCALL __cdecl | |
#define XMLCDECL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Cygwin platform, GNU compiler */ | |
#if defined(_WIN32) && defined(__CYGWIN__) | |
#undef XMLPUBFUN | |
#undef XMLPUBVAR | |
#undef XMLCALL | |
#undef XMLCDECL | |
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC) | |
#define XMLPUBFUN __declspec(dllexport) | |
#define XMLPUBVAR __declspec(dllexport) | |
#else | |
#define XMLPUBFUN | |
#if !defined(LIBXML_STATIC) | |
#define XMLPUBVAR __declspec(dllimport) extern | |
#else | |
#define XMLPUBVAR | |
#endif | |
#endif | |
#define XMLCALL __cdecl | |
#define XMLCDECL __cdecl | |
#endif | |
/* Compatibility */ | |
#if !defined(LIBXML_DLL_IMPORT) | |
#define LIBXML_DLL_IMPORT XMLPUBVAR | |
#endif | |
#endif /* __XML_EXPORTS_H__ */ | |
/* | |
* Summary: interface for the I/O interfaces used by the parser | |
* Description: interface for the I/O interfaces used by the parser | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_IO_H__ | |
#define __XML_IO_H__ | |
#include <stdio.h> | |
#include <libxml/xmlversion.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Those are the functions and datatypes for the parser input | |
* I/O structures. | |
*/ | |
/** | |
* xmlInputMatchCallback: | |
* @filename: the filename or URI | |
* | |
* Callback used in the I/O Input API to detect if the current handler | |
* can provide input fonctionnalities for this resource. | |
* | |
* Returns 1 if yes and 0 if another Input module should be used | |
*/ | |
typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename); | |
/** | |
* xmlInputOpenCallback: | |
* @filename: the filename or URI | |
* | |
* Callback used in the I/O Input API to open the resource | |
* | |
* Returns an Input context or NULL in case or error | |
*/ | |
typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename); | |
/** | |
* xmlInputReadCallback: | |
* @context: an Input context | |
* @buffer: the buffer to store data read | |
* @len: the length of the buffer in bytes | |
* | |
* Callback used in the I/O Input API to read the resource | |
* | |
* Returns the number of bytes read or -1 in case of error | |
*/ | |
typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len); | |
/** | |
* xmlInputCloseCallback: | |
* @context: an Input context | |
* | |
* Callback used in the I/O Input API to close the resource | |
* | |
* Returns 0 or -1 in case of error | |
*/ | |
typedef int (XMLCALL *xmlInputCloseCallback) (void * context); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
/* | |
* Those are the functions and datatypes for the library output | |
* I/O structures. | |
*/ | |
/** | |
* xmlOutputMatchCallback: | |
* @filename: the filename or URI | |
* | |
* Callback used in the I/O Output API to detect if the current handler | |
* can provide output fonctionnalities for this resource. | |
* | |
* Returns 1 if yes and 0 if another Output module should be used | |
*/ | |
typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename); | |
/** | |
* xmlOutputOpenCallback: | |
* @filename: the filename or URI | |
* | |
* Callback used in the I/O Output API to open the resource | |
* | |
* Returns an Output context or NULL in case or error | |
*/ | |
typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename); | |
/** | |
* xmlOutputWriteCallback: | |
* @context: an Output context | |
* @buffer: the buffer of data to write | |
* @len: the length of the buffer in bytes | |
* | |
* Callback used in the I/O Output API to write to the resource | |
* | |
* Returns the number of bytes written or -1 in case of error | |
*/ | |
typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer, | |
int len); | |
/** | |
* xmlOutputCloseCallback: | |
* @context: an Output context | |
* | |
* Callback used in the I/O Output API to close the resource | |
* | |
* Returns 0 or -1 in case of error | |
*/ | |
typedef int (XMLCALL *xmlOutputCloseCallback) (void * context); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/globals.h> | |
#include <libxml/tree.h> | |
#include <libxml/parser.h> | |
#include <libxml/encoding.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
struct _xmlParserInputBuffer { | |
void* context; | |
xmlInputReadCallback readcallback; | |
xmlInputCloseCallback closecallback; | |
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ | |
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */ | |
xmlBufPtr raw; /* if encoder != NULL buffer for raw input */ | |
int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ | |
int error; | |
unsigned long rawconsumed;/* amount consumed from raw */ | |
}; | |
#ifdef LIBXML_OUTPUT_ENABLED | |
struct _xmlOutputBuffer { | |
void* context; | |
xmlOutputWriteCallback writecallback; | |
xmlOutputCloseCallback closecallback; | |
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ | |
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ | |
xmlBufPtr conv; /* if encoder != NULL buffer for output */ | |
int written; /* total number of byte written */ | |
int error; | |
}; | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* | |
* Interfaces for input | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlCleanupInputCallbacks (void); | |
XMLPUBFUN int XMLCALL | |
xmlPopInputCallbacks (void); | |
XMLPUBFUN void XMLCALL | |
xmlRegisterDefaultInputCallbacks (void); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlAllocParserInputBuffer (xmlCharEncoding enc); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlParserInputBufferCreateFilename (const char *URI, | |
xmlCharEncoding enc); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlParserInputBufferCreateFile (FILE *file, | |
xmlCharEncoding enc); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlParserInputBufferCreateFd (int fd, | |
xmlCharEncoding enc); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlParserInputBufferCreateMem (const char *mem, int size, | |
xmlCharEncoding enc); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlParserInputBufferCreateStatic (const char *mem, int size, | |
xmlCharEncoding enc); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
xmlCharEncoding enc); | |
XMLPUBFUN int XMLCALL | |
xmlParserInputBufferRead (xmlParserInputBufferPtr in, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlParserInputBufferGrow (xmlParserInputBufferPtr in, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlParserInputBufferPush (xmlParserInputBufferPtr in, | |
int len, | |
const char *buf); | |
XMLPUBFUN void XMLCALL | |
xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); | |
XMLPUBFUN char * XMLCALL | |
xmlParserGetDirectory (const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, | |
xmlInputOpenCallback openFunc, | |
xmlInputReadCallback readFunc, | |
xmlInputCloseCallback closeFunc); | |
xmlParserInputBufferPtr | |
__xmlParserInputBufferCreateFilename(const char *URI, | |
xmlCharEncoding enc); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
/* | |
* Interfaces for output | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlCleanupOutputCallbacks (void); | |
XMLPUBFUN void XMLCALL | |
xmlRegisterDefaultOutputCallbacks(void); | |
XMLPUBFUN xmlOutputBufferPtr XMLCALL | |
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); | |
XMLPUBFUN xmlOutputBufferPtr XMLCALL | |
xmlOutputBufferCreateFilename (const char *URI, | |
xmlCharEncodingHandlerPtr encoder, | |
int compression); | |
XMLPUBFUN xmlOutputBufferPtr XMLCALL | |
xmlOutputBufferCreateFile (FILE *file, | |
xmlCharEncodingHandlerPtr encoder); | |
XMLPUBFUN xmlOutputBufferPtr XMLCALL | |
xmlOutputBufferCreateBuffer (xmlBufferPtr buffer, | |
xmlCharEncodingHandlerPtr encoder); | |
XMLPUBFUN xmlOutputBufferPtr XMLCALL | |
xmlOutputBufferCreateFd (int fd, | |
xmlCharEncodingHandlerPtr encoder); | |
XMLPUBFUN xmlOutputBufferPtr XMLCALL | |
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite, | |
xmlOutputCloseCallback ioclose, | |
void *ioctx, | |
xmlCharEncodingHandlerPtr encoder); | |
/* Couple of APIs to get the output without digging into the buffers */ | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlOutputBufferGetContent (xmlOutputBufferPtr out); | |
XMLPUBFUN size_t XMLCALL | |
xmlOutputBufferGetSize (xmlOutputBufferPtr out); | |
XMLPUBFUN int XMLCALL | |
xmlOutputBufferWrite (xmlOutputBufferPtr out, | |
int len, | |
const char *buf); | |
XMLPUBFUN int XMLCALL | |
xmlOutputBufferWriteString (xmlOutputBufferPtr out, | |
const char *str); | |
XMLPUBFUN int XMLCALL | |
xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, | |
const xmlChar *str, | |
xmlCharEncodingOutputFunc escaping); | |
XMLPUBFUN int XMLCALL | |
xmlOutputBufferFlush (xmlOutputBufferPtr out); | |
XMLPUBFUN int XMLCALL | |
xmlOutputBufferClose (xmlOutputBufferPtr out); | |
XMLPUBFUN int XMLCALL | |
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, | |
xmlOutputOpenCallback openFunc, | |
xmlOutputWriteCallback writeFunc, | |
xmlOutputCloseCallback closeFunc); | |
xmlOutputBufferPtr | |
__xmlOutputBufferCreateFilename(const char *URI, | |
xmlCharEncodingHandlerPtr encoder, | |
int compression); | |
#ifdef LIBXML_HTTP_ENABLED | |
/* This function only exists if HTTP support built into the library */ | |
XMLPUBFUN void XMLCALL | |
xmlRegisterHTTPPostCallbacks (void ); | |
#endif /* LIBXML_HTTP_ENABLED */ | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, | |
xmlParserInputPtr ret); | |
/* | |
* A predefined entity loader disabling network accesses | |
*/ | |
XMLPUBFUN xmlParserInputPtr XMLCALL | |
xmlNoNetExternalEntityLoader (const char *URL, | |
const char *ID, | |
xmlParserCtxtPtr ctxt); | |
/* | |
* xmlNormalizeWindowsPath is obsolete, don't use it. | |
* Check xmlCanonicPath in uri.h for a better alternative. | |
*/ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlNormalizeWindowsPath (const xmlChar *path); | |
XMLPUBFUN int XMLCALL | |
xmlCheckFilename (const char *path); | |
/** | |
* Default 'file://' protocol callbacks | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlFileMatch (const char *filename); | |
XMLPUBFUN void * XMLCALL | |
xmlFileOpen (const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlFileRead (void * context, | |
char * buffer, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlFileClose (void * context); | |
/** | |
* Default 'http://' protocol callbacks | |
*/ | |
#ifdef LIBXML_HTTP_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlIOHTTPMatch (const char *filename); | |
XMLPUBFUN void * XMLCALL | |
xmlIOHTTPOpen (const char *filename); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void * XMLCALL | |
xmlIOHTTPOpenW (const char * post_uri, | |
int compression ); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
XMLPUBFUN int XMLCALL | |
xmlIOHTTPRead (void * context, | |
char * buffer, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlIOHTTPClose (void * context); | |
#endif /* LIBXML_HTTP_ENABLED */ | |
/** | |
* Default 'ftp://' protocol callbacks | |
*/ | |
#ifdef LIBXML_FTP_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlIOFTPMatch (const char *filename); | |
XMLPUBFUN void * XMLCALL | |
xmlIOFTPOpen (const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlIOFTPRead (void * context, | |
char * buffer, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlIOFTPClose (void * context); | |
#endif /* LIBXML_FTP_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_IO_H__ */ |
/* | |
* Summary: interface for the memory allocator | |
* Description: provides interfaces for the memory allocator, | |
* including debugging capabilities. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __DEBUG_MEMORY_ALLOC__ | |
#define __DEBUG_MEMORY_ALLOC__ | |
#include <stdio.h> | |
#include <libxml/xmlversion.h> | |
/** | |
* DEBUG_MEMORY: | |
* | |
* DEBUG_MEMORY replaces the allocator with a collect and debug | |
* shell to the libc allocator. | |
* DEBUG_MEMORY should only be activated when debugging | |
* libxml i.e. if libxml has been configured with --with-debug-mem too. | |
*/ | |
/* #define DEBUG_MEMORY_FREED */ | |
/* #define DEBUG_MEMORY_LOCATION */ | |
#ifdef DEBUG | |
#ifndef DEBUG_MEMORY | |
#define DEBUG_MEMORY | |
#endif | |
#endif | |
/** | |
* DEBUG_MEMORY_LOCATION: | |
* | |
* DEBUG_MEMORY_LOCATION should be activated only when debugging | |
* libxml i.e. if libxml has been configured with --with-debug-mem too. | |
*/ | |
#ifdef DEBUG_MEMORY_LOCATION | |
#endif | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* The XML memory wrapper support 4 basic overloadable functions. | |
*/ | |
/** | |
* xmlFreeFunc: | |
* @mem: an already allocated block of memory | |
* | |
* Signature for a free() implementation. | |
*/ | |
typedef void (XMLCALL *xmlFreeFunc)(void *mem); | |
/** | |
* xmlMallocFunc: | |
* @size: the size requested in bytes | |
* | |
* Signature for a malloc() implementation. | |
* | |
* Returns a pointer to the newly allocated block or NULL in case of error. | |
*/ | |
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size); | |
/** | |
* xmlReallocFunc: | |
* @mem: an already allocated block of memory | |
* @size: the new size requested in bytes | |
* | |
* Signature for a realloc() implementation. | |
* | |
* Returns a pointer to the newly reallocated block or NULL in case of error. | |
*/ | |
typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size); | |
/** | |
* xmlStrdupFunc: | |
* @str: a zero terminated string | |
* | |
* Signature for an strdup() implementation. | |
* | |
* Returns the copy of the string or NULL in case of error. | |
*/ | |
typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); | |
/* | |
* The 4 interfaces used for all memory handling within libxml. | |
LIBXML_DLL_IMPORT xmlFreeFunc xmlFree; | |
LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc; | |
LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic; | |
LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; | |
LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; | |
*/ | |
/* | |
* The way to overload the existing functions. | |
* The xmlGc function have an extra entry for atomic block | |
* allocations useful for garbage collected memory allocators | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlMemSetup (xmlFreeFunc freeFunc, | |
xmlMallocFunc mallocFunc, | |
xmlReallocFunc reallocFunc, | |
xmlStrdupFunc strdupFunc); | |
XMLPUBFUN int XMLCALL | |
xmlMemGet (xmlFreeFunc *freeFunc, | |
xmlMallocFunc *mallocFunc, | |
xmlReallocFunc *reallocFunc, | |
xmlStrdupFunc *strdupFunc); | |
XMLPUBFUN int XMLCALL | |
xmlGcMemSetup (xmlFreeFunc freeFunc, | |
xmlMallocFunc mallocFunc, | |
xmlMallocFunc mallocAtomicFunc, | |
xmlReallocFunc reallocFunc, | |
xmlStrdupFunc strdupFunc); | |
XMLPUBFUN int XMLCALL | |
xmlGcMemGet (xmlFreeFunc *freeFunc, | |
xmlMallocFunc *mallocFunc, | |
xmlMallocFunc *mallocAtomicFunc, | |
xmlReallocFunc *reallocFunc, | |
xmlStrdupFunc *strdupFunc); | |
/* | |
* Initialization of the memory layer. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlInitMemory (void); | |
/* | |
* Cleanup of the memory layer. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlCleanupMemory (void); | |
/* | |
* These are specific to the XML debug memory wrapper. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlMemUsed (void); | |
XMLPUBFUN int XMLCALL | |
xmlMemBlocks (void); | |
XMLPUBFUN void XMLCALL | |
xmlMemDisplay (FILE *fp); | |
XMLPUBFUN void XMLCALL | |
xmlMemDisplayLast(FILE *fp, long nbBytes); | |
XMLPUBFUN void XMLCALL | |
xmlMemShow (FILE *fp, int nr); | |
XMLPUBFUN void XMLCALL | |
xmlMemoryDump (void); | |
XMLPUBFUN void * XMLCALL | |
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); | |
XMLPUBFUN void * XMLCALL | |
xmlMemRealloc (void *ptr,size_t size); | |
XMLPUBFUN void XMLCALL | |
xmlMemFree (void *ptr); | |
XMLPUBFUN char * XMLCALL | |
xmlMemoryStrdup (const char *str); | |
XMLPUBFUN void * XMLCALL | |
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); | |
XMLPUBFUN void * XMLCALL | |
xmlReallocLoc (void *ptr, size_t size, const char *file, int line); | |
XMLPUBFUN void * XMLCALL | |
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); | |
XMLPUBFUN char * XMLCALL | |
xmlMemStrdupLoc (const char *str, const char *file, int line); | |
#ifdef DEBUG_MEMORY_LOCATION | |
/** | |
* xmlMalloc: | |
* @size: number of bytes to allocate | |
* | |
* Wrapper for the malloc() function used in the XML library. | |
* | |
* Returns the pointer to the allocated area or NULL in case of error. | |
*/ | |
#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__) | |
/** | |
* xmlMallocAtomic: | |
* @size: number of bytes to allocate | |
* | |
* Wrapper for the malloc() function used in the XML library for allocation | |
* of block not containing pointers to other areas. | |
* | |
* Returns the pointer to the allocated area or NULL in case of error. | |
*/ | |
#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__) | |
/** | |
* xmlRealloc: | |
* @ptr: pointer to the existing allocated area | |
* @size: number of bytes to allocate | |
* | |
* Wrapper for the realloc() function used in the XML library. | |
* | |
* Returns the pointer to the allocated area or NULL in case of error. | |
*/ | |
#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__) | |
/** | |
* xmlMemStrdup: | |
* @str: pointer to the existing string | |
* | |
* Wrapper for the strdup() function, xmlStrdup() is usually preferred. | |
* | |
* Returns the pointer to the allocated area or NULL in case of error. | |
*/ | |
#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) | |
#endif /* DEBUG_MEMORY_LOCATION */ | |
#ifdef __cplusplus | |
} | |
#endif /* __cplusplus */ | |
#ifndef __XML_GLOBALS_H | |
#ifndef __XML_THREADS_H__ | |
#include <libxml/threads.h> | |
#include <libxml/globals.h> | |
#endif | |
#endif | |
#endif /* __DEBUG_MEMORY_ALLOC__ */ | |
/* | |
* Summary: dynamic module loading | |
* Description: basic API for dynamic module loading, used by | |
* libexslt added in 2.6.17 | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Joel W. Reed | |
*/ | |
#ifndef __XML_MODULE_H__ | |
#define __XML_MODULE_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_MODULES_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlModulePtr: | |
* | |
* A handle to a dynamically loaded module | |
*/ | |
typedef struct _xmlModule xmlModule; | |
typedef xmlModule *xmlModulePtr; | |
/** | |
* xmlModuleOption: | |
* | |
* enumeration of options that can be passed down to xmlModuleOpen() | |
*/ | |
typedef enum { | |
XML_MODULE_LAZY = 1, /* lazy binding */ | |
XML_MODULE_LOCAL= 2 /* local binding */ | |
} xmlModuleOption; | |
XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename, | |
int options); | |
XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module, | |
const char* name, | |
void **result); | |
XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module); | |
XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_MODULES_ENABLED */ | |
#endif /*__XML_MODULE_H__ */ |
/* | |
* Summary: the XMLReader implementation | |
* Description: API of the XML streaming API based on C# interfaces. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XMLREADER_H__ | |
#define __XML_XMLREADER_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#include <libxml/xmlIO.h> | |
#ifdef LIBXML_SCHEMAS_ENABLED | |
#include <libxml/relaxng.h> | |
#include <libxml/xmlschemas.h> | |
#endif | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlParserSeverities: | |
* | |
* How severe an error callback is when the per-reader error callback API | |
* is used. | |
*/ | |
typedef enum { | |
XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, | |
XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, | |
XML_PARSER_SEVERITY_WARNING = 3, | |
XML_PARSER_SEVERITY_ERROR = 4 | |
} xmlParserSeverities; | |
#ifdef LIBXML_READER_ENABLED | |
/** | |
* xmlTextReaderMode: | |
* | |
* Internal state values for the reader. | |
*/ | |
typedef enum { | |
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 | |
} xmlTextReaderMode; | |
/** | |
* xmlParserProperties: | |
* | |
* Some common options to use with xmlTextReaderSetParserProp, but it | |
* is better to use xmlParserOption and the xmlReaderNewxxx and | |
* xmlReaderForxxx APIs now. | |
*/ | |
typedef enum { | |
XML_PARSER_LOADDTD = 1, | |
XML_PARSER_DEFAULTATTRS = 2, | |
XML_PARSER_VALIDATE = 3, | |
XML_PARSER_SUBST_ENTITIES = 4 | |
} xmlParserProperties; | |
/** | |
* xmlReaderTypes: | |
* | |
* Predefined constants for the different types of nodes. | |
*/ | |
typedef enum { | |
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 | |
} xmlReaderTypes; | |
/** | |
* xmlTextReader: | |
* | |
* Structure for an xmlReader context. | |
*/ | |
typedef struct _xmlTextReader xmlTextReader; | |
/** | |
* xmlTextReaderPtr: | |
* | |
* Pointer to an xmlReader context. | |
*/ | |
typedef xmlTextReader *xmlTextReaderPtr; | |
/* | |
* Constructors & Destructor | |
*/ | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlNewTextReader (xmlParserInputBufferPtr input, | |
const char *URI); | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlNewTextReaderFilename(const char *URI); | |
XMLPUBFUN void XMLCALL | |
xmlFreeTextReader (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderSetup(xmlTextReaderPtr reader, | |
xmlParserInputBufferPtr input, const char *URL, | |
const char *encoding, int options); | |
/* | |
* Iterators | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderRead (xmlTextReaderPtr reader); | |
#ifdef LIBXML_WRITER_ENABLED | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderReadInnerXml(xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader); | |
#endif | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderReadString (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader); | |
/* | |
* Attributes of the node | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderAttributeCount(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderDepth (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderHasAttributes(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderHasValue(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderIsDefault (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderNodeType (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderQuoteChar (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderReadState (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstLocalName (xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstName (xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstPrefix (xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstString (xmlTextReaderPtr reader, | |
const xmlChar *str); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstValue (xmlTextReaderPtr reader); | |
/* | |
* use the Const version of the routine for | |
* better performance and simpler code | |
*/ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderBaseUri (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderLocalName (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderName (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderPrefix (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderXmlLang (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderValue (xmlTextReaderPtr reader); | |
/* | |
* Methods of the XmlTextReader | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderClose (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, | |
int no); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderGetAttribute (xmlTextReaderPtr reader, | |
const xmlChar *name); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, | |
const xmlChar *localName, | |
const xmlChar *namespaceURI); | |
XMLPUBFUN xmlParserInputBufferPtr XMLCALL | |
xmlTextReaderGetRemainder (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, | |
const xmlChar *prefix); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, | |
int no); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, | |
const xmlChar *name); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, | |
const xmlChar *localName, | |
const xmlChar *namespaceURI); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderMoveToElement (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderNormalization (xmlTextReaderPtr reader); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstEncoding (xmlTextReaderPtr reader); | |
/* | |
* Extensions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderSetParserProp (xmlTextReaderPtr reader, | |
int prop, | |
int value); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderGetParserProp (xmlTextReaderPtr reader, | |
int prop); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlTextReaderCurrentNode (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlTextReaderPreserve (xmlTextReaderPtr reader); | |
#ifdef LIBXML_PATTERN_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderPreservePattern(xmlTextReaderPtr reader, | |
const xmlChar *pattern, | |
const xmlChar **namespaces); | |
#endif /* LIBXML_PATTERN_ENABLED */ | |
XMLPUBFUN xmlDocPtr XMLCALL | |
xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlTextReaderExpand (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderNext (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderNextSibling (xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderIsValid (xmlTextReaderPtr reader); | |
#ifdef LIBXML_SCHEMAS_ENABLED | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, | |
const char *rng); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, | |
xmlRelaxNGValidCtxtPtr ctxt, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, | |
xmlRelaxNGPtr schema); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, | |
const char *xsd); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, | |
xmlSchemaValidCtxtPtr ctxt, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderSetSchema (xmlTextReaderPtr reader, | |
xmlSchemaPtr schema); | |
#endif | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderStandalone (xmlTextReaderPtr reader); | |
/* | |
* Index lookup | |
*/ | |
XMLPUBFUN long XMLCALL | |
xmlTextReaderByteConsumed (xmlTextReaderPtr reader); | |
/* | |
* New more complete APIs for simpler creation and reuse of readers | |
*/ | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlReaderWalker (xmlDocPtr doc); | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlReaderForDoc (const xmlChar * cur, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlReaderForFile (const char *filename, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlReaderForMemory (const char *buffer, | |
int size, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlReaderForFd (int fd, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlTextReaderPtr XMLCALL | |
xmlReaderForIO (xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlReaderNewWalker (xmlTextReaderPtr reader, | |
xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlReaderNewDoc (xmlTextReaderPtr reader, | |
const xmlChar * cur, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlReaderNewFile (xmlTextReaderPtr reader, | |
const char *filename, | |
const char *encoding, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlReaderNewMemory (xmlTextReaderPtr reader, | |
const char *buffer, | |
int size, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlReaderNewFd (xmlTextReaderPtr reader, | |
int fd, | |
const char *URL, | |
const char *encoding, | |
int options); | |
XMLPUBFUN int XMLCALL | |
xmlReaderNewIO (xmlTextReaderPtr reader, | |
xmlInputReadCallback ioread, | |
xmlInputCloseCallback ioclose, | |
void *ioctx, | |
const char *URL, | |
const char *encoding, | |
int options); | |
/* | |
* Error handling extensions | |
*/ | |
typedef void * xmlTextReaderLocatorPtr; | |
/** | |
* xmlTextReaderErrorFunc: | |
* @arg: the user argument | |
* @msg: the message | |
* @severity: the severity of the error | |
* @locator: a locator indicating where the error occurred | |
* | |
* Signature of an error callback from a reader parser | |
*/ | |
typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, | |
const char *msg, | |
xmlParserSeverities severity, | |
xmlTextReaderLocatorPtr locator); | |
XMLPUBFUN int XMLCALL | |
xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); | |
XMLPUBFUN void XMLCALL | |
xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, | |
xmlTextReaderErrorFunc f, | |
void *arg); | |
XMLPUBFUN void XMLCALL | |
xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, | |
xmlStructuredErrorFunc f, | |
void *arg); | |
XMLPUBFUN void XMLCALL | |
xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, | |
xmlTextReaderErrorFunc *f, | |
void **arg); | |
#endif /* LIBXML_READER_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XMLREADER_H__ */ | |
/* | |
* Summary: regular expressions handling | |
* Description: basic API for libxml regular expressions handling used | |
* for XML Schemas and validation. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_REGEXP_H__ | |
#define __XML_REGEXP_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_REGEXP_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlRegexpPtr: | |
* | |
* A libxml regular expression, they can actually be far more complex | |
* thank the POSIX regex expressions. | |
*/ | |
typedef struct _xmlRegexp xmlRegexp; | |
typedef xmlRegexp *xmlRegexpPtr; | |
/** | |
* xmlRegExecCtxtPtr: | |
* | |
* A libxml progressive regular expression evaluation context | |
*/ | |
typedef struct _xmlRegExecCtxt xmlRegExecCtxt; | |
typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; | |
#ifdef __cplusplus | |
} | |
#endif | |
#include <libxml/tree.h> | |
#include <libxml/dict.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* The POSIX like API | |
*/ | |
XMLPUBFUN xmlRegexpPtr XMLCALL | |
xmlRegexpCompile (const xmlChar *regexp); | |
XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); | |
XMLPUBFUN int XMLCALL | |
xmlRegexpExec (xmlRegexpPtr comp, | |
const xmlChar *value); | |
XMLPUBFUN void XMLCALL | |
xmlRegexpPrint (FILE *output, | |
xmlRegexpPtr regexp); | |
XMLPUBFUN int XMLCALL | |
xmlRegexpIsDeterminist(xmlRegexpPtr comp); | |
/** | |
* xmlRegExecCallbacks: | |
* @exec: the regular expression context | |
* @token: the current token string | |
* @transdata: transition data | |
* @inputdata: input data | |
* | |
* Callback function when doing a transition in the automata | |
*/ | |
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, | |
const xmlChar *token, | |
void *transdata, | |
void *inputdata); | |
/* | |
* The progressive API | |
*/ | |
XMLPUBFUN xmlRegExecCtxtPtr XMLCALL | |
xmlRegNewExecCtxt (xmlRegexpPtr comp, | |
xmlRegExecCallbacks callback, | |
void *data); | |
XMLPUBFUN void XMLCALL | |
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); | |
XMLPUBFUN int XMLCALL | |
xmlRegExecPushString(xmlRegExecCtxtPtr exec, | |
const xmlChar *value, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlRegExecPushString2(xmlRegExecCtxtPtr exec, | |
const xmlChar *value, | |
const xmlChar *value2, | |
void *data); | |
XMLPUBFUN int XMLCALL | |
xmlRegExecNextValues(xmlRegExecCtxtPtr exec, | |
int *nbval, | |
int *nbneg, | |
xmlChar **values, | |
int *terminal); | |
XMLPUBFUN int XMLCALL | |
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, | |
const xmlChar **string, | |
int *nbval, | |
int *nbneg, | |
xmlChar **values, | |
int *terminal); | |
#ifdef LIBXML_EXPR_ENABLED | |
/* | |
* Formal regular expression handling | |
* Its goal is to do some formal work on content models | |
*/ | |
/* expressions are used within a context */ | |
typedef struct _xmlExpCtxt xmlExpCtxt; | |
typedef xmlExpCtxt *xmlExpCtxtPtr; | |
XMLPUBFUN void XMLCALL | |
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt); | |
XMLPUBFUN xmlExpCtxtPtr XMLCALL | |
xmlExpNewCtxt (int maxNodes, | |
xmlDictPtr dict); | |
XMLPUBFUN int XMLCALL | |
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt); | |
/* Expressions are trees but the tree is opaque */ | |
typedef struct _xmlExpNode xmlExpNode; | |
typedef xmlExpNode *xmlExpNodePtr; | |
typedef enum { | |
XML_EXP_EMPTY = 0, | |
XML_EXP_FORBID = 1, | |
XML_EXP_ATOM = 2, | |
XML_EXP_SEQ = 3, | |
XML_EXP_OR = 4, | |
XML_EXP_COUNT = 5 | |
} xmlExpNodeType; | |
/* | |
* 2 core expressions shared by all for the empty language set | |
* and for the set with just the empty token | |
*/ | |
XMLPUBVAR xmlExpNodePtr forbiddenExp; | |
XMLPUBVAR xmlExpNodePtr emptyExp; | |
/* | |
* Expressions are reference counted internally | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlExpFree (xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr expr); | |
XMLPUBFUN void XMLCALL | |
xmlExpRef (xmlExpNodePtr expr); | |
/* | |
* constructors can be either manual or from a string | |
*/ | |
XMLPUBFUN xmlExpNodePtr XMLCALL | |
xmlExpParse (xmlExpCtxtPtr ctxt, | |
const char *expr); | |
XMLPUBFUN xmlExpNodePtr XMLCALL | |
xmlExpNewAtom (xmlExpCtxtPtr ctxt, | |
const xmlChar *name, | |
int len); | |
XMLPUBFUN xmlExpNodePtr XMLCALL | |
xmlExpNewOr (xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr left, | |
xmlExpNodePtr right); | |
XMLPUBFUN xmlExpNodePtr XMLCALL | |
xmlExpNewSeq (xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr left, | |
xmlExpNodePtr right); | |
XMLPUBFUN xmlExpNodePtr XMLCALL | |
xmlExpNewRange (xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr subset, | |
int min, | |
int max); | |
/* | |
* The really interesting APIs | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlExpIsNillable(xmlExpNodePtr expr); | |
XMLPUBFUN int XMLCALL | |
xmlExpMaxToken (xmlExpNodePtr expr); | |
XMLPUBFUN int XMLCALL | |
xmlExpGetLanguage(xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr expr, | |
const xmlChar**langList, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlExpGetStart (xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr expr, | |
const xmlChar**tokList, | |
int len); | |
XMLPUBFUN xmlExpNodePtr XMLCALL | |
xmlExpStringDerive(xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr expr, | |
const xmlChar *str, | |
int len); | |
XMLPUBFUN xmlExpNodePtr XMLCALL | |
xmlExpExpDerive (xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr expr, | |
xmlExpNodePtr sub); | |
XMLPUBFUN int XMLCALL | |
xmlExpSubsume (xmlExpCtxtPtr ctxt, | |
xmlExpNodePtr expr, | |
xmlExpNodePtr sub); | |
XMLPUBFUN void XMLCALL | |
xmlExpDump (xmlBufferPtr buf, | |
xmlExpNodePtr expr); | |
#endif /* LIBXML_EXPR_ENABLED */ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_REGEXP_ENABLED */ | |
#endif /*__XML_REGEXP_H__ */ |
/* | |
* Summary: the XML document serializer | |
* Description: API to save document or subtree of document | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XMLSAVE_H__ | |
#define __XML_XMLSAVE_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/tree.h> | |
#include <libxml/encoding.h> | |
#include <libxml/xmlIO.h> | |
#ifdef LIBXML_OUTPUT_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlSaveOption: | |
* | |
* This is the set of XML save options that can be passed down | |
* to the xmlSaveToFd() and similar calls. | |
*/ | |
typedef enum { | |
XML_SAVE_FORMAT = 1<<0, /* format save output */ | |
XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ | |
XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ | |
XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ | |
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ | |
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ | |
XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ | |
XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ | |
} xmlSaveOption; | |
typedef struct _xmlSaveCtxt xmlSaveCtxt; | |
typedef xmlSaveCtxt *xmlSaveCtxtPtr; | |
XMLPUBFUN xmlSaveCtxtPtr XMLCALL | |
xmlSaveToFd (int fd, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlSaveCtxtPtr XMLCALL | |
xmlSaveToFilename (const char *filename, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlSaveCtxtPtr XMLCALL | |
xmlSaveToBuffer (xmlBufferPtr buffer, | |
const char *encoding, | |
int options); | |
XMLPUBFUN xmlSaveCtxtPtr XMLCALL | |
xmlSaveToIO (xmlOutputWriteCallback iowrite, | |
xmlOutputCloseCallback ioclose, | |
void *ioctx, | |
const char *encoding, | |
int options); | |
XMLPUBFUN long XMLCALL | |
xmlSaveDoc (xmlSaveCtxtPtr ctxt, | |
xmlDocPtr doc); | |
XMLPUBFUN long XMLCALL | |
xmlSaveTree (xmlSaveCtxtPtr ctxt, | |
xmlNodePtr node); | |
XMLPUBFUN int XMLCALL | |
xmlSaveFlush (xmlSaveCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlSaveClose (xmlSaveCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, | |
xmlCharEncodingOutputFunc escape); | |
XMLPUBFUN int XMLCALL | |
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, | |
xmlCharEncodingOutputFunc escape); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
#endif /* __XML_XMLSAVE_H__ */ | |
/* | |
* Summary: incomplete XML Schemas structure implementation | |
* Description: interface to the XML Schemas handling and schema validity | |
* checking, it is incomplete right now. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_SCHEMA_H__ | |
#define __XML_SCHEMA_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_SCHEMAS_ENABLED | |
#include <libxml/tree.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* This error codes are obsolete; not used any more. | |
*/ | |
typedef enum { | |
XML_SCHEMAS_ERR_OK = 0, | |
XML_SCHEMAS_ERR_NOROOT = 1, | |
XML_SCHEMAS_ERR_UNDECLAREDELEM, | |
XML_SCHEMAS_ERR_NOTTOPLEVEL, | |
XML_SCHEMAS_ERR_MISSING, | |
XML_SCHEMAS_ERR_WRONGELEM, | |
XML_SCHEMAS_ERR_NOTYPE, | |
XML_SCHEMAS_ERR_NOROLLBACK, | |
XML_SCHEMAS_ERR_ISABSTRACT, | |
XML_SCHEMAS_ERR_NOTEMPTY, | |
XML_SCHEMAS_ERR_ELEMCONT, | |
XML_SCHEMAS_ERR_HAVEDEFAULT, | |
XML_SCHEMAS_ERR_NOTNILLABLE, | |
XML_SCHEMAS_ERR_EXTRACONTENT, | |
XML_SCHEMAS_ERR_INVALIDATTR, | |
XML_SCHEMAS_ERR_INVALIDELEM, | |
XML_SCHEMAS_ERR_NOTDETERMINIST, | |
XML_SCHEMAS_ERR_CONSTRUCT, | |
XML_SCHEMAS_ERR_INTERNAL, | |
XML_SCHEMAS_ERR_NOTSIMPLE, | |
XML_SCHEMAS_ERR_ATTRUNKNOWN, | |
XML_SCHEMAS_ERR_ATTRINVALID, | |
XML_SCHEMAS_ERR_VALUE, | |
XML_SCHEMAS_ERR_FACET, | |
XML_SCHEMAS_ERR_, | |
XML_SCHEMAS_ERR_XXX | |
} xmlSchemaValidError; | |
/* | |
* ATTENTION: Change xmlSchemaSetValidOptions's check | |
* for invalid values, if adding to the validation | |
* options below. | |
*/ | |
/** | |
* xmlSchemaValidOption: | |
* | |
* This is the set of XML Schema validation options. | |
*/ | |
typedef enum { | |
XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 | |
/* Default/fixed: create an attribute node | |
* or an element's text node on the instance. | |
*/ | |
} xmlSchemaValidOption; | |
/* | |
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, | |
* assemble schemata using | |
* xsi:schemaLocation and | |
* xsi:noNamespaceSchemaLocation | |
*/ | |
/** | |
* The schemas related types are kept internal | |
*/ | |
typedef struct _xmlSchema xmlSchema; | |
typedef xmlSchema *xmlSchemaPtr; | |
/** | |
* xmlSchemaValidityErrorFunc: | |
* @ctx: the validation context | |
* @msg: the message | |
* @...: extra arguments | |
* | |
* Signature of an error callback from an XSD validation | |
*/ | |
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) | |
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* xmlSchemaValidityWarningFunc: | |
* @ctx: the validation context | |
* @msg: the message | |
* @...: extra arguments | |
* | |
* Signature of a warning callback from an XSD validation | |
*/ | |
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) | |
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); | |
/** | |
* A schemas validation context | |
*/ | |
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; | |
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; | |
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; | |
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; | |
/** | |
* xmlSchemaValidityLocatorFunc: | |
* @ctx: user provided context | |
* @file: returned file information | |
* @line: returned line information | |
* | |
* A schemas validation locator, a callback called by the validator. | |
* This is used when file or node informations are not available | |
* to find out what file and line number are affected | |
* | |
* Returns: 0 in case of success and -1 in case of error | |
*/ | |
typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx, | |
const char **file, unsigned long *line); | |
/* | |
* Interfaces for parsing. | |
*/ | |
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL | |
xmlSchemaNewParserCtxt (const char *URL); | |
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL | |
xmlSchemaNewMemParserCtxt (const char *buffer, | |
int size); | |
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL | |
xmlSchemaNewDocParserCtxt (xmlDocPtr doc); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, | |
xmlSchemaValidityErrorFunc err, | |
xmlSchemaValidityWarningFunc warn, | |
void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, | |
xmlStructuredErrorFunc serror, | |
void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, | |
xmlSchemaValidityErrorFunc * err, | |
xmlSchemaValidityWarningFunc * warn, | |
void **ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); | |
XMLPUBFUN xmlSchemaPtr XMLCALL | |
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaFree (xmlSchemaPtr schema); | |
#ifdef LIBXML_OUTPUT_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlSchemaDump (FILE *output, | |
xmlSchemaPtr schema); | |
#endif /* LIBXML_OUTPUT_ENABLED */ | |
/* | |
* Interfaces for validating | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, | |
xmlSchemaValidityErrorFunc err, | |
xmlSchemaValidityWarningFunc warn, | |
void *ctx); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, | |
xmlStructuredErrorFunc serror, | |
void *ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, | |
xmlSchemaValidityErrorFunc *err, | |
xmlSchemaValidityWarningFunc *warn, | |
void **ctx); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, | |
int options); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, | |
const char *filename); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); | |
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL | |
xmlSchemaNewValidCtxt (xmlSchemaPtr schema); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, | |
xmlDocPtr instance); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, | |
xmlNodePtr elem); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, | |
xmlParserInputBufferPtr input, | |
xmlCharEncoding enc, | |
xmlSAXHandlerPtr sax, | |
void *user_data); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt, | |
const char * filename, | |
int options); | |
XMLPUBFUN xmlParserCtxtPtr XMLCALL | |
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); | |
/* | |
* Interface to insert Schemas SAX validation in a SAX stream | |
*/ | |
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; | |
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; | |
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL | |
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt, | |
xmlSAXHandlerPtr *sax, | |
void **user_data); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt, | |
xmlSchemaValidityLocatorFunc f, | |
void *ctxt); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_SCHEMAS_ENABLED */ | |
#endif /* __XML_SCHEMA_H__ */ |
/* | |
* Summary: implementation of XML Schema Datatypes | |
* Description: module providing the XML Schema Datatypes implementation | |
* both definition and validity checking | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_SCHEMA_TYPES_H__ | |
#define __XML_SCHEMA_TYPES_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_SCHEMAS_ENABLED | |
#include <libxml/schemasInternals.h> | |
#include <libxml/xmlschemas.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
typedef enum { | |
XML_SCHEMA_WHITESPACE_UNKNOWN = 0, | |
XML_SCHEMA_WHITESPACE_PRESERVE = 1, | |
XML_SCHEMA_WHITESPACE_REPLACE = 2, | |
XML_SCHEMA_WHITESPACE_COLLAPSE = 3 | |
} xmlSchemaWhitespaceValueType; | |
XMLPUBFUN void XMLCALL | |
xmlSchemaInitTypes (void); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaCleanupTypes (void); | |
XMLPUBFUN xmlSchemaTypePtr XMLCALL | |
xmlSchemaGetPredefinedType (const xmlChar *name, | |
const xmlChar *ns); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, | |
const xmlChar *value, | |
xmlSchemaValPtr *val); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, | |
const xmlChar *value, | |
xmlSchemaValPtr *val, | |
xmlNodePtr node); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateFacet (xmlSchemaTypePtr base, | |
xmlSchemaFacetPtr facet, | |
const xmlChar *value, | |
xmlSchemaValPtr val); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, | |
xmlSchemaWhitespaceValueType fws, | |
xmlSchemaValType valType, | |
const xmlChar *value, | |
xmlSchemaValPtr val, | |
xmlSchemaWhitespaceValueType ws); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaFreeValue (xmlSchemaValPtr val); | |
XMLPUBFUN xmlSchemaFacetPtr XMLCALL | |
xmlSchemaNewFacet (void); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, | |
xmlSchemaTypePtr typeDecl, | |
xmlSchemaParserCtxtPtr ctxt, | |
const xmlChar *name); | |
XMLPUBFUN void XMLCALL | |
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaCompareValues (xmlSchemaValPtr x, | |
xmlSchemaValPtr y); | |
XMLPUBFUN xmlSchemaTypePtr XMLCALL | |
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, | |
const xmlChar *value, | |
unsigned long actualLen, | |
unsigned long *expectedLen); | |
XMLPUBFUN xmlSchemaTypePtr XMLCALL | |
xmlSchemaGetBuiltInType (xmlSchemaValType type); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, | |
int facetType); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlSchemaCollapseString (const xmlChar *value); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlSchemaWhiteSpaceReplace (const xmlChar *value); | |
XMLPUBFUN unsigned long XMLCALL | |
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, | |
xmlSchemaFacetPtr facet, | |
const xmlChar *value, | |
xmlSchemaValPtr val, | |
unsigned long *length); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, | |
xmlSchemaValType valType, | |
const xmlChar *value, | |
xmlSchemaValPtr val, | |
unsigned long *length, | |
xmlSchemaWhitespaceValueType ws); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, | |
const xmlChar *value, | |
xmlSchemaValPtr *val, | |
xmlNodePtr node); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaGetCanonValue (xmlSchemaValPtr val, | |
const xmlChar **retValue); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, | |
const xmlChar **retValue, | |
xmlSchemaWhitespaceValueType ws); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValueAppend (xmlSchemaValPtr prev, | |
xmlSchemaValPtr cur); | |
XMLPUBFUN xmlSchemaValPtr XMLCALL | |
xmlSchemaValueGetNext (xmlSchemaValPtr cur); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlSchemaValueGetAsString (xmlSchemaValPtr val); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); | |
XMLPUBFUN xmlSchemaValPtr XMLCALL | |
xmlSchemaNewStringValue (xmlSchemaValType type, | |
const xmlChar *value); | |
XMLPUBFUN xmlSchemaValPtr XMLCALL | |
xmlSchemaNewNOTATIONValue (const xmlChar *name, | |
const xmlChar *ns); | |
XMLPUBFUN xmlSchemaValPtr XMLCALL | |
xmlSchemaNewQNameValue (const xmlChar *namespaceName, | |
const xmlChar *localName); | |
XMLPUBFUN int XMLCALL | |
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, | |
xmlSchemaWhitespaceValueType xws, | |
xmlSchemaValPtr y, | |
xmlSchemaWhitespaceValueType yws); | |
XMLPUBFUN xmlSchemaValPtr XMLCALL | |
xmlSchemaCopyValue (xmlSchemaValPtr val); | |
XMLPUBFUN xmlSchemaValType XMLCALL | |
xmlSchemaGetValType (xmlSchemaValPtr val); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_SCHEMAS_ENABLED */ | |
#endif /* __XML_SCHEMA_TYPES_H__ */ |
/* | |
* Summary: set of routines to process strings | |
* Description: type and interfaces needed for the internal string handling | |
* of the library, especially UTF8 processing. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_STRING_H__ | |
#define __XML_STRING_H__ | |
#include <stdarg.h> | |
#include <libxml/xmlversion.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xmlChar: | |
* | |
* This is a basic byte in an UTF-8 encoded string. | |
* It's unsigned allowing to pinpoint case where char * are assigned | |
* to xmlChar * (possibly making serialization back impossible). | |
*/ | |
typedef unsigned char xmlChar; | |
/** | |
* BAD_CAST: | |
* | |
* Macro to cast a string to an xmlChar * when one know its safe. | |
*/ | |
#define BAD_CAST (xmlChar *) | |
/* | |
* xmlChar handling | |
*/ | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStrdup (const xmlChar *cur); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStrndup (const xmlChar *cur, | |
int len); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCharStrndup (const char *cur, | |
int len); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlCharStrdup (const char *cur); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStrsub (const xmlChar *str, | |
int start, | |
int len); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlStrchr (const xmlChar *str, | |
xmlChar val); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlStrstr (const xmlChar *str, | |
const xmlChar *val); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlStrcasestr (const xmlChar *str, | |
const xmlChar *val); | |
XMLPUBFUN int XMLCALL | |
xmlStrcmp (const xmlChar *str1, | |
const xmlChar *str2); | |
XMLPUBFUN int XMLCALL | |
xmlStrncmp (const xmlChar *str1, | |
const xmlChar *str2, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlStrcasecmp (const xmlChar *str1, | |
const xmlChar *str2); | |
XMLPUBFUN int XMLCALL | |
xmlStrncasecmp (const xmlChar *str1, | |
const xmlChar *str2, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlStrEqual (const xmlChar *str1, | |
const xmlChar *str2); | |
XMLPUBFUN int XMLCALL | |
xmlStrQEqual (const xmlChar *pref, | |
const xmlChar *name, | |
const xmlChar *str); | |
XMLPUBFUN int XMLCALL | |
xmlStrlen (const xmlChar *str); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStrcat (xmlChar *cur, | |
const xmlChar *add); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStrncat (xmlChar *cur, | |
const xmlChar *add, | |
int len); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlStrncatNew (const xmlChar *str1, | |
const xmlChar *str2, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlStrPrintf (xmlChar *buf, | |
int len, | |
const char *msg, | |
...) LIBXML_ATTR_FORMAT(3,4); | |
XMLPUBFUN int XMLCALL | |
xmlStrVPrintf (xmlChar *buf, | |
int len, | |
const char *msg, | |
va_list ap) LIBXML_ATTR_FORMAT(3,0); | |
XMLPUBFUN int XMLCALL | |
xmlGetUTF8Char (const unsigned char *utf, | |
int *len); | |
XMLPUBFUN int XMLCALL | |
xmlCheckUTF8 (const unsigned char *utf); | |
XMLPUBFUN int XMLCALL | |
xmlUTF8Strsize (const xmlChar *utf, | |
int len); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlUTF8Strndup (const xmlChar *utf, | |
int len); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlUTF8Strpos (const xmlChar *utf, | |
int pos); | |
XMLPUBFUN int XMLCALL | |
xmlUTF8Strloc (const xmlChar *utf, | |
const xmlChar *utfchar); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlUTF8Strsub (const xmlChar *utf, | |
int start, | |
int len); | |
XMLPUBFUN int XMLCALL | |
xmlUTF8Strlen (const xmlChar *utf); | |
XMLPUBFUN int XMLCALL | |
xmlUTF8Size (const xmlChar *utf); | |
XMLPUBFUN int XMLCALL | |
xmlUTF8Charcmp (const xmlChar *utf1, | |
const xmlChar *utf2); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_STRING_H__ */ |
/* | |
* Summary: Unicode character APIs | |
* Description: API for the Unicode character APIs | |
* | |
* This file is automatically generated from the | |
* UCS description files of the Unicode Character Database | |
* http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html | |
* using the genUnicode.py Python script. | |
* | |
* Generation date: Mon Mar 27 11:09:52 2006 | |
* Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_UNICODE_H__ | |
#define __XML_UNICODE_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_UNICODE_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLao (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTags (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsThai (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code); | |
XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_UNICODE_ENABLED */ | |
#endif /* __XML_UNICODE_H__ */ |
/* | |
* Summary: compile-time version informations | |
* Description: compile-time version informations for the XML library | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_VERSION_H__ | |
#define __XML_VERSION_H__ | |
#include <libxml/xmlexports.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* use those to be sure nothing nasty will happen if | |
* your library and includes mismatch | |
*/ | |
#ifndef LIBXML2_COMPILING_MSCCDEF | |
XMLPUBFUN void XMLCALL xmlCheckVersion(int version); | |
#endif /* LIBXML2_COMPILING_MSCCDEF */ | |
/** | |
* LIBXML_DOTTED_VERSION: | |
* | |
* the version string like "1.2.3" | |
*/ | |
#define LIBXML_DOTTED_VERSION "2.9.5" | |
/** | |
* LIBXML_VERSION: | |
* | |
* the version number: 1.2.3 value is 10203 | |
*/ | |
#define LIBXML_VERSION 20905 | |
/** | |
* LIBXML_VERSION_STRING: | |
* | |
* the version number string, 1.2.3 value is "10203" | |
*/ | |
#define LIBXML_VERSION_STRING "20905" | |
/** | |
* LIBXML_VERSION_EXTRA: | |
* | |
* extra version information, used to show a CVS compilation | |
*/ | |
#define LIBXML_VERSION_EXTRA "" | |
/** | |
* LIBXML_TEST_VERSION: | |
* | |
* Macro to check that the libxml version in use is compatible with | |
* the version the software has been compiled against | |
*/ | |
#define LIBXML_TEST_VERSION xmlCheckVersion(20905); | |
#ifndef VMS | |
#if 0 | |
/** | |
* WITH_TRIO: | |
* | |
* defined if the trio support need to be configured in | |
*/ | |
#define WITH_TRIO | |
#else | |
/** | |
* WITHOUT_TRIO: | |
* | |
* defined if the trio support should not be configured in | |
*/ | |
#define WITHOUT_TRIO | |
#endif | |
#else /* VMS */ | |
/** | |
* WITH_TRIO: | |
* | |
* defined if the trio support need to be configured in | |
*/ | |
#define WITH_TRIO 1 | |
#endif /* VMS */ | |
/** | |
* LIBXML_THREAD_ENABLED: | |
* | |
* Whether the thread support is configured in | |
*/ | |
#if 1 | |
#if defined(_REENTRANT) || defined(__MT__) || \ | |
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) | |
#define LIBXML_THREAD_ENABLED | |
#endif | |
#endif | |
/** | |
* LIBXML_THREAD_ALLOC_ENABLED: | |
* | |
* Whether the allocation hooks are per-thread | |
*/ | |
#if 0 | |
#define LIBXML_THREAD_ALLOC_ENABLED | |
#endif | |
/** | |
* LIBXML_TREE_ENABLED: | |
* | |
* Whether the DOM like tree manipulation API support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_TREE_ENABLED | |
#endif | |
/** | |
* LIBXML_OUTPUT_ENABLED: | |
* | |
* Whether the serialization/saving support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_OUTPUT_ENABLED | |
#endif | |
/** | |
* LIBXML_PUSH_ENABLED: | |
* | |
* Whether the push parsing interfaces are configured in | |
*/ | |
#if 1 | |
#define LIBXML_PUSH_ENABLED | |
#endif | |
/** | |
* LIBXML_READER_ENABLED: | |
* | |
* Whether the xmlReader parsing interface is configured in | |
*/ | |
#if 1 | |
#define LIBXML_READER_ENABLED | |
#endif | |
/** | |
* LIBXML_PATTERN_ENABLED: | |
* | |
* Whether the xmlPattern node selection interface is configured in | |
*/ | |
#if 1 | |
#define LIBXML_PATTERN_ENABLED | |
#endif | |
/** | |
* LIBXML_WRITER_ENABLED: | |
* | |
* Whether the xmlWriter saving interface is configured in | |
*/ | |
#if 1 | |
#define LIBXML_WRITER_ENABLED | |
#endif | |
/** | |
* LIBXML_SAX1_ENABLED: | |
* | |
* Whether the older SAX1 interface is configured in | |
*/ | |
#if 1 | |
#define LIBXML_SAX1_ENABLED | |
#endif | |
/** | |
* LIBXML_FTP_ENABLED: | |
* | |
* Whether the FTP support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_FTP_ENABLED | |
#endif | |
/** | |
* LIBXML_HTTP_ENABLED: | |
* | |
* Whether the HTTP support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_HTTP_ENABLED | |
#endif | |
/** | |
* LIBXML_VALID_ENABLED: | |
* | |
* Whether the DTD validation support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_VALID_ENABLED | |
#endif | |
/** | |
* LIBXML_HTML_ENABLED: | |
* | |
* Whether the HTML support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_HTML_ENABLED | |
#endif | |
/** | |
* LIBXML_LEGACY_ENABLED: | |
* | |
* Whether the deprecated APIs are compiled in for compatibility | |
*/ | |
#if 1 | |
#define LIBXML_LEGACY_ENABLED | |
#endif | |
/** | |
* LIBXML_C14N_ENABLED: | |
* | |
* Whether the Canonicalization support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_C14N_ENABLED | |
#endif | |
/** | |
* LIBXML_CATALOG_ENABLED: | |
* | |
* Whether the Catalog support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_CATALOG_ENABLED | |
#endif | |
/** | |
* LIBXML_DOCB_ENABLED: | |
* | |
* Whether the SGML Docbook support is configured in | |
*/ | |
#if 1 | |
#define LIBXML_DOCB_ENABLED | |
#endif | |
/** | |
* LIBXML_XPATH_ENABLED: | |
* | |
* Whether XPath is configured in | |
*/ | |
#if 1 | |
#define LIBXML_XPATH_ENABLED | |
#endif | |
/** | |
* LIBXML_XPTR_ENABLED: | |
* | |
* Whether XPointer is configured in | |
*/ | |
#if 1 | |
#define LIBXML_XPTR_ENABLED | |
#endif | |
/** | |
* LIBXML_XINCLUDE_ENABLED: | |
* | |
* Whether XInclude is configured in | |
*/ | |
#if 1 | |
#define LIBXML_XINCLUDE_ENABLED | |
#endif | |
/** | |
* LIBXML_ICONV_ENABLED: | |
* | |
* Whether iconv support is available | |
*/ | |
#if 1 | |
#define LIBXML_ICONV_ENABLED | |
#endif | |
/** | |
* LIBXML_ICU_ENABLED: | |
* | |
* Whether icu support is available | |
*/ | |
#if 0 | |
#define LIBXML_ICU_ENABLED | |
#endif | |
/** | |
* LIBXML_ISO8859X_ENABLED: | |
* | |
* Whether ISO-8859-* support is made available in case iconv is not | |
*/ | |
#if 0 | |
#define LIBXML_ISO8859X_ENABLED | |
#endif | |
/** | |
* LIBXML_DEBUG_ENABLED: | |
* | |
* Whether Debugging module is configured in | |
*/ | |
#if 1 | |
#define LIBXML_DEBUG_ENABLED | |
#endif | |
/** | |
* DEBUG_MEMORY_LOCATION: | |
* | |
* Whether the memory debugging is configured in | |
*/ | |
#if 0 | |
#define DEBUG_MEMORY_LOCATION | |
#endif | |
/** | |
* LIBXML_DEBUG_RUNTIME: | |
* | |
* Whether the runtime debugging is configured in | |
*/ | |
#if 0 | |
#define LIBXML_DEBUG_RUNTIME | |
#endif | |
/** | |
* LIBXML_UNICODE_ENABLED: | |
* | |
* Whether the Unicode related interfaces are compiled in | |
*/ | |
#if 1 | |
#define LIBXML_UNICODE_ENABLED | |
#endif | |
/** | |
* LIBXML_REGEXP_ENABLED: | |
* | |
* Whether the regular expressions interfaces are compiled in | |
*/ | |
#if 1 | |
#define LIBXML_REGEXP_ENABLED | |
#endif | |
/** | |
* LIBXML_AUTOMATA_ENABLED: | |
* | |
* Whether the automata interfaces are compiled in | |
*/ | |
#if 1 | |
#define LIBXML_AUTOMATA_ENABLED | |
#endif | |
/** | |
* LIBXML_EXPR_ENABLED: | |
* | |
* Whether the formal expressions interfaces are compiled in | |
*/ | |
#if 1 | |
#define LIBXML_EXPR_ENABLED | |
#endif | |
/** | |
* LIBXML_SCHEMAS_ENABLED: | |
* | |
* Whether the Schemas validation interfaces are compiled in | |
*/ | |
#if 1 | |
#define LIBXML_SCHEMAS_ENABLED | |
#endif | |
/** | |
* LIBXML_SCHEMATRON_ENABLED: | |
* | |
* Whether the Schematron validation interfaces are compiled in | |
*/ | |
#if 1 | |
#define LIBXML_SCHEMATRON_ENABLED | |
#endif | |
/** | |
* LIBXML_MODULES_ENABLED: | |
* | |
* Whether the module interfaces are compiled in | |
*/ | |
#if 1 | |
#define LIBXML_MODULES_ENABLED | |
/** | |
* LIBXML_MODULE_EXTENSION: | |
* | |
* the string suffix used by dynamic modules (usually shared libraries) | |
*/ | |
#define LIBXML_MODULE_EXTENSION ".dll" | |
#endif | |
/** | |
* LIBXML_ZLIB_ENABLED: | |
* | |
* Whether the Zlib support is compiled in | |
*/ | |
#if 1 | |
#define LIBXML_ZLIB_ENABLED | |
#endif | |
/** | |
* LIBXML_LZMA_ENABLED: | |
* | |
* Whether the Lzma support is compiled in | |
*/ | |
#if 0 | |
#define LIBXML_LZMA_ENABLED | |
#endif | |
#ifdef __GNUC__ | |
#ifdef HAVE_ANSIDECL_H | |
#include <ansidecl.h> | |
#endif | |
/** | |
* ATTRIBUTE_UNUSED: | |
* | |
* Macro used to signal to GCC unused function parameters | |
*/ | |
#ifndef ATTRIBUTE_UNUSED | |
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) | |
# define ATTRIBUTE_UNUSED __attribute__((unused)) | |
# else | |
# define ATTRIBUTE_UNUSED | |
# endif | |
#endif | |
/** | |
* LIBXML_ATTR_ALLOC_SIZE: | |
* | |
* Macro used to indicate to GCC this is an allocator function | |
*/ | |
#ifndef LIBXML_ATTR_ALLOC_SIZE | |
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) | |
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) | |
# else | |
# define LIBXML_ATTR_ALLOC_SIZE(x) | |
# endif | |
#else | |
# define LIBXML_ATTR_ALLOC_SIZE(x) | |
#endif | |
/** | |
* LIBXML_ATTR_FORMAT: | |
* | |
* Macro used to indicate to GCC the parameter are printf like | |
*/ | |
#ifndef LIBXML_ATTR_FORMAT | |
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) | |
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) | |
# else | |
# define LIBXML_ATTR_FORMAT(fmt,args) | |
# endif | |
#else | |
# define LIBXML_ATTR_FORMAT(fmt,args) | |
#endif | |
#else /* ! __GNUC__ */ | |
/** | |
* ATTRIBUTE_UNUSED: | |
* | |
* Macro used to signal to GCC unused function parameters | |
*/ | |
#define ATTRIBUTE_UNUSED | |
/** | |
* LIBXML_ATTR_ALLOC_SIZE: | |
* | |
* Macro used to indicate to GCC this is an allocator function | |
*/ | |
#define LIBXML_ATTR_ALLOC_SIZE(x) | |
/** | |
* LIBXML_ATTR_FORMAT: | |
* | |
* Macro used to indicate to GCC the parameter are printf like | |
*/ | |
#define LIBXML_ATTR_FORMAT(fmt,args) | |
#endif /* __GNUC__ */ | |
#ifdef __cplusplus | |
} | |
#endif /* __cplusplus */ | |
#endif | |
/* | |
* Summary: text writing API for XML | |
* Description: text writing API for XML | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Alfred Mickautsch <alfred@mickautsch.de> | |
*/ | |
#ifndef __XML_XMLWRITER_H__ | |
#define __XML_XMLWRITER_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_WRITER_ENABLED | |
#include <stdarg.h> | |
#include <libxml/xmlIO.h> | |
#include <libxml/list.h> | |
#include <libxml/xmlstring.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
typedef struct _xmlTextWriter xmlTextWriter; | |
typedef xmlTextWriter *xmlTextWriterPtr; | |
/* | |
* Constructors & Destructor | |
*/ | |
XMLPUBFUN xmlTextWriterPtr XMLCALL | |
xmlNewTextWriter(xmlOutputBufferPtr out); | |
XMLPUBFUN xmlTextWriterPtr XMLCALL | |
xmlNewTextWriterFilename(const char *uri, int compression); | |
XMLPUBFUN xmlTextWriterPtr XMLCALL | |
xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); | |
XMLPUBFUN xmlTextWriterPtr XMLCALL | |
xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); | |
XMLPUBFUN xmlTextWriterPtr XMLCALL | |
xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); | |
XMLPUBFUN xmlTextWriterPtr XMLCALL | |
xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, | |
int compression); | |
XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); | |
/* | |
* Functions | |
*/ | |
/* | |
* Document | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartDocument(xmlTextWriterPtr writer, | |
const char *version, | |
const char *encoding, | |
const char *standalone); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr | |
writer); | |
/* | |
* Comments | |
*/ | |
XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr | |
writer); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(2,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr | |
writer, | |
const xmlChar * | |
content); | |
/* | |
* Elements | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartElement(xmlTextWriterPtr writer, | |
const xmlChar * name); | |
XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr | |
writer, | |
const xmlChar * | |
prefix, | |
const xmlChar * name, | |
const xmlChar * | |
namespaceURI); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); | |
XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr | |
writer); | |
/* | |
* Elements conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(3,4); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(3,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr | |
writer, | |
const xmlChar * name, | |
const xmlChar * | |
content); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, | |
const xmlChar * prefix, | |
const xmlChar * name, | |
const xmlChar * namespaceURI, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(5,6); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, | |
const xmlChar * prefix, | |
const xmlChar * name, | |
const xmlChar * namespaceURI, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(5,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr | |
writer, | |
const xmlChar * | |
prefix, | |
const xmlChar * name, | |
const xmlChar * | |
namespaceURI, | |
const xmlChar * | |
content); | |
/* | |
* Text | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, | |
const char *format, va_list argptr) | |
LIBXML_ATTR_FORMAT(2,0); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, | |
const xmlChar * content, int len); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteRaw(xmlTextWriterPtr writer, | |
const xmlChar * content); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr | |
writer, | |
const char | |
*format, ...) | |
LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr | |
writer, | |
const char | |
*format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(2,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, | |
const xmlChar * | |
content); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, | |
const char *data, | |
int start, int len); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, | |
const char *data, | |
int start, int len); | |
/* | |
* Attributes | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartAttribute(xmlTextWriterPtr writer, | |
const xmlChar * name); | |
XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr | |
writer, | |
const xmlChar * | |
prefix, | |
const xmlChar * | |
name, | |
const xmlChar * | |
namespaceURI); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr | |
writer); | |
/* | |
* Attributes conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(3,4); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(3,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr | |
writer, | |
const xmlChar * name, | |
const xmlChar * | |
content); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, | |
const xmlChar * prefix, | |
const xmlChar * name, | |
const xmlChar * namespaceURI, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(5,6); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, | |
const xmlChar * prefix, | |
const xmlChar * name, | |
const xmlChar * namespaceURI, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(5,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr | |
writer, | |
const xmlChar * | |
prefix, | |
const xmlChar * | |
name, | |
const xmlChar * | |
namespaceURI, | |
const xmlChar * | |
content); | |
/* | |
* PI's | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartPI(xmlTextWriterPtr writer, | |
const xmlChar * target); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); | |
/* | |
* PI conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, | |
const xmlChar * target, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(3,4); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, | |
const xmlChar * target, | |
const char *format, va_list argptr) | |
LIBXML_ATTR_FORMAT(3,0); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWritePI(xmlTextWriterPtr writer, | |
const xmlChar * target, | |
const xmlChar * content); | |
/** | |
* xmlTextWriterWriteProcessingInstruction: | |
* | |
* This macro maps to xmlTextWriterWritePI | |
*/ | |
#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI | |
/* | |
* CDATA | |
*/ | |
XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); | |
/* | |
* CDATA conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(2,3); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, | |
const char *format, va_list argptr) | |
LIBXML_ATTR_FORMAT(2,0); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, | |
const xmlChar * content); | |
/* | |
* DTD | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartDTD(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const xmlChar * pubid, | |
const xmlChar * sysid); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); | |
/* | |
* DTD conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const xmlChar * pubid, | |
const xmlChar * sysid, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(5,6); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const xmlChar * pubid, | |
const xmlChar * sysid, | |
const char *format, va_list argptr) | |
LIBXML_ATTR_FORMAT(5,0); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteDTD(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const xmlChar * pubid, | |
const xmlChar * sysid, | |
const xmlChar * subset); | |
/** | |
* xmlTextWriterWriteDocType: | |
* | |
* this macro maps to xmlTextWriterWriteDTD | |
*/ | |
#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD | |
/* | |
* DTD element definition | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, | |
const xmlChar * name); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr | |
writer); | |
/* | |
* DTD element definition conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(3,4); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(3,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr | |
writer, | |
const xmlChar * | |
name, | |
const xmlChar * | |
content); | |
/* | |
* DTD attribute list definition | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, | |
const xmlChar * name); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr | |
writer); | |
/* | |
* DTD attribute list definition conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(3,4); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(3,0); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr | |
writer, | |
const xmlChar * | |
name, | |
const xmlChar * | |
content); | |
/* | |
* DTD entity definition | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, | |
int pe, const xmlChar * name); | |
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr | |
writer); | |
/* | |
* DTD entity definition conveniency functions | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, | |
int pe, | |
const xmlChar * name, | |
const char *format, ...) | |
LIBXML_ATTR_FORMAT(4,5); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, | |
int pe, | |
const xmlChar * name, | |
const char *format, | |
va_list argptr) | |
LIBXML_ATTR_FORMAT(4,0); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, | |
int pe, | |
const xmlChar * name, | |
const xmlChar * content); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, | |
int pe, | |
const xmlChar * name, | |
const xmlChar * pubid, | |
const xmlChar * sysid, | |
const xmlChar * ndataid); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr | |
writer, | |
const xmlChar * pubid, | |
const xmlChar * sysid, | |
const xmlChar * | |
ndataid); | |
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr | |
writer, int pe, | |
const xmlChar * name, | |
const xmlChar * | |
pubid, | |
const xmlChar * | |
sysid, | |
const xmlChar * | |
ndataid, | |
const xmlChar * | |
content); | |
/* | |
* DTD notation definition | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, | |
const xmlChar * name, | |
const xmlChar * pubid, | |
const xmlChar * sysid); | |
/* | |
* Indentation | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterSetIndentString(xmlTextWriterPtr writer, | |
const xmlChar * str); | |
XMLPUBFUN int XMLCALL | |
xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); | |
/* | |
* misc | |
*/ | |
XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_WRITER_ENABLED */ | |
#endif /* __XML_XMLWRITER_H__ */ |
/* | |
* Summary: XML Path Language implementation | |
* Description: API for the XML Path Language implementation | |
* | |
* XML Path Language implementation | |
* XPath is a language for addressing parts of an XML document, | |
* designed to be used by both XSLT and XPointer | |
* http://www.w3.org/TR/xpath | |
* | |
* Implements | |
* W3C Recommendation 16 November 1999 | |
* http://www.w3.org/TR/1999/REC-xpath-19991116 | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XPATH_H__ | |
#define __XML_XPATH_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_XPATH_ENABLED | |
#include <libxml/xmlerror.h> | |
#include <libxml/tree.h> | |
#include <libxml/hash.h> | |
#endif /* LIBXML_XPATH_ENABLED */ | |
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ | |
#ifdef LIBXML_XPATH_ENABLED | |
typedef struct _xmlXPathContext xmlXPathContext; | |
typedef xmlXPathContext *xmlXPathContextPtr; | |
typedef struct _xmlXPathParserContext xmlXPathParserContext; | |
typedef xmlXPathParserContext *xmlXPathParserContextPtr; | |
/** | |
* The set of XPath error codes. | |
*/ | |
typedef enum { | |
XPATH_EXPRESSION_OK = 0, | |
XPATH_NUMBER_ERROR, | |
XPATH_UNFINISHED_LITERAL_ERROR, | |
XPATH_START_LITERAL_ERROR, | |
XPATH_VARIABLE_REF_ERROR, | |
XPATH_UNDEF_VARIABLE_ERROR, | |
XPATH_INVALID_PREDICATE_ERROR, | |
XPATH_EXPR_ERROR, | |
XPATH_UNCLOSED_ERROR, | |
XPATH_UNKNOWN_FUNC_ERROR, | |
XPATH_INVALID_OPERAND, | |
XPATH_INVALID_TYPE, | |
XPATH_INVALID_ARITY, | |
XPATH_INVALID_CTXT_SIZE, | |
XPATH_INVALID_CTXT_POSITION, | |
XPATH_MEMORY_ERROR, | |
XPTR_SYNTAX_ERROR, | |
XPTR_RESOURCE_ERROR, | |
XPTR_SUB_RESOURCE_ERROR, | |
XPATH_UNDEF_PREFIX_ERROR, | |
XPATH_ENCODING_ERROR, | |
XPATH_INVALID_CHAR_ERROR, | |
XPATH_INVALID_CTXT, | |
XPATH_STACK_ERROR, | |
XPATH_FORBID_VARIABLE_ERROR | |
} xmlXPathError; | |
/* | |
* A node-set (an unordered collection of nodes without duplicates). | |
*/ | |
typedef struct _xmlNodeSet xmlNodeSet; | |
typedef xmlNodeSet *xmlNodeSetPtr; | |
struct _xmlNodeSet { | |
int nodeNr; /* number of nodes in the set */ | |
int nodeMax; /* size of the array as allocated */ | |
xmlNodePtr *nodeTab; /* array of nodes in no particular order */ | |
/* @@ with_ns to check wether namespace nodes should be looked at @@ */ | |
}; | |
/* | |
* An expression is evaluated to yield an object, which | |
* has one of the following four basic types: | |
* - node-set | |
* - boolean | |
* - number | |
* - string | |
* | |
* @@ XPointer will add more types ! | |
*/ | |
typedef enum { | |
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 /* An XSLT value tree, non modifiable */ | |
} xmlXPathObjectType; | |
typedef struct _xmlXPathObject xmlXPathObject; | |
typedef xmlXPathObject *xmlXPathObjectPtr; | |
struct _xmlXPathObject { | |
xmlXPathObjectType type; | |
xmlNodeSetPtr nodesetval; | |
int boolval; | |
double floatval; | |
xmlChar *stringval; | |
void *user; | |
int index; | |
void *user2; | |
int index2; | |
}; | |
/** | |
* xmlXPathConvertFunc: | |
* @obj: an XPath object | |
* @type: the number of the target type | |
* | |
* A conversion function is associated to a type and used to cast | |
* the new type to primitive values. | |
* | |
* Returns -1 in case of error, 0 otherwise | |
*/ | |
typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); | |
/* | |
* Extra type: a name and a conversion function. | |
*/ | |
typedef struct _xmlXPathType xmlXPathType; | |
typedef xmlXPathType *xmlXPathTypePtr; | |
struct _xmlXPathType { | |
const xmlChar *name; /* the type name */ | |
xmlXPathConvertFunc func; /* the conversion function */ | |
}; | |
/* | |
* Extra variable: a name and a value. | |
*/ | |
typedef struct _xmlXPathVariable xmlXPathVariable; | |
typedef xmlXPathVariable *xmlXPathVariablePtr; | |
struct _xmlXPathVariable { | |
const xmlChar *name; /* the variable name */ | |
xmlXPathObjectPtr value; /* the value */ | |
}; | |
/** | |
* xmlXPathEvalFunc: | |
* @ctxt: an XPath parser context | |
* @nargs: the number of arguments passed to the function | |
* | |
* An XPath evaluation function, the parameters are on the XPath context stack. | |
*/ | |
typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, | |
int nargs); | |
/* | |
* Extra function: a name and a evaluation function. | |
*/ | |
typedef struct _xmlXPathFunct xmlXPathFunct; | |
typedef xmlXPathFunct *xmlXPathFuncPtr; | |
struct _xmlXPathFunct { | |
const xmlChar *name; /* the function name */ | |
xmlXPathEvalFunc func; /* the evaluation function */ | |
}; | |
/** | |
* xmlXPathAxisFunc: | |
* @ctxt: the XPath interpreter context | |
* @cur: the previous node being explored on that axis | |
* | |
* An axis traversal function. To traverse an axis, the engine calls | |
* the first time with cur == NULL and repeat until the function returns | |
* NULL indicating the end of the axis traversal. | |
* | |
* Returns the next node in that axis or NULL if at the end of the axis. | |
*/ | |
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, | |
xmlXPathObjectPtr cur); | |
/* | |
* Extra axis: a name and an axis function. | |
*/ | |
typedef struct _xmlXPathAxis xmlXPathAxis; | |
typedef xmlXPathAxis *xmlXPathAxisPtr; | |
struct _xmlXPathAxis { | |
const xmlChar *name; /* the axis name */ | |
xmlXPathAxisFunc func; /* the search function */ | |
}; | |
/** | |
* xmlXPathFunction: | |
* @ctxt: the XPath interprestation context | |
* @nargs: the number of arguments | |
* | |
* An XPath function. | |
* The arguments (if any) are popped out from the context stack | |
* and the result is pushed on the stack. | |
*/ | |
typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); | |
/* | |
* Function and Variable Lookup. | |
*/ | |
/** | |
* xmlXPathVariableLookupFunc: | |
* @ctxt: an XPath context | |
* @name: name of the variable | |
* @ns_uri: the namespace name hosting this variable | |
* | |
* Prototype for callbacks used to plug variable lookup in the XPath | |
* engine. | |
* | |
* Returns the XPath object value or NULL if not found. | |
*/ | |
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri); | |
/** | |
* xmlXPathFuncLookupFunc: | |
* @ctxt: an XPath context | |
* @name: name of the function | |
* @ns_uri: the namespace name hosting this function | |
* | |
* Prototype for callbacks used to plug function lookup in the XPath | |
* engine. | |
* | |
* Returns the XPath function or NULL if not found. | |
*/ | |
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri); | |
/** | |
* xmlXPathFlags: | |
* Flags for XPath engine compilation and runtime | |
*/ | |
/** | |
* XML_XPATH_CHECKNS: | |
* | |
* check namespaces at compilation | |
*/ | |
#define XML_XPATH_CHECKNS (1<<0) | |
/** | |
* XML_XPATH_NOVAR: | |
* | |
* forbid variables in expression | |
*/ | |
#define XML_XPATH_NOVAR (1<<1) | |
/** | |
* xmlXPathContext: | |
* | |
* Expression evaluation occurs with respect to a context. | |
* he context consists of: | |
* - a node (the context node) | |
* - a node list (the context node list) | |
* - a set of variable bindings | |
* - a function library | |
* - the set of namespace declarations in scope for the expression | |
* Following the switch to hash tables, this need to be trimmed up at | |
* the next binary incompatible release. | |
* The node may be modified when the context is passed to libxml2 | |
* for an XPath evaluation so you may need to initialize it again | |
* before the next call. | |
*/ | |
struct _xmlXPathContext { | |
xmlDocPtr doc; /* The current document */ | |
xmlNodePtr node; /* The current node */ | |
int nb_variables_unused; /* unused (hash table) */ | |
int max_variables_unused; /* unused (hash table) */ | |
xmlHashTablePtr varHash; /* Hash table of defined variables */ | |
int nb_types; /* number of defined types */ | |
int max_types; /* max number of types */ | |
xmlXPathTypePtr types; /* Array of defined types */ | |
int nb_funcs_unused; /* unused (hash table) */ | |
int max_funcs_unused; /* unused (hash table) */ | |
xmlHashTablePtr funcHash; /* Hash table of defined funcs */ | |
int nb_axis; /* number of defined axis */ | |
int max_axis; /* max number of axis */ | |
xmlXPathAxisPtr axis; /* Array of defined axis */ | |
/* the namespace nodes of the context node */ | |
xmlNsPtr *namespaces; /* Array of namespaces */ | |
int nsNr; /* number of namespace in scope */ | |
void *user; /* function to free */ | |
/* extra variables */ | |
int contextSize; /* the context size */ | |
int proximityPosition; /* the proximity position */ | |
/* extra stuff for XPointer */ | |
int xptr; /* is this an XPointer context? */ | |
xmlNodePtr here; /* for here() */ | |
xmlNodePtr origin; /* for origin() */ | |
/* the set of namespace declarations in scope for the expression */ | |
xmlHashTablePtr nsHash; /* The namespaces hash table */ | |
xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ | |
void *varLookupData; /* variable lookup data */ | |
/* Possibility to link in an extra item */ | |
void *extra; /* needed for XSLT */ | |
/* The function name and URI when calling a function */ | |
const xmlChar *function; | |
const xmlChar *functionURI; | |
/* function lookup function and data */ | |
xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ | |
void *funcLookupData; /* function lookup data */ | |
/* temporary namespace lists kept for walking the namespace axis */ | |
xmlNsPtr *tmpNsList; /* Array of namespaces */ | |
int tmpNsNr; /* number of namespaces in scope */ | |
/* error reporting mechanism */ | |
void *userData; /* user specific data block */ | |
xmlStructuredErrorFunc error; /* the callback in case of errors */ | |
xmlError lastError; /* the last error */ | |
xmlNodePtr debugNode; /* the source node XSLT */ | |
/* dictionary */ | |
xmlDictPtr dict; /* dictionary if any */ | |
int flags; /* flags to control compilation */ | |
/* Cache for reusal of XPath objects */ | |
void *cache; | |
}; | |
/* | |
* The structure of a compiled expression form is not public. | |
*/ | |
typedef struct _xmlXPathCompExpr xmlXPathCompExpr; | |
typedef xmlXPathCompExpr *xmlXPathCompExprPtr; | |
/** | |
* xmlXPathParserContext: | |
* | |
* An XPath parser context. It contains pure parsing informations, | |
* an xmlXPathContext, and the stack of objects. | |
*/ | |
struct _xmlXPathParserContext { | |
const xmlChar *cur; /* the current char being parsed */ | |
const xmlChar *base; /* the full expression */ | |
int error; /* error code */ | |
xmlXPathContextPtr context; /* the evaluation context */ | |
xmlXPathObjectPtr value; /* the current value */ | |
int valueNr; /* number of values stacked */ | |
int valueMax; /* max number of values stacked */ | |
xmlXPathObjectPtr *valueTab; /* stack of values */ | |
xmlXPathCompExprPtr comp; /* the precompiled expression */ | |
int xptr; /* it this an XPointer expression */ | |
xmlNodePtr ancestor; /* used for walking preceding axis */ | |
int valueFrame; /* used to limit Pop on the stack */ | |
}; | |
/************************************************************************ | |
* * | |
* Public API * | |
* * | |
************************************************************************/ | |
/** | |
* Objects and Nodesets handling | |
*/ | |
XMLPUBVAR double xmlXPathNAN; | |
XMLPUBVAR double xmlXPathPINF; | |
XMLPUBVAR double xmlXPathNINF; | |
/* These macros may later turn into functions */ | |
/** | |
* xmlXPathNodeSetGetLength: | |
* @ns: a node-set | |
* | |
* Implement a functionality similar to the DOM NodeList.length. | |
* | |
* Returns the number of nodes in the node-set. | |
*/ | |
#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) | |
/** | |
* xmlXPathNodeSetItem: | |
* @ns: a node-set | |
* @index: index of a node in the set | |
* | |
* Implements a functionality similar to the DOM NodeList.item(). | |
* | |
* Returns the xmlNodePtr at the given @index in @ns or NULL if | |
* @index is out of range (0 to length-1) | |
*/ | |
#define xmlXPathNodeSetItem(ns, index) \ | |
((((ns) != NULL) && \ | |
((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ | |
(ns)->nodeTab[(index)] \ | |
: NULL) | |
/** | |
* xmlXPathNodeSetIsEmpty: | |
* @ns: a node-set | |
* | |
* Checks whether @ns is empty or not. | |
* | |
* Returns %TRUE if @ns is an empty node-set. | |
*/ | |
#define xmlXPathNodeSetIsEmpty(ns) \ | |
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) | |
XMLPUBFUN void XMLCALL | |
xmlXPathFreeObject (xmlXPathObjectPtr obj); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathNodeSetCreate (xmlNodePtr val); | |
XMLPUBFUN void XMLCALL | |
xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); | |
XMLPUBFUN void XMLCALL | |
xmlXPathFreeNodeSet (xmlNodeSetPtr obj); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathObjectCopy (xmlXPathObjectPtr val); | |
XMLPUBFUN int XMLCALL | |
xmlXPathCmpNodes (xmlNodePtr node1, | |
xmlNodePtr node2); | |
/** | |
* Conversion functions to basic types. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlXPathCastNumberToBoolean (double val); | |
XMLPUBFUN int XMLCALL | |
xmlXPathCastStringToBoolean (const xmlChar * val); | |
XMLPUBFUN int XMLCALL | |
xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); | |
XMLPUBFUN int XMLCALL | |
xmlXPathCastToBoolean (xmlXPathObjectPtr val); | |
XMLPUBFUN double XMLCALL | |
xmlXPathCastBooleanToNumber (int val); | |
XMLPUBFUN double XMLCALL | |
xmlXPathCastStringToNumber (const xmlChar * val); | |
XMLPUBFUN double XMLCALL | |
xmlXPathCastNodeToNumber (xmlNodePtr node); | |
XMLPUBFUN double XMLCALL | |
xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); | |
XMLPUBFUN double XMLCALL | |
xmlXPathCastToNumber (xmlXPathObjectPtr val); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathCastBooleanToString (int val); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathCastNumberToString (double val); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathCastNodeToString (xmlNodePtr node); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathCastToString (xmlXPathObjectPtr val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathConvertBoolean (xmlXPathObjectPtr val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathConvertNumber (xmlXPathObjectPtr val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathConvertString (xmlXPathObjectPtr val); | |
/** | |
* Context handling. | |
*/ | |
XMLPUBFUN xmlXPathContextPtr XMLCALL | |
xmlXPathNewContext (xmlDocPtr doc); | |
XMLPUBFUN void XMLCALL | |
xmlXPathFreeContext (xmlXPathContextPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlXPathContextSetCache(xmlXPathContextPtr ctxt, | |
int active, | |
int value, | |
int options); | |
/** | |
* Evaluation functions. | |
*/ | |
XMLPUBFUN long XMLCALL | |
xmlXPathOrderDocElems (xmlDocPtr doc); | |
XMLPUBFUN int XMLCALL | |
xmlXPathSetContextNode (xmlNodePtr node, | |
xmlXPathContextPtr ctx); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNodeEval (xmlNodePtr node, | |
const xmlChar *str, | |
xmlXPathContextPtr ctx); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathEval (const xmlChar *str, | |
xmlXPathContextPtr ctx); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathEvalExpression (const xmlChar *str, | |
xmlXPathContextPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, | |
xmlXPathObjectPtr res); | |
/** | |
* Separate compilation/evaluation entry points. | |
*/ | |
XMLPUBFUN xmlXPathCompExprPtr XMLCALL | |
xmlXPathCompile (const xmlChar *str); | |
XMLPUBFUN xmlXPathCompExprPtr XMLCALL | |
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, | |
const xmlChar *str); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathCompiledEval (xmlXPathCompExprPtr comp, | |
xmlXPathContextPtr ctx); | |
XMLPUBFUN int XMLCALL | |
xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, | |
xmlXPathContextPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); | |
#endif /* LIBXML_XPATH_ENABLED */ | |
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |
XMLPUBFUN void XMLCALL | |
xmlXPathInit (void); | |
XMLPUBFUN int XMLCALL | |
xmlXPathIsNaN (double val); | |
XMLPUBFUN int XMLCALL | |
xmlXPathIsInf (double val); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ | |
#endif /* ! __XML_XPATH_H__ */ |
/* | |
* Summary: internal interfaces for XML Path Language implementation | |
* Description: internal interfaces for XML Path Language implementation | |
* used to build new modules on top of XPath like XPointer and | |
* XSLT | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XPATH_INTERNALS_H__ | |
#define __XML_XPATH_INTERNALS_H__ | |
#include <libxml/xmlversion.h> | |
#include <libxml/xpath.h> | |
#ifdef LIBXML_XPATH_ENABLED | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/************************************************************************ | |
* * | |
* Helpers * | |
* * | |
************************************************************************/ | |
/* | |
* Many of these macros may later turn into functions. They | |
* shouldn't be used in #ifdef's preprocessor instructions. | |
*/ | |
/** | |
* xmlXPathSetError: | |
* @ctxt: an XPath parser context | |
* @err: an xmlXPathError code | |
* | |
* Raises an error. | |
*/ | |
#define xmlXPathSetError(ctxt, err) \ | |
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ | |
if ((ctxt) != NULL) (ctxt)->error = (err); } | |
/** | |
* xmlXPathSetArityError: | |
* @ctxt: an XPath parser context | |
* | |
* Raises an XPATH_INVALID_ARITY error. | |
*/ | |
#define xmlXPathSetArityError(ctxt) \ | |
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) | |
/** | |
* xmlXPathSetTypeError: | |
* @ctxt: an XPath parser context | |
* | |
* Raises an XPATH_INVALID_TYPE error. | |
*/ | |
#define xmlXPathSetTypeError(ctxt) \ | |
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) | |
/** | |
* xmlXPathGetError: | |
* @ctxt: an XPath parser context | |
* | |
* Get the error code of an XPath context. | |
* | |
* Returns the context error. | |
*/ | |
#define xmlXPathGetError(ctxt) ((ctxt)->error) | |
/** | |
* xmlXPathCheckError: | |
* @ctxt: an XPath parser context | |
* | |
* Check if an XPath error was raised. | |
* | |
* Returns true if an error has been raised, false otherwise. | |
*/ | |
#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) | |
/** | |
* xmlXPathGetDocument: | |
* @ctxt: an XPath parser context | |
* | |
* Get the document of an XPath context. | |
* | |
* Returns the context document. | |
*/ | |
#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) | |
/** | |
* xmlXPathGetContextNode: | |
* @ctxt: an XPath parser context | |
* | |
* Get the context node of an XPath context. | |
* | |
* Returns the context node. | |
*/ | |
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) | |
XMLPUBFUN int XMLCALL | |
xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN double XMLCALL | |
xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathPopString (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN void * XMLCALL | |
xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); | |
/** | |
* xmlXPathReturnBoolean: | |
* @ctxt: an XPath parser context | |
* @val: a boolean | |
* | |
* Pushes the boolean @val on the context stack. | |
*/ | |
#define xmlXPathReturnBoolean(ctxt, val) \ | |
valuePush((ctxt), xmlXPathNewBoolean(val)) | |
/** | |
* xmlXPathReturnTrue: | |
* @ctxt: an XPath parser context | |
* | |
* Pushes true on the context stack. | |
*/ | |
#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) | |
/** | |
* xmlXPathReturnFalse: | |
* @ctxt: an XPath parser context | |
* | |
* Pushes false on the context stack. | |
*/ | |
#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) | |
/** | |
* xmlXPathReturnNumber: | |
* @ctxt: an XPath parser context | |
* @val: a double | |
* | |
* Pushes the double @val on the context stack. | |
*/ | |
#define xmlXPathReturnNumber(ctxt, val) \ | |
valuePush((ctxt), xmlXPathNewFloat(val)) | |
/** | |
* xmlXPathReturnString: | |
* @ctxt: an XPath parser context | |
* @str: a string | |
* | |
* Pushes the string @str on the context stack. | |
*/ | |
#define xmlXPathReturnString(ctxt, str) \ | |
valuePush((ctxt), xmlXPathWrapString(str)) | |
/** | |
* xmlXPathReturnEmptyString: | |
* @ctxt: an XPath parser context | |
* | |
* Pushes an empty string on the stack. | |
*/ | |
#define xmlXPathReturnEmptyString(ctxt) \ | |
valuePush((ctxt), xmlXPathNewCString("")) | |
/** | |
* xmlXPathReturnNodeSet: | |
* @ctxt: an XPath parser context | |
* @ns: a node-set | |
* | |
* Pushes the node-set @ns on the context stack. | |
*/ | |
#define xmlXPathReturnNodeSet(ctxt, ns) \ | |
valuePush((ctxt), xmlXPathWrapNodeSet(ns)) | |
/** | |
* xmlXPathReturnEmptyNodeSet: | |
* @ctxt: an XPath parser context | |
* | |
* Pushes an empty node-set on the context stack. | |
*/ | |
#define xmlXPathReturnEmptyNodeSet(ctxt) \ | |
valuePush((ctxt), xmlXPathNewNodeSet(NULL)) | |
/** | |
* xmlXPathReturnExternal: | |
* @ctxt: an XPath parser context | |
* @val: user data | |
* | |
* Pushes user data on the context stack. | |
*/ | |
#define xmlXPathReturnExternal(ctxt, val) \ | |
valuePush((ctxt), xmlXPathWrapExternal(val)) | |
/** | |
* xmlXPathStackIsNodeSet: | |
* @ctxt: an XPath parser context | |
* | |
* Check if the current value on the XPath stack is a node set or | |
* an XSLT value tree. | |
* | |
* Returns true if the current object on the stack is a node-set. | |
*/ | |
#define xmlXPathStackIsNodeSet(ctxt) \ | |
(((ctxt)->value != NULL) \ | |
&& (((ctxt)->value->type == XPATH_NODESET) \ | |
|| ((ctxt)->value->type == XPATH_XSLT_TREE))) | |
/** | |
* xmlXPathStackIsExternal: | |
* @ctxt: an XPath parser context | |
* | |
* Checks if the current value on the XPath stack is an external | |
* object. | |
* | |
* Returns true if the current object on the stack is an external | |
* object. | |
*/ | |
#define xmlXPathStackIsExternal(ctxt) \ | |
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) | |
/** | |
* xmlXPathEmptyNodeSet: | |
* @ns: a node-set | |
* | |
* Empties a node-set. | |
*/ | |
#define xmlXPathEmptyNodeSet(ns) \ | |
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; } | |
/** | |
* CHECK_ERROR: | |
* | |
* Macro to return from the function if an XPath error was detected. | |
*/ | |
#define CHECK_ERROR \ | |
if (ctxt->error != XPATH_EXPRESSION_OK) return | |
/** | |
* CHECK_ERROR0: | |
* | |
* Macro to return 0 from the function if an XPath error was detected. | |
*/ | |
#define CHECK_ERROR0 \ | |
if (ctxt->error != XPATH_EXPRESSION_OK) return(0) | |
/** | |
* XP_ERROR: | |
* @X: the error code | |
* | |
* Macro to raise an XPath error and return. | |
*/ | |
#define XP_ERROR(X) \ | |
{ xmlXPathErr(ctxt, X); return; } | |
/** | |
* XP_ERROR0: | |
* @X: the error code | |
* | |
* Macro to raise an XPath error and return 0. | |
*/ | |
#define XP_ERROR0(X) \ | |
{ xmlXPathErr(ctxt, X); return(0); } | |
/** | |
* CHECK_TYPE: | |
* @typeval: the XPath type | |
* | |
* Macro to check that the value on top of the XPath stack is of a given | |
* type. | |
*/ | |
#define CHECK_TYPE(typeval) \ | |
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ | |
XP_ERROR(XPATH_INVALID_TYPE) | |
/** | |
* CHECK_TYPE0: | |
* @typeval: the XPath type | |
* | |
* Macro to check that the value on top of the XPath stack is of a given | |
* type. Return(0) in case of failure | |
*/ | |
#define CHECK_TYPE0(typeval) \ | |
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ | |
XP_ERROR0(XPATH_INVALID_TYPE) | |
/** | |
* CHECK_ARITY: | |
* @x: the number of expected args | |
* | |
* Macro to check that the number of args passed to an XPath function matches. | |
*/ | |
#define CHECK_ARITY(x) \ | |
if (ctxt == NULL) return; \ | |
if (nargs != (x)) \ | |
XP_ERROR(XPATH_INVALID_ARITY); \ | |
if (ctxt->valueNr < ctxt->valueFrame + (x)) \ | |
XP_ERROR(XPATH_STACK_ERROR); | |
/** | |
* CAST_TO_STRING: | |
* | |
* Macro to try to cast the value on the top of the XPath stack to a string. | |
*/ | |
#define CAST_TO_STRING \ | |
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ | |
xmlXPathStringFunction(ctxt, 1); | |
/** | |
* CAST_TO_NUMBER: | |
* | |
* Macro to try to cast the value on the top of the XPath stack to a number. | |
*/ | |
#define CAST_TO_NUMBER \ | |
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ | |
xmlXPathNumberFunction(ctxt, 1); | |
/** | |
* CAST_TO_BOOLEAN: | |
* | |
* Macro to try to cast the value on the top of the XPath stack to a boolean. | |
*/ | |
#define CAST_TO_BOOLEAN \ | |
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ | |
xmlXPathBooleanFunction(ctxt, 1); | |
/* | |
* Variable Lookup forwarding. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, | |
xmlXPathVariableLookupFunc f, | |
void *data); | |
/* | |
* Function Lookup forwarding. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, | |
xmlXPathFuncLookupFunc f, | |
void *funcCtxt); | |
/* | |
* Error reporting. | |
*/ | |
XMLPUBFUN void XMLCALL | |
xmlXPatherror (xmlXPathParserContextPtr ctxt, | |
const char *file, | |
int line, | |
int no); | |
XMLPUBFUN void XMLCALL | |
xmlXPathErr (xmlXPathParserContextPtr ctxt, | |
int error); | |
#ifdef LIBXML_DEBUG_ENABLED | |
XMLPUBFUN void XMLCALL | |
xmlXPathDebugDumpObject (FILE *output, | |
xmlXPathObjectPtr cur, | |
int depth); | |
XMLPUBFUN void XMLCALL | |
xmlXPathDebugDumpCompExpr(FILE *output, | |
xmlXPathCompExprPtr comp, | |
int depth); | |
#endif | |
/** | |
* NodeSet handling. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlXPathNodeSetContains (xmlNodeSetPtr cur, | |
xmlNodePtr val); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathDifference (xmlNodeSetPtr nodes1, | |
xmlNodeSetPtr nodes2); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathIntersection (xmlNodeSetPtr nodes1, | |
xmlNodeSetPtr nodes2); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathDistinctSorted (xmlNodeSetPtr nodes); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathDistinct (xmlNodeSetPtr nodes); | |
XMLPUBFUN int XMLCALL | |
xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, | |
xmlNodeSetPtr nodes2); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, | |
xmlNodePtr node); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, | |
xmlNodeSetPtr nodes2); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathNodeLeading (xmlNodeSetPtr nodes, | |
xmlNodePtr node); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathLeading (xmlNodeSetPtr nodes1, | |
xmlNodeSetPtr nodes2); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, | |
xmlNodePtr node); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, | |
xmlNodeSetPtr nodes2); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathNodeTrailing (xmlNodeSetPtr nodes, | |
xmlNodePtr node); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathTrailing (xmlNodeSetPtr nodes1, | |
xmlNodeSetPtr nodes2); | |
/** | |
* Extending a context. | |
*/ | |
XMLPUBFUN int XMLCALL | |
xmlXPathRegisterNs (xmlXPathContextPtr ctxt, | |
const xmlChar *prefix, | |
const xmlChar *ns_uri); | |
XMLPUBFUN const xmlChar * XMLCALL | |
xmlXPathNsLookup (xmlXPathContextPtr ctxt, | |
const xmlChar *prefix); | |
XMLPUBFUN void XMLCALL | |
xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, | |
const xmlChar *name, | |
xmlXPathFunction f); | |
XMLPUBFUN int XMLCALL | |
xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri, | |
xmlXPathFunction f); | |
XMLPUBFUN int XMLCALL | |
xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, | |
const xmlChar *name, | |
xmlXPathObjectPtr value); | |
XMLPUBFUN int XMLCALL | |
xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri, | |
xmlXPathObjectPtr value); | |
XMLPUBFUN xmlXPathFunction XMLCALL | |
xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, | |
const xmlChar *name); | |
XMLPUBFUN xmlXPathFunction XMLCALL | |
xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri); | |
XMLPUBFUN void XMLCALL | |
xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathVariableLookup (xmlXPathContextPtr ctxt, | |
const xmlChar *name); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri); | |
XMLPUBFUN void XMLCALL | |
xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); | |
/** | |
* Utilities to extend XPath. | |
*/ | |
XMLPUBFUN xmlXPathParserContextPtr XMLCALL | |
xmlXPathNewParserContext (const xmlChar *str, | |
xmlXPathContextPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); | |
/* TODO: remap to xmlXPathValuePop and Push. */ | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
valuePop (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN int XMLCALL | |
valuePush (xmlXPathParserContextPtr ctxt, | |
xmlXPathObjectPtr value); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNewString (const xmlChar *val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNewCString (const char *val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathWrapString (xmlChar *val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathWrapCString (char * val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNewFloat (double val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNewBoolean (int val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNewNodeSet (xmlNodePtr val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNewValueTree (xmlNodePtr val); | |
XMLPUBFUN int XMLCALL | |
xmlXPathNodeSetAdd (xmlNodeSetPtr cur, | |
xmlNodePtr val); | |
XMLPUBFUN int XMLCALL | |
xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, | |
xmlNodePtr val); | |
XMLPUBFUN int XMLCALL | |
xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, | |
xmlNodePtr node, | |
xmlNsPtr ns); | |
XMLPUBFUN void XMLCALL | |
xmlXPathNodeSetSort (xmlNodeSetPtr set); | |
XMLPUBFUN void XMLCALL | |
xmlXPathRoot (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN void XMLCALL | |
xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathParseName (xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN xmlChar * XMLCALL | |
xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); | |
/* | |
* Existing functions. | |
*/ | |
XMLPUBFUN double XMLCALL | |
xmlXPathStringEvalNumber (const xmlChar *str); | |
XMLPUBFUN int XMLCALL | |
xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, | |
xmlXPathObjectPtr res); | |
XMLPUBFUN void XMLCALL | |
xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); | |
XMLPUBFUN xmlNodeSetPtr XMLCALL | |
xmlXPathNodeSetMerge (xmlNodeSetPtr val1, | |
xmlNodeSetPtr val2); | |
XMLPUBFUN void XMLCALL | |
xmlXPathNodeSetDel (xmlNodeSetPtr cur, | |
xmlNodePtr val); | |
XMLPUBFUN void XMLCALL | |
xmlXPathNodeSetRemove (xmlNodeSetPtr cur, | |
int val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathNewNodeSetList (xmlNodeSetPtr val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathWrapNodeSet (xmlNodeSetPtr val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPathWrapExternal (void *val); | |
XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); | |
XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); | |
XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); | |
/* | |
* Some of the axis navigation routines. | |
*/ | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, | |
xmlNodePtr cur); | |
/* | |
* The official core of XPath functions. | |
*/ | |
XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); | |
/** | |
* Really internal functions | |
*/ | |
XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_XPATH_ENABLED */ | |
#endif /* ! __XML_XPATH_INTERNALS_H__ */ |
/* | |
* Summary: API to handle XML Pointers | |
* Description: API to handle XML Pointers | |
* Base implementation was made accordingly to | |
* W3C Candidate Recommendation 7 June 2000 | |
* http://www.w3.org/TR/2000/CR-xptr-20000607 | |
* | |
* Added support for the element() scheme described in: | |
* W3C Proposed Recommendation 13 November 2002 | |
* http://www.w3.org/TR/2002/PR-xptr-element-20021113/ | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XPTR_H__ | |
#define __XML_XPTR_H__ | |
#include <libxml/xmlversion.h> | |
#ifdef LIBXML_XPTR_ENABLED | |
#include <libxml/tree.h> | |
#include <libxml/xpath.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* A Location Set | |
*/ | |
typedef struct _xmlLocationSet xmlLocationSet; | |
typedef xmlLocationSet *xmlLocationSetPtr; | |
struct _xmlLocationSet { | |
int locNr; /* number of locations in the set */ | |
int locMax; /* size of the array as allocated */ | |
xmlXPathObjectPtr *locTab;/* array of locations */ | |
}; | |
/* | |
* Handling of location sets. | |
*/ | |
XMLPUBFUN xmlLocationSetPtr XMLCALL | |
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); | |
XMLPUBFUN void XMLCALL | |
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); | |
XMLPUBFUN xmlLocationSetPtr XMLCALL | |
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, | |
xmlLocationSetPtr val2); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewRange (xmlNodePtr start, | |
int startindex, | |
xmlNodePtr end, | |
int endindex); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewRangePoints (xmlXPathObjectPtr start, | |
xmlXPathObjectPtr end); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewRangeNodePoint (xmlNodePtr start, | |
xmlXPathObjectPtr end); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, | |
xmlNodePtr end); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewRangeNodes (xmlNodePtr start, | |
xmlNodePtr end); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewLocationSetNodes (xmlNodePtr start, | |
xmlNodePtr end); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewRangeNodeObject (xmlNodePtr start, | |
xmlXPathObjectPtr end); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrNewCollapsedRange (xmlNodePtr start); | |
XMLPUBFUN void XMLCALL | |
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, | |
xmlXPathObjectPtr val); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrWrapLocationSet (xmlLocationSetPtr val); | |
XMLPUBFUN void XMLCALL | |
xmlXPtrLocationSetDel (xmlLocationSetPtr cur, | |
xmlXPathObjectPtr val); | |
XMLPUBFUN void XMLCALL | |
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, | |
int val); | |
/* | |
* Functions. | |
*/ | |
XMLPUBFUN xmlXPathContextPtr XMLCALL | |
xmlXPtrNewContext (xmlDocPtr doc, | |
xmlNodePtr here, | |
xmlNodePtr origin); | |
XMLPUBFUN xmlXPathObjectPtr XMLCALL | |
xmlXPtrEval (const xmlChar *str, | |
xmlXPathContextPtr ctx); | |
XMLPUBFUN void XMLCALL | |
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XMLPUBFUN xmlNodePtr XMLCALL | |
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); | |
XMLPUBFUN void XMLCALL | |
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* LIBXML_XPTR_ENABLED */ | |
#endif /* __XML_XPTR_H__ */ |
/* | |
* Summary: interface for the XSLT attribute handling | |
* Description: this module handles the specificities of attribute | |
* and attribute groups processing. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_ATTRIBUTES_H__ | |
#define __XML_XSLT_ATTRIBUTES_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XSLTPUBFUN void XSLTCALL | |
xsltParseStylesheetAttributeSet (xsltStylesheetPtr style, | |
xmlNodePtr cur); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeAttributeSetsHashes (xsltStylesheetPtr style); | |
XSLTPUBFUN void XSLTCALL | |
xsltApplyAttributeSet (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
const xmlChar *attributes); | |
XSLTPUBFUN void XSLTCALL | |
xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_ATTRIBUTES_H__ */ | |
/* | |
* Summary: interface for the document handling | |
* Description: implements document loading and cache (multiple | |
* document() reference for the same resources must | |
* be equal. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_DOCUMENTS_H__ | |
#define __XML_XSLT_DOCUMENTS_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XSLTPUBFUN xsltDocumentPtr XSLTCALL | |
xsltNewDocument (xsltTransformContextPtr ctxt, | |
xmlDocPtr doc); | |
XSLTPUBFUN xsltDocumentPtr XSLTCALL | |
xsltLoadDocument (xsltTransformContextPtr ctxt, | |
const xmlChar *URI); | |
XSLTPUBFUN xsltDocumentPtr XSLTCALL | |
xsltFindDocument (xsltTransformContextPtr ctxt, | |
xmlDocPtr doc); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeDocuments (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN xsltDocumentPtr XSLTCALL | |
xsltLoadStyleDocument (xsltStylesheetPtr style, | |
const xmlChar *URI); | |
XSLTPUBFUN xsltDocumentPtr XSLTCALL | |
xsltNewStyleDocument (xsltStylesheetPtr style, | |
xmlDocPtr doc); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeStyleDocuments (xsltStylesheetPtr style); | |
/* | |
* Hooks for document loading | |
*/ | |
/** | |
* xsltLoadType: | |
* | |
* Enum defining the kind of loader requirement. | |
*/ | |
typedef enum { | |
XSLT_LOAD_START = 0, /* loading for a top stylesheet */ | |
XSLT_LOAD_STYLESHEET = 1, /* loading for a stylesheet include/import */ | |
XSLT_LOAD_DOCUMENT = 2 /* loading document at transformation time */ | |
} xsltLoadType; | |
/** | |
* xsltDocLoaderFunc: | |
* @URI: the URI of the document to load | |
* @dict: the dictionary to use when parsing that document | |
* @options: parsing options, a set of xmlParserOption | |
* @ctxt: the context, either a stylesheet or a transformation context | |
* @type: the xsltLoadType indicating the kind of loading required | |
* | |
* An xsltDocLoaderFunc is a signature for a function which can be | |
* registered to load document not provided by the compilation or | |
* transformation API themselve, for example when an xsl:import, | |
* xsl:include is found at compilation time or when a document() | |
* call is made at runtime. | |
* | |
* Returns the pointer to the document (which will be modified and | |
* freed by the engine later), or NULL in case of error. | |
*/ | |
typedef xmlDocPtr (*xsltDocLoaderFunc) (const xmlChar *URI, | |
xmlDictPtr dict, | |
int options, | |
void *ctxt, | |
xsltLoadType type); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetLoaderFunc (xsltDocLoaderFunc f); | |
/* the loader may be needed by extension libraries so it is exported */ | |
XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader; | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_DOCUMENTS_H__ */ | |
/* | |
* Summary: interface for the extension support | |
* Description: This provide the API needed for simple and module | |
* extension support. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_EXTENSION_H__ | |
#define __XML_XSLT_EXTENSION_H__ | |
#include <libxml/xpath.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* Extension Modules API. | |
*/ | |
/** | |
* xsltInitGlobals: | |
* | |
* Initialize the global variables for extensions | |
* | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltInitGlobals (void); | |
/** | |
* xsltStyleExtInitFunction: | |
* @ctxt: an XSLT stylesheet | |
* @URI: the namespace URI for the extension | |
* | |
* A function called at initialization time of an XSLT extension module. | |
* | |
* Returns a pointer to the module specific data for this transformation. | |
*/ | |
typedef void * (*xsltStyleExtInitFunction) (xsltStylesheetPtr style, | |
const xmlChar *URI); | |
/** | |
* xsltStyleExtShutdownFunction: | |
* @ctxt: an XSLT stylesheet | |
* @URI: the namespace URI for the extension | |
* @data: the data associated to this module | |
* | |
* A function called at shutdown time of an XSLT extension module. | |
*/ | |
typedef void (*xsltStyleExtShutdownFunction) (xsltStylesheetPtr style, | |
const xmlChar *URI, | |
void *data); | |
/** | |
* xsltExtInitFunction: | |
* @ctxt: an XSLT transformation context | |
* @URI: the namespace URI for the extension | |
* | |
* A function called at initialization time of an XSLT extension module. | |
* | |
* Returns a pointer to the module specific data for this transformation. | |
*/ | |
typedef void * (*xsltExtInitFunction) (xsltTransformContextPtr ctxt, | |
const xmlChar *URI); | |
/** | |
* xsltExtShutdownFunction: | |
* @ctxt: an XSLT transformation context | |
* @URI: the namespace URI for the extension | |
* @data: the data associated to this module | |
* | |
* A function called at shutdown time of an XSLT extension module. | |
*/ | |
typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt, | |
const xmlChar *URI, | |
void *data); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtModule (const xmlChar *URI, | |
xsltExtInitFunction initFunc, | |
xsltExtShutdownFunction shutdownFunc); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtModuleFull | |
(const xmlChar * URI, | |
xsltExtInitFunction initFunc, | |
xsltExtShutdownFunction shutdownFunc, | |
xsltStyleExtInitFunction styleInitFunc, | |
xsltStyleExtShutdownFunction styleShutdownFunc); | |
XSLTPUBFUN int XSLTCALL | |
xsltUnregisterExtModule (const xmlChar * URI); | |
XSLTPUBFUN void * XSLTCALL | |
xsltGetExtData (xsltTransformContextPtr ctxt, | |
const xmlChar *URI); | |
XSLTPUBFUN void * XSLTCALL | |
xsltStyleGetExtData (xsltStylesheetPtr style, | |
const xmlChar *URI); | |
#ifdef XSLT_REFACTORED | |
XSLTPUBFUN void * XSLTCALL | |
xsltStyleStylesheetLevelGetExtData( | |
xsltStylesheetPtr style, | |
const xmlChar * URI); | |
#endif | |
XSLTPUBFUN void XSLTCALL | |
xsltShutdownCtxtExts (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN void XSLTCALL | |
xsltShutdownExts (xsltStylesheetPtr style); | |
XSLTPUBFUN xsltTransformContextPtr XSLTCALL | |
xsltXPathGetTransformContext | |
(xmlXPathParserContextPtr ctxt); | |
/* | |
* extension functions | |
*/ | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtModuleFunction | |
(const xmlChar *name, | |
const xmlChar *URI, | |
xmlXPathFunction function); | |
XSLTPUBFUN xmlXPathFunction XSLTCALL | |
xsltExtModuleFunctionLookup (const xmlChar *name, | |
const xmlChar *URI); | |
XSLTPUBFUN int XSLTCALL | |
xsltUnregisterExtModuleFunction | |
(const xmlChar *name, | |
const xmlChar *URI); | |
/* | |
* extension elements | |
*/ | |
typedef xsltElemPreCompPtr (*xsltPreComputeFunction) | |
(xsltStylesheetPtr style, | |
xmlNodePtr inst, | |
xsltTransformFunction function); | |
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL | |
xsltNewElemPreComp (xsltStylesheetPtr style, | |
xmlNodePtr inst, | |
xsltTransformFunction function); | |
XSLTPUBFUN void XSLTCALL | |
xsltInitElemPreComp (xsltElemPreCompPtr comp, | |
xsltStylesheetPtr style, | |
xmlNodePtr inst, | |
xsltTransformFunction function, | |
xsltElemPreCompDeallocator freeFunc); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtModuleElement | |
(const xmlChar *name, | |
const xmlChar *URI, | |
xsltPreComputeFunction precomp, | |
xsltTransformFunction transform); | |
XSLTPUBFUN xsltTransformFunction XSLTCALL | |
xsltExtElementLookup (xsltTransformContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *URI); | |
XSLTPUBFUN xsltTransformFunction XSLTCALL | |
xsltExtModuleElementLookup | |
(const xmlChar *name, | |
const xmlChar *URI); | |
XSLTPUBFUN xsltPreComputeFunction XSLTCALL | |
xsltExtModuleElementPreComputeLookup | |
(const xmlChar *name, | |
const xmlChar *URI); | |
XSLTPUBFUN int XSLTCALL | |
xsltUnregisterExtModuleElement | |
(const xmlChar *name, | |
const xmlChar *URI); | |
/* | |
* top-level elements | |
*/ | |
typedef void (*xsltTopLevelFunction) (xsltStylesheetPtr style, | |
xmlNodePtr inst); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtModuleTopLevel | |
(const xmlChar *name, | |
const xmlChar *URI, | |
xsltTopLevelFunction function); | |
XSLTPUBFUN xsltTopLevelFunction XSLTCALL | |
xsltExtModuleTopLevelLookup | |
(const xmlChar *name, | |
const xmlChar *URI); | |
XSLTPUBFUN int XSLTCALL | |
xsltUnregisterExtModuleTopLevel | |
(const xmlChar *name, | |
const xmlChar *URI); | |
/* These 2 functions are deprecated for use within modules. */ | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtFunction (xsltTransformContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *URI, | |
xmlXPathFunction function); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtElement (xsltTransformContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *URI, | |
xsltTransformFunction function); | |
/* | |
* Extension Prefix handling API. | |
* Those are used by the XSLT (pre)processor. | |
*/ | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterExtPrefix (xsltStylesheetPtr style, | |
const xmlChar *prefix, | |
const xmlChar *URI); | |
XSLTPUBFUN int XSLTCALL | |
xsltCheckExtPrefix (xsltStylesheetPtr style, | |
const xmlChar *URI); | |
XSLTPUBFUN int XSLTCALL | |
xsltCheckExtURI (xsltStylesheetPtr style, | |
const xmlChar *URI); | |
XSLTPUBFUN int XSLTCALL | |
xsltInitCtxtExts (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeCtxtExts (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeExts (xsltStylesheetPtr style); | |
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL | |
xsltPreComputeExtModuleElement | |
(xsltStylesheetPtr style, | |
xmlNodePtr inst); | |
/* | |
* Extension Infos access. | |
* Used by exslt initialisation | |
*/ | |
XSLTPUBFUN xmlHashTablePtr XSLTCALL | |
xsltGetExtInfo (xsltStylesheetPtr style, | |
const xmlChar *URI); | |
/** | |
* Test module http://xmlsoft.org/XSLT/ | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltRegisterTestModule (void); | |
XSLTPUBFUN void XSLTCALL | |
xsltDebugDumpExtensions (FILE * output); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_EXTENSION_H__ */ | |
/* | |
* Summary: interface for the non-standard features | |
* Description: implement some extension outside the XSLT namespace | |
* but not EXSLT with is in a different library. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_EXTRA_H__ | |
#define __XML_XSLT_EXTRA_H__ | |
#include <libxml/xpath.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XSLT_LIBXSLT_NAMESPACE: | |
* | |
* This is the libxslt namespace for specific extensions. | |
*/ | |
#define XSLT_LIBXSLT_NAMESPACE ((xmlChar *) "http://xmlsoft.org/XSLT/namespace") | |
/** | |
* XSLT_SAXON_NAMESPACE: | |
* | |
* This is Michael Kay's Saxon processor namespace for extensions. | |
*/ | |
#define XSLT_SAXON_NAMESPACE ((xmlChar *) "http://icl.com/saxon") | |
/** | |
* XSLT_XT_NAMESPACE: | |
* | |
* This is James Clark's XT processor namespace for extensions. | |
*/ | |
#define XSLT_XT_NAMESPACE ((xmlChar *) "http://www.jclark.com/xt") | |
/** | |
* XSLT_XALAN_NAMESPACE: | |
* | |
* This is the Apache project XALAN processor namespace for extensions. | |
*/ | |
#define XSLT_XALAN_NAMESPACE ((xmlChar *) \ | |
"org.apache.xalan.xslt.extensions.Redirect") | |
XSLTPUBFUN void XSLTCALL | |
xsltFunctionNodeSet (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltDebug (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltRegisterExtras (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN void XSLTCALL | |
xsltRegisterAllExtras (void); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_EXTRA_H__ */ | |
/* | |
* Summary: interface for the XSLT functions not from XPath | |
* Description: a set of extra functions coming from XSLT but not in XPath | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard and Bjorn Reese <breese@users.sourceforge.net> | |
*/ | |
#ifndef __XML_XSLT_FUNCTIONS_H__ | |
#define __XML_XSLT_FUNCTIONS_H__ | |
#include <libxml/xpath.h> | |
#include <libxml/xpathInternals.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XSLT_REGISTER_FUNCTION_LOOKUP: | |
* | |
* Registering macro, not general purpose at all but used in different modules. | |
*/ | |
#define XSLT_REGISTER_FUNCTION_LOOKUP(ctxt) \ | |
xmlXPathRegisterFuncLookup((ctxt)->xpathCtxt, \ | |
(xmlXPathFuncLookupFunc) xsltXPathFunctionLookup, \ | |
(void *)(ctxt->xpathCtxt)); | |
XSLTPUBFUN xmlXPathFunction XSLTCALL | |
xsltXPathFunctionLookup (xmlXPathContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri); | |
/* | |
* Interfaces for the functions implementations. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltDocumentFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltKeyFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
XSLTPUBFUN void XSLTCALL | |
xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt, | |
int nargs); | |
/* | |
* And the registration | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltRegisterAllFunctions (xmlXPathContextPtr ctxt); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_FUNCTIONS_H__ */ | |
/* | |
* Summary: interface for the XSLT import support | |
* Description: macros and fuctions needed to implement and | |
* access the import tree | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_IMPORTS_H__ | |
#define __XML_XSLT_IMPORTS_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XSLT_GET_IMPORT_PTR: | |
* | |
* A macro to import pointers from the stylesheet cascading order. | |
*/ | |
#define XSLT_GET_IMPORT_PTR(res, style, name) { \ | |
xsltStylesheetPtr st = style; \ | |
res = NULL; \ | |
while (st != NULL) { \ | |
if (st->name != NULL) { res = st->name; break; } \ | |
st = xsltNextImport(st); \ | |
}} | |
/** | |
* XSLT_GET_IMPORT_INT: | |
* | |
* A macro to import intergers from the stylesheet cascading order. | |
*/ | |
#define XSLT_GET_IMPORT_INT(res, style, name) { \ | |
xsltStylesheetPtr st = style; \ | |
res = -1; \ | |
while (st != NULL) { \ | |
if (st->name != -1) { res = st->name; break; } \ | |
st = xsltNextImport(st); \ | |
}} | |
/* | |
* Module interfaces | |
*/ | |
XSLTPUBFUN int XSLTCALL | |
xsltParseStylesheetImport(xsltStylesheetPtr style, | |
xmlNodePtr cur); | |
XSLTPUBFUN int XSLTCALL | |
xsltParseStylesheetInclude | |
(xsltStylesheetPtr style, | |
xmlNodePtr cur); | |
XSLTPUBFUN xsltStylesheetPtr XSLTCALL | |
xsltNextImport (xsltStylesheetPtr style); | |
XSLTPUBFUN int XSLTCALL | |
xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt); | |
XSLTPUBFUN int XSLTCALL | |
xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, | |
xmlNodePtr node); | |
XSLTPUBFUN xsltTemplatePtr XSLTCALL | |
xsltFindTemplate (xsltTransformContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *nameURI); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_IMPORTS_H__ */ | |
/* | |
* Summary: interface for the key matching used in key() and template matches. | |
* Description: implementation of the key mechanims. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_KEY_H__ | |
#define __XML_XSLT_KEY_H__ | |
#include <libxml/xpath.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* NODE_IS_KEYED: | |
* | |
* check for bit 15 set | |
*/ | |
#define NODE_IS_KEYED (1 >> 15) | |
XSLTPUBFUN int XSLTCALL | |
xsltAddKey (xsltStylesheetPtr style, | |
const xmlChar *name, | |
const xmlChar *nameURI, | |
const xmlChar *match, | |
const xmlChar *use, | |
xmlNodePtr inst); | |
XSLTPUBFUN xmlNodeSetPtr XSLTCALL | |
xsltGetKey (xsltTransformContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *nameURI, | |
const xmlChar *value); | |
XSLTPUBFUN void XSLTCALL | |
xsltInitCtxtKeys (xsltTransformContextPtr ctxt, | |
xsltDocumentPtr doc); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeKeys (xsltStylesheetPtr style); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeDocumentKeys (xsltDocumentPtr doc); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_H__ */ | |
/* | |
* Summary: internal header only used during the compilation of libxslt | |
* Description: internal header only used during the compilation of libxslt | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XSLT_LIBXSLT_H__ | |
#define __XSLT_LIBXSLT_H__ | |
#if defined(WIN32) && !defined (__CYGWIN__) && !defined (__MINGW32__) | |
#include <win32config.h> | |
#else | |
#include "config.h" | |
#endif | |
#include <libxslt/xsltconfig.h> | |
#include <libxml/xmlversion.h> | |
#if !defined LIBXSLT_PUBLIC | |
#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC | |
#define LIBXSLT_PUBLIC __declspec(dllimport) | |
#else | |
#define LIBXSLT_PUBLIC | |
#endif | |
#endif | |
#if defined(_MSC_VER) || defined(__MINGW32__) | |
#include <io.h> | |
#include <direct.h> | |
#define mkdir(p,m) _mkdir(p) | |
#endif | |
#endif /* ! __XSLT_LIBXSLT_H__ */ |
/* | |
* Summary: interface for the XSLT namespace handling | |
* Description: set of function easing the processing and generation | |
* of namespace nodes in XSLT. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_NAMESPACES_H__ | |
#define __XML_XSLT_NAMESPACES_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Used within nsAliases hashtable when the default namespace is required | |
* but it's not been explicitly defined | |
*/ | |
/** | |
* UNDEFINED_DEFAULT_NS: | |
* | |
* Special value for undefined namespace, internal | |
*/ | |
#define UNDEFINED_DEFAULT_NS (const xmlChar *) -1L | |
XSLTPUBFUN void XSLTCALL | |
xsltNamespaceAlias (xsltStylesheetPtr style, | |
xmlNodePtr node); | |
XSLTPUBFUN xmlNsPtr XSLTCALL | |
xsltGetNamespace (xsltTransformContextPtr ctxt, | |
xmlNodePtr cur, | |
xmlNsPtr ns, | |
xmlNodePtr out); | |
XSLTPUBFUN xmlNsPtr XSLTCALL | |
xsltGetPlainNamespace (xsltTransformContextPtr ctxt, | |
xmlNodePtr cur, | |
xmlNsPtr ns, | |
xmlNodePtr out); | |
XSLTPUBFUN xmlNsPtr XSLTCALL | |
xsltGetSpecialNamespace (xsltTransformContextPtr ctxt, | |
xmlNodePtr cur, | |
const xmlChar *URI, | |
const xmlChar *prefix, | |
xmlNodePtr out); | |
XSLTPUBFUN xmlNsPtr XSLTCALL | |
xsltCopyNamespace (xsltTransformContextPtr ctxt, | |
xmlNodePtr elem, | |
xmlNsPtr ns); | |
XSLTPUBFUN xmlNsPtr XSLTCALL | |
xsltCopyNamespaceList (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNsPtr cur); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeNamespaceAliasHashes | |
(xsltStylesheetPtr style); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_NAMESPACES_H__ */ | |
/* | |
* Summary: Implementation of the XSLT number functions | |
* Description: Implementation of the XSLT number functions | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Bjorn Reese <breese@users.sourceforge.net> and Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_NUMBERSINTERNALS_H__ | |
#define __XML_XSLT_NUMBERSINTERNALS_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
struct _xsltCompMatch; | |
/** | |
* xsltNumberData: | |
* | |
* This data structure is just a wrapper to pass xsl:number data in. | |
*/ | |
typedef struct _xsltNumberData xsltNumberData; | |
typedef xsltNumberData *xsltNumberDataPtr; | |
struct _xsltNumberData { | |
const xmlChar *level; | |
const xmlChar *count; | |
const xmlChar *from; | |
const xmlChar *value; | |
const xmlChar *format; | |
int has_format; | |
int digitsPerGroup; | |
int groupingCharacter; | |
int groupingCharacterLen; | |
xmlDocPtr doc; | |
xmlNodePtr node; | |
struct _xsltCompMatch *countPat; | |
struct _xsltCompMatch *fromPat; | |
/* | |
* accelerators | |
*/ | |
}; | |
/** | |
* xsltFormatNumberInfo,: | |
* | |
* This data structure lists the various parameters needed to format numbers. | |
*/ | |
typedef struct _xsltFormatNumberInfo xsltFormatNumberInfo; | |
typedef xsltFormatNumberInfo *xsltFormatNumberInfoPtr; | |
struct _xsltFormatNumberInfo { | |
int integer_hash; /* Number of '#' in integer part */ | |
int integer_digits; /* Number of '0' in integer part */ | |
int frac_digits; /* Number of '0' in fractional part */ | |
int frac_hash; /* Number of '#' in fractional part */ | |
int group; /* Number of chars per display 'group' */ | |
int multiplier; /* Scaling for percent or permille */ | |
char add_decimal; /* Flag for whether decimal point appears in pattern */ | |
char is_multiplier_set; /* Flag to catch multiple occurences of percent/permille */ | |
char is_negative_pattern;/* Flag for processing -ve prefix/suffix */ | |
}; | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_NUMBERSINTERNALS_H__ */ |
/* | |
* Summary: precomputing stylesheets | |
* Description: this is the compilation phase, where most of the | |
* stylesheet is "compiled" into faster to use data. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_PRECOMP_H__ | |
#define __XML_XSLT_PRECOMP_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Interfaces | |
*/ | |
extern const xmlChar *xsltExtMarker; | |
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL | |
xsltDocumentComp (xsltStylesheetPtr style, | |
xmlNodePtr inst, | |
xsltTransformFunction function); | |
XSLTPUBFUN void XSLTCALL | |
xsltStylePreCompute (xsltStylesheetPtr style, | |
xmlNodePtr inst); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeStylePreComps (xsltStylesheetPtr style); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_PRECOMP_H__ */ | |
/* | |
* Summary: interface for the libxslt security framework | |
* Description: the libxslt security framework allow to restrict | |
* the access to new resources (file or URL) from | |
* the stylesheet at runtime. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_SECURITY_H__ | |
#define __XML_XSLT_SECURITY_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* xsltSecurityPref: | |
* | |
* structure to indicate the preferences for security in the XSLT | |
* transformation. | |
*/ | |
typedef struct _xsltSecurityPrefs xsltSecurityPrefs; | |
typedef xsltSecurityPrefs *xsltSecurityPrefsPtr; | |
/** | |
* xsltSecurityOption: | |
* | |
* the set of option that can be configured | |
*/ | |
typedef enum { | |
XSLT_SECPREF_READ_FILE = 1, | |
XSLT_SECPREF_WRITE_FILE, | |
XSLT_SECPREF_CREATE_DIRECTORY, | |
XSLT_SECPREF_READ_NETWORK, | |
XSLT_SECPREF_WRITE_NETWORK | |
} xsltSecurityOption; | |
/** | |
* xsltSecurityCheck: | |
* | |
* User provided function to check the value of a string like a file | |
* path or an URL ... | |
*/ | |
typedef int (*xsltSecurityCheck) (xsltSecurityPrefsPtr sec, | |
xsltTransformContextPtr ctxt, | |
const char *value); | |
/* | |
* Module interfaces | |
*/ | |
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL | |
xsltNewSecurityPrefs (void); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec); | |
XSLTPUBFUN int XSLTCALL | |
xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec, | |
xsltSecurityOption option, | |
xsltSecurityCheck func); | |
XSLTPUBFUN xsltSecurityCheck XSLTCALL | |
xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec, | |
xsltSecurityOption option); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec); | |
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL | |
xsltGetDefaultSecurityPrefs (void); | |
XSLTPUBFUN int XSLTCALL | |
xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec, | |
xsltTransformContextPtr ctxt); | |
XSLTPUBFUN int XSLTCALL | |
xsltSecurityAllow (xsltSecurityPrefsPtr sec, | |
xsltTransformContextPtr ctxt, | |
const char *value); | |
XSLTPUBFUN int XSLTCALL | |
xsltSecurityForbid (xsltSecurityPrefsPtr sec, | |
xsltTransformContextPtr ctxt, | |
const char *value); | |
/* | |
* internal interfaces | |
*/ | |
XSLTPUBFUN int XSLTCALL | |
xsltCheckWrite (xsltSecurityPrefsPtr sec, | |
xsltTransformContextPtr ctxt, | |
const xmlChar *URL); | |
XSLTPUBFUN int XSLTCALL | |
xsltCheckRead (xsltSecurityPrefsPtr sec, | |
xsltTransformContextPtr ctxt, | |
const xmlChar *URL); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_SECURITY_H__ */ | |
/* | |
* Summary: interface for the template processing | |
* Description: This set of routine encapsulates XPath calls | |
* and Attribute Value Templates evaluation. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_TEMPLATES_H__ | |
#define __XML_XSLT_TEMPLATES_H__ | |
#include <libxml/xpath.h> | |
#include <libxml/xpathInternals.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
XSLTPUBFUN int XSLTCALL | |
xsltEvalXPathPredicate (xsltTransformContextPtr ctxt, | |
xmlXPathCompExprPtr comp, | |
xmlNsPtr *nsList, | |
int nsNr); | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltEvalTemplateString (xsltTransformContextPtr ctxt, | |
xmlNodePtr contextNode, | |
xmlNodePtr inst); | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltEvalAttrValueTemplate (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
const xmlChar *name, | |
const xmlChar *ns); | |
XSLTPUBFUN const xmlChar * XSLTCALL | |
xsltEvalStaticAttrValueTemplate (xsltStylesheetPtr style, | |
xmlNodePtr node, | |
const xmlChar *name, | |
const xmlChar *ns, | |
int *found); | |
/* TODO: this is obviously broken ... the namespaces should be passed too ! */ | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltEvalXPathString (xsltTransformContextPtr ctxt, | |
xmlXPathCompExprPtr comp); | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltEvalXPathStringNs (xsltTransformContextPtr ctxt, | |
xmlXPathCompExprPtr comp, | |
int nsNr, | |
xmlNsPtr *nsList); | |
XSLTPUBFUN xmlNodePtr * XSLTCALL | |
xsltTemplateProcess (xsltTransformContextPtr ctxt, | |
xmlNodePtr node); | |
XSLTPUBFUN xmlAttrPtr XSLTCALL | |
xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt, | |
xmlNodePtr target, | |
xmlAttrPtr cur); | |
XSLTPUBFUN xmlAttrPtr XSLTCALL | |
xsltAttrTemplateProcess (xsltTransformContextPtr ctxt, | |
xmlNodePtr target, | |
xmlAttrPtr attr); | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltAttrTemplateValueProcess (xsltTransformContextPtr ctxt, | |
const xmlChar* attr); | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt, | |
const xmlChar* str, | |
xmlNodePtr node); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_TEMPLATES_H__ */ | |
/* | |
* Summary: the XSLT engine transformation part. | |
* Description: This module implements the bulk of the actual | |
* transformation processing. Most of the xsl: element | |
* constructs are implemented in this module. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_TRANSFORM_H__ | |
#define __XML_XSLT_TRANSFORM_H__ | |
#include <libxml/parser.h> | |
#include <libxml/xmlIO.h> | |
#include "xsltexports.h" | |
#include <libxslt/xsltInternals.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XInclude default processing. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltSetXIncludeDefault (int xinclude); | |
XSLTPUBFUN int XSLTCALL | |
xsltGetXIncludeDefault (void); | |
/** | |
* Export context to users. | |
*/ | |
XSLTPUBFUN xsltTransformContextPtr XSLTCALL | |
xsltNewTransformContext (xsltStylesheetPtr style, | |
xmlDocPtr doc); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeTransformContext(xsltTransformContextPtr ctxt); | |
XSLTPUBFUN xmlDocPtr XSLTCALL | |
xsltApplyStylesheetUser (xsltStylesheetPtr style, | |
xmlDocPtr doc, | |
const char **params, | |
const char *output, | |
FILE * profile, | |
xsltTransformContextPtr userCtxt); | |
XSLTPUBFUN void XSLTCALL | |
xsltProcessOneNode (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xsltStackElemPtr params); | |
/** | |
* Private Interfaces. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltApplyStripSpaces (xsltTransformContextPtr ctxt, | |
xmlNodePtr node); | |
XSLTPUBFUN xmlDocPtr XSLTCALL | |
xsltApplyStylesheet (xsltStylesheetPtr style, | |
xmlDocPtr doc, | |
const char **params); | |
XSLTPUBFUN xmlDocPtr XSLTCALL | |
xsltProfileStylesheet (xsltStylesheetPtr style, | |
xmlDocPtr doc, | |
const char **params, | |
FILE * output); | |
XSLTPUBFUN int XSLTCALL | |
xsltRunStylesheet (xsltStylesheetPtr style, | |
xmlDocPtr doc, | |
const char **params, | |
const char *output, | |
xmlSAXHandlerPtr SAX, | |
xmlOutputBufferPtr IObuf); | |
XSLTPUBFUN int XSLTCALL | |
xsltRunStylesheetUser (xsltStylesheetPtr style, | |
xmlDocPtr doc, | |
const char **params, | |
const char *output, | |
xmlSAXHandlerPtr SAX, | |
xmlOutputBufferPtr IObuf, | |
FILE * profile, | |
xsltTransformContextPtr userCtxt); | |
XSLTPUBFUN void XSLTCALL | |
xsltApplyOneTemplate (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr list, | |
xsltTemplatePtr templ, | |
xsltStackElemPtr params); | |
XSLTPUBFUN void XSLTCALL | |
xsltDocumentElem (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltSort (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltCopy (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltText (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltElement (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltComment (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltAttribute (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltProcessingInstruction(xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltCopyOf (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltValueOf (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltNumber (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltApplyImports (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltCallTemplate (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltApplyTemplates (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltChoose (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltIf (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltForEach (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltStylePreCompPtr comp); | |
XSLTPUBFUN void XSLTCALL | |
xsltRegisterAllElement (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN xmlNodePtr XSLTCALL | |
xsltCopyTextString (xsltTransformContextPtr ctxt, | |
xmlNodePtr target, | |
const xmlChar *string, | |
int noescape); | |
/* Following 2 functions needed for libexslt/functions.c */ | |
XSLTPUBFUN void XSLTCALL | |
xsltLocalVariablePop (xsltTransformContextPtr ctxt, | |
int limitNr, | |
int level); | |
XSLTPUBFUN int XSLTCALL | |
xsltLocalVariablePush (xsltTransformContextPtr ctxt, | |
xsltStackElemPtr variable, | |
int level); | |
/* | |
* Hook for the debugger if activated. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xslHandleDebugger (xmlNodePtr cur, | |
xmlNodePtr node, | |
xsltTemplatePtr templ, | |
xsltTransformContextPtr ctxt); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_TRANSFORM_H__ */ | |
/************************************************************************* | |
* | |
* $Id$ | |
* | |
* Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. | |
* | |
* Permission to use, copy, modify, and distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND | |
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. | |
* | |
************************************************************************* | |
* | |
* http://ctrio.sourceforge.net/ | |
* | |
************************************************************************/ | |
#ifndef TRIO_TRIO_H | |
#define TRIO_TRIO_H | |
#if !defined(WITHOUT_TRIO) | |
/* | |
* Use autoconf defines if present. Packages using trio must define | |
* HAVE_CONFIG_H as a compiler option themselves. | |
*/ | |
#if defined(HAVE_CONFIG_H) | |
# include <config.h> | |
#endif | |
#include "triodef.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#if defined(TRIO_COMPILER_ANCIENT) | |
# include <varargs.h> | |
#else | |
# include <stdarg.h> | |
#endif | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Error codes. | |
* | |
* Remember to add a textual description to trio_strerror. | |
*/ | |
enum { | |
TRIO_EOF = 1, | |
TRIO_EINVAL = 2, | |
TRIO_ETOOMANY = 3, | |
TRIO_EDBLREF = 4, | |
TRIO_EGAP = 5, | |
TRIO_ENOMEM = 6, | |
TRIO_ERANGE = 7, | |
TRIO_ERRNO = 8, | |
TRIO_ECUSTOM = 9 | |
}; | |
/* Error macros */ | |
#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF) | |
#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8) | |
#define TRIO_ERROR_NAME(x) trio_strerror(x) | |
typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int)); | |
typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t)); | |
TRIO_CONST char *trio_strerror TRIO_PROTO((int)); | |
/************************************************************************* | |
* Print Functions | |
*/ | |
int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...)); | |
int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args)); | |
int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args)); | |
int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...)); | |
int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args)); | |
int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args)); | |
int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...)); | |
int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args)); | |
int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args)); | |
int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure, | |
TRIO_CONST char *format, ...)); | |
int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure, | |
TRIO_CONST char *format, va_list args)); | |
int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure, | |
TRIO_CONST char *format, void **args)); | |
int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...)); | |
int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args)); | |
int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args)); | |
int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...)); | |
int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format, | |
va_list args)); | |
int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format, | |
void **args)); | |
int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...)); | |
int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format, | |
va_list args)); | |
char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...)); | |
char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args)); | |
int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...)); | |
int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args)); | |
/************************************************************************* | |
* Scan Functions | |
*/ | |
int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...)); | |
int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args)); | |
int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args)); | |
int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...)); | |
int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args)); | |
int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args)); | |
int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...)); | |
int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args)); | |
int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args)); | |
int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure, | |
TRIO_CONST char *format, ...)); | |
int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure, | |
TRIO_CONST char *format, va_list args)); | |
int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure, | |
TRIO_CONST char *format, void **args)); | |
int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...)); | |
int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args)); | |
int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args)); | |
/************************************************************************* | |
* Locale Functions | |
*/ | |
void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint)); | |
void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator)); | |
void trio_locale_set_grouping TRIO_PROTO((char *grouping)); | |
/************************************************************************* | |
* Renaming | |
*/ | |
#ifdef TRIO_REPLACE_STDIO | |
/* Replace the <stdio.h> functions */ | |
#ifndef HAVE_PRINTF | |
# define printf trio_printf | |
#endif | |
#ifndef HAVE_VPRINTF | |
# define vprintf trio_vprintf | |
#endif | |
#ifndef HAVE_FPRINTF | |
# define fprintf trio_fprintf | |
#endif | |
#ifndef HAVE_VFPRINTF | |
# define vfprintf trio_vfprintf | |
#endif | |
#ifndef HAVE_SPRINTF | |
# define sprintf trio_sprintf | |
#endif | |
#ifndef HAVE_VSPRINTF | |
# define vsprintf trio_vsprintf | |
#endif | |
#ifndef HAVE_SNPRINTF | |
# define snprintf trio_snprintf | |
#endif | |
#ifndef HAVE_VSNPRINTF | |
# define vsnprintf trio_vsnprintf | |
#endif | |
#ifndef HAVE_SCANF | |
# define scanf trio_scanf | |
#endif | |
#ifndef HAVE_VSCANF | |
# define vscanf trio_vscanf | |
#endif | |
#ifndef HAVE_FSCANF | |
# define fscanf trio_fscanf | |
#endif | |
#ifndef HAVE_VFSCANF | |
# define vfscanf trio_vfscanf | |
#endif | |
#ifndef HAVE_SSCANF | |
# define sscanf trio_sscanf | |
#endif | |
#ifndef HAVE_VSSCANF | |
# define vsscanf trio_vsscanf | |
#endif | |
/* These aren't stdio functions, but we make them look similar */ | |
#define dprintf trio_dprintf | |
#define vdprintf trio_vdprintf | |
#define aprintf trio_aprintf | |
#define vaprintf trio_vaprintf | |
#define asprintf trio_asprintf | |
#define vasprintf trio_vasprintf | |
#define dscanf trio_dscanf | |
#define vdscanf trio_vdscanf | |
#endif | |
#ifdef __cplusplus | |
} /* extern "C" */ | |
#endif | |
#endif /* WITHOUT_TRIO */ | |
#endif /* TRIO_TRIO_H */ |
/************************************************************************* | |
* | |
* $Id$ | |
* | |
* Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net> | |
* | |
* Permission to use, copy, modify, and distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND | |
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. | |
* | |
************************************************************************/ | |
#ifndef TRIO_TRIODEF_H | |
#define TRIO_TRIODEF_H | |
/************************************************************************* | |
* Platform and compiler support detection | |
*/ | |
#if defined(__GNUC__) | |
# define TRIO_COMPILER_GCC | |
#elif defined(__SUNPRO_C) | |
# define TRIO_COMPILER_SUNPRO | |
#elif defined(__SUNPRO_CC) | |
# define TRIO_COMPILER_SUNPRO | |
# define __SUNPRO_C __SUNPRO_CC | |
#elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__) | |
# define TRIO_COMPILER_XLC | |
#elif defined(_AIX) && !defined(__GNUC__) | |
# define TRIO_COMPILER_XLC /* Workaround for old xlc */ | |
#elif defined(__DECC) || defined(__DECCXX) | |
# define TRIO_COMPILER_DECC | |
#elif defined(__osf__) && defined(__LANGUAGE_C__) | |
# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */ | |
#elif defined(_MSC_VER) | |
# define TRIO_COMPILER_MSVC | |
#elif defined(__BORLANDC__) | |
# define TRIO_COMPILER_BCB | |
#endif | |
#if defined(VMS) || defined(__VMS) | |
/* | |
* VMS is placed first to avoid identifying the platform as Unix | |
* based on the DECC compiler later on. | |
*/ | |
# define TRIO_PLATFORM_VMS | |
#elif defined(unix) || defined(__unix) || defined(__unix__) | |
# define TRIO_PLATFORM_UNIX | |
#elif defined(TRIO_COMPILER_XLC) || defined(_AIX) | |
# define TRIO_PLATFORM_UNIX | |
#elif defined(TRIO_COMPILER_DECC) || defined(__osf___) | |
# define TRIO_PLATFORM_UNIX | |
#elif defined(__NetBSD__) | |
# define TRIO_PLATFORM_UNIX | |
#elif defined(__QNX__) | |
# define TRIO_PLATFORM_UNIX | |
# define TRIO_PLATFORM_QNX | |
#elif defined(__CYGWIN__) | |
# define TRIO_PLATFORM_UNIX | |
#elif defined(AMIGA) && defined(TRIO_COMPILER_GCC) | |
# define TRIO_PLATFORM_UNIX | |
#elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32) | |
# define TRIO_PLATFORM_WIN32 | |
#elif defined(mpeix) || defined(__mpexl) | |
# define TRIO_PLATFORM_MPEIX | |
#endif | |
#if defined(_AIX) | |
# define TRIO_PLATFORM_AIX | |
#elif defined(__hpux) | |
# define TRIO_PLATFORM_HPUX | |
#elif defined(sun) || defined(__sun__) | |
# if defined(__SVR4) || defined(__svr4__) | |
# define TRIO_PLATFORM_SOLARIS | |
# else | |
# define TRIO_PLATFORM_SUNOS | |
# endif | |
#endif | |
#if defined(__STDC__) || defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) | |
# define TRIO_COMPILER_SUPPORTS_C89 | |
# if defined(__STDC_VERSION__) | |
# define TRIO_COMPILER_SUPPORTS_C90 | |
# if (__STDC_VERSION__ >= 199409L) | |
# define TRIO_COMPILER_SUPPORTS_C94 | |
# endif | |
# if (__STDC_VERSION__ >= 199901L) | |
# define TRIO_COMPILER_SUPPORTS_C99 | |
# endif | |
# elif defined(TRIO_COMPILER_SUNPRO) | |
# if (__SUNPRO_C >= 0x420) | |
# define TRIO_COMPILER_SUPPORTS_C94 | |
# endif | |
# endif | |
#endif | |
#if defined(_XOPEN_SOURCE) | |
# if defined(_XOPEN_SOURCE_EXTENDED) | |
# define TRIO_COMPILER_SUPPORTS_UNIX95 | |
# endif | |
# if (_XOPEN_VERSION >= 500) | |
# define TRIO_COMPILER_SUPPORTS_UNIX98 | |
# endif | |
# if (_XOPEN_VERSION >= 600) | |
# define TRIO_COMPILER_SUPPORTS_UNIX01 | |
# endif | |
#endif | |
/************************************************************************* | |
* Generic defines | |
*/ | |
#if !defined(TRIO_PUBLIC) | |
# define TRIO_PUBLIC | |
#endif | |
#if !defined(TRIO_PRIVATE) | |
# define TRIO_PRIVATE static | |
#endif | |
#if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus)) | |
# define TRIO_COMPILER_ANCIENT | |
#endif | |
#if defined(TRIO_COMPILER_ANCIENT) | |
# define TRIO_CONST | |
# define TRIO_VOLATILE | |
# define TRIO_SIGNED | |
typedef double trio_long_double_t; | |
typedef char * trio_pointer_t; | |
# define TRIO_SUFFIX_LONG(x) x | |
# define TRIO_PROTO(x) () | |
# define TRIO_NOARGS | |
# define TRIO_ARGS1(list,a1) list a1; | |
# define TRIO_ARGS2(list,a1,a2) list a1; a2; | |
# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3; | |
# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4; | |
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5; | |
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6; | |
# define TRIO_VARGS2(list,a1,a2) list a1; a2 | |
# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3 | |
# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4 | |
# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5 | |
# define TRIO_VA_DECL va_dcl | |
# define TRIO_VA_START(x,y) va_start(x) | |
# define TRIO_VA_END(x) va_end(x) | |
#else /* ANSI C */ | |
# define TRIO_CONST const | |
# define TRIO_VOLATILE volatile | |
# define TRIO_SIGNED signed | |
typedef long double trio_long_double_t; | |
typedef void * trio_pointer_t; | |
# define TRIO_SUFFIX_LONG(x) x ## L | |
# define TRIO_PROTO(x) x | |
# define TRIO_NOARGS void | |
# define TRIO_ARGS1(list,a1) (a1) | |
# define TRIO_ARGS2(list,a1,a2) (a1,a2) | |
# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3) | |
# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4) | |
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5) | |
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6) | |
# define TRIO_VARGS2 TRIO_ARGS2 | |
# define TRIO_VARGS3 TRIO_ARGS3 | |
# define TRIO_VARGS4 TRIO_ARGS4 | |
# define TRIO_VARGS5 TRIO_ARGS5 | |
# define TRIO_VA_DECL ... | |
# define TRIO_VA_START(x,y) va_start(x,y) | |
# define TRIO_VA_END(x) va_end(x) | |
#endif | |
#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus) | |
# define TRIO_INLINE inline | |
#elif defined(TRIO_COMPILER_GCC) | |
# define TRIO_INLINE __inline__ | |
#elif defined(TRIO_COMPILER_MSVC) | |
# define TRIO_INLINE _inline | |
#elif defined(TRIO_COMPILER_BCB) | |
# define TRIO_INLINE __inline | |
#else | |
# define TRIO_INLINE | |
#endif | |
/************************************************************************* | |
* Workarounds | |
*/ | |
#if defined(TRIO_PLATFORM_VMS) | |
/* | |
* Computations done with constants at compile time can trigger these | |
* even when compiling with IEEE enabled. | |
*/ | |
# pragma message disable (UNDERFLOW, FLOATOVERFL) | |
# if (__CRTL_VER < 80000000) | |
/* | |
* Although the compiler supports C99 language constructs, the C | |
* run-time library does not contain all C99 functions. | |
* | |
* This was the case for 70300022. Update the 80000000 value when | |
* it has been accurately determined what version of the library | |
* supports C99. | |
*/ | |
# if defined(TRIO_COMPILER_SUPPORTS_C99) | |
# undef TRIO_COMPILER_SUPPORTS_C99 | |
# endif | |
# endif | |
#endif | |
/* | |
* Not all preprocessors supports the LL token. | |
*/ | |
#if defined(TRIO_COMPILER_BCB) | |
#else | |
# define TRIO_COMPILER_SUPPORTS_LL | |
#endif | |
#endif /* TRIO_TRIODEF_H */ |
/* | |
* Summary: interface for the variable matching and lookup. | |
* Description: interface for the variable matching and lookup. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_VARIABLES_H__ | |
#define __XML_XSLT_VARIABLES_H__ | |
#include <libxml/xpath.h> | |
#include <libxml/xpathInternals.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#include "functions.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XSLT_REGISTER_VARIABLE_LOOKUP: | |
* | |
* Registering macro, not general purpose at all but used in different modules. | |
*/ | |
#define XSLT_REGISTER_VARIABLE_LOOKUP(ctxt) \ | |
xmlXPathRegisterVariableLookup((ctxt)->xpathCtxt, \ | |
xsltXPathVariableLookup, (void *)(ctxt)); \ | |
xsltRegisterAllFunctions((ctxt)->xpathCtxt); \ | |
xsltRegisterAllElement(ctxt); \ | |
(ctxt)->xpathCtxt->extra = ctxt | |
/* | |
* Flags for memory management of RVTs | |
*/ | |
/** | |
* XSLT_RVT_LOCAL: | |
* | |
* RVT is destroyed after the current instructions ends. | |
*/ | |
#define XSLT_RVT_LOCAL ((void *)1) | |
/** | |
* XSLT_RVT_VARIABLE: | |
* | |
* RVT is part of a local variable and destroyed after the variable goes out | |
* of scope. | |
*/ | |
#define XSLT_RVT_VARIABLE ((void *)2) | |
/** | |
* XSLT_RVT_FUNC_RESULT: | |
* | |
* RVT is part of results returned with func:result. The RVT won't be | |
* destroyed after exiting a template and will be reset to XSLT_RVT_LOCAL or | |
* XSLT_RVT_VARIABLE in the template that receives the return value. | |
*/ | |
#define XSLT_RVT_FUNC_RESULT ((void *)3) | |
/** | |
* XSLT_RVT_GLOBAL: | |
* | |
* RVT is part of a global variable. | |
*/ | |
#define XSLT_RVT_GLOBAL ((void *)4) | |
/* | |
* Interfaces for the variable module. | |
*/ | |
XSLTPUBFUN int XSLTCALL | |
xsltEvalGlobalVariables (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN int XSLTCALL | |
xsltEvalUserParams (xsltTransformContextPtr ctxt, | |
const char **params); | |
XSLTPUBFUN int XSLTCALL | |
xsltQuoteUserParams (xsltTransformContextPtr ctxt, | |
const char **params); | |
XSLTPUBFUN int XSLTCALL | |
xsltEvalOneUserParam (xsltTransformContextPtr ctxt, | |
const xmlChar * name, | |
const xmlChar * value); | |
XSLTPUBFUN int XSLTCALL | |
xsltQuoteOneUserParam (xsltTransformContextPtr ctxt, | |
const xmlChar * name, | |
const xmlChar * value); | |
XSLTPUBFUN void XSLTCALL | |
xsltParseGlobalVariable (xsltStylesheetPtr style, | |
xmlNodePtr cur); | |
XSLTPUBFUN void XSLTCALL | |
xsltParseGlobalParam (xsltStylesheetPtr style, | |
xmlNodePtr cur); | |
XSLTPUBFUN void XSLTCALL | |
xsltParseStylesheetVariable (xsltTransformContextPtr ctxt, | |
xmlNodePtr cur); | |
XSLTPUBFUN void XSLTCALL | |
xsltParseStylesheetParam (xsltTransformContextPtr ctxt, | |
xmlNodePtr cur); | |
XSLTPUBFUN xsltStackElemPtr XSLTCALL | |
xsltParseStylesheetCallerParam (xsltTransformContextPtr ctxt, | |
xmlNodePtr cur); | |
XSLTPUBFUN int XSLTCALL | |
xsltAddStackElemList (xsltTransformContextPtr ctxt, | |
xsltStackElemPtr elems); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeGlobalVariables (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL | |
xsltVariableLookup (xsltTransformContextPtr ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri); | |
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL | |
xsltXPathVariableLookup (void *ctxt, | |
const xmlChar *name, | |
const xmlChar *ns_uri); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_VARIABLES_H__ */ | |
/* | |
* Summary: Windows configuration header | |
* Description: Windows configuration header | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Igor Zlatkovic | |
*/ | |
#ifndef __LIBXSLT_WIN32_CONFIG__ | |
#define __LIBXSLT_WIN32_CONFIG__ | |
#define HAVE_CTYPE_H 1 | |
#define HAVE_STDLIB_H 1 | |
#define HAVE_STDARG_H 1 | |
#define HAVE_MALLOC_H 1 | |
#define HAVE_TIME_H 1 | |
#define HAVE_LOCALTIME 1 | |
#define HAVE_GMTIME 1 | |
#define HAVE_TIME 1 | |
#define HAVE_MATH_H 1 | |
#define HAVE_FCNTL_H 1 | |
#include <io.h> | |
#define HAVE_ISINF | |
#define HAVE_ISNAN | |
#include <math.h> | |
#if defined _MSC_VER || defined __MINGW32__ | |
/* MS C-runtime has functions which can be used in order to determine if | |
a given floating-point variable contains NaN, (+-)INF. These are | |
preferred, because floating-point technology is considered propriatary | |
by MS and we can assume that their functions know more about their | |
oddities than we do. */ | |
#include <float.h> | |
/* Bjorn Reese figured a quite nice construct for isinf() using the | |
_fpclass() function. */ | |
#ifndef isinf | |
#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \ | |
: ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0)) | |
#endif | |
/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */ | |
#ifndef isnan | |
#define isnan(d) (_isnan(d)) | |
#endif | |
#else /* _MSC_VER */ | |
static int isinf (double d) { | |
int expon = 0; | |
double val = frexp (d, &expon); | |
if (expon == 1025) { | |
if (val == 0.5) { | |
return 1; | |
} else if (val == -0.5) { | |
return -1; | |
} else { | |
return 0; | |
} | |
} else { | |
return 0; | |
} | |
} | |
static int isnan (double d) { | |
int expon = 0; | |
double val = frexp (d, &expon); | |
if (expon == 1025) { | |
if (val == 0.5) { | |
return 0; | |
} else if (val == -0.5) { | |
return 0; | |
} else { | |
return 1; | |
} | |
} else { | |
return 0; | |
} | |
} | |
#endif /* _MSC_VER */ | |
#include <direct.h> | |
/* snprintf emulation taken from http://stackoverflow.com/a/8712996/1956010 */ | |
#if defined(_MSC_VER) && _MSC_VER < 1900 | |
#include <stdarg.h> | |
#include <stdio.h> | |
#define snprintf c99_snprintf | |
#define vsnprintf c99_vsnprintf | |
__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) | |
{ | |
int count = -1; | |
if (size != 0) | |
count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); | |
if (count == -1) | |
count = _vscprintf(format, ap); | |
return count; | |
} | |
__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) | |
{ | |
int count; | |
va_list ap; | |
va_start(ap, format); | |
count = c99_vsnprintf(outBuf, size, format, ap); | |
va_end(ap); | |
return count; | |
} | |
#endif /* defined(_MSC_VER) && _MSC_VER < 1900 */ | |
#define HAVE_SYS_STAT_H | |
#define HAVE__STAT | |
#define HAVE_STRING_H | |
#include <libxml/xmlversion.h> | |
#ifndef ATTRIBUTE_UNUSED | |
#define ATTRIBUTE_UNUSED | |
#endif | |
#define _WINSOCKAPI_ | |
#endif /* __LIBXSLT_WIN32_CONFIG__ */ | |
/* | |
* Summary: Interfaces, constants and types related to the XSLT engine | |
* Description: Interfaces, constants and types related to the XSLT engine | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_H__ | |
#define __XML_XSLT_H__ | |
#include <libxml/tree.h> | |
#include "xsltexports.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XSLT_DEFAULT_VERSION: | |
* | |
* The default version of XSLT supported. | |
*/ | |
#define XSLT_DEFAULT_VERSION "1.0" | |
/** | |
* XSLT_DEFAULT_VENDOR: | |
* | |
* The XSLT "vendor" string for this processor. | |
*/ | |
#define XSLT_DEFAULT_VENDOR "libxslt" | |
/** | |
* XSLT_DEFAULT_URL: | |
* | |
* The XSLT "vendor" URL for this processor. | |
*/ | |
#define XSLT_DEFAULT_URL "http://xmlsoft.org/XSLT/" | |
/** | |
* XSLT_NAMESPACE: | |
* | |
* The XSLT specification namespace. | |
*/ | |
#define XSLT_NAMESPACE ((const xmlChar *)"http://www.w3.org/1999/XSL/Transform") | |
/** | |
* XSLT_PARSE_OPTIONS: | |
* | |
* The set of options to pass to an xmlReadxxx when loading files for | |
* XSLT consumption. | |
*/ | |
#define XSLT_PARSE_OPTIONS \ | |
XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA | |
/** | |
* xsltMaxDepth: | |
* | |
* This value is used to detect templates loops. | |
*/ | |
XSLTPUBVAR int xsltMaxDepth; | |
/** | |
* * xsltMaxVars: | |
* * | |
* * This value is used to detect templates loops. | |
* */ | |
XSLTPUBVAR int xsltMaxVars; | |
/** | |
* xsltEngineVersion: | |
* | |
* The version string for libxslt. | |
*/ | |
XSLTPUBVAR const char *xsltEngineVersion; | |
/** | |
* xsltLibxsltVersion: | |
* | |
* The version of libxslt compiled. | |
*/ | |
XSLTPUBVAR const int xsltLibxsltVersion; | |
/** | |
* xsltLibxmlVersion: | |
* | |
* The version of libxml libxslt was compiled against. | |
*/ | |
XSLTPUBVAR const int xsltLibxmlVersion; | |
/* | |
* Global initialization function. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltInit (void); | |
/* | |
* Global cleanup function. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltCleanupGlobals (void); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_H__ */ | |
/* | |
* Summary: compile-time version informations for the XSLT engine | |
* Description: compile-time version informations for the XSLT engine | |
* this module is autogenerated. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLTCONFIG_H__ | |
#define __XML_XSLTCONFIG_H__ | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* LIBXSLT_DOTTED_VERSION: | |
* | |
* the version string like "1.2.3" | |
*/ | |
#define LIBXSLT_DOTTED_VERSION "1.1.30" | |
/** | |
* LIBXSLT_VERSION: | |
* | |
* the version number: 1.2.3 value is 10203 | |
*/ | |
#define LIBXSLT_VERSION 10130 | |
/** | |
* LIBXSLT_VERSION_STRING: | |
* | |
* the version number string, 1.2.3 value is "10203" | |
*/ | |
#define LIBXSLT_VERSION_STRING "10130" | |
/** | |
* LIBXSLT_VERSION_EXTRA: | |
* | |
* extra version information, used to show a CVS compilation | |
*/ | |
#define LIBXSLT_VERSION_EXTRA "" | |
/** | |
* WITH_XSLT_DEBUG: | |
* | |
* Activate the compilation of the debug reporting. Speed penalty | |
* is insignifiant and being able to run xsltpoc -v is useful. On | |
* by default unless --without-debug is passed to configure | |
*/ | |
#if 1 | |
#define WITH_XSLT_DEBUG | |
#endif | |
#if 0 | |
/** | |
* DEBUG_MEMORY: | |
* | |
* should be activated only when debugging libxslt. It replaces the | |
* allocator with a collect and debug shell to the libc allocator. | |
* Use configure --with-mem-debug to activate it on both library | |
*/ | |
#define DEBUG_MEMORY | |
/** | |
* DEBUG_MEMORY_LOCATION: | |
* | |
* should be activated only when debugging libxslt. | |
* DEBUG_MEMORY_LOCATION should be activated only when libxml has | |
* been configured with --with-debug-mem too | |
*/ | |
#define DEBUG_MEMORY_LOCATION | |
#endif | |
/** | |
* XSLT_NEED_TRIO: | |
* | |
* should be activated if the existing libc library lacks some of the | |
* string formatting function, in that case reuse the Trio ones already | |
* compiled in the libxml2 library. | |
*/ | |
#if 0 | |
#define XSLT_NEED_TRIO | |
#endif | |
#ifdef __VMS | |
#define HAVE_MATH_H 1 | |
#define HAVE_SYS_STAT_H 1 | |
#ifndef XSLT_NEED_TRIO | |
#define XSLT_NEED_TRIO | |
#endif | |
#endif | |
#ifdef XSLT_NEED_TRIO | |
#define TRIO_REPLACE_STDIO | |
#endif | |
/** | |
* WITH_XSLT_DEBUGGER: | |
* | |
* Activate the compilation of the debugger support. Speed penalty | |
* is insignifiant. | |
* On by default unless --without-debugger is passed to configure | |
*/ | |
#if 1 | |
#ifndef WITH_DEBUGGER | |
#define WITH_DEBUGGER | |
#endif | |
#endif | |
/** | |
* WITH_MODULES: | |
* | |
* Whether module support is configured into libxslt | |
* Note: no default module path for win32 platforms | |
*/ | |
#if 0 | |
#ifndef WITH_MODULES | |
#define WITH_MODULES | |
#endif | |
#define LIBXSLT_DEFAULT_PLUGINS_PATH() "NULL" | |
#endif | |
/** | |
* Locale support | |
*/ | |
#if 0 | |
#ifndef XSLT_LOCALE_XLOCALE | |
#define XSLT_LOCALE_XLOCALE | |
#endif | |
#elif 1 | |
#ifndef XSLT_LOCALE_WINAPI | |
#define XSLT_LOCALE_WINAPI | |
#endif | |
#endif | |
/** | |
* ATTRIBUTE_UNUSED: | |
* | |
* This macro is used to flag unused function parameters to GCC | |
*/ | |
#ifdef __GNUC__ | |
#ifdef HAVE_ANSIDECL_H | |
#include <ansidecl.h> | |
#endif | |
#ifndef ATTRIBUTE_UNUSED | |
#define ATTRIBUTE_UNUSED __attribute__((unused)) | |
#endif | |
#else | |
#define ATTRIBUTE_UNUSED | |
#endif | |
/** | |
* LIBXSLT_ATTR_FORMAT: | |
* | |
* This macro is used to indicate to GCC the parameters are printf-like | |
*/ | |
#ifdef __GNUC__ | |
#define LIBXSLT_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) | |
#else | |
#define LIBXSLT_ATTR_FORMAT(fmt,args) | |
#endif | |
/** | |
* LIBXSLT_PUBLIC: | |
* | |
* This macro is used to declare PUBLIC variables for Cygwin and for MSC on Windows | |
*/ | |
#if !defined LIBXSLT_PUBLIC | |
#if (defined(__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC | |
#define LIBXSLT_PUBLIC __declspec(dllimport) | |
#else | |
#define LIBXSLT_PUBLIC | |
#endif | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLTCONFIG_H__ */ |
/* | |
* Summary: macros for marking symbols as exportable/importable. | |
* Description: macros for marking symbols as exportable/importable. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Igor Zlatkovic <igor@zlatkovic.com> | |
*/ | |
#ifndef __XSLT_EXPORTS_H__ | |
#define __XSLT_EXPORTS_H__ | |
/** | |
* XSLTPUBFUN: | |
* XSLTPUBFUN, XSLTPUBVAR, XSLTCALL | |
* | |
* Macros which declare an exportable function, an exportable variable and | |
* the calling convention used for functions. | |
* | |
* Please use an extra block for every platform/compiler combination when | |
* modifying this, rather than overlong #ifdef lines. This helps | |
* readability as well as the fact that different compilers on the same | |
* platform might need different definitions. | |
*/ | |
/** | |
* XSLTPUBFUN: | |
* | |
* Macros which declare an exportable function | |
*/ | |
#define XSLTPUBFUN | |
/** | |
* XSLTPUBVAR: | |
* | |
* Macros which declare an exportable variable | |
*/ | |
#define XSLTPUBVAR extern | |
/** | |
* XSLTCALL: | |
* | |
* Macros which declare the called convention for exported functions | |
*/ | |
#define XSLTCALL | |
/** DOC_DISABLE */ | |
/* Windows platform with MS compiler */ | |
#if defined(_WIN32) && defined(_MSC_VER) | |
#undef XSLTPUBFUN | |
#undef XSLTPUBVAR | |
#undef XSLTCALL | |
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) | |
#define XSLTPUBFUN __declspec(dllexport) | |
#define XSLTPUBVAR __declspec(dllexport) | |
#else | |
#define XSLTPUBFUN | |
#if !defined(LIBXSLT_STATIC) | |
#define XSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define XSLTPUBVAR extern | |
#endif | |
#endif | |
#define XSLTCALL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Windows platform with Borland compiler */ | |
#if defined(_WIN32) && defined(__BORLANDC__) | |
#undef XSLTPUBFUN | |
#undef XSLTPUBVAR | |
#undef XSLTCALL | |
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) | |
#define XSLTPUBFUN __declspec(dllexport) | |
#define XSLTPUBVAR __declspec(dllexport) extern | |
#else | |
#define XSLTPUBFUN | |
#if !defined(LIBXSLT_STATIC) | |
#define XSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define XSLTPUBVAR extern | |
#endif | |
#endif | |
#define XSLTCALL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Windows platform with GNU compiler (Mingw) */ | |
#if defined(_WIN32) && defined(__MINGW32__) | |
#undef XSLTPUBFUN | |
#undef XSLTPUBVAR | |
#undef XSLTCALL | |
/* | |
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) | |
*/ | |
#if !defined(LIBXSLT_STATIC) | |
#define XSLTPUBFUN __declspec(dllexport) | |
#define XSLTPUBVAR __declspec(dllexport) extern | |
#else | |
#define XSLTPUBFUN | |
#if !defined(LIBXSLT_STATIC) | |
#define XSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define XSLTPUBVAR extern | |
#endif | |
#endif | |
#define XSLTCALL __cdecl | |
#if !defined _REENTRANT | |
#define _REENTRANT | |
#endif | |
#endif | |
/* Cygwin platform, GNU compiler */ | |
#if defined(_WIN32) && defined(__CYGWIN__) | |
#undef XSLTPUBFUN | |
#undef XSLTPUBVAR | |
#undef XSLTCALL | |
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) | |
#define XSLTPUBFUN __declspec(dllexport) | |
#define XSLTPUBVAR __declspec(dllexport) | |
#else | |
#define XSLTPUBFUN | |
#if !defined(LIBXSLT_STATIC) | |
#define XSLTPUBVAR __declspec(dllimport) extern | |
#else | |
#define XSLTPUBVAR | |
#endif | |
#endif | |
#define XSLTCALL __cdecl | |
#endif | |
/* Compatibility */ | |
#if !defined(LIBXSLT_PUBLIC) | |
#define LIBXSLT_PUBLIC XSLTPUBVAR | |
#endif | |
#endif /* __XSLT_EXPORTS_H__ */ | |
/* | |
* Summary: internal data structures, constants and functions | |
* Description: Internal data structures, constants and functions used | |
* by the XSLT engine. | |
* They are not part of the API or ABI, i.e. they can change | |
* without prior notice, use carefully. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLT_INTERNALS_H__ | |
#define __XML_XSLT_INTERNALS_H__ | |
#include <libxml/tree.h> | |
#include <libxml/hash.h> | |
#include <libxml/xpath.h> | |
#include <libxml/xmlerror.h> | |
#include <libxml/dict.h> | |
#include <libxml/xmlstring.h> | |
#include <libxslt/xslt.h> | |
#include "xsltexports.h" | |
#include "xsltlocale.h" | |
#include "numbersInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* #define XSLT_DEBUG_PROFILE_CACHE */ | |
/** | |
* XSLT_IS_TEXT_NODE: | |
* | |
* check if the argument is a text node | |
*/ | |
#define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \ | |
(((n)->type == XML_TEXT_NODE) || \ | |
((n)->type == XML_CDATA_SECTION_NODE))) | |
/** | |
* XSLT_MARK_RES_TREE_FRAG: | |
* | |
* internal macro to set up tree fragments | |
*/ | |
#define XSLT_MARK_RES_TREE_FRAG(n) \ | |
(n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt"); | |
/** | |
* XSLT_IS_RES_TREE_FRAG: | |
* | |
* internal macro to test tree fragments | |
*/ | |
#define XSLT_IS_RES_TREE_FRAG(n) \ | |
((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \ | |
((n)->name != NULL) && ((n)->name[0] == ' ')) | |
/** | |
* XSLT_REFACTORED_KEYCOMP: | |
* | |
* Internal define to enable on-demand xsl:key computation. | |
* That's the only mode now but the define is kept for compatibility | |
*/ | |
#define XSLT_REFACTORED_KEYCOMP | |
/** | |
* XSLT_FAST_IF: | |
* | |
* Internal define to enable usage of xmlXPathCompiledEvalToBoolean() | |
* for XSLT "tests"; e.g. in <xsl:if test="/foo/bar"> | |
*/ | |
#define XSLT_FAST_IF | |
/** | |
* XSLT_REFACTORED: | |
* | |
* Internal define to enable the refactored parts of Libxslt. | |
*/ | |
/* #define XSLT_REFACTORED */ | |
/* ==================================================================== */ | |
/** | |
* XSLT_REFACTORED_VARS: | |
* | |
* Internal define to enable the refactored variable part of libxslt | |
*/ | |
#define XSLT_REFACTORED_VARS | |
#ifdef XSLT_REFACTORED | |
extern const xmlChar *xsltXSLTAttrMarker; | |
/* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */ | |
/* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */ | |
/** | |
* XSLT_REFACTORED_XSLT_NSCOMP | |
* | |
* Internal define to enable the pointer-comparison of | |
* namespaces of XSLT elements. | |
*/ | |
/* #define XSLT_REFACTORED_XSLT_NSCOMP */ | |
/** | |
* XSLT_REFACTORED_XPATHCOMP: | |
* | |
* Internal define to enable the optimization of the | |
* compilation of XPath expressions. | |
*/ | |
#define XSLT_REFACTORED_XPATHCOMP | |
#ifdef XSLT_REFACTORED_XSLT_NSCOMP | |
extern const xmlChar *xsltConstNamespaceNameXSLT; | |
/** | |
* IS_XSLT_ELEM_FAST: | |
* | |
* quick test to detect XSLT elements | |
*/ | |
#define IS_XSLT_ELEM_FAST(n) \ | |
(((n) != NULL) && ((n)->ns != NULL) && \ | |
((n)->ns->href == xsltConstNamespaceNameXSLT)) | |
/** | |
* IS_XSLT_ATTR_FAST: | |
* | |
* quick test to detect XSLT attributes | |
*/ | |
#define IS_XSLT_ATTR_FAST(a) \ | |
(((a) != NULL) && ((a)->ns != NULL) && \ | |
((a)->ns->href == xsltConstNamespaceNameXSLT)) | |
/** | |
* XSLT_HAS_INTERNAL_NSMAP: | |
* | |
* check for namespace mapping | |
*/ | |
#define XSLT_HAS_INTERNAL_NSMAP(s) \ | |
(((s) != NULL) && ((s)->principal) && \ | |
((s)->principal->principalData) && \ | |
((s)->principal->principalData->nsMap)) | |
/** | |
* XSLT_GET_INTERNAL_NSMAP: | |
* | |
* get pointer to namespace map | |
*/ | |
#define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap) | |
#else /* XSLT_REFACTORED_XSLT_NSCOMP */ | |
/** | |
* IS_XSLT_ELEM_FAST: | |
* | |
* quick check whether this is an xslt element | |
*/ | |
#define IS_XSLT_ELEM_FAST(n) \ | |
(((n) != NULL) && ((n)->ns != NULL) && \ | |
(xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) | |
/** | |
* IS_XSLT_ATTR_FAST: | |
* | |
* quick check for xslt namespace attribute | |
*/ | |
#define IS_XSLT_ATTR_FAST(a) \ | |
(((a) != NULL) && ((a)->ns != NULL) && \ | |
(xmlStrEqual((a)->ns->href, XSLT_NAMESPACE))) | |
#endif /* XSLT_REFACTORED_XSLT_NSCOMP */ | |
/** | |
* XSLT_REFACTORED_MANDATORY_VERSION: | |
* | |
* TODO: Currently disabled to surpress regression test failures, since | |
* the old behaviour was that a missing version attribute | |
* produced a only a warning and not an error, which was incerrect. | |
* So the regression tests need to be fixed if this is enabled. | |
*/ | |
/* #define XSLT_REFACTORED_MANDATORY_VERSION */ | |
/** | |
* xsltPointerList: | |
* | |
* Pointer-list for various purposes. | |
*/ | |
typedef struct _xsltPointerList xsltPointerList; | |
typedef xsltPointerList *xsltPointerListPtr; | |
struct _xsltPointerList { | |
void **items; | |
int number; | |
int size; | |
}; | |
#endif | |
/** | |
* XSLT_REFACTORED_PARSING: | |
* | |
* Internal define to enable the refactored parts of Libxslt | |
* related to parsing. | |
*/ | |
/* #define XSLT_REFACTORED_PARSING */ | |
/** | |
* XSLT_MAX_SORT: | |
* | |
* Max number of specified xsl:sort on an element. | |
*/ | |
#define XSLT_MAX_SORT 15 | |
/** | |
* XSLT_PAT_NO_PRIORITY: | |
* | |
* Specific value for pattern without priority expressed. | |
*/ | |
#define XSLT_PAT_NO_PRIORITY -12345789 | |
/** | |
* xsltRuntimeExtra: | |
* | |
* Extra information added to the transformation context. | |
*/ | |
typedef struct _xsltRuntimeExtra xsltRuntimeExtra; | |
typedef xsltRuntimeExtra *xsltRuntimeExtraPtr; | |
struct _xsltRuntimeExtra { | |
void *info; /* pointer to the extra data */ | |
xmlFreeFunc deallocate; /* pointer to the deallocation routine */ | |
union { /* dual-purpose field */ | |
void *ptr; /* data not needing deallocation */ | |
int ival; /* integer value storage */ | |
} val; | |
}; | |
/** | |
* XSLT_RUNTIME_EXTRA_LST: | |
* @ctxt: the transformation context | |
* @nr: the index | |
* | |
* Macro used to access extra information stored in the context | |
*/ | |
#define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info | |
/** | |
* XSLT_RUNTIME_EXTRA_FREE: | |
* @ctxt: the transformation context | |
* @nr: the index | |
* | |
* Macro used to free extra information stored in the context | |
*/ | |
#define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate | |
/** | |
* XSLT_RUNTIME_EXTRA: | |
* @ctxt: the transformation context | |
* @nr: the index | |
* | |
* Macro used to define extra information stored in the context | |
*/ | |
#define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ | |
/** | |
* xsltTemplate: | |
* | |
* The in-memory structure corresponding to an XSLT Template. | |
*/ | |
typedef struct _xsltTemplate xsltTemplate; | |
typedef xsltTemplate *xsltTemplatePtr; | |
struct _xsltTemplate { | |
struct _xsltTemplate *next;/* chained list sorted by priority */ | |
struct _xsltStylesheet *style;/* the containing stylesheet */ | |
xmlChar *match; /* the matching string */ | |
float priority; /* as given from the stylesheet, not computed */ | |
const xmlChar *name; /* the local part of the name QName */ | |
const xmlChar *nameURI; /* the URI part of the name QName */ | |
const xmlChar *mode;/* the local part of the mode QName */ | |
const xmlChar *modeURI;/* the URI part of the mode QName */ | |
xmlNodePtr content; /* the template replacement value */ | |
xmlNodePtr elem; /* the source element */ | |
/* | |
* TODO: @inheritedNsNr and @inheritedNs won't be used in the | |
* refactored code. | |
*/ | |
int inheritedNsNr; /* number of inherited namespaces */ | |
xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */ | |
/* Profiling informations */ | |
int nbCalls; /* the number of time the template was called */ | |
unsigned long time; /* the time spent in this template */ | |
void *params; /* xsl:param instructions */ | |
int templNr; /* Nb of templates in the stack */ | |
int templMax; /* Size of the templtes stack */ | |
xsltTemplatePtr *templCalledTab; /* templates called */ | |
int *templCountTab; /* .. and how often */ | |
}; | |
/** | |
* xsltDecimalFormat: | |
* | |
* Data structure of decimal-format. | |
*/ | |
typedef struct _xsltDecimalFormat xsltDecimalFormat; | |
typedef xsltDecimalFormat *xsltDecimalFormatPtr; | |
struct _xsltDecimalFormat { | |
struct _xsltDecimalFormat *next; /* chained list */ | |
xmlChar *name; | |
/* Used for interpretation of pattern */ | |
xmlChar *digit; | |
xmlChar *patternSeparator; | |
/* May appear in result */ | |
xmlChar *minusSign; | |
xmlChar *infinity; | |
xmlChar *noNumber; /* Not-a-number */ | |
/* Used for interpretation of pattern and may appear in result */ | |
xmlChar *decimalPoint; | |
xmlChar *grouping; | |
xmlChar *percent; | |
xmlChar *permille; | |
xmlChar *zeroDigit; | |
const xmlChar *nsUri; | |
}; | |
/** | |
* xsltDocument: | |
* | |
* Data structure associated to a parsed document. | |
*/ | |
typedef struct _xsltDocument xsltDocument; | |
typedef xsltDocument *xsltDocumentPtr; | |
struct _xsltDocument { | |
struct _xsltDocument *next; /* documents are kept in a chained list */ | |
int main; /* is this the main document */ | |
xmlDocPtr doc; /* the parsed document */ | |
void *keys; /* key tables storage */ | |
struct _xsltDocument *includes; /* subsidiary includes */ | |
int preproc; /* pre-processing already done */ | |
int nbKeysComputed; | |
}; | |
/** | |
* xsltKeyDef: | |
* | |
* Representation of an xsl:key. | |
*/ | |
typedef struct _xsltKeyDef xsltKeyDef; | |
typedef xsltKeyDef *xsltKeyDefPtr; | |
struct _xsltKeyDef { | |
struct _xsltKeyDef *next; | |
xmlNodePtr inst; | |
xmlChar *name; | |
xmlChar *nameURI; | |
xmlChar *match; | |
xmlChar *use; | |
xmlXPathCompExprPtr comp; | |
xmlXPathCompExprPtr usecomp; | |
xmlNsPtr *nsList; /* the namespaces in scope */ | |
int nsNr; /* the number of namespaces in scope */ | |
}; | |
/** | |
* xsltKeyTable: | |
* | |
* Holds the computed keys for key definitions of the same QName. | |
* Is owned by an xsltDocument. | |
*/ | |
typedef struct _xsltKeyTable xsltKeyTable; | |
typedef xsltKeyTable *xsltKeyTablePtr; | |
struct _xsltKeyTable { | |
struct _xsltKeyTable *next; | |
xmlChar *name; | |
xmlChar *nameURI; | |
xmlHashTablePtr keys; | |
}; | |
/* | |
* The in-memory structure corresponding to an XSLT Stylesheet. | |
* NOTE: most of the content is simply linked from the doc tree | |
* structure, no specific allocation is made. | |
*/ | |
typedef struct _xsltStylesheet xsltStylesheet; | |
typedef xsltStylesheet *xsltStylesheetPtr; | |
typedef struct _xsltTransformContext xsltTransformContext; | |
typedef xsltTransformContext *xsltTransformContextPtr; | |
/** | |
* xsltElemPreComp: | |
* | |
* The in-memory structure corresponding to element precomputed data, | |
* designed to be extended by extension implementors. | |
*/ | |
typedef struct _xsltElemPreComp xsltElemPreComp; | |
typedef xsltElemPreComp *xsltElemPreCompPtr; | |
/** | |
* xsltTransformFunction: | |
* @ctxt: the XSLT transformation context | |
* @node: the input node | |
* @inst: the stylesheet node | |
* @comp: the compiled information from the stylesheet | |
* | |
* Signature of the function associated to elements part of the | |
* stylesheet language like xsl:if or xsl:apply-templates. | |
*/ | |
typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst, | |
xsltElemPreCompPtr comp); | |
/** | |
* xsltSortFunc: | |
* @ctxt: a transformation context | |
* @sorts: the node-set to sort | |
* @nbsorts: the number of sorts | |
* | |
* Signature of the function to use during sorting | |
*/ | |
typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, | |
int nbsorts); | |
typedef enum { | |
XSLT_FUNC_COPY=1, | |
XSLT_FUNC_SORT, | |
XSLT_FUNC_TEXT, | |
XSLT_FUNC_ELEMENT, | |
XSLT_FUNC_ATTRIBUTE, | |
XSLT_FUNC_COMMENT, | |
XSLT_FUNC_PI, | |
XSLT_FUNC_COPYOF, | |
XSLT_FUNC_VALUEOF, | |
XSLT_FUNC_NUMBER, | |
XSLT_FUNC_APPLYIMPORTS, | |
XSLT_FUNC_CALLTEMPLATE, | |
XSLT_FUNC_APPLYTEMPLATES, | |
XSLT_FUNC_CHOOSE, | |
XSLT_FUNC_IF, | |
XSLT_FUNC_FOREACH, | |
XSLT_FUNC_DOCUMENT, | |
XSLT_FUNC_WITHPARAM, | |
XSLT_FUNC_PARAM, | |
XSLT_FUNC_VARIABLE, | |
XSLT_FUNC_WHEN, | |
XSLT_FUNC_EXTENSION | |
#ifdef XSLT_REFACTORED | |
, | |
XSLT_FUNC_OTHERWISE, | |
XSLT_FUNC_FALLBACK, | |
XSLT_FUNC_MESSAGE, | |
XSLT_FUNC_INCLUDE, | |
XSLT_FUNC_ATTRSET, | |
XSLT_FUNC_LITERAL_RESULT_ELEMENT, | |
XSLT_FUNC_UNKOWN_FORWARDS_COMPAT | |
#endif | |
} xsltStyleType; | |
/** | |
* xsltElemPreCompDeallocator: | |
* @comp: the #xsltElemPreComp to free up | |
* | |
* Deallocates an #xsltElemPreComp structure. | |
*/ | |
typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp); | |
/** | |
* xsltElemPreComp: | |
* | |
* The basic structure for compiled items of the AST of the XSLT processor. | |
* This structure is also intended to be extended by extension implementors. | |
* TODO: This is somehow not nice, since it has a "free" field, which | |
* derived stylesheet-structs do not have. | |
*/ | |
struct _xsltElemPreComp { | |
xsltElemPreCompPtr next; /* next item in the global chained | |
list hold by xsltStylesheet. */ | |
xsltStyleType type; /* type of the element */ | |
xsltTransformFunction func; /* handling function */ | |
xmlNodePtr inst; /* the node in the stylesheet's tree | |
corresponding to this item */ | |
/* end of common part */ | |
xsltElemPreCompDeallocator free; /* the deallocator */ | |
}; | |
/** | |
* xsltStylePreComp: | |
* | |
* The abstract basic structure for items of the XSLT processor. | |
* This includes: | |
* 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.) | |
* 2) compiled forms of literal result elements | |
* 3) compiled forms of extension elements | |
*/ | |
typedef struct _xsltStylePreComp xsltStylePreComp; | |
typedef xsltStylePreComp *xsltStylePreCompPtr; | |
#ifdef XSLT_REFACTORED | |
/* | |
* Some pointer-list utility functions. | |
*/ | |
XSLTPUBFUN xsltPointerListPtr XSLTCALL | |
xsltPointerListCreate (int initialSize); | |
XSLTPUBFUN void XSLTCALL | |
xsltPointerListFree (xsltPointerListPtr list); | |
XSLTPUBFUN void XSLTCALL | |
xsltPointerListClear (xsltPointerListPtr list); | |
XSLTPUBFUN int XSLTCALL | |
xsltPointerListAddSize (xsltPointerListPtr list, | |
void *item, | |
int initialSize); | |
/************************************************************************ | |
* * | |
* Refactored structures * | |
* * | |
************************************************************************/ | |
typedef struct _xsltNsListContainer xsltNsListContainer; | |
typedef xsltNsListContainer *xsltNsListContainerPtr; | |
struct _xsltNsListContainer { | |
xmlNsPtr *list; | |
int totalNumber; | |
int xpathNumber; | |
}; | |
/** | |
* XSLT_ITEM_COMPATIBILITY_FIELDS: | |
* | |
* Fields for API compatibility to the structure | |
* _xsltElemPreComp which is used for extension functions. | |
* Note that @next is used for storage; it does not reflect a next | |
* sibling in the tree. | |
* TODO: Evaluate if we really need such a compatibility. | |
*/ | |
#define XSLT_ITEM_COMPATIBILITY_FIELDS \ | |
xsltElemPreCompPtr next;\ | |
xsltStyleType type;\ | |
xsltTransformFunction func;\ | |
xmlNodePtr inst; | |
/** | |
* XSLT_ITEM_NAVIGATION_FIELDS: | |
* | |
* Currently empty. | |
* TODO: It is intended to hold navigational fields in the future. | |
*/ | |
#define XSLT_ITEM_NAVIGATION_FIELDS | |
/* | |
xsltStylePreCompPtr parent;\ | |
xsltStylePreCompPtr children;\ | |
xsltStylePreCompPtr nextItem; | |
*/ | |
/** | |
* XSLT_ITEM_NSINSCOPE_FIELDS: | |
* | |
* The in-scope namespaces. | |
*/ | |
#define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs; | |
/** | |
* XSLT_ITEM_COMMON_FIELDS: | |
* | |
* Common fields used for all items. | |
*/ | |
#define XSLT_ITEM_COMMON_FIELDS \ | |
XSLT_ITEM_COMPATIBILITY_FIELDS \ | |
XSLT_ITEM_NAVIGATION_FIELDS \ | |
XSLT_ITEM_NSINSCOPE_FIELDS | |
/** | |
* _xsltStylePreComp: | |
* | |
* The abstract basic structure for items of the XSLT processor. | |
* This includes: | |
* 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.) | |
* 2) compiled forms of literal result elements | |
* 3) various properties for XSLT instructions (e.g. xsl:when, | |
* xsl:with-param) | |
* | |
* REVISIT TODO: Keep this structure equal to the fields | |
* defined by XSLT_ITEM_COMMON_FIELDS | |
*/ | |
struct _xsltStylePreComp { | |
xsltElemPreCompPtr next; /* next item in the global chained | |
list hold by xsltStylesheet */ | |
xsltStyleType type; /* type of the item */ | |
xsltTransformFunction func; /* handling function */ | |
xmlNodePtr inst; /* the node in the stylesheet's tree | |
corresponding to this item. */ | |
/* Currently no navigational fields. */ | |
xsltNsListContainerPtr inScopeNs; | |
}; | |
/** | |
* xsltStyleBasicEmptyItem: | |
* | |
* Abstract structure only used as a short-cut for | |
* XSLT items with no extra fields. | |
* NOTE that it is intended that this structure looks the same as | |
* _xsltStylePreComp. | |
*/ | |
typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem; | |
typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr; | |
struct _xsltStyleBasicEmptyItem { | |
XSLT_ITEM_COMMON_FIELDS | |
}; | |
/** | |
* xsltStyleBasicExpressionItem: | |
* | |
* Abstract structure only used as a short-cut for | |
* XSLT items with just an expression. | |
*/ | |
typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem; | |
typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr; | |
struct _xsltStyleBasicExpressionItem { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *select; /* TODO: Change this to "expression". */ | |
xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */ | |
}; | |
/************************************************************************ | |
* * | |
* XSLT-instructions/declarations * | |
* * | |
************************************************************************/ | |
/** | |
* xsltStyleItemElement: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:element | |
* name = { qname } | |
* namespace = { uri-reference } | |
* use-attribute-sets = qnames> | |
* <!-- Content: template --> | |
* </xsl:element> | |
*/ | |
typedef struct _xsltStyleItemElement xsltStyleItemElement; | |
typedef xsltStyleItemElement *xsltStyleItemElementPtr; | |
struct _xsltStyleItemElement { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *use; | |
int has_use; | |
const xmlChar *name; | |
int has_name; | |
const xmlChar *ns; | |
const xmlChar *nsPrefix; | |
int has_ns; | |
}; | |
/** | |
* xsltStyleItemAttribute: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:attribute | |
* name = { qname } | |
* namespace = { uri-reference }> | |
* <!-- Content: template --> | |
* </xsl:attribute> | |
*/ | |
typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute; | |
typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr; | |
struct _xsltStyleItemAttribute { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *name; | |
int has_name; | |
const xmlChar *ns; | |
const xmlChar *nsPrefix; | |
int has_ns; | |
}; | |
/** | |
* xsltStyleItemText: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:text | |
* disable-output-escaping = "yes" | "no"> | |
* <!-- Content: #PCDATA --> | |
* </xsl:text> | |
*/ | |
typedef struct _xsltStyleItemText xsltStyleItemText; | |
typedef xsltStyleItemText *xsltStyleItemTextPtr; | |
struct _xsltStyleItemText { | |
XSLT_ITEM_COMMON_FIELDS | |
int noescape; /* text */ | |
}; | |
/** | |
* xsltStyleItemComment: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:comment> | |
* <!-- Content: template --> | |
* </xsl:comment> | |
*/ | |
typedef xsltStyleBasicEmptyItem xsltStyleItemComment; | |
typedef xsltStyleItemComment *xsltStyleItemCommentPtr; | |
/** | |
* xsltStyleItemPI: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:processing-instruction | |
* name = { ncname }> | |
* <!-- Content: template --> | |
* </xsl:processing-instruction> | |
*/ | |
typedef struct _xsltStyleItemPI xsltStyleItemPI; | |
typedef xsltStyleItemPI *xsltStyleItemPIPtr; | |
struct _xsltStyleItemPI { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *name; | |
int has_name; | |
}; | |
/** | |
* xsltStyleItemApplyImports: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:apply-imports /> | |
*/ | |
typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports; | |
typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr; | |
/** | |
* xsltStyleItemApplyTemplates: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:apply-templates | |
* select = node-set-expression | |
* mode = qname> | |
* <!-- Content: (xsl:sort | xsl:with-param)* --> | |
* </xsl:apply-templates> | |
*/ | |
typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates; | |
typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr; | |
struct _xsltStyleItemApplyTemplates { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *mode; /* apply-templates */ | |
const xmlChar *modeURI; /* apply-templates */ | |
const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ | |
xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ | |
/* TODO: with-params */ | |
}; | |
/** | |
* xsltStyleItemCallTemplate: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:call-template | |
* name = qname> | |
* <!-- Content: xsl:with-param* --> | |
* </xsl:call-template> | |
*/ | |
typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate; | |
typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr; | |
struct _xsltStyleItemCallTemplate { | |
XSLT_ITEM_COMMON_FIELDS | |
xsltTemplatePtr templ; /* call-template */ | |
const xmlChar *name; /* element, attribute, pi */ | |
int has_name; /* element, attribute, pi */ | |
const xmlChar *ns; /* element */ | |
int has_ns; /* element */ | |
/* TODO: with-params */ | |
}; | |
/** | |
* xsltStyleItemCopy: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:copy | |
* use-attribute-sets = qnames> | |
* <!-- Content: template --> | |
* </xsl:copy> | |
*/ | |
typedef struct _xsltStyleItemCopy xsltStyleItemCopy; | |
typedef xsltStyleItemCopy *xsltStyleItemCopyPtr; | |
struct _xsltStyleItemCopy { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *use; /* copy, element */ | |
int has_use; /* copy, element */ | |
}; | |
/** | |
* xsltStyleItemIf: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:if | |
* test = boolean-expression> | |
* <!-- Content: template --> | |
* </xsl:if> | |
*/ | |
typedef struct _xsltStyleItemIf xsltStyleItemIf; | |
typedef xsltStyleItemIf *xsltStyleItemIfPtr; | |
struct _xsltStyleItemIf { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *test; /* if */ | |
xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ | |
}; | |
/** | |
* xsltStyleItemCopyOf: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:copy-of | |
* select = expression /> | |
*/ | |
typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf; | |
typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr; | |
/** | |
* xsltStyleItemValueOf: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:value-of | |
* select = string-expression | |
* disable-output-escaping = "yes" | "no" /> | |
*/ | |
typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf; | |
typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr; | |
struct _xsltStyleItemValueOf { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *select; | |
xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ | |
int noescape; | |
}; | |
/** | |
* xsltStyleItemNumber: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:number | |
* level = "single" | "multiple" | "any" | |
* count = pattern | |
* from = pattern | |
* value = number-expression | |
* format = { string } | |
* lang = { nmtoken } | |
* letter-value = { "alphabetic" | "traditional" } | |
* grouping-separator = { char } | |
* grouping-size = { number } /> | |
*/ | |
typedef struct _xsltStyleItemNumber xsltStyleItemNumber; | |
typedef xsltStyleItemNumber *xsltStyleItemNumberPtr; | |
struct _xsltStyleItemNumber { | |
XSLT_ITEM_COMMON_FIELDS | |
xsltNumberData numdata; /* number */ | |
}; | |
/** | |
* xsltStyleItemChoose: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:choose> | |
* <!-- Content: (xsl:when+, xsl:otherwise?) --> | |
* </xsl:choose> | |
*/ | |
typedef xsltStyleBasicEmptyItem xsltStyleItemChoose; | |
typedef xsltStyleItemChoose *xsltStyleItemChoosePtr; | |
/** | |
* xsltStyleItemFallback: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:fallback> | |
* <!-- Content: template --> | |
* </xsl:fallback> | |
*/ | |
typedef xsltStyleBasicEmptyItem xsltStyleItemFallback; | |
typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr; | |
/** | |
* xsltStyleItemForEach: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:for-each | |
* select = node-set-expression> | |
* <!-- Content: (xsl:sort*, template) --> | |
* </xsl:for-each> | |
*/ | |
typedef xsltStyleBasicExpressionItem xsltStyleItemForEach; | |
typedef xsltStyleItemForEach *xsltStyleItemForEachPtr; | |
/** | |
* xsltStyleItemMessage: | |
* | |
* <!-- Category: instruction --> | |
* <xsl:message | |
* terminate = "yes" | "no"> | |
* <!-- Content: template --> | |
* </xsl:message> | |
*/ | |
typedef struct _xsltStyleItemMessage xsltStyleItemMessage; | |
typedef xsltStyleItemMessage *xsltStyleItemMessagePtr; | |
struct _xsltStyleItemMessage { | |
XSLT_ITEM_COMMON_FIELDS | |
int terminate; | |
}; | |
/** | |
* xsltStyleItemDocument: | |
* | |
* NOTE: This is not an instruction of XSLT 1.0. | |
*/ | |
typedef struct _xsltStyleItemDocument xsltStyleItemDocument; | |
typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr; | |
struct _xsltStyleItemDocument { | |
XSLT_ITEM_COMMON_FIELDS | |
int ver11; /* assigned: in xsltDocumentComp; | |
read: nowhere; | |
TODO: Check if we need. */ | |
const xmlChar *filename; /* document URL */ | |
int has_filename; | |
}; | |
/************************************************************************ | |
* * | |
* Non-instructions (actually properties of instructions/declarations) * | |
* * | |
************************************************************************/ | |
/** | |
* xsltStyleBasicItemVariable: | |
* | |
* Basic struct for xsl:variable, xsl:param and xsl:with-param. | |
* It's currently important to have equal fields, since | |
* xsltParseStylesheetCallerParam() is used with xsl:with-param from | |
* the xslt side and with xsl:param from the exslt side (in | |
* exsltFuncFunctionFunction()). | |
* | |
* FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param | |
* have additional different fields. | |
*/ | |
typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable; | |
typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr; | |
struct _xsltStyleBasicItemVariable { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *select; | |
xmlXPathCompExprPtr comp; | |
const xmlChar *name; | |
int has_name; | |
const xmlChar *ns; | |
int has_ns; | |
}; | |
/** | |
* xsltStyleItemVariable: | |
* | |
* <!-- Category: top-level-element --> | |
* <xsl:param | |
* name = qname | |
* select = expression> | |
* <!-- Content: template --> | |
* </xsl:param> | |
*/ | |
typedef xsltStyleBasicItemVariable xsltStyleItemVariable; | |
typedef xsltStyleItemVariable *xsltStyleItemVariablePtr; | |
/** | |
* xsltStyleItemParam: | |
* | |
* <!-- Category: top-level-element --> | |
* <xsl:param | |
* name = qname | |
* select = expression> | |
* <!-- Content: template --> | |
* </xsl:param> | |
*/ | |
typedef struct _xsltStyleItemParam xsltStyleItemParam; | |
typedef xsltStyleItemParam *xsltStyleItemParamPtr; | |
struct _xsltStyleItemParam { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *select; | |
xmlXPathCompExprPtr comp; | |
const xmlChar *name; | |
int has_name; | |
const xmlChar *ns; | |
int has_ns; | |
}; | |
/** | |
* xsltStyleItemWithParam: | |
* | |
* <xsl:with-param | |
* name = qname | |
* select = expression> | |
* <!-- Content: template --> | |
* </xsl:with-param> | |
*/ | |
typedef xsltStyleBasicItemVariable xsltStyleItemWithParam; | |
typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr; | |
/** | |
* xsltStyleItemSort: | |
* | |
* Reflects the XSLT xsl:sort item. | |
* Allowed parents: xsl:apply-templates, xsl:for-each | |
* <xsl:sort | |
* select = string-expression | |
* lang = { nmtoken } | |
* data-type = { "text" | "number" | qname-but-not-ncname } | |
* order = { "ascending" | "descending" } | |
* case-order = { "upper-first" | "lower-first" } /> | |
*/ | |
typedef struct _xsltStyleItemSort xsltStyleItemSort; | |
typedef xsltStyleItemSort *xsltStyleItemSortPtr; | |
struct _xsltStyleItemSort { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *stype; /* sort */ | |
int has_stype; /* sort */ | |
int number; /* sort */ | |
const xmlChar *order; /* sort */ | |
int has_order; /* sort */ | |
int descending; /* sort */ | |
const xmlChar *lang; /* sort */ | |
int has_lang; /* sort */ | |
xsltLocale locale; /* sort */ | |
const xmlChar *case_order; /* sort */ | |
int lower_first; /* sort */ | |
const xmlChar *use; | |
int has_use; | |
const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ | |
xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ | |
}; | |
/** | |
* xsltStyleItemWhen: | |
* | |
* <xsl:when | |
* test = boolean-expression> | |
* <!-- Content: template --> | |
* </xsl:when> | |
* Allowed parent: xsl:choose | |
*/ | |
typedef struct _xsltStyleItemWhen xsltStyleItemWhen; | |
typedef xsltStyleItemWhen *xsltStyleItemWhenPtr; | |
struct _xsltStyleItemWhen { | |
XSLT_ITEM_COMMON_FIELDS | |
const xmlChar *test; | |
xmlXPathCompExprPtr comp; | |
}; | |
/** | |
* xsltStyleItemOtherwise: | |
* | |
* Allowed parent: xsl:choose | |
* <xsl:otherwise> | |
* <!-- Content: template --> | |
* </xsl:otherwise> | |
*/ | |
typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise; | |
typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr; | |
struct _xsltStyleItemOtherwise { | |
XSLT_ITEM_COMMON_FIELDS | |
}; | |
typedef struct _xsltStyleItemInclude xsltStyleItemInclude; | |
typedef xsltStyleItemInclude *xsltStyleItemIncludePtr; | |
struct _xsltStyleItemInclude { | |
XSLT_ITEM_COMMON_FIELDS | |
xsltDocumentPtr include; | |
}; | |
/************************************************************************ | |
* * | |
* XSLT elements in forwards-compatible mode * | |
* * | |
************************************************************************/ | |
typedef struct _xsltStyleItemUknown xsltStyleItemUknown; | |
typedef xsltStyleItemUknown *xsltStyleItemUknownPtr; | |
struct _xsltStyleItemUknown { | |
XSLT_ITEM_COMMON_FIELDS | |
}; | |
/************************************************************************ | |
* * | |
* Extension elements * | |
* * | |
************************************************************************/ | |
/* | |
* xsltStyleItemExtElement: | |
* | |
* Reflects extension elements. | |
* | |
* NOTE: Due to the fact that the structure xsltElemPreComp is most | |
* probably already heavily in use out there by users, so we cannot | |
* easily change it, we'll create an intermediate structure which will | |
* hold an xsltElemPreCompPtr. | |
* BIG NOTE: The only problem I see here is that the user processes the | |
* content of the stylesheet tree, possibly he'll lookup the node->psvi | |
* fields in order to find subsequent extension functions. | |
* In this case, the user's code will break, since the node->psvi | |
* field will hold now the xsltStyleItemExtElementPtr and not | |
* the xsltElemPreCompPtr. | |
* However the place where the structure is anchored in the node-tree, | |
* namely node->psvi, has beed already once been moved from node->_private | |
* to node->psvi, so we have a precedent here, which, I think, should allow | |
* us to change such semantics without headaches. | |
*/ | |
typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement; | |
typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr; | |
struct _xsltStyleItemExtElement { | |
XSLT_ITEM_COMMON_FIELDS | |
xsltElemPreCompPtr item; | |
}; | |
/************************************************************************ | |
* * | |
* Literal result elements * | |
* * | |
************************************************************************/ | |
typedef struct _xsltEffectiveNs xsltEffectiveNs; | |
typedef xsltEffectiveNs *xsltEffectiveNsPtr; | |
struct _xsltEffectiveNs { | |
xsltEffectiveNsPtr nextInStore; /* storage next */ | |
xsltEffectiveNsPtr next; /* next item in the list */ | |
const xmlChar *prefix; | |
const xmlChar *nsName; | |
/* | |
* Indicates if eclared on the literal result element; dunno if really | |
* needed. | |
*/ | |
int holdByElem; | |
}; | |
/* | |
* Info for literal result elements. | |
* This will be set on the elem->psvi field and will be | |
* shared by literal result elements, which have the same | |
* excluded result namespaces; i.e., this *won't* be created uniquely | |
* for every literal result element. | |
*/ | |
typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo; | |
typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr; | |
struct _xsltStyleItemLRElementInfo { | |
XSLT_ITEM_COMMON_FIELDS | |
/* | |
* @effectiveNs is the set of effective ns-nodes | |
* on the literal result element, which will be added to the result | |
* element if not already existing in the result tree. | |
* This means that excluded namespaces (via exclude-result-prefixes, | |
* extension-element-prefixes and the XSLT namespace) not added | |
* to the set. | |
* Namespace-aliasing was applied on the @effectiveNs. | |
*/ | |
xsltEffectiveNsPtr effectiveNs; | |
}; | |
#ifdef XSLT_REFACTORED | |
typedef struct _xsltNsAlias xsltNsAlias; | |
typedef xsltNsAlias *xsltNsAliasPtr; | |
struct _xsltNsAlias { | |
xsltNsAliasPtr next; /* next in the list */ | |
xmlNsPtr literalNs; | |
xmlNsPtr targetNs; | |
xmlDocPtr docOfTargetNs; | |
}; | |
#endif | |
#ifdef XSLT_REFACTORED_XSLT_NSCOMP | |
typedef struct _xsltNsMap xsltNsMap; | |
typedef xsltNsMap *xsltNsMapPtr; | |
struct _xsltNsMap { | |
xsltNsMapPtr next; /* next in the list */ | |
xmlDocPtr doc; | |
xmlNodePtr elem; /* the element holding the ns-decl */ | |
xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */ | |
const xmlChar *origNsName; /* the original XML namespace name */ | |
const xmlChar *newNsName; /* the mapped XML namespace name */ | |
}; | |
#endif | |
/************************************************************************ | |
* * | |
* Compile-time structures for *internal* use only * | |
* * | |
************************************************************************/ | |
typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData; | |
typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr; | |
typedef struct _xsltNsList xsltNsList; | |
typedef xsltNsList *xsltNsListPtr; | |
struct _xsltNsList { | |
xsltNsListPtr next; /* next in the list */ | |
xmlNsPtr ns; | |
}; | |
/* | |
* xsltVarInfo: | |
* | |
* Used at compilation time for parameters and variables. | |
*/ | |
typedef struct _xsltVarInfo xsltVarInfo; | |
typedef xsltVarInfo *xsltVarInfoPtr; | |
struct _xsltVarInfo { | |
xsltVarInfoPtr next; /* next in the list */ | |
xsltVarInfoPtr prev; | |
int depth; /* the depth in the tree */ | |
const xmlChar *name; | |
const xmlChar *nsName; | |
}; | |
/** | |
* xsltCompilerNodeInfo: | |
* | |
* Per-node information during compile-time. | |
*/ | |
typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo; | |
typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr; | |
struct _xsltCompilerNodeInfo { | |
xsltCompilerNodeInfoPtr next; | |
xsltCompilerNodeInfoPtr prev; | |
xmlNodePtr node; | |
int depth; | |
xsltTemplatePtr templ; /* The owning template */ | |
int category; /* XSLT element, LR-element or | |
extension element */ | |
xsltStyleType type; | |
xsltElemPreCompPtr item; /* The compiled information */ | |
/* The current in-scope namespaces */ | |
xsltNsListContainerPtr inScopeNs; | |
/* The current excluded result namespaces */ | |
xsltPointerListPtr exclResultNs; | |
/* The current extension instruction namespaces */ | |
xsltPointerListPtr extElemNs; | |
/* The current info for literal result elements. */ | |
xsltStyleItemLRElementInfoPtr litResElemInfo; | |
/* | |
* Set to 1 if in-scope namespaces changed, | |
* or excluded result namespaces changed, | |
* or extension element namespaces changed. | |
* This will trigger creation of new infos | |
* for literal result elements. | |
*/ | |
int nsChanged; | |
int preserveWhitespace; | |
int stripWhitespace; | |
int isRoot; /* whether this is the stylesheet's root node */ | |
int forwardsCompat; /* whether forwards-compatible mode is enabled */ | |
/* whether the content of an extension element was processed */ | |
int extContentHandled; | |
/* the type of the current child */ | |
xsltStyleType curChildType; | |
}; | |
/** | |
* XSLT_CCTXT: | |
* | |
* get pointer to compiler context | |
*/ | |
#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) | |
typedef enum { | |
XSLT_ERROR_SEVERITY_ERROR = 0, | |
XSLT_ERROR_SEVERITY_WARNING | |
} xsltErrorSeverityType; | |
typedef struct _xsltCompilerCtxt xsltCompilerCtxt; | |
typedef xsltCompilerCtxt *xsltCompilerCtxtPtr; | |
struct _xsltCompilerCtxt { | |
void *errorCtxt; /* user specific error context */ | |
/* | |
* used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */ | |
xsltErrorSeverityType errSeverity; | |
int warnings; /* TODO: number of warnings found at | |
compilation */ | |
int errors; /* TODO: number of errors found at | |
compilation */ | |
xmlDictPtr dict; | |
xsltStylesheetPtr style; | |
int simplified; /* whether this is a simplified stylesheet */ | |
/* TODO: structured/unstructured error contexts. */ | |
int depth; /* Current depth of processing */ | |
xsltCompilerNodeInfoPtr inode; | |
xsltCompilerNodeInfoPtr inodeList; | |
xsltCompilerNodeInfoPtr inodeLast; | |
xsltPointerListPtr tmpList; /* Used for various purposes */ | |
/* | |
* The XSLT version as specified by the stylesheet's root element. | |
*/ | |
int isInclude; | |
int hasForwardsCompat; /* whether forwards-compatible mode was used | |
in a parsing episode */ | |
int maxNodeInfos; /* TEMP TODO: just for the interest */ | |
int maxLREs; /* TEMP TODO: just for the interest */ | |
/* | |
* In order to keep the old behaviour, applying strict rules of | |
* the spec can be turned off. This has effect only on special | |
* mechanisms like whitespace-stripping in the stylesheet. | |
*/ | |
int strict; | |
xsltPrincipalStylesheetDataPtr psData; | |
#ifdef XSLT_REFACTORED_XPATHCOMP | |
xmlXPathContextPtr xpathCtxt; | |
#endif | |
xsltStyleItemUknownPtr unknownItem; | |
int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */ | |
xsltNsAliasPtr nsAliases; | |
xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */ | |
xsltVarInfoPtr ivar; /* topmost local variable/param. */ | |
}; | |
#else /* XSLT_REFACTORED */ | |
/* | |
* The old structures before refactoring. | |
*/ | |
/** | |
* _xsltStylePreComp: | |
* | |
* The in-memory structure corresponding to XSLT stylesheet constructs | |
* precomputed data. | |
*/ | |
struct _xsltStylePreComp { | |
xsltElemPreCompPtr next; /* chained list */ | |
xsltStyleType type; /* type of the element */ | |
xsltTransformFunction func; /* handling function */ | |
xmlNodePtr inst; /* the instruction */ | |
/* | |
* Pre computed values. | |
*/ | |
const xmlChar *stype; /* sort */ | |
int has_stype; /* sort */ | |
int number; /* sort */ | |
const xmlChar *order; /* sort */ | |
int has_order; /* sort */ | |
int descending; /* sort */ | |
const xmlChar *lang; /* sort */ | |
int has_lang; /* sort */ | |
xsltLocale locale; /* sort */ | |
const xmlChar *case_order; /* sort */ | |
int lower_first; /* sort */ | |
const xmlChar *use; /* copy, element */ | |
int has_use; /* copy, element */ | |
int noescape; /* text */ | |
const xmlChar *name; /* element, attribute, pi */ | |
int has_name; /* element, attribute, pi */ | |
const xmlChar *ns; /* element */ | |
int has_ns; /* element */ | |
const xmlChar *mode; /* apply-templates */ | |
const xmlChar *modeURI; /* apply-templates */ | |
const xmlChar *test; /* if */ | |
xsltTemplatePtr templ; /* call-template */ | |
const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ | |
int ver11; /* document */ | |
const xmlChar *filename; /* document URL */ | |
int has_filename; /* document */ | |
xsltNumberData numdata; /* number */ | |
xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ | |
xmlNsPtr *nsList; /* the namespaces in scope */ | |
int nsNr; /* the number of namespaces in scope */ | |
}; | |
#endif /* XSLT_REFACTORED */ | |
/* | |
* The in-memory structure corresponding to an XSLT Variable | |
* or Param. | |
*/ | |
typedef struct _xsltStackElem xsltStackElem; | |
typedef xsltStackElem *xsltStackElemPtr; | |
struct _xsltStackElem { | |
struct _xsltStackElem *next;/* chained list */ | |
xsltStylePreCompPtr comp; /* the compiled form */ | |
int computed; /* was the evaluation done */ | |
const xmlChar *name; /* the local part of the name QName */ | |
const xmlChar *nameURI; /* the URI part of the name QName */ | |
const xmlChar *select; /* the eval string */ | |
xmlNodePtr tree; /* the sequence constructor if no eval | |
string or the location */ | |
xmlXPathObjectPtr value; /* The value if computed */ | |
xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0) | |
which are bound to the variable's lifetime. */ | |
int level; /* the depth in the tree; | |
-1 if persistent (e.g. a given xsl:with-param) */ | |
xsltTransformContextPtr context; /* The transformation context; needed to cache | |
the variables */ | |
int flags; | |
}; | |
#ifdef XSLT_REFACTORED | |
struct _xsltPrincipalStylesheetData { | |
/* | |
* Namespace dictionary for ns-prefixes and ns-names: | |
* TODO: Shared between stylesheets, and XPath mechanisms. | |
* Not used yet. | |
*/ | |
xmlDictPtr namespaceDict; | |
/* | |
* Global list of in-scope namespaces. | |
*/ | |
xsltPointerListPtr inScopeNamespaces; | |
/* | |
* Global list of information for [xsl:]excluded-result-prefixes. | |
*/ | |
xsltPointerListPtr exclResultNamespaces; | |
/* | |
* Global list of information for [xsl:]extension-element-prefixes. | |
*/ | |
xsltPointerListPtr extElemNamespaces; | |
xsltEffectiveNsPtr effectiveNs; | |
#ifdef XSLT_REFACTORED_XSLT_NSCOMP | |
/* | |
* Namespace name map to get rid of string comparison of namespace names. | |
*/ | |
xsltNsMapPtr nsMap; | |
#endif | |
}; | |
#endif | |
/* | |
* Note that we added a @compCtxt field to anchor an stylesheet compilation | |
* context, since, due to historical reasons, various compile-time function | |
* take only the stylesheet as argument and not a compilation context. | |
*/ | |
struct _xsltStylesheet { | |
/* | |
* The stylesheet import relation is kept as a tree. | |
*/ | |
struct _xsltStylesheet *parent; | |
struct _xsltStylesheet *next; | |
struct _xsltStylesheet *imports; | |
xsltDocumentPtr docList; /* the include document list */ | |
/* | |
* General data on the style sheet document. | |
*/ | |
xmlDocPtr doc; /* the parsed XML stylesheet */ | |
xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and | |
preserve space elements */ | |
int stripAll; /* strip-space * (1) preserve-space * (-1) */ | |
xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */ | |
/* | |
* Global variable or parameters. | |
*/ | |
xsltStackElemPtr variables; /* linked list of param and variables */ | |
/* | |
* Template descriptions. | |
*/ | |
xsltTemplatePtr templates; /* the ordered list of templates */ | |
void *templatesHash; /* hash table or wherever compiled templates | |
informations are stored */ | |
void *rootMatch; /* template based on / */ | |
void *keyMatch; /* template based on key() */ | |
void *elemMatch; /* template based on * */ | |
void *attrMatch; /* template based on @* */ | |
void *parentMatch; /* template based on .. */ | |
void *textMatch; /* template based on text() */ | |
void *piMatch; /* template based on processing-instruction() */ | |
void *commentMatch; /* template based on comment() */ | |
/* | |
* Namespace aliases. | |
* NOTE: Not used in the refactored code. | |
*/ | |
xmlHashTablePtr nsAliases; /* the namespace alias hash tables */ | |
/* | |
* Attribute sets. | |
*/ | |
xmlHashTablePtr attributeSets;/* the attribute sets hash tables */ | |
/* | |
* Namespaces. | |
* TODO: Eliminate this. | |
*/ | |
xmlHashTablePtr nsHash; /* the set of namespaces in use: | |
ATTENTION: This is used for | |
execution of XPath expressions; unfortunately | |
it restricts the stylesheet to have distinct | |
prefixes. | |
TODO: We need to get rid of this. | |
*/ | |
void *nsDefs; /* ATTENTION TODO: This is currently used to store | |
xsltExtDefPtr (in extensions.c) and | |
*not* xmlNsPtr. | |
*/ | |
/* | |
* Key definitions. | |
*/ | |
void *keys; /* key definitions */ | |
/* | |
* Output related stuff. | |
*/ | |
xmlChar *method; /* the output method */ | |
xmlChar *methodURI; /* associated namespace if any */ | |
xmlChar *version; /* version string */ | |
xmlChar *encoding; /* encoding string */ | |
int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ | |
/* | |
* Number formatting. | |
*/ | |
xsltDecimalFormatPtr decimalFormat; | |
int standalone; /* standalone = "yes" | "no" */ | |
xmlChar *doctypePublic; /* doctype-public string */ | |
xmlChar *doctypeSystem; /* doctype-system string */ | |
int indent; /* should output being indented */ | |
xmlChar *mediaType; /* media-type string */ | |
/* | |
* Precomputed blocks. | |
*/ | |
xsltElemPreCompPtr preComps;/* list of precomputed blocks */ | |
int warnings; /* number of warnings found at compilation */ | |
int errors; /* number of errors found at compilation */ | |
xmlChar *exclPrefix; /* last excluded prefixes */ | |
xmlChar **exclPrefixTab; /* array of excluded prefixes */ | |
int exclPrefixNr; /* number of excluded prefixes in scope */ | |
int exclPrefixMax; /* size of the array */ | |
void *_private; /* user defined data */ | |
/* | |
* Extensions. | |
*/ | |
xmlHashTablePtr extInfos; /* the extension data */ | |
int extrasNr; /* the number of extras required */ | |
/* | |
* For keeping track of nested includes | |
*/ | |
xsltDocumentPtr includes; /* points to last nested include */ | |
/* | |
* dictionary: shared between stylesheet, context and documents. | |
*/ | |
xmlDictPtr dict; | |
/* | |
* precompiled attribute value templates. | |
*/ | |
void *attVTs; | |
/* | |
* if namespace-alias has an alias for the default stylesheet prefix | |
* NOTE: Not used in the refactored code. | |
*/ | |
const xmlChar *defaultAlias; | |
/* | |
* bypass pre-processing (already done) (used in imports) | |
*/ | |
int nopreproc; | |
/* | |
* all document text strings were internalized | |
*/ | |
int internalized; | |
/* | |
* Literal Result Element as Stylesheet c.f. section 2.3 | |
*/ | |
int literal_result; | |
/* | |
* The principal stylesheet | |
*/ | |
xsltStylesheetPtr principal; | |
#ifdef XSLT_REFACTORED | |
/* | |
* Compilation context used during compile-time. | |
*/ | |
xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */ | |
xsltPrincipalStylesheetDataPtr principalData; | |
#endif | |
/* | |
* Forwards-compatible processing | |
*/ | |
int forwards_compatible; | |
xmlHashTablePtr namedTemplates; /* hash table of named templates */ | |
}; | |
typedef struct _xsltTransformCache xsltTransformCache; | |
typedef xsltTransformCache *xsltTransformCachePtr; | |
struct _xsltTransformCache { | |
xmlDocPtr RVT; | |
int nbRVT; | |
xsltStackElemPtr stackItems; | |
int nbStackItems; | |
#ifdef XSLT_DEBUG_PROFILE_CACHE | |
int dbgCachedRVTs; | |
int dbgReusedRVTs; | |
int dbgCachedVars; | |
int dbgReusedVars; | |
#endif | |
}; | |
/* | |
* The in-memory structure corresponding to an XSLT Transformation. | |
*/ | |
typedef enum { | |
XSLT_OUTPUT_XML = 0, | |
XSLT_OUTPUT_HTML, | |
XSLT_OUTPUT_TEXT | |
} xsltOutputType; | |
typedef enum { | |
XSLT_STATE_OK = 0, | |
XSLT_STATE_ERROR, | |
XSLT_STATE_STOPPED | |
} xsltTransformState; | |
struct _xsltTransformContext { | |
xsltStylesheetPtr style; /* the stylesheet used */ | |
xsltOutputType type; /* the type of output */ | |
xsltTemplatePtr templ; /* the current template */ | |
int templNr; /* Nb of templates in the stack */ | |
int templMax; /* Size of the templtes stack */ | |
xsltTemplatePtr *templTab; /* the template stack */ | |
xsltStackElemPtr vars; /* the current variable list */ | |
int varsNr; /* Nb of variable list in the stack */ | |
int varsMax; /* Size of the variable list stack */ | |
xsltStackElemPtr *varsTab; /* the variable list stack */ | |
int varsBase; /* the var base for current templ */ | |
/* | |
* Extensions | |
*/ | |
xmlHashTablePtr extFunctions; /* the extension functions */ | |
xmlHashTablePtr extElements; /* the extension elements */ | |
xmlHashTablePtr extInfos; /* the extension data */ | |
const xmlChar *mode; /* the current mode */ | |
const xmlChar *modeURI; /* the current mode URI */ | |
xsltDocumentPtr docList; /* the document list */ | |
xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */ | |
xmlNodePtr node; /* the current node being processed */ | |
xmlNodeSetPtr nodeList; /* the current node list */ | |
/* xmlNodePtr current; the node */ | |
xmlDocPtr output; /* the resulting document */ | |
xmlNodePtr insert; /* the insertion node */ | |
xmlXPathContextPtr xpathCtxt; /* the XPath context */ | |
xsltTransformState state; /* the current state */ | |
/* | |
* Global variables | |
*/ | |
xmlHashTablePtr globalVars; /* the global variables and params */ | |
xmlNodePtr inst; /* the instruction in the stylesheet */ | |
int xinclude; /* should XInclude be processed */ | |
const char * outputFile; /* the output URI if known */ | |
int profile; /* is this run profiled */ | |
long prof; /* the current profiled value */ | |
int profNr; /* Nb of templates in the stack */ | |
int profMax; /* Size of the templtaes stack */ | |
long *profTab; /* the profile template stack */ | |
void *_private; /* user defined data */ | |
int extrasNr; /* the number of extras used */ | |
int extrasMax; /* the number of extras allocated */ | |
xsltRuntimeExtraPtr extras; /* extra per runtime informations */ | |
xsltDocumentPtr styleList; /* the stylesheet docs list */ | |
void * sec; /* the security preferences if any */ | |
xmlGenericErrorFunc error; /* a specific error handler */ | |
void * errctx; /* context for the error handler */ | |
xsltSortFunc sortfunc; /* a ctxt specific sort routine */ | |
/* | |
* handling of temporary Result Value Tree | |
* (XSLT 1.0 term: "Result Tree Fragment") | |
*/ | |
xmlDocPtr tmpRVT; /* list of RVT without persistance */ | |
xmlDocPtr persistRVT; /* list of persistant RVTs */ | |
int ctxtflags; /* context processing flags */ | |
/* | |
* Speed optimization when coalescing text nodes | |
*/ | |
const xmlChar *lasttext; /* last text node content */ | |
int lasttsize; /* last text node size */ | |
int lasttuse; /* last text node use */ | |
/* | |
* Per Context Debugging | |
*/ | |
int debugStatus; /* the context level debug status */ | |
unsigned long* traceCode; /* pointer to the variable holding the mask */ | |
int parserOptions; /* parser options xmlParserOption */ | |
/* | |
* dictionary: shared between stylesheet, context and documents. | |
*/ | |
xmlDictPtr dict; | |
xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */ | |
/* | |
* all document text strings are internalized | |
*/ | |
int internalized; | |
int nbKeys; | |
int hasTemplKeyPatterns; | |
xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */ | |
xmlNodePtr initialContextNode; | |
xmlDocPtr initialContextDoc; | |
xsltTransformCachePtr cache; | |
void *contextVariable; /* the current variable item */ | |
xmlDocPtr localRVT; /* list of local tree fragments; will be freed when | |
the instruction which created the fragment | |
exits */ | |
xmlDocPtr localRVTBase; /* Obsolete */ | |
int keyInitLevel; /* Needed to catch recursive keys issues */ | |
int depth; /* Needed to catch recursions */ | |
int maxTemplateDepth; | |
int maxTemplateVars; | |
}; | |
/** | |
* CHECK_STOPPED: | |
* | |
* Macro to check if the XSLT processing should be stopped. | |
* Will return from the function. | |
*/ | |
#define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return; | |
/** | |
* CHECK_STOPPEDE: | |
* | |
* Macro to check if the XSLT processing should be stopped. | |
* Will goto the error: label. | |
*/ | |
#define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error; | |
/** | |
* CHECK_STOPPED0: | |
* | |
* Macro to check if the XSLT processing should be stopped. | |
* Will return from the function with a 0 value. | |
*/ | |
#define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0); | |
/* | |
* The macro XML_CAST_FPTR is a hack to avoid a gcc warning about | |
* possible incompatibilities between function pointers and object | |
* pointers. It is defined in libxml/hash.h within recent versions | |
* of libxml2, but is put here for compatibility. | |
*/ | |
#ifndef XML_CAST_FPTR | |
/** | |
* XML_CAST_FPTR: | |
* @fptr: pointer to a function | |
* | |
* Macro to do a casting from an object pointer to a | |
* function pointer without encountering a warning from | |
* gcc | |
* | |
* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) | |
* This macro violated ISO C aliasing rules (gcc4 on s390 broke) | |
* so it is disabled now | |
*/ | |
#define XML_CAST_FPTR(fptr) fptr | |
#endif | |
/* | |
* Functions associated to the internal types | |
xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, | |
xmlChar *name); | |
*/ | |
XSLTPUBFUN xsltStylesheetPtr XSLTCALL | |
xsltNewStylesheet (void); | |
XSLTPUBFUN xsltStylesheetPtr XSLTCALL | |
xsltParseStylesheetFile (const xmlChar* filename); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeStylesheet (xsltStylesheetPtr style); | |
XSLTPUBFUN int XSLTCALL | |
xsltIsBlank (xmlChar *str); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeStackElemList (xsltStackElemPtr elem); | |
XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL | |
xsltDecimalFormatGetByName(xsltStylesheetPtr style, | |
xmlChar *name); | |
XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL | |
xsltDecimalFormatGetByQName(xsltStylesheetPtr style, | |
const xmlChar *nsUri, | |
const xmlChar *name); | |
XSLTPUBFUN xsltStylesheetPtr XSLTCALL | |
xsltParseStylesheetProcess(xsltStylesheetPtr ret, | |
xmlDocPtr doc); | |
XSLTPUBFUN void XSLTCALL | |
xsltParseStylesheetOutput(xsltStylesheetPtr style, | |
xmlNodePtr cur); | |
XSLTPUBFUN xsltStylesheetPtr XSLTCALL | |
xsltParseStylesheetDoc (xmlDocPtr doc); | |
XSLTPUBFUN xsltStylesheetPtr XSLTCALL | |
xsltParseStylesheetImportedDoc(xmlDocPtr doc, | |
xsltStylesheetPtr style); | |
XSLTPUBFUN xsltStylesheetPtr XSLTCALL | |
xsltLoadStylesheetPI (xmlDocPtr doc); | |
XSLTPUBFUN void XSLTCALL | |
xsltNumberFormat (xsltTransformContextPtr ctxt, | |
xsltNumberDataPtr data, | |
xmlNodePtr node); | |
XSLTPUBFUN xmlXPathError XSLTCALL | |
xsltFormatNumberConversion(xsltDecimalFormatPtr self, | |
xmlChar *format, | |
double number, | |
xmlChar **result); | |
XSLTPUBFUN void XSLTCALL | |
xsltParseTemplateContent(xsltStylesheetPtr style, | |
xmlNodePtr templ); | |
XSLTPUBFUN int XSLTCALL | |
xsltAllocateExtra (xsltStylesheetPtr style); | |
XSLTPUBFUN int XSLTCALL | |
xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt); | |
/* | |
* Extra functions for Result Value Trees | |
*/ | |
XSLTPUBFUN xmlDocPtr XSLTCALL | |
xsltCreateRVT (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterTmpRVT (xsltTransformContextPtr ctxt, | |
xmlDocPtr RVT); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterLocalRVT (xsltTransformContextPtr ctxt, | |
xmlDocPtr RVT); | |
XSLTPUBFUN int XSLTCALL | |
xsltRegisterPersistRVT (xsltTransformContextPtr ctxt, | |
xmlDocPtr RVT); | |
XSLTPUBFUN int XSLTCALL | |
xsltExtensionInstructionResultRegister( | |
xsltTransformContextPtr ctxt, | |
xmlXPathObjectPtr obj); | |
XSLTPUBFUN int XSLTCALL | |
xsltExtensionInstructionResultFinalize( | |
xsltTransformContextPtr ctxt); | |
XSLTPUBFUN int XSLTCALL | |
xsltFlagRVTs( | |
xsltTransformContextPtr ctxt, | |
xmlXPathObjectPtr obj, | |
void *val); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeRVTs (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN void XSLTCALL | |
xsltReleaseRVT (xsltTransformContextPtr ctxt, | |
xmlDocPtr RVT); | |
/* | |
* Extra functions for Attribute Value Templates | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltCompileAttr (xsltStylesheetPtr style, | |
xmlAttrPtr attr); | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltEvalAVT (xsltTransformContextPtr ctxt, | |
void *avt, | |
xmlNodePtr node); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeAVTList (void *avt); | |
/* | |
* Extra function for successful xsltCleanupGlobals / xsltInit sequence. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltUninit (void); | |
/************************************************************************ | |
* * | |
* Compile-time functions for *internal* use only * | |
* * | |
************************************************************************/ | |
#ifdef XSLT_REFACTORED | |
XSLTPUBFUN void XSLTCALL | |
xsltParseSequenceConstructor( | |
xsltCompilerCtxtPtr cctxt, | |
xmlNodePtr start); | |
XSLTPUBFUN int XSLTCALL | |
xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt, | |
xmlNodePtr elem); | |
#ifdef XSLT_REFACTORED_XSLT_NSCOMP | |
XSLTPUBFUN int XSLTCALL | |
xsltRestoreDocumentNamespaces( | |
xsltNsMapPtr ns, | |
xmlDocPtr doc); | |
#endif | |
#endif /* XSLT_REFACTORED */ | |
/************************************************************************ | |
* * | |
* Transformation-time functions for *internal* use only * | |
* * | |
************************************************************************/ | |
XSLTPUBFUN int XSLTCALL | |
xsltInitCtxtKey (xsltTransformContextPtr ctxt, | |
xsltDocumentPtr doc, | |
xsltKeyDefPtr keyd); | |
XSLTPUBFUN int XSLTCALL | |
xsltInitAllDocKeys (xsltTransformContextPtr ctxt); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLT_H__ */ | |
/* | |
* Summary: Locale handling | |
* Description: Interfaces for locale handling. Needed for language dependent | |
* sorting. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Nick Wellnhofer | |
*/ | |
#ifndef __XML_XSLTLOCALE_H__ | |
#define __XML_XSLTLOCALE_H__ | |
#include <libxml/xmlstring.h> | |
#include "xsltexports.h" | |
#ifdef XSLT_LOCALE_XLOCALE | |
#include <locale.h> | |
#include <xlocale.h> | |
#ifdef __GLIBC__ | |
/*locale_t is defined only if _GNU_SOURCE is defined*/ | |
typedef __locale_t xsltLocale; | |
#else | |
typedef locale_t xsltLocale; | |
#endif | |
typedef xmlChar xsltLocaleChar; | |
#elif defined(XSLT_LOCALE_WINAPI) | |
#include <windows.h> | |
#include <winnls.h> | |
typedef LCID xsltLocale; | |
typedef wchar_t xsltLocaleChar; | |
#else | |
/* | |
* XSLT_LOCALE_NONE: | |
* Macro indicating that locale are not supported | |
*/ | |
#ifndef XSLT_LOCALE_NONE | |
#define XSLT_LOCALE_NONE | |
#endif | |
typedef void *xsltLocale; | |
typedef xmlChar xsltLocaleChar; | |
#endif | |
XSLTPUBFUN xsltLocale XSLTCALL | |
xsltNewLocale (const xmlChar *langName); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeLocale (xsltLocale locale); | |
XSLTPUBFUN xsltLocaleChar * XSLTCALL | |
xsltStrxfrm (xsltLocale locale, | |
const xmlChar *string); | |
XSLTPUBFUN int XSLTCALL | |
xsltLocaleStrcmp (xsltLocale locale, | |
const xsltLocaleChar *str1, | |
const xsltLocaleChar *str2); | |
XSLTPUBFUN void XSLTCALL | |
xsltFreeLocales (void); | |
#endif /* __XML_XSLTLOCALE_H__ */ |
/* | |
* Summary: set of utilities for the XSLT engine | |
* Description: interfaces for the utilities module of the XSLT engine. | |
* things like message handling, profiling, and other | |
* generally useful routines. | |
* | |
* Copy: See Copyright for the status of this software. | |
* | |
* Author: Daniel Veillard | |
*/ | |
#ifndef __XML_XSLTUTILS_H__ | |
#define __XML_XSLTUTILS_H__ | |
#include <libxslt/xsltconfig.h> | |
#ifdef HAVE_STDARG_H | |
#include <stdarg.h> | |
#endif | |
#include <libxml/xpath.h> | |
#include <libxml/dict.h> | |
#include <libxml/xmlerror.h> | |
#include "xsltexports.h" | |
#include "xsltInternals.h" | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/** | |
* XSLT_TODO: | |
* | |
* Macro to flag unimplemented blocks. | |
*/ | |
#define XSLT_TODO \ | |
xsltGenericError(xsltGenericErrorContext, \ | |
"Unimplemented block at %s:%d\n", \ | |
__FILE__, __LINE__); | |
/** | |
* XSLT_STRANGE: | |
* | |
* Macro to flag that a problem was detected internally. | |
*/ | |
#define XSLT_STRANGE \ | |
xsltGenericError(xsltGenericErrorContext, \ | |
"Internal error at %s:%d\n", \ | |
__FILE__, __LINE__); | |
/** | |
* IS_XSLT_ELEM: | |
* | |
* Checks that the element pertains to XSLT namespace. | |
*/ | |
#define IS_XSLT_ELEM(n) \ | |
(((n) != NULL) && ((n)->type == XML_ELEMENT_NODE) && \ | |
((n)->ns != NULL) && (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) | |
/** | |
* IS_XSLT_NAME: | |
* | |
* Checks the value of an element in XSLT namespace. | |
*/ | |
#define IS_XSLT_NAME(n, val) \ | |
(xmlStrEqual((n)->name, (const xmlChar *) (val))) | |
/** | |
* IS_XSLT_REAL_NODE: | |
* | |
* Check that a node is a 'real' one: document, element, text or attribute. | |
*/ | |
#define IS_XSLT_REAL_NODE(n) \ | |
(((n) != NULL) && \ | |
(((n)->type == XML_ELEMENT_NODE) || \ | |
((n)->type == XML_TEXT_NODE) || \ | |
((n)->type == XML_CDATA_SECTION_NODE) || \ | |
((n)->type == XML_ATTRIBUTE_NODE) || \ | |
((n)->type == XML_DOCUMENT_NODE) || \ | |
((n)->type == XML_HTML_DOCUMENT_NODE) || \ | |
((n)->type == XML_COMMENT_NODE) || \ | |
((n)->type == XML_PI_NODE))) | |
/* | |
* Our own version of namespaced atributes lookup. | |
*/ | |
XSLTPUBFUN xmlChar * XSLTCALL | |
xsltGetNsProp (xmlNodePtr node, | |
const xmlChar *name, | |
const xmlChar *nameSpace); | |
XSLTPUBFUN const xmlChar * XSLTCALL | |
xsltGetCNsProp (xsltStylesheetPtr style, | |
xmlNodePtr node, | |
const xmlChar *name, | |
const xmlChar *nameSpace); | |
XSLTPUBFUN int XSLTCALL | |
xsltGetUTF8Char (const unsigned char *utf, | |
int *len); | |
/* | |
* XSLT Debug Tracing Tracing Types | |
*/ | |
typedef enum { | |
XSLT_TRACE_ALL = -1, | |
XSLT_TRACE_NONE = 0, | |
XSLT_TRACE_COPY_TEXT = 1<<0, | |
XSLT_TRACE_PROCESS_NODE = 1<<1, | |
XSLT_TRACE_APPLY_TEMPLATE = 1<<2, | |
XSLT_TRACE_COPY = 1<<3, | |
XSLT_TRACE_COMMENT = 1<<4, | |
XSLT_TRACE_PI = 1<<5, | |
XSLT_TRACE_COPY_OF = 1<<6, | |
XSLT_TRACE_VALUE_OF = 1<<7, | |
XSLT_TRACE_CALL_TEMPLATE = 1<<8, | |
XSLT_TRACE_APPLY_TEMPLATES = 1<<9, | |
XSLT_TRACE_CHOOSE = 1<<10, | |
XSLT_TRACE_IF = 1<<11, | |
XSLT_TRACE_FOR_EACH = 1<<12, | |
XSLT_TRACE_STRIP_SPACES = 1<<13, | |
XSLT_TRACE_TEMPLATES = 1<<14, | |
XSLT_TRACE_KEYS = 1<<15, | |
XSLT_TRACE_VARIABLES = 1<<16 | |
} xsltDebugTraceCodes; | |
/** | |
* XSLT_TRACE: | |
* | |
* Control the type of xsl debugtrace messages emitted. | |
*/ | |
#define XSLT_TRACE(ctxt,code,call) \ | |
if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \ | |
call | |
XSLTPUBFUN void XSLTCALL | |
xsltDebugSetDefaultTrace(xsltDebugTraceCodes val); | |
XSLTPUBFUN xsltDebugTraceCodes XSLTCALL | |
xsltDebugGetDefaultTrace(void); | |
/* | |
* XSLT specific error and debug reporting functions. | |
*/ | |
XSLTPUBVAR xmlGenericErrorFunc xsltGenericError; | |
XSLTPUBVAR void *xsltGenericErrorContext; | |
XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug; | |
XSLTPUBVAR void *xsltGenericDebugContext; | |
XSLTPUBFUN void XSLTCALL | |
xsltPrintErrorContext (xsltTransformContextPtr ctxt, | |
xsltStylesheetPtr style, | |
xmlNodePtr node); | |
XSLTPUBFUN void XSLTCALL | |
xsltMessage (xsltTransformContextPtr ctxt, | |
xmlNodePtr node, | |
xmlNodePtr inst); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetGenericErrorFunc (void *ctx, | |
xmlGenericErrorFunc handler); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetGenericDebugFunc (void *ctx, | |
xmlGenericErrorFunc handler); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt, | |
void *ctx, | |
xmlGenericErrorFunc handler); | |
XSLTPUBFUN void XSLTCALL | |
xsltTransformError (xsltTransformContextPtr ctxt, | |
xsltStylesheetPtr style, | |
xmlNodePtr node, | |
const char *msg, | |
...) LIBXSLT_ATTR_FORMAT(4,5); | |
XSLTPUBFUN int XSLTCALL | |
xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt, | |
int options); | |
/* | |
* Sorting. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltDocumentSortFunction (xmlNodeSetPtr list); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetSortFunc (xsltSortFunc handler); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, | |
xsltSortFunc handler); | |
XSLTPUBFUN void XSLTCALL | |
xsltDefaultSortFunction (xsltTransformContextPtr ctxt, | |
xmlNodePtr *sorts, | |
int nbsorts); | |
XSLTPUBFUN void XSLTCALL | |
xsltDoSortFunction (xsltTransformContextPtr ctxt, | |
xmlNodePtr * sorts, | |
int nbsorts); | |
XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL | |
xsltComputeSortResult (xsltTransformContextPtr ctxt, | |
xmlNodePtr sort); | |
/* | |
* QNames handling. | |
*/ | |
XSLTPUBFUN const xmlChar * XSLTCALL | |
xsltSplitQName (xmlDictPtr dict, | |
const xmlChar *name, | |
const xmlChar **prefix); | |
XSLTPUBFUN const xmlChar * XSLTCALL | |
xsltGetQNameURI (xmlNodePtr node, | |
xmlChar **name); | |
XSLTPUBFUN const xmlChar * XSLTCALL | |
xsltGetQNameURI2 (xsltStylesheetPtr style, | |
xmlNodePtr node, | |
const xmlChar **name); | |
/* | |
* Output, reuse libxml I/O buffers. | |
*/ | |
XSLTPUBFUN int XSLTCALL | |
xsltSaveResultTo (xmlOutputBufferPtr buf, | |
xmlDocPtr result, | |
xsltStylesheetPtr style); | |
XSLTPUBFUN int XSLTCALL | |
xsltSaveResultToFilename (const char *URI, | |
xmlDocPtr result, | |
xsltStylesheetPtr style, | |
int compression); | |
XSLTPUBFUN int XSLTCALL | |
xsltSaveResultToFile (FILE *file, | |
xmlDocPtr result, | |
xsltStylesheetPtr style); | |
XSLTPUBFUN int XSLTCALL | |
xsltSaveResultToFd (int fd, | |
xmlDocPtr result, | |
xsltStylesheetPtr style); | |
XSLTPUBFUN int XSLTCALL | |
xsltSaveResultToString (xmlChar **doc_txt_ptr, | |
int * doc_txt_len, | |
xmlDocPtr result, | |
xsltStylesheetPtr style); | |
/* | |
* XPath interface | |
*/ | |
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL | |
xsltXPathCompile (xsltStylesheetPtr style, | |
const xmlChar *str); | |
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL | |
xsltXPathCompileFlags (xsltStylesheetPtr style, | |
const xmlChar *str, | |
int flags); | |
/* | |
* Profiling. | |
*/ | |
XSLTPUBFUN void XSLTCALL | |
xsltSaveProfiling (xsltTransformContextPtr ctxt, | |
FILE *output); | |
XSLTPUBFUN xmlDocPtr XSLTCALL | |
xsltGetProfileInformation (xsltTransformContextPtr ctxt); | |
XSLTPUBFUN long XSLTCALL | |
xsltTimestamp (void); | |
XSLTPUBFUN void XSLTCALL | |
xsltCalibrateAdjust (long delta); | |
/** | |
* XSLT_TIMESTAMP_TICS_PER_SEC: | |
* | |
* Sampling precision for profiling | |
*/ | |
#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l | |
/* | |
* Hooks for the debugger. | |
*/ | |
typedef enum { | |
XSLT_DEBUG_NONE = 0, /* no debugging allowed */ | |
XSLT_DEBUG_INIT, | |
XSLT_DEBUG_STEP, | |
XSLT_DEBUG_STEPOUT, | |
XSLT_DEBUG_NEXT, | |
XSLT_DEBUG_STOP, | |
XSLT_DEBUG_CONT, | |
XSLT_DEBUG_RUN, | |
XSLT_DEBUG_RUN_RESTART, | |
XSLT_DEBUG_QUIT | |
} xsltDebugStatusCodes; | |
XSLTPUBVAR int xslDebugStatus; | |
typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node, | |
xsltTemplatePtr templ, xsltTransformContextPtr ctxt); | |
typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source); | |
typedef void (*xsltDropCallCallback) (void); | |
XSLTPUBFUN void XSLTCALL | |
xsltSetDebuggerStatus (int value); | |
XSLTPUBFUN int XSLTCALL | |
xsltGetDebuggerStatus (void); | |
XSLTPUBFUN int XSLTCALL | |
xsltSetDebuggerCallbacks (int no, void *block); | |
XSLTPUBFUN int XSLTCALL | |
xslAddCall (xsltTemplatePtr templ, | |
xmlNodePtr source); | |
XSLTPUBFUN void XSLTCALL | |
xslDropCall (void); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* __XML_XSLTUTILS_H__ */ | |
#ifndef LXML_VERSION_STRING | |
#define LXML_VERSION_STRING "4.4.1" | |
#endif |
from lxml.includes.tree cimport xmlDoc | |
from lxml.includes.xmlerror cimport xmlStructuredErrorFunc | |
cdef extern from "libxml/relaxng.h": | |
ctypedef struct xmlRelaxNG | |
ctypedef struct xmlRelaxNGParserCtxt | |
ctypedef struct xmlRelaxNGValidCtxt | |
ctypedef enum 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 | |
cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) nogil | |
cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) nogil | |
cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) nogil | |
cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) nogil | |
cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) nogil | |
cdef void xmlRelaxNGFree(xmlRelaxNG* schema) nogil | |
cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) nogil | |
cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) nogil | |
cdef void xmlRelaxNGSetValidStructuredErrors( | |
xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil | |
cdef void xmlRelaxNGSetParserStructuredErrors( | |
xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil |
from lxml.includes cimport xmlerror | |
from lxml.includes.tree cimport xmlDoc | |
cdef extern from "libxml/schematron.h": | |
ctypedef struct xmlSchematron | |
ctypedef struct xmlSchematronParserCtxt | |
ctypedef struct xmlSchematronValidCtxt | |
ctypedef enum xmlSchematronValidOptions: | |
XML_SCHEMATRON_OUT_QUIET = 1 # quiet no report | |
XML_SCHEMATRON_OUT_TEXT = 2 # build a textual report | |
XML_SCHEMATRON_OUT_XML = 4 # output SVRL | |
XML_SCHEMATRON_OUT_ERROR = 8 # output via xmlStructuredErrorFunc | |
XML_SCHEMATRON_OUT_FILE = 256 # output to a file descriptor | |
XML_SCHEMATRON_OUT_BUFFER = 512 # output to a buffer | |
XML_SCHEMATRON_OUT_IO = 1024 # output to I/O mechanism | |
cdef xmlSchematronParserCtxt* xmlSchematronNewDocParserCtxt( | |
xmlDoc* doc) nogil | |
cdef xmlSchematronParserCtxt* xmlSchematronNewParserCtxt( | |
char* filename) nogil | |
cdef xmlSchematronValidCtxt* xmlSchematronNewValidCtxt( | |
xmlSchematron* schema, int options) nogil | |
cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) nogil | |
cdef int xmlSchematronValidateDoc(xmlSchematronValidCtxt* ctxt, | |
xmlDoc* instance) nogil | |
cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) nogil | |
cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) nogil | |
cdef void xmlSchematronFree(xmlSchematron* schema) nogil | |
cdef void xmlSchematronSetValidStructuredErrors( | |
xmlSchematronValidCtxt* ctxt, | |
xmlerror.xmlStructuredErrorFunc error_func, void *data) |
from libc cimport stdio | |
from libc.string cimport const_char, const_uchar | |
cdef extern from "lxml-version.h": | |
# deprecated declaration, use etreepublic.pxd instead | |
cdef char* LXML_VERSION_STRING | |
cdef extern from "libxml/xmlversion.h": | |
cdef const_char* xmlParserVersion | |
cdef int LIBXML_VERSION | |
cdef extern from "libxml/xmlstring.h": | |
ctypedef unsigned char xmlChar | |
ctypedef const xmlChar const_xmlChar "const xmlChar" | |
cdef int xmlStrlen(const_xmlChar* str) nogil | |
cdef xmlChar* xmlStrdup(const_xmlChar* cur) nogil | |
cdef int xmlStrncmp(const_xmlChar* str1, const_xmlChar* str2, int length) nogil | |
cdef int xmlStrcmp(const_xmlChar* str1, const_xmlChar* str2) nogil | |
cdef int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) nogil | |
cdef const_xmlChar* xmlStrstr(const_xmlChar* str1, const_xmlChar* str2) nogil | |
cdef const_xmlChar* xmlStrchr(const_xmlChar* str1, xmlChar ch) nogil | |
cdef const_xmlChar* _xcstr "(const xmlChar*)PyBytes_AS_STRING" (object s) | |
cdef extern from "libxml/encoding.h": | |
ctypedef enum xmlCharEncoding: | |
XML_CHAR_ENCODING_ERROR = -1 # No char encoding detected | |
XML_CHAR_ENCODING_NONE = 0 # No char encoding detected | |
XML_CHAR_ENCODING_UTF8 = 1 # UTF-8 | |
XML_CHAR_ENCODING_UTF16LE = 2 # UTF-16 little endian | |
XML_CHAR_ENCODING_UTF16BE = 3 # UTF-16 big endian | |
XML_CHAR_ENCODING_UCS4LE = 4 # UCS-4 little endian | |
XML_CHAR_ENCODING_UCS4BE = 5 # UCS-4 big endian | |
XML_CHAR_ENCODING_EBCDIC = 6 # EBCDIC uh! | |
XML_CHAR_ENCODING_UCS4_2143 = 7 # UCS-4 unusual ordering | |
XML_CHAR_ENCODING_UCS4_3412 = 8 # UCS-4 unusual ordering | |
XML_CHAR_ENCODING_UCS2 = 9 # UCS-2 | |
XML_CHAR_ENCODING_8859_1 = 10 # ISO-8859-1 ISO Latin 1 | |
XML_CHAR_ENCODING_8859_2 = 11 # ISO-8859-2 ISO Latin 2 | |
XML_CHAR_ENCODING_8859_3 = 12 # ISO-8859-3 | |
XML_CHAR_ENCODING_8859_4 = 13 # ISO-8859-4 | |
XML_CHAR_ENCODING_8859_5 = 14 # ISO-8859-5 | |
XML_CHAR_ENCODING_8859_6 = 15 # ISO-8859-6 | |
XML_CHAR_ENCODING_8859_7 = 16 # ISO-8859-7 | |
XML_CHAR_ENCODING_8859_8 = 17 # ISO-8859-8 | |
XML_CHAR_ENCODING_8859_9 = 18 # ISO-8859-9 | |
XML_CHAR_ENCODING_2022_JP = 19 # ISO-2022-JP | |
XML_CHAR_ENCODING_SHIFT_JIS = 20 # Shift_JIS | |
XML_CHAR_ENCODING_EUC_JP = 21 # EUC-JP | |
XML_CHAR_ENCODING_ASCII = 22 # pure ASCII | |
ctypedef struct xmlCharEncodingHandler | |
cdef xmlCharEncodingHandler* xmlFindCharEncodingHandler(char* name) nogil | |
cdef xmlCharEncodingHandler* xmlGetCharEncodingHandler( | |
xmlCharEncoding enc) nogil | |
cdef int xmlCharEncCloseFunc(xmlCharEncodingHandler* handler) nogil | |
cdef xmlCharEncoding xmlDetectCharEncoding(const_xmlChar* text, int len) nogil | |
cdef const_char* xmlGetCharEncodingName(xmlCharEncoding enc) nogil | |
cdef xmlCharEncoding xmlParseCharEncoding(char* name) nogil | |
ctypedef int (*xmlCharEncodingOutputFunc)( | |
unsigned char *out_buf, int *outlen, const_uchar *in_buf, int *inlen) | |
cdef extern from "libxml/chvalid.h": | |
cdef int xmlIsChar_ch(char c) nogil | |
cdef int xmlIsCharQ(int ch) nogil | |
cdef extern from "libxml/hash.h": | |
ctypedef struct xmlHashTable | |
ctypedef void (*xmlHashScanner)(void* payload, void* data, const_xmlChar* name) # may require GIL! | |
void xmlHashScan(xmlHashTable* table, xmlHashScanner f, void* data) nogil | |
void* xmlHashLookup(xmlHashTable* table, const_xmlChar* name) nogil | |
ctypedef void (*xmlHashDeallocator)(void *payload, xmlChar *name) | |
cdef xmlHashTable* xmlHashCreate(int size) | |
cdef xmlHashTable* xmlHashCreateDict(int size, xmlDict *dict) | |
cdef int xmlHashSize(xmlHashTable* table) | |
cdef void xmlHashFree(xmlHashTable* table, xmlHashDeallocator f) | |
cdef extern from *: # actually "libxml/dict.h" | |
# libxml/dict.h appears to be broken to include in C | |
ctypedef struct xmlDict | |
cdef const_xmlChar* xmlDictLookup(xmlDict* dict, const_xmlChar* name, int len) nogil | |
cdef const_xmlChar* xmlDictExists(xmlDict* dict, const_xmlChar* name, int len) nogil | |
cdef int xmlDictOwns(xmlDict* dict, const_xmlChar* name) nogil | |
cdef size_t xmlDictSize(xmlDict* dict) nogil | |
cdef extern from "libxml/tree.h": | |
ctypedef struct xmlDoc | |
ctypedef struct xmlAttr | |
ctypedef struct xmlNotationTable | |
ctypedef enum 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 | |
ctypedef enum 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 | |
ctypedef enum xmlElementContentType: | |
XML_ELEMENT_CONTENT_PCDATA= 1 | |
XML_ELEMENT_CONTENT_ELEMENT= 2 | |
XML_ELEMENT_CONTENT_SEQ= 3 | |
XML_ELEMENT_CONTENT_OR= 4 | |
ctypedef enum xmlElementContentOccur: | |
XML_ELEMENT_CONTENT_ONCE= 1 | |
XML_ELEMENT_CONTENT_OPT= 2 | |
XML_ELEMENT_CONTENT_MULT= 3 | |
XML_ELEMENT_CONTENT_PLUS= 4 | |
ctypedef enum 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 | |
ctypedef enum xmlAttributeDefault: | |
XML_ATTRIBUTE_NONE= 1 | |
XML_ATTRIBUTE_REQUIRED= 2 | |
XML_ATTRIBUTE_IMPLIED= 3 | |
XML_ATTRIBUTE_FIXED= 4 | |
ctypedef enum 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 | |
ctypedef struct xmlNs: | |
const_xmlChar* href | |
const_xmlChar* prefix | |
xmlNs* next | |
ctypedef struct xmlNode: | |
void* _private | |
xmlElementType type | |
const_xmlChar* name | |
xmlNode* children | |
xmlNode* last | |
xmlNode* parent | |
xmlNode* next | |
xmlNode* prev | |
xmlDoc* doc | |
xmlChar* content | |
xmlAttr* properties | |
xmlNs* ns | |
xmlNs* nsDef | |
unsigned short line | |
ctypedef struct xmlElementContent: | |
xmlElementContentType type | |
xmlElementContentOccur ocur | |
const_xmlChar *name | |
xmlElementContent *c1 | |
xmlElementContent *c2 | |
xmlElementContent *parent | |
const_xmlChar *prefix | |
ctypedef struct xmlEnumeration: | |
xmlEnumeration *next | |
const_xmlChar *name | |
ctypedef struct xmlAttribute: | |
void* _private | |
xmlElementType type | |
const_xmlChar* name | |
xmlNode* children | |
xmlNode* last | |
xmlDtd* parent | |
xmlNode* next | |
xmlNode* prev | |
xmlDoc* doc | |
xmlAttribute* nexth | |
xmlAttributeType atype | |
xmlAttributeDefault def_ "def" | |
const_xmlChar* defaultValue | |
xmlEnumeration* tree | |
const_xmlChar* prefix | |
const_xmlChar* elem | |
ctypedef struct xmlElement: | |
void* _private | |
xmlElementType type | |
const_xmlChar* name | |
xmlNode* children | |
xmlNode* last | |
xmlNode* parent | |
xmlNode* next | |
xmlNode* prev | |
xmlDoc* doc | |
xmlElementTypeVal etype | |
xmlElementContent* content | |
xmlAttribute* attributes | |
const_xmlChar* prefix | |
void *contModel | |
ctypedef struct xmlEntity: | |
void* _private | |
xmlElementType type | |
const_xmlChar* name | |
xmlNode* children | |
xmlNode* last | |
xmlDtd* parent | |
xmlNode* next | |
xmlNode* prev | |
xmlDoc* doc | |
xmlChar* orig | |
xmlChar* content | |
int length | |
xmlEntityType etype | |
const_xmlChar* ExternalID | |
const_xmlChar* SystemID | |
xmlEntity* nexte | |
const_xmlChar* URI | |
int owner | |
int checked | |
ctypedef struct xmlDtd: | |
const_xmlChar* name | |
const_xmlChar* ExternalID | |
const_xmlChar* SystemID | |
void* notations | |
void* entities | |
void* pentities | |
void* attributes | |
void* elements | |
xmlNode* children | |
xmlNode* last | |
xmlDoc* doc | |
ctypedef struct xmlDoc: | |
xmlElementType type | |
char* name | |
xmlNode* children | |
xmlNode* last | |
xmlNode* parent | |
xmlNode* next | |
xmlNode* prev | |
xmlDoc* doc | |
xmlDict* dict | |
xmlHashTable* ids | |
int standalone | |
const_xmlChar* version | |
const_xmlChar* encoding | |
const_xmlChar* URL | |
void* _private | |
xmlDtd* intSubset | |
xmlDtd* extSubset | |
ctypedef struct xmlAttr: | |
void* _private | |
xmlElementType type | |
const_xmlChar* name | |
xmlNode* children | |
xmlNode* last | |
xmlNode* parent | |
xmlAttr* next | |
xmlAttr* prev | |
xmlDoc* doc | |
xmlNs* ns | |
xmlAttributeType atype | |
ctypedef struct xmlID: | |
const_xmlChar* value | |
const_xmlChar* name | |
xmlAttr* attr | |
xmlDoc* doc | |
ctypedef struct xmlBuffer | |
ctypedef struct xmlBuf # new in libxml2 2.9 | |
ctypedef struct xmlOutputBuffer: | |
xmlBuf* buffer | |
xmlBuf* conv | |
int error | |
const_xmlChar* XML_XML_NAMESPACE | |
cdef void xmlFreeDoc(xmlDoc* cur) nogil | |
cdef void xmlFreeDtd(xmlDtd* cur) nogil | |
cdef void xmlFreeNode(xmlNode* cur) nogil | |
cdef void xmlFreeNsList(xmlNs* ns) nogil | |
cdef void xmlFreeNs(xmlNs* ns) nogil | |
cdef void xmlFree(void* buf) nogil | |
cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name) nogil | |
cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content) nogil | |
cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content) nogil | |
cdef xmlNode* xmlNewDocPI(xmlDoc* doc, const_xmlChar* name, const_xmlChar* content) nogil | |
cdef xmlNode* xmlNewReference(xmlDoc* doc, const_xmlChar* name) nogil | |
cdef xmlNode* xmlNewCDataBlock(xmlDoc* doc, const_xmlChar* text, int len) nogil | |
cdef xmlNs* xmlNewNs(xmlNode* node, const_xmlChar* href, const_xmlChar* prefix) nogil | |
cdef xmlNode* xmlAddChild(xmlNode* parent, xmlNode* cur) nogil | |
cdef xmlNode* xmlReplaceNode(xmlNode* old, xmlNode* cur) nogil | |
cdef xmlNode* xmlAddPrevSibling(xmlNode* cur, xmlNode* elem) nogil | |
cdef xmlNode* xmlAddNextSibling(xmlNode* cur, xmlNode* elem) nogil | |
cdef xmlNode* xmlNewDocNode(xmlDoc* doc, xmlNs* ns, | |
const_xmlChar* name, const_xmlChar* content) nogil | |
cdef xmlDoc* xmlNewDoc(const_xmlChar* version) nogil | |
cdef xmlAttr* xmlNewProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil | |
cdef xmlAttr* xmlNewNsProp(xmlNode* node, xmlNs* ns, | |
const_xmlChar* name, const_xmlChar* value) nogil | |
cdef xmlChar* xmlGetNoNsProp(xmlNode* node, const_xmlChar* name) nogil | |
cdef xmlChar* xmlGetNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil | |
cdef void xmlSetNs(xmlNode* node, xmlNs* ns) nogil | |
cdef xmlAttr* xmlSetProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil | |
cdef xmlAttr* xmlSetNsProp(xmlNode* node, xmlNs* ns, | |
const_xmlChar* name, const_xmlChar* value) nogil | |
cdef int xmlRemoveID(xmlDoc* doc, xmlAttr* cur) nogil | |
cdef int xmlRemoveProp(xmlAttr* cur) nogil | |
cdef void xmlFreePropList(xmlAttr* cur) nogil | |
cdef xmlChar* xmlGetNodePath(xmlNode* node) nogil | |
cdef void xmlDocDumpMemory(xmlDoc* cur, char** mem, int* size) nogil | |
cdef void xmlDocDumpMemoryEnc(xmlDoc* cur, char** mem, int* size, | |
char* encoding) nogil | |
cdef int xmlSaveFileTo(xmlOutputBuffer* out, xmlDoc* cur, | |
char* encoding) nogil | |
cdef void xmlUnlinkNode(xmlNode* cur) nogil | |
cdef xmlNode* xmlDocSetRootElement(xmlDoc* doc, xmlNode* root) nogil | |
cdef xmlNode* xmlDocGetRootElement(xmlDoc* doc) nogil | |
cdef void xmlSetTreeDoc(xmlNode* tree, xmlDoc* doc) nogil | |
cdef xmlAttr* xmlHasProp(xmlNode* node, const_xmlChar* name) nogil | |
cdef xmlAttr* xmlHasNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil | |
cdef xmlChar* xmlNodeGetContent(xmlNode* cur) nogil | |
cdef int xmlNodeBufGetContent(xmlBuffer* buffer, xmlNode* cur) nogil | |
cdef xmlNs* xmlSearchNs(xmlDoc* doc, xmlNode* node, const_xmlChar* prefix) nogil | |
cdef xmlNs* xmlSearchNsByHref(xmlDoc* doc, xmlNode* node, const_xmlChar* href) nogil | |
cdef int xmlIsBlankNode(xmlNode* node) nogil | |
cdef long xmlGetLineNo(xmlNode* node) nogil | |
cdef void xmlElemDump(stdio.FILE* f, xmlDoc* doc, xmlNode* cur) nogil | |
cdef void xmlNodeDumpOutput(xmlOutputBuffer* buf, | |
xmlDoc* doc, xmlNode* cur, int level, | |
int format, const_char* encoding) nogil | |
cdef void xmlBufAttrSerializeTxtContent(xmlOutputBuffer *buf, xmlDoc *doc, | |
xmlAttr *attr, const_xmlChar *string) nogil | |
cdef void xmlNodeSetName(xmlNode* cur, const_xmlChar* name) nogil | |
cdef void xmlNodeSetContent(xmlNode* cur, const_xmlChar* content) nogil | |
cdef xmlDtd* xmlCopyDtd(xmlDtd* dtd) nogil | |
cdef xmlDoc* xmlCopyDoc(xmlDoc* doc, int recursive) nogil | |
cdef xmlNode* xmlCopyNode(xmlNode* node, int extended) nogil | |
cdef xmlNode* xmlDocCopyNode(xmlNode* node, xmlDoc* doc, int extended) nogil | |
cdef int xmlReconciliateNs(xmlDoc* doc, xmlNode* tree) nogil | |
cdef xmlNs* xmlNewReconciliedNs(xmlDoc* doc, xmlNode* tree, xmlNs* ns) nogil | |
cdef xmlBuffer* xmlBufferCreate() nogil | |
cdef void xmlBufferWriteChar(xmlBuffer* buf, char* string) nogil | |
cdef void xmlBufferFree(xmlBuffer* buf) nogil | |
cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil | |
cdef int xmlBufferLength(xmlBuffer* buf) nogil | |
cdef const_xmlChar* xmlBufContent(xmlBuf* buf) nogil # new in libxml2 2.9 | |
cdef size_t xmlBufUse(xmlBuf* buf) nogil # new in libxml2 2.9 | |
cdef int xmlKeepBlanksDefault(int val) nogil | |
cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil | |
cdef xmlDtd* xmlCreateIntSubset(xmlDoc* doc, const_xmlChar* name, | |
const_xmlChar* ExternalID, const_xmlChar* SystemID) nogil | |
cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil | |
cdef int xmlValidateNCName(const_xmlChar* value, int space) nogil | |
cdef extern from "libxml/uri.h": | |
cdef const_xmlChar* xmlBuildURI(const_xmlChar* href, const_xmlChar* base) nogil | |
cdef extern from "libxml/HTMLtree.h": | |
cdef void htmlNodeDumpFormatOutput(xmlOutputBuffer* buf, | |
xmlDoc* doc, xmlNode* cur, | |
char* encoding, int format) nogil | |
cdef xmlDoc* htmlNewDoc(const_xmlChar* uri, const_xmlChar* externalID) nogil | |
cdef extern from "libxml/valid.h": | |
cdef xmlAttr* xmlGetID(xmlDoc* doc, const_xmlChar* ID) nogil | |
cdef void xmlDumpNotationTable(xmlBuffer* buffer, | |
xmlNotationTable* table) nogil | |
cdef int xmlValidateNameValue(const_xmlChar* value) nogil | |
cdef extern from "libxml/xmlIO.h": | |
cdef int xmlOutputBufferWrite(xmlOutputBuffer* out, | |
int len, const_char* str) nogil | |
cdef int xmlOutputBufferWriteString(xmlOutputBuffer* out, const_char* str) nogil | |
cdef int xmlOutputBufferWriteEscape(xmlOutputBuffer* out, | |
const_xmlChar* str, | |
xmlCharEncodingOutputFunc escapefunc) nogil | |
cdef int xmlOutputBufferFlush(xmlOutputBuffer* out) nogil | |
cdef int xmlOutputBufferClose(xmlOutputBuffer* out) nogil | |
ctypedef int (*xmlInputReadCallback)(void* context, | |
char* buffer, int len) | |
ctypedef int (*xmlInputCloseCallback)(void* context) | |
ctypedef int (*xmlOutputWriteCallback)(void* context, | |
char* buffer, int len) | |
ctypedef int (*xmlOutputCloseCallback)(void* context) | |
cdef xmlOutputBuffer* xmlAllocOutputBuffer( | |
xmlCharEncodingHandler* encoder) nogil | |
cdef xmlOutputBuffer* xmlOutputBufferCreateIO( | |
xmlOutputWriteCallback iowrite, | |
xmlOutputCloseCallback ioclose, | |
void * ioctx, | |
xmlCharEncodingHandler* encoder) nogil | |
cdef xmlOutputBuffer* xmlOutputBufferCreateFile( | |
stdio.FILE* file, xmlCharEncodingHandler* encoder) nogil | |
cdef xmlOutputBuffer* xmlOutputBufferCreateFilename( | |
char* URI, xmlCharEncodingHandler* encoder, int compression) nogil | |
cdef extern from "libxml/xmlsave.h": | |
ctypedef struct xmlSaveCtxt | |
ctypedef enum xmlSaveOption: | |
XML_SAVE_FORMAT = 1 # format save output (2.6.17) | |
XML_SAVE_NO_DECL = 2 # drop the xml declaration (2.6.21) | |
XML_SAVE_NO_EMPTY = 4 # no empty tags (2.6.22) | |
XML_SAVE_NO_XHTML = 8 # disable XHTML1 specific rules (2.6.22) | |
XML_SAVE_XHTML = 16 # force XHTML1 specific rules (2.7.2) | |
XML_SAVE_AS_XML = 32 # force XML serialization on HTML doc (2.7.2) | |
XML_SAVE_AS_HTML = 64 # force HTML serialization on XML doc (2.7.2) | |
cdef xmlSaveCtxt* xmlSaveToFilename(char* filename, char* encoding, | |
int options) nogil | |
cdef xmlSaveCtxt* xmlSaveToBuffer(xmlBuffer* buffer, char* encoding, | |
int options) nogil # libxml2 2.6.23 | |
cdef long xmlSaveDoc(xmlSaveCtxt* ctxt, xmlDoc* doc) nogil | |
cdef long xmlSaveTree(xmlSaveCtxt* ctxt, xmlNode* node) nogil | |
cdef int xmlSaveClose(xmlSaveCtxt* ctxt) nogil | |
cdef int xmlSaveFlush(xmlSaveCtxt* ctxt) nogil | |
cdef int xmlSaveSetAttrEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil | |
cdef int xmlSaveSetEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil | |
cdef extern from "libxml/globals.h": | |
cdef int xmlThrDefKeepBlanksDefaultValue(int onoff) nogil | |
cdef int xmlThrDefLineNumbersDefaultValue(int onoff) nogil | |
cdef int xmlThrDefIndentTreeOutput(int onoff) nogil | |
cdef extern from "libxml/xmlmemory.h" nogil: | |
cdef void* xmlMalloc(size_t size) | |
cdef int xmlMemBlocks() | |
cdef int xmlMemUsed() | |
cdef void xmlMemDisplay(stdio.FILE* file) | |
cdef void xmlMemDisplayLast(stdio.FILE* file, long num_bytes) | |
cdef void xmlMemShow(stdio.FILE* file, int count) | |
cdef extern from "etree_defs.h": | |
cdef bint _isElement(xmlNode* node) nogil | |
cdef bint _isElementOrXInclude(xmlNode* node) nogil | |
cdef const_xmlChar* _getNs(xmlNode* node) nogil | |
cdef void BEGIN_FOR_EACH_ELEMENT_FROM(xmlNode* tree_top, | |
xmlNode* start_node, | |
bint inclusive) nogil | |
cdef void END_FOR_EACH_ELEMENT_FROM(xmlNode* start_node) nogil | |
cdef void BEGIN_FOR_EACH_FROM(xmlNode* tree_top, | |
xmlNode* start_node, | |
bint inclusive) nogil | |
cdef void END_FOR_EACH_FROM(xmlNode* start_node) nogil |
cdef extern from "libxml/uri.h": | |
ctypedef struct xmlURI | |
cdef xmlURI* xmlParseURI(char* str) | |
cdef void xmlFreeURI(xmlURI* uri) |
from lxml.includes.tree cimport xmlDoc, xmlNode | |
cdef extern from "libxml/xinclude.h": | |
ctypedef struct xmlXIncludeCtxt | |
cdef int xmlXIncludeProcess(xmlDoc* doc) nogil | |
cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) nogil | |
cdef int xmlXIncludeProcessTree(xmlNode* doc) nogil | |
cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) nogil | |
# libxml2 >= 2.7.4 | |
cdef int xmlXIncludeProcessTreeFlagsData( | |
xmlNode* doc, int parser_opts, void* data) nogil | |
cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) nogil | |
cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) nogil | |
cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) nogil | |
# libxml2 >= 2.6.27 | |
cdef int xmlXIncludeProcessFlagsData( | |
xmlDoc* doc, int flags, void* data) nogil |
# --- BEGIN: GENERATED CONSTANTS --- | |
# This section is generated by the script 'update-error-constants.py'. | |
cdef extern from "libxml/xmlerror.h": | |
ctypedef enum xmlErrorLevel: | |
XML_ERR_NONE = 0 | |
XML_ERR_WARNING = 1 # A simple warning | |
XML_ERR_ERROR = 2 # A recoverable error | |
XML_ERR_FATAL = 3 # A fatal error | |
ctypedef enum xmlErrorDomain: | |
XML_FROM_NONE = 0 | |
XML_FROM_PARSER = 1 # The XML parser | |
XML_FROM_TREE = 2 # The tree module | |
XML_FROM_NAMESPACE = 3 # The XML Namespace module | |
XML_FROM_DTD = 4 # The XML DTD validation with parser contex | |
XML_FROM_HTML = 5 # The HTML parser | |
XML_FROM_MEMORY = 6 # The memory allocator | |
XML_FROM_OUTPUT = 7 # The serialization code | |
XML_FROM_IO = 8 # The Input/Output stack | |
XML_FROM_FTP = 9 # The FTP module | |
XML_FROM_HTTP = 10 # The HTTP module | |
XML_FROM_XINCLUDE = 11 # The XInclude processing | |
XML_FROM_XPATH = 12 # The XPath module | |
XML_FROM_XPOINTER = 13 # The XPointer module | |
XML_FROM_REGEXP = 14 # The regular expressions module | |
XML_FROM_DATATYPE = 15 # The W3C XML Schemas Datatype module | |
XML_FROM_SCHEMASP = 16 # The W3C XML Schemas parser module | |
XML_FROM_SCHEMASV = 17 # The W3C XML Schemas validation module | |
XML_FROM_RELAXNGP = 18 # The Relax-NG parser module | |
XML_FROM_RELAXNGV = 19 # The Relax-NG validator module | |
XML_FROM_CATALOG = 20 # The Catalog module | |
XML_FROM_C14N = 21 # The Canonicalization module | |
XML_FROM_XSLT = 22 # The XSLT engine from libxslt | |
XML_FROM_VALID = 23 # The XML DTD validation with valid context | |
XML_FROM_CHECK = 24 # The error checking module | |
XML_FROM_WRITER = 25 # The xmlwriter module | |
XML_FROM_MODULE = 26 # The dynamically loaded module modul | |
XML_FROM_I18N = 27 # The module handling character conversion | |
XML_FROM_SCHEMATRONV = 28 # The Schematron validator module | |
XML_FROM_BUFFER = 29 # The buffers module | |
XML_FROM_URI = 30 # The URI module | |
ctypedef enum 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 |
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)
(Sorry about that, but we can’t show files that are this big right now.)