Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .editorconfig +11 -0
- .gitattributes +3 -35
- .gitignore +66 -0
- .gitlab-ci.yml +367 -0
- .gitlab-ci/Dockerfile +56 -0
- .gitlab-ci/Dockerfile.docs +5 -0
- .gitlab-ci/Test-Msvc.ps1 +46 -0
- .gitlab-ci/dist.sh +11 -0
- .gitlab-ci/downstream-lxml.sh +12 -0
- .gitlab-ci/downstream-nokogiri.sh +14 -0
- .gitlab-ci/downstream-perl.sh +16 -0
- .gitlab-ci/downstream-php.sh +26 -0
- .gitlab-ci/downstream-xmlstarlet.sh +17 -0
- .gitlab-ci/install.sh +24 -0
- .gitlab-ci/llvm-symbolizer +9 -0
- .gitlab-ci/setup_mingw.sh +18 -0
- .gitlab-ci/test.sh +8 -0
- .gitlab-ci/test_cmake.sh +23 -0
- .gitlab-ci/test_meson.sh +23 -0
- CMakeLists.txt +747 -0
- Copyright +24 -0
- HTMLparser.c +0 -0
- HTMLtree.c +1314 -0
- MAINTAINERS.md +130 -0
- Makefile.am +241 -0
- NEWS +0 -0
- README.md +182 -0
- README.zOS +212 -0
- SAX2.c +2842 -0
- VERSION +1 -0
- autogen.sh +97 -0
- buf.c +1156 -0
- c14n.c +2171 -0
- catalog.c +0 -0
- chvalid.c +174 -0
- codegen/charset.inc +1223 -0
- codegen/escape.inc +66 -0
- codegen/genCharset.py +379 -0
- codegen/genEscape.py +69 -0
- codegen/genHtml5Ent.py +170 -0
- codegen/genHtml5LibTests.py +93 -0
- codegen/genRanges.py +222 -0
- codegen/genTestApi.py +285 -0
- codegen/genUnicode.py +252 -0
- codegen/html5ent.inc +0 -0
- codegen/ranges.def +361 -0
- codegen/ranges.inc +131 -0
- codegen/rangetab.py +34 -0
- codegen/unicode.inc +1473 -0
- codegen/xmlmod.py +146 -0
.editorconfig
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EditorConfig : http://EditorConfig.org
|
| 2 |
+
|
| 3 |
+
root = true
|
| 4 |
+
|
| 5 |
+
[*]
|
| 6 |
+
indent_style = space
|
| 7 |
+
indent_size = 4
|
| 8 |
+
tab_width = 8
|
| 9 |
+
|
| 10 |
+
[Makefile*]
|
| 11 |
+
indent_style = tab
|
.gitattributes
CHANGED
|
@@ -1,35 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
/result/** -text
|
| 2 |
+
/test/** -text
|
| 3 |
+
fuzz/defaultwhat.profraw filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.exe
|
| 2 |
+
*.o
|
| 3 |
+
*.la
|
| 4 |
+
*.lo
|
| 5 |
+
*.pyc
|
| 6 |
+
|
| 7 |
+
# Executables
|
| 8 |
+
/xmlcatalog
|
| 9 |
+
/xmllint
|
| 10 |
+
|
| 11 |
+
# Test executables
|
| 12 |
+
/runsuite
|
| 13 |
+
/runtest
|
| 14 |
+
/runxmlconf
|
| 15 |
+
/testModule
|
| 16 |
+
/testapi
|
| 17 |
+
/testchar
|
| 18 |
+
/testdict
|
| 19 |
+
/testlimits
|
| 20 |
+
/testparser
|
| 21 |
+
/testrecurse
|
| 22 |
+
|
| 23 |
+
# Tests
|
| 24 |
+
/missing.lst
|
| 25 |
+
/runsuite.log
|
| 26 |
+
/runxmlconf.log
|
| 27 |
+
/test.out
|
| 28 |
+
/xmlconf
|
| 29 |
+
/xstc/Tests
|
| 30 |
+
|
| 31 |
+
# Generated by build system
|
| 32 |
+
/config.h
|
| 33 |
+
/include/libxml/xmlversion.h
|
| 34 |
+
/libxml-2.0.pc
|
| 35 |
+
/libxml2-config.cmake
|
| 36 |
+
/xml2-config
|
| 37 |
+
|
| 38 |
+
# Autotools
|
| 39 |
+
.deps
|
| 40 |
+
.libs
|
| 41 |
+
Makefile
|
| 42 |
+
Makefile.in
|
| 43 |
+
/INSTALL
|
| 44 |
+
/aclocal.m4
|
| 45 |
+
/autom4te.cache
|
| 46 |
+
/compile
|
| 47 |
+
/config.guess
|
| 48 |
+
/config.guess~
|
| 49 |
+
/config.h.in
|
| 50 |
+
/config.h.in~
|
| 51 |
+
/config.log
|
| 52 |
+
/config.status
|
| 53 |
+
/config.sub
|
| 54 |
+
/config.sub~
|
| 55 |
+
/configure
|
| 56 |
+
/configure~
|
| 57 |
+
/depcomp
|
| 58 |
+
/install-sh
|
| 59 |
+
/install-sh~
|
| 60 |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include:
|
| 2 |
+
- component: "gitlab.gnome.org/GNOME/citemplates/release-service@master"
|
| 3 |
+
inputs:
|
| 4 |
+
dist-job-name: "dist"
|
| 5 |
+
tarball-artifact-path: "${TARBALL_ARTIFACT_PATH}"
|
| 6 |
+
|
| 7 |
+
install:
|
| 8 |
+
image: registry.gitlab.gnome.org/gnome/libxml2/docs
|
| 9 |
+
before_script:
|
| 10 |
+
- rm -rf libxml2-build
|
| 11 |
+
- mkdir libxml2-build
|
| 12 |
+
- ln -s /tests/xmlconf .
|
| 13 |
+
script:
|
| 14 |
+
- sh .gitlab-ci/install.sh
|
| 15 |
+
variables:
|
| 16 |
+
CFLAGS: "-O2"
|
| 17 |
+
DOXYGEN_WARN_AS_ERROR: "FAIL_ON_WARNINGS"
|
| 18 |
+
artifacts:
|
| 19 |
+
expire_in: 2 hrs
|
| 20 |
+
paths:
|
| 21 |
+
- install
|
| 22 |
+
|
| 23 |
+
.test:
|
| 24 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 25 |
+
variables:
|
| 26 |
+
BASE_CONFIG: "--with-http --with-schematron --with-zlib --with-python"
|
| 27 |
+
before_script:
|
| 28 |
+
- rm -rf libxml2-build
|
| 29 |
+
- mkdir libxml2-build
|
| 30 |
+
- ln -s /tests/xmlconf .
|
| 31 |
+
script:
|
| 32 |
+
- sh .gitlab-ci/test.sh
|
| 33 |
+
|
| 34 |
+
gcc:
|
| 35 |
+
extends: .test
|
| 36 |
+
variables:
|
| 37 |
+
CFLAGS: "-O2"
|
| 38 |
+
|
| 39 |
+
gcc:c89:
|
| 40 |
+
extends: .test
|
| 41 |
+
variables:
|
| 42 |
+
CONFIG: "--without-python"
|
| 43 |
+
CFLAGS: "-O2 -std=c89 -D_XOPEN_SOURCE=600 -Wno-error=unused-function -Wno-error=overlength-strings"
|
| 44 |
+
|
| 45 |
+
gcc:minimum:
|
| 46 |
+
extends: .test
|
| 47 |
+
variables:
|
| 48 |
+
BASE_CONFIG: "--with-minimum"
|
| 49 |
+
CFLAGS: "-O2"
|
| 50 |
+
|
| 51 |
+
gcc:medium:
|
| 52 |
+
extends: .test
|
| 53 |
+
variables:
|
| 54 |
+
BASE_CONFIG: "--with-minimum"
|
| 55 |
+
CONFIG: "--with-threads --with-tree --with-xpath --with-output --with-html --with-iso8859x --with-valid"
|
| 56 |
+
CFLAGS: "-O2"
|
| 57 |
+
|
| 58 |
+
gcc:legacy:
|
| 59 |
+
extends: .test
|
| 60 |
+
only:
|
| 61 |
+
- schedules
|
| 62 |
+
variables:
|
| 63 |
+
BASE_CONFIG: "--with-legacy --with-python"
|
| 64 |
+
CFLAGS: "-O2"
|
| 65 |
+
|
| 66 |
+
gcc:static:
|
| 67 |
+
extends: .test
|
| 68 |
+
variables:
|
| 69 |
+
CONFIG: "--disable-shared --without-python --without-modules"
|
| 70 |
+
CFLAGS: "-O2"
|
| 71 |
+
|
| 72 |
+
clang:asan:
|
| 73 |
+
extends: .test
|
| 74 |
+
tags:
|
| 75 |
+
- asan
|
| 76 |
+
variables:
|
| 77 |
+
CONFIG: "--without-python"
|
| 78 |
+
CC: clang
|
| 79 |
+
CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined,integer -fno-sanitize-recover=all"
|
| 80 |
+
UBSAN_OPTIONS: "print_stacktrace=1"
|
| 81 |
+
ASAN_SYMBOLIZER_PATH: "$CI_PROJECT_DIR/.gitlab-ci/llvm-symbolizer"
|
| 82 |
+
|
| 83 |
+
clang:msan:
|
| 84 |
+
extends: .test
|
| 85 |
+
# only:
|
| 86 |
+
# - schedules
|
| 87 |
+
variables:
|
| 88 |
+
CONFIG: "--without-python --without-zlib"
|
| 89 |
+
CC: clang
|
| 90 |
+
CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=memory"
|
| 91 |
+
MSAN_SYMBOLIZER_PATH: "$CI_PROJECT_DIR/.gitlab-ci/llvm-symbolizer"
|
| 92 |
+
|
| 93 |
+
.mingw:
|
| 94 |
+
tags:
|
| 95 |
+
- win32-ps
|
| 96 |
+
variables:
|
| 97 |
+
BASE_CONFIG: "--with-http --with-schematron --with-zlib --with-python"
|
| 98 |
+
# Python is disabled for now, see #658
|
| 99 |
+
CONFIG: "--with-docs --without-python"
|
| 100 |
+
CHERE_INVOKING: "yes"
|
| 101 |
+
before_script:
|
| 102 |
+
- $Env:Path="C:\msys64\usr\bin;$Env:Path"
|
| 103 |
+
- bash -lc 'sh .gitlab-ci/setup_mingw.sh autotools'
|
| 104 |
+
script:
|
| 105 |
+
- bash -lc 'sh .gitlab-ci/test.sh'
|
| 106 |
+
cache:
|
| 107 |
+
key: "$MSYSTEM"
|
| 108 |
+
paths:
|
| 109 |
+
- xmlconf/
|
| 110 |
+
|
| 111 |
+
mingw:w64-x86_64:shared:
|
| 112 |
+
extends: .mingw
|
| 113 |
+
variables:
|
| 114 |
+
CFLAGS: "-O2"
|
| 115 |
+
MSYSTEM: MINGW64
|
| 116 |
+
|
| 117 |
+
mingw:w64-i686:shared:
|
| 118 |
+
extends: .mingw
|
| 119 |
+
only:
|
| 120 |
+
- schedules
|
| 121 |
+
variables:
|
| 122 |
+
CFLAGS: "-O2"
|
| 123 |
+
MSYSTEM: MINGW32
|
| 124 |
+
|
| 125 |
+
# Disabled, GCC missing?
|
| 126 |
+
.mingw:msys:shared:
|
| 127 |
+
extends: .mingw
|
| 128 |
+
variables:
|
| 129 |
+
CFLAGS: "-O2"
|
| 130 |
+
MSYSTEM: MSYS
|
| 131 |
+
|
| 132 |
+
.cmake:linux:
|
| 133 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 134 |
+
before_script:
|
| 135 |
+
- rm -rf libxml2-build
|
| 136 |
+
- mkdir libxml2-build
|
| 137 |
+
- ln -s /tests/xmlconf .
|
| 138 |
+
script:
|
| 139 |
+
- sh .gitlab-ci/test_cmake.sh
|
| 140 |
+
artifacts:
|
| 141 |
+
paths:
|
| 142 |
+
- libxml2-$CI_COMMIT_SHORT_SHA-$SUFFIX.tar.gz
|
| 143 |
+
expire_in: 1 day
|
| 144 |
+
|
| 145 |
+
cmake:linux:gcc:shared:
|
| 146 |
+
extends: .cmake:linux
|
| 147 |
+
variables:
|
| 148 |
+
BUILD_SHARED_LIBS: "ON"
|
| 149 |
+
CONFIG: "-DLIBXML2_WITH_DOCS=ON"
|
| 150 |
+
CC: gcc
|
| 151 |
+
SUFFIX: linux-gcc-shared
|
| 152 |
+
|
| 153 |
+
cmake:linux:gcc:static:
|
| 154 |
+
extends: .cmake:linux
|
| 155 |
+
only:
|
| 156 |
+
- schedules
|
| 157 |
+
variables:
|
| 158 |
+
BUILD_SHARED_LIBS: "OFF"
|
| 159 |
+
CC: gcc
|
| 160 |
+
SUFFIX: linux-gcc-static
|
| 161 |
+
|
| 162 |
+
cmake:linux:clang:shared:
|
| 163 |
+
extends: .cmake:linux
|
| 164 |
+
only:
|
| 165 |
+
- schedules
|
| 166 |
+
variables:
|
| 167 |
+
BUILD_SHARED_LIBS: "ON"
|
| 168 |
+
CC: clang
|
| 169 |
+
SUFFIX: linux-clang-shared
|
| 170 |
+
|
| 171 |
+
cmake:linux:clang:static:
|
| 172 |
+
extends: .cmake:linux
|
| 173 |
+
only:
|
| 174 |
+
- schedules
|
| 175 |
+
variables:
|
| 176 |
+
BUILD_SHARED_LIBS: "OFF"
|
| 177 |
+
CC: clang
|
| 178 |
+
SUFFIX: linux-clang-static
|
| 179 |
+
|
| 180 |
+
.cmake:mingw:
|
| 181 |
+
tags:
|
| 182 |
+
- win32-ps
|
| 183 |
+
variables:
|
| 184 |
+
CHERE_INVOKING: "yes"
|
| 185 |
+
before_script:
|
| 186 |
+
- $Env:Path="C:\msys64\usr\bin;$Env:Path"
|
| 187 |
+
- bash -lc 'sh .gitlab-ci/setup_mingw.sh cmake ninja'
|
| 188 |
+
script:
|
| 189 |
+
- bash -lc 'sh .gitlab-ci/test_cmake.sh -G Ninja'
|
| 190 |
+
cache:
|
| 191 |
+
key: "$MSYSTEM"
|
| 192 |
+
paths:
|
| 193 |
+
- xmlconf/
|
| 194 |
+
artifacts:
|
| 195 |
+
paths:
|
| 196 |
+
- libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:SUFFIX.tar.gz
|
| 197 |
+
expire_in: 1 day
|
| 198 |
+
|
| 199 |
+
cmake:mingw:w64-i686:shared:
|
| 200 |
+
extends: .cmake:mingw
|
| 201 |
+
only:
|
| 202 |
+
- schedules
|
| 203 |
+
variables:
|
| 204 |
+
BUILD_SHARED_LIBS: "ON"
|
| 205 |
+
CONFIG: "-DLIBXML2_WITH_DOCS=ON"
|
| 206 |
+
MSYSTEM: MINGW32
|
| 207 |
+
SUFFIX: mingw-w64-i686-shared
|
| 208 |
+
|
| 209 |
+
cmake:mingw:w64-i686:static:
|
| 210 |
+
extends: .cmake:mingw
|
| 211 |
+
# only:
|
| 212 |
+
# - schedules
|
| 213 |
+
variables:
|
| 214 |
+
BUILD_SHARED_LIBS: "OFF"
|
| 215 |
+
MSYSTEM: MINGW32
|
| 216 |
+
SUFFIX: mingw-w64-i686-static
|
| 217 |
+
|
| 218 |
+
cmake:mingw:w64-x86_64:shared:
|
| 219 |
+
extends: .cmake:mingw
|
| 220 |
+
# only:
|
| 221 |
+
# - schedules
|
| 222 |
+
variables:
|
| 223 |
+
BUILD_SHARED_LIBS: "ON"
|
| 224 |
+
MSYSTEM: MINGW64
|
| 225 |
+
SUFFIX: mingw-w64-x86_64-shared
|
| 226 |
+
|
| 227 |
+
cmake:mingw:w64-x86_64:static:
|
| 228 |
+
extends: .cmake:mingw
|
| 229 |
+
only:
|
| 230 |
+
- schedules
|
| 231 |
+
variables:
|
| 232 |
+
BUILD_SHARED_LIBS: "OFF"
|
| 233 |
+
MSYSTEM: MINGW64
|
| 234 |
+
SUFFIX: mingw-w64-x86_64-static
|
| 235 |
+
|
| 236 |
+
.cmake:msvc:
|
| 237 |
+
tags:
|
| 238 |
+
- win32-ps
|
| 239 |
+
variables:
|
| 240 |
+
# MSVC warns when casting `const char **` to `void *` which is wrong.
|
| 241 |
+
# Disable warning C4090.
|
| 242 |
+
CFLAGS: /WX /wd4090
|
| 243 |
+
CMAKE_VERSION: 3.19.4
|
| 244 |
+
script:
|
| 245 |
+
- .gitlab-ci/Test-Msvc
|
| 246 |
+
cache:
|
| 247 |
+
key: "msvc"
|
| 248 |
+
paths:
|
| 249 |
+
- cmake-$Env:CMAKE_VERSION-win64-x64/
|
| 250 |
+
- xmlconf/
|
| 251 |
+
- 7za.exe
|
| 252 |
+
artifacts:
|
| 253 |
+
paths:
|
| 254 |
+
- libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:CMAKE_GENERATOR_TOOLSET-$Env:CMAKE_GENERATOR_PLATFORM-$Env:SUFFIX.7z
|
| 255 |
+
expire_in: 1 day
|
| 256 |
+
|
| 257 |
+
.cmake:msvc:v141:
|
| 258 |
+
extends: .cmake:msvc
|
| 259 |
+
variables:
|
| 260 |
+
CMAKE_GENERATOR: Visual Studio 15 2017
|
| 261 |
+
CMAKE_GENERATOR_TOOLSET: v141
|
| 262 |
+
|
| 263 |
+
.cmake:msvc:v141:x64:
|
| 264 |
+
extends: .cmake:msvc:v141
|
| 265 |
+
variables:
|
| 266 |
+
CMAKE_GENERATOR_PLATFORM: x64
|
| 267 |
+
|
| 268 |
+
cmake:msvc:v141:x64:shared:
|
| 269 |
+
extends: .cmake:msvc:v141:x64
|
| 270 |
+
variables:
|
| 271 |
+
BUILD_SHARED_LIBS: "ON"
|
| 272 |
+
SUFFIX: shared
|
| 273 |
+
|
| 274 |
+
cmake:msvc:v141:x64:static:
|
| 275 |
+
extends: .cmake:msvc:v141:x64
|
| 276 |
+
only:
|
| 277 |
+
- schedules
|
| 278 |
+
variables:
|
| 279 |
+
BUILD_SHARED_LIBS: "OFF"
|
| 280 |
+
SUFFIX: static
|
| 281 |
+
|
| 282 |
+
.cmake:msvc:v141:x86:
|
| 283 |
+
extends: .cmake:msvc:v141
|
| 284 |
+
only:
|
| 285 |
+
- schedules
|
| 286 |
+
variables:
|
| 287 |
+
CMAKE_GENERATOR_PLATFORM: Win32
|
| 288 |
+
|
| 289 |
+
cmake:msvc:v141:x86:shared:
|
| 290 |
+
extends: .cmake:msvc:v141:x86
|
| 291 |
+
only:
|
| 292 |
+
- schedules
|
| 293 |
+
variables:
|
| 294 |
+
BUILD_SHARED_LIBS: "ON"
|
| 295 |
+
SUFFIX: shared
|
| 296 |
+
|
| 297 |
+
cmake:msvc:v141:x86:static:
|
| 298 |
+
extends: .cmake:msvc:v141:x86
|
| 299 |
+
variables:
|
| 300 |
+
BUILD_SHARED_LIBS: "OFF"
|
| 301 |
+
SUFFIX: static
|
| 302 |
+
|
| 303 |
+
meson:
|
| 304 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 305 |
+
before_script:
|
| 306 |
+
- ln -s /tests/xmlconf .
|
| 307 |
+
script:
|
| 308 |
+
- sh .gitlab-ci/test_meson.sh
|
| 309 |
+
|
| 310 |
+
cmake:linux:gcc:shared:
|
| 311 |
+
extends: .cmake:linux
|
| 312 |
+
variables:
|
| 313 |
+
BUILD_SHARED_LIBS: "ON"
|
| 314 |
+
CC: gcc
|
| 315 |
+
SUFFIX: linux-gcc-shared
|
| 316 |
+
|
| 317 |
+
dist:
|
| 318 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 319 |
+
script:
|
| 320 |
+
- sh .gitlab-ci/dist.sh
|
| 321 |
+
- echo "TARBALL_ARTIFACT_PATH=$(ls libxml2-dist/*.tar.xz)" >> build.env
|
| 322 |
+
artifacts:
|
| 323 |
+
paths:
|
| 324 |
+
- libxml2-dist/*.tar.xz
|
| 325 |
+
reports:
|
| 326 |
+
dotenv: build.env
|
| 327 |
+
|
| 328 |
+
pages:
|
| 329 |
+
needs: [install]
|
| 330 |
+
script:
|
| 331 |
+
- cp -r install/share/doc/libxml2 public
|
| 332 |
+
- cp doc/_redirects public
|
| 333 |
+
artifacts:
|
| 334 |
+
paths:
|
| 335 |
+
- public
|
| 336 |
+
only:
|
| 337 |
+
- master@GNOME/libxml2
|
| 338 |
+
|
| 339 |
+
downstream-lxml:
|
| 340 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 341 |
+
needs: [install]
|
| 342 |
+
script:
|
| 343 |
+
- sh .gitlab-ci/downstream-lxml.sh
|
| 344 |
+
|
| 345 |
+
downstream-nokogiri:
|
| 346 |
+
# owner: @flavorjones
|
| 347 |
+
image: ghcr.io/sparklemotion/nokogiri-test:upstream-libxml
|
| 348 |
+
script:
|
| 349 |
+
- .gitlab-ci/downstream-nokogiri.sh
|
| 350 |
+
|
| 351 |
+
downstream-perl:
|
| 352 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 353 |
+
needs: [install]
|
| 354 |
+
script:
|
| 355 |
+
- sh .gitlab-ci/downstream-perl.sh
|
| 356 |
+
|
| 357 |
+
downstream-php:
|
| 358 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 359 |
+
needs: [install]
|
| 360 |
+
script:
|
| 361 |
+
- sh .gitlab-ci/downstream-php.sh
|
| 362 |
+
|
| 363 |
+
downstream-xmlstarlet:
|
| 364 |
+
image: registry.gitlab.gnome.org/gnome/libxml2
|
| 365 |
+
needs: [install]
|
| 366 |
+
script:
|
| 367 |
+
- sh .gitlab-ci/downstream-xmlstarlet.sh
|
.gitlab-ci/Dockerfile
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The image is also used for libxslt.
|
| 2 |
+
#
|
| 3 |
+
# package required for
|
| 4 |
+
# ------------------------------------------------------------
|
| 5 |
+
# libclang-rt-dev sanitizer runtimes
|
| 6 |
+
# llvm llvm-symbolizer (for sanitizer backtraces)
|
| 7 |
+
# git libxslt, downstream projects
|
| 8 |
+
# libgcrypt-dev libxslt
|
| 9 |
+
# xz-utils make dist
|
| 10 |
+
# doxygen documentation
|
| 11 |
+
# xsltproc documentation
|
| 12 |
+
# docbook-xsl documentation
|
| 13 |
+
|
| 14 |
+
FROM ubuntu:24.04
|
| 15 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 16 |
+
RUN apt-get update && \
|
| 17 |
+
apt-get upgrade -y && \
|
| 18 |
+
apt-get install -y --no-install-recommends \
|
| 19 |
+
curl git ca-certificates \
|
| 20 |
+
autoconf automake libtool pkg-config \
|
| 21 |
+
make gcc clang llvm libclang-rt-dev \
|
| 22 |
+
zlib1g-dev libgcrypt-dev \
|
| 23 |
+
python3-dev \
|
| 24 |
+
cmake meson \
|
| 25 |
+
xz-utils \
|
| 26 |
+
doxygen xsltproc docbook-xsl
|
| 27 |
+
WORKDIR /tests
|
| 28 |
+
RUN curl https://www.w3.org/XML/Test/xmlts20080827.tar.gz |tar xz
|
| 29 |
+
|
| 30 |
+
# XML::LibXML uses Alien::Libxml2 which has a huge dependency chain.
|
| 31 |
+
# We try to install most dependencies with apt. We also require
|
| 32 |
+
# libxml2-dev to stop Alien::Libxml2 from downloading and building
|
| 33 |
+
# libxml2 on its own.
|
| 34 |
+
RUN apt-get install -y --no-install-recommends \
|
| 35 |
+
libperl-dev libxml2-dev cpanminus \
|
| 36 |
+
libalien-build-perl \
|
| 37 |
+
libio-socket-ssl-perl \
|
| 38 |
+
libsort-versions-perl \
|
| 39 |
+
liburi-perl \
|
| 40 |
+
libxml-namespacesupport-perl \
|
| 41 |
+
libxml-sax-perl \
|
| 42 |
+
libyaml-perl
|
| 43 |
+
RUN cpanm -n Alien::Libxml2
|
| 44 |
+
RUN apt-get remove -y libxml2-dev
|
| 45 |
+
|
| 46 |
+
# PHP
|
| 47 |
+
RUN apt-get install -y --no-install-recommends \
|
| 48 |
+
bison re2c libsqlite3-dev
|
| 49 |
+
|
| 50 |
+
# lxml
|
| 51 |
+
RUN apt-get install -y --no-install-recommends \
|
| 52 |
+
cython3
|
| 53 |
+
|
| 54 |
+
# xmlstarlet
|
| 55 |
+
RUN apt-get install -y --no-install-recommends \
|
| 56 |
+
docbook-xsl-ns
|
.gitlab-ci/Dockerfile.docs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Image used to generate documentation with a recent version of Doxygen.
|
| 2 |
+
# 1.14.0 fixes an important bug.
|
| 3 |
+
|
| 4 |
+
FROM archlinux:base-devel
|
| 5 |
+
RUN pacman -Syu --noconfirm doxygen libxslt docbook-xsl git
|
.gitlab-ci/Test-Msvc.ps1
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
| 2 |
+
|
| 3 |
+
if (-not (Test-Path 7za.exe)) {
|
| 4 |
+
Invoke-WebRequest `
|
| 5 |
+
-Uri https://www.7-zip.org/a/7z1900-extra.7z `
|
| 6 |
+
-OutFile 7z1900-extra.7z
|
| 7 |
+
cmake -E tar xf 7z1900-extra.7z 7za.exe
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
if (-not (Test-Path xmlconf)) {
|
| 11 |
+
Invoke-WebRequest `
|
| 12 |
+
-Uri https://www.w3.org/XML/Test/xmlts20080827.tar.gz `
|
| 13 |
+
-OutFile xmlts20080827.tar.gz ;
|
| 14 |
+
.\7za.exe x xmlts20080827.tar.gz
|
| 15 |
+
.\7za.exe x xmlts20080827.tar
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
cmake `
|
| 19 |
+
-G "Visual Studio 16 2019" `
|
| 20 |
+
-DBUILD_SHARED_LIBS="$Env:BUILD_SHARED_LIBS" `
|
| 21 |
+
-DCMAKE_INSTALL_PREFIX=libxml2-install `
|
| 22 |
+
-DLIBXML2_WITH_SCHEMATRON=ON `
|
| 23 |
+
-DLIBXML2_WITH_ICONV=OFF `
|
| 24 |
+
-DLIBXML2_WITH_PYTHON=OFF `
|
| 25 |
+
-DLIBXML2_WITH_ZLIB=OFF `
|
| 26 |
+
-S . -B libxml2-build
|
| 27 |
+
if ($LastExitCode -ne 0) {
|
| 28 |
+
throw "cmake failed"
|
| 29 |
+
}
|
| 30 |
+
cmake --build libxml2-build --config Debug --target install
|
| 31 |
+
cmake --build libxml2-build --config Release --target install
|
| 32 |
+
New-Item -ItemType Directory libxml2-install\share\libxml2
|
| 33 |
+
Copy-Item Copyright libxml2-install\share\libxml2
|
| 34 |
+
|
| 35 |
+
cd libxml2-build
|
| 36 |
+
ctest -C Debug -VV
|
| 37 |
+
if ($LastExitCode -ne 0) {
|
| 38 |
+
throw "ctest failed"
|
| 39 |
+
}
|
| 40 |
+
ctest -C Release -VV
|
| 41 |
+
if ($LastExitCode -ne 0) {
|
| 42 |
+
throw "ctest failed"
|
| 43 |
+
}
|
| 44 |
+
cd ..
|
| 45 |
+
|
| 46 |
+
.\7za.exe a libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:CMAKE_GENERATOR_TOOLSET-$Env:CMAKE_GENERATOR_PLATFORM-$Env:SUFFIX.7z .\libxml2-install\*
|
.gitlab-ci/dist.sh
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
mkdir -p libxml2-dist
|
| 6 |
+
cd libxml2-dist
|
| 7 |
+
sh ../autogen.sh
|
| 8 |
+
make distcheck V=1 DISTCHECK_CONFIGURE_FLAGS='--with-docs --with-legacy'
|
| 9 |
+
if [ -z "$CI_COMMIT_TAG" ]; then
|
| 10 |
+
mv libxml2-*.tar.xz libxml2-git-$CI_COMMIT_SHORT_SHA.tar.xz
|
| 11 |
+
fi
|
.gitlab-ci/downstream-lxml.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
srcdir=$(pwd)
|
| 6 |
+
installdir="$srcdir/install"
|
| 7 |
+
export PKG_CONFIG_PATH="$installdir/lib/pkgconfig"
|
| 8 |
+
|
| 9 |
+
git clone --depth 1 https://github.com/lxml/lxml.git
|
| 10 |
+
cd lxml
|
| 11 |
+
make
|
| 12 |
+
LD_LIBRARY_PATH="$installdir/lib" make TESTFLAGS='' test
|
.gitlab-ci/downstream-nokogiri.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
export LIBXML_DIR=$(pwd)
|
| 6 |
+
export MAKEFLAGS=-j$(nproc)
|
| 7 |
+
export NOCONFIGURE=1
|
| 8 |
+
./autogen.sh
|
| 9 |
+
|
| 10 |
+
git clone https://github.com/sparklemotion/nokogiri
|
| 11 |
+
cd nokogiri
|
| 12 |
+
bundle install
|
| 13 |
+
bundle exec rake compile -- --with-xml2-source-dir=${LIBXML_DIR}
|
| 14 |
+
bundle exec rake test
|
.gitlab-ci/downstream-perl.sh
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
srcdir=$(pwd)
|
| 6 |
+
installdir="$srcdir/install"
|
| 7 |
+
incdir="$installdir/include/libxml2"
|
| 8 |
+
libdir="$installdir/lib"
|
| 9 |
+
|
| 10 |
+
git clone --depth 1 -b test-suite-libxml2 \
|
| 11 |
+
https://github.com/nwellnhof/perl-XML-LibXML.git
|
| 12 |
+
cd perl-XML-LibXML
|
| 13 |
+
|
| 14 |
+
perl Makefile.PL INC="-I$incdir" LIBS="-L$libdir -lxml2"
|
| 15 |
+
make
|
| 16 |
+
make test
|
.gitlab-ci/downstream-php.sh
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
srcdir=$(pwd)
|
| 6 |
+
installdir="$srcdir/install"
|
| 7 |
+
export PKG_CONFIG_PATH="$installdir/lib/pkgconfig"
|
| 8 |
+
|
| 9 |
+
git clone --depth 1 https://github.com/php/php-src.git
|
| 10 |
+
cd php-src
|
| 11 |
+
./buildconf
|
| 12 |
+
./configure --with-xsl --enable-soap --enable-debug
|
| 13 |
+
make -j$(nproc)
|
| 14 |
+
make TESTS=" \
|
| 15 |
+
-g FAIL \
|
| 16 |
+
--show-diff \
|
| 17 |
+
--no-progress \
|
| 18 |
+
ext/dom \
|
| 19 |
+
ext/libxml \
|
| 20 |
+
ext/simplexml \
|
| 21 |
+
ext/soap \
|
| 22 |
+
ext/xml \
|
| 23 |
+
ext/xmlreader \
|
| 24 |
+
ext/xmlwriter \
|
| 25 |
+
ext/xsl \
|
| 26 |
+
" test
|
.gitlab-ci/downstream-xmlstarlet.sh
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
srcdir=$(pwd)
|
| 6 |
+
installdir="$srcdir/install"
|
| 7 |
+
# xmlstarlet uses xml2-config
|
| 8 |
+
export PATH="$installdir/bin:$PATH"
|
| 9 |
+
|
| 10 |
+
# We can't use --depth 1 because configure calls git-describe
|
| 11 |
+
# which needs the branch history.
|
| 12 |
+
git clone --single-branch https://github.com/nwellnhof/xmlstar.git
|
| 13 |
+
cd xmlstar
|
| 14 |
+
autoreconf -sif
|
| 15 |
+
./configure
|
| 16 |
+
make
|
| 17 |
+
LD_LIBRARY_PATH="$installdir/lib" make check
|
.gitlab-ci/install.sh
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
srcdir=$(pwd)
|
| 6 |
+
|
| 7 |
+
mkdir -p install
|
| 8 |
+
installdir="$srcdir/install"
|
| 9 |
+
export PKG_CONFIG_PATH="$installdir/lib/pkgconfig"
|
| 10 |
+
|
| 11 |
+
sh autogen.sh "--prefix=$installdir" --with-docs --with-schematron --with-zlib
|
| 12 |
+
make -j$(nproc)
|
| 13 |
+
make install
|
| 14 |
+
|
| 15 |
+
# Make system XML catalog available
|
| 16 |
+
ln -s /etc install/etc
|
| 17 |
+
|
| 18 |
+
git clone --depth 1 https://gitlab.gnome.org/GNOME/libxslt.git
|
| 19 |
+
cd libxslt
|
| 20 |
+
sh autogen.sh \
|
| 21 |
+
"--prefix=$installdir" \
|
| 22 |
+
--without-python
|
| 23 |
+
make -j$(nproc)
|
| 24 |
+
make install
|
.gitlab-ci/llvm-symbolizer
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Newer versions of llvm-symbolizer require libxml2 themselves. Running
|
| 4 |
+
# a test program with LD_LIBRARY_PATH set to .libs makes llvm-symbolizer
|
| 5 |
+
# pick up the tested development version of libxml2 which breaks
|
| 6 |
+
# completely if the build is instrumented with ASan. This wrapper script
|
| 7 |
+
# invokes llvm-symbolizer with an empty LD_LIBRARY_PATH.
|
| 8 |
+
|
| 9 |
+
LD_LIBRARY_PATH='' llvm-symbolizer "$@"
|
.gitlab-ci/setup_mingw.sh
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
pacman --noconfirm -Syu
|
| 4 |
+
|
| 5 |
+
prefix=
|
| 6 |
+
if [ -n "$MINGW_PACKAGE_PREFIX" ]; then
|
| 7 |
+
prefix="${MINGW_PACKAGE_PREFIX}-"
|
| 8 |
+
fi
|
| 9 |
+
for module in docbook-xsl doxygen libiconv python xsltproc xz zlib "$@"; do
|
| 10 |
+
pacman --noconfirm -S --needed ${prefix}$module
|
| 11 |
+
done
|
| 12 |
+
|
| 13 |
+
mkdir -p libxml2-build
|
| 14 |
+
|
| 15 |
+
if [ ! -e xmlconf ]; then
|
| 16 |
+
wget https://www.w3.org/XML/Test/xmlts20080827.tar -O - |
|
| 17 |
+
tar -x
|
| 18 |
+
fi
|
.gitlab-ci/test.sh
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
cd libxml2-build
|
| 6 |
+
sh ../autogen.sh $BASE_CONFIG $CONFIG || cat config.log
|
| 7 |
+
make -j$(nproc) V=1 CFLAGS="$CFLAGS -Werror"
|
| 8 |
+
make CFLAGS="$CFLAGS -Werror" check
|
.gitlab-ci/test_cmake.sh
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
CFLAGS="-Werror $CFLAGS" \
|
| 6 |
+
cmake "$@" \
|
| 7 |
+
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
|
| 8 |
+
-DCMAKE_INSTALL_PREFIX=libxml2-install \
|
| 9 |
+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
| 10 |
+
-DLIBXML2_WITH_HTTP=ON \
|
| 11 |
+
-DLIBXML2_WITH_SCHEMATRON=ON \
|
| 12 |
+
-DLIBXML2_WITH_ZLIB=ON \
|
| 13 |
+
-DLIBXML2_WITH_PYTHON=ON \
|
| 14 |
+
$CONFIG \
|
| 15 |
+
-S . -B libxml2-build
|
| 16 |
+
cmake --build libxml2-build --target install
|
| 17 |
+
|
| 18 |
+
(cd libxml2-build && ctest -VV)
|
| 19 |
+
|
| 20 |
+
mkdir -p libxml2-install/share/libxml2
|
| 21 |
+
cp Copyright libxml2-install/share/libxml2
|
| 22 |
+
(cd libxml2-install &&
|
| 23 |
+
tar -czf ../libxml2-$CI_COMMIT_SHORT_SHA-$SUFFIX.tar.gz *)
|
.gitlab-ci/test_meson.sh
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
# compile with the following warnings:
|
| 6 |
+
# --warnlevel 3 : passes to the compiler -Wall -Wextra -Wpedantic
|
| 7 |
+
# --werror : passes to the compiler -Werror
|
| 8 |
+
# --default-library : can be 'shared', 'static' or 'both'
|
| 9 |
+
meson setup \
|
| 10 |
+
--warnlevel 3 \
|
| 11 |
+
--werror \
|
| 12 |
+
--buildtype=debugoptimized \
|
| 13 |
+
--default-library shared \
|
| 14 |
+
-Ddocs=enabled \
|
| 15 |
+
-Dhttp=enabled \
|
| 16 |
+
-Dschematron=enabled \
|
| 17 |
+
-Dzlib=enabled \
|
| 18 |
+
-Dpython=enabled \
|
| 19 |
+
builddir
|
| 20 |
+
|
| 21 |
+
ninja -C builddir
|
| 22 |
+
|
| 23 |
+
meson test --verbose -C builddir
|
CMakeLists.txt
ADDED
|
@@ -0,0 +1,747 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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KE_MATCH_1})
|
| 7 |
+
set(LIBXML_MINOR_VERSION ${CMAKE_MATCH_2})
|
| 8 |
+
set(LIBXML_MICRO_VERSION ${CMAKE_MATCH_3})
|
| 9 |
+
endif()
|
| 10 |
+
|
| 11 |
+
project(libxml2 VERSION ${VERSION} LANGUAGES C)
|
| 12 |
+
|
| 13 |
+
set(CMAKE_C_STANDARD 11)
|
| 14 |
+
|
| 15 |
+
include(CheckCSourceCompiles)
|
| 16 |
+
include(CheckFunctionExists)
|
| 17 |
+
include(CheckIncludeFiles)
|
| 18 |
+
include(CheckLibraryExists)
|
| 19 |
+
include(CheckStructHasMember)
|
| 20 |
+
include(CheckSymbolExists)
|
| 21 |
+
include(CMakeDependentOption)
|
| 22 |
+
include(CMakePackageConfigHelpers)
|
| 23 |
+
include(CMakePushCheckState)
|
| 24 |
+
include(FindPkgConfig)
|
| 25 |
+
include(GNUInstallDirs)
|
| 26 |
+
|
| 27 |
+
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
| 28 |
+
option(LIBXML2_WITH_CATALOG "Add the Catalog support" ON)
|
| 29 |
+
option(LIBXML2_WITH_DEBUG "Add the debugging module" ON)
|
| 30 |
+
option(LIBXML2_WITH_DOCS "Build documentation" OFF)
|
| 31 |
+
option(LIBXML2_WITH_HTML "Add the HTML support" ON)
|
| 32 |
+
option(LIBXML2_WITH_HTTP "ABI compatibility for removed HTTP support" OFF)
|
| 33 |
+
option(LIBXML2_WITH_ICONV "Add ICONV support" ON)
|
| 34 |
+
option(LIBXML2_WITH_ICU "Add ICU support" OFF)
|
| 35 |
+
option(LIBXML2_WITH_ISO8859X "Add ISO8859X support if no iconv" ON)
|
| 36 |
+
option(LIBXML2_WITH_LEGACY "Add deprecated APIs for compatibility" OFF)
|
| 37 |
+
option(LIBXML2_WITH_MODULES "Add the dynamic modules support" ON)
|
| 38 |
+
option(LIBXML2_WITH_OUTPUT "Add the serialization support" ON)
|
| 39 |
+
option(LIBXML2_WITH_PATTERN "Add the xmlPattern selection interface" ON)
|
| 40 |
+
option(LIBXML2_WITH_PROGRAMS "Build programs" ON)
|
| 41 |
+
option(LIBXML2_WITH_PUSH "Add the PUSH parser interfaces" ON)
|
| 42 |
+
option(LIBXML2_WITH_PYTHON "Build Python bindings" OFF)
|
| 43 |
+
option(LIBXML2_WITH_READLINE "readline support for xmllint shell" OFF)
|
| 44 |
+
option(LIBXML2_WITH_REGEXPS "Add Regular Expressions support" ON)
|
| 45 |
+
option(LIBXML2_WITH_SAX1 "Add the older SAX1 interface" ON)
|
| 46 |
+
option(LIBXML2_WITH_TESTS "Build tests" ON)
|
| 47 |
+
option(LIBXML2_WITH_THREADS "Add multithread support" ON)
|
| 48 |
+
option(LIBXML2_WITH_TLS "Enable thread-local storage" OFF)
|
| 49 |
+
option(LIBXML2_WITH_VALID "Add the DTD validation support" ON)
|
| 50 |
+
option(LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON)
|
| 51 |
+
option(LIBXML2_WITH_XPATH "Add the XPATH support" ON)
|
| 52 |
+
|
| 53 |
+
cmake_dependent_option(
|
| 54 |
+
LIBXML2_WITH_ZLIB "Use libz" OFF
|
| 55 |
+
"NOT LIBXML2_WITH_LEGACY" ON)
|
| 56 |
+
|
| 57 |
+
cmake_dependent_option(
|
| 58 |
+
LIBXML2_WITH_C14N "Add the Canonicalization support" ON
|
| 59 |
+
"LIBXML2_WITH_OUTPUT;LIBXML2_WITH_XPATH" OFF)
|
| 60 |
+
cmake_dependent_option(
|
| 61 |
+
LIBXML2_WITH_HISTORY "history support for xmllint shell" OFF
|
| 62 |
+
"LIBXML2_WITH_READLINE" OFF)
|
| 63 |
+
cmake_dependent_option(
|
| 64 |
+
LIBXML2_WITH_READER "Add the xmlReader parsing interface" ON
|
| 65 |
+
"LIBXML2_WITH_PUSH" OFF)
|
| 66 |
+
cmake_dependent_option(
|
| 67 |
+
LIBXML2_WITH_SCHEMAS "Add XML Schemas 1.0 support" ON
|
| 68 |
+
"LIBXML2_WITH_PATTERN;LIBXML2_WITH_REGEXPS" OFF)
|
| 69 |
+
cmake_dependent_option(
|
| 70 |
+
LIBXML2_WITH_SCHEMATRON "Add Schematron support" OFF
|
| 71 |
+
"LIBXML2_WITH_PATTERN;LIBXML2_WITH_XPATH" OFF)
|
| 72 |
+
cmake_dependent_option(
|
| 73 |
+
LIBXML2_WITH_THREAD_ALLOC "Add per-thread malloc hooks" OFF
|
| 74 |
+
"LIBXML2_WITH_THREADS" OFF)
|
| 75 |
+
cmake_dependent_option(
|
| 76 |
+
LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" ON
|
| 77 |
+
"LIBXML2_WITH_OUTPUT;LIBXML2_WITH_PUSH" OFF)
|
| 78 |
+
cmake_dependent_option(
|
| 79 |
+
LIBXML2_WITH_XPTR "Add the XPointer support" ON
|
| 80 |
+
"LIBXML2_WITH_XPATH" OFF)
|
| 81 |
+
|
| 82 |
+
cmake_dependent_option(
|
| 83 |
+
LIBXML2_WITH_RELAXNG "Add Relax-NG support" ON
|
| 84 |
+
"LIBXML2_WITH_REGEXPS;LIBXML2_WITH_SCHEMAS" OFF)
|
| 85 |
+
|
| 86 |
+
if(LIBXML2_WITH_PYTHON)
|
| 87 |
+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
| 88 |
+
#set(LIBXML2_PYTHON_INSTALL_DIR ${Python3_SITEARCH} CACHE PATH "Python bindings install directory")
|
| 89 |
+
set(LIBXML2_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python"
|
| 90 |
+
CACHE PATH "Python bindings install directory")
|
| 91 |
+
endif()
|
| 92 |
+
|
| 93 |
+
foreach(VARIABLE IN ITEMS WITH_C14N WITH_CATALOG WITH_DEBUG WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RELAXNG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB)
|
| 94 |
+
if(LIBXML2_${VARIABLE})
|
| 95 |
+
set(${VARIABLE} 1)
|
| 96 |
+
else()
|
| 97 |
+
set(${VARIABLE} 0)
|
| 98 |
+
endif()
|
| 99 |
+
endforeach()
|
| 100 |
+
|
| 101 |
+
set(LIBXML_VERSION ${VERSION})
|
| 102 |
+
set(LIBXML_VERSION_EXTRA "")
|
| 103 |
+
math(EXPR LIBXML_VERSION_NUMBER "
|
| 104 |
+
${LIBXML_MAJOR_VERSION} * 10000 +
|
| 105 |
+
${LIBXML_MINOR_VERSION} * 100 +
|
| 106 |
+
${LIBXML_MICRO_VERSION}
|
| 107 |
+
")
|
| 108 |
+
|
| 109 |
+
set(MODULE_EXTENSION "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
| 110 |
+
|
| 111 |
+
if(LIBXML2_WITH_ICONV)
|
| 112 |
+
find_package(Iconv REQUIRED)
|
| 113 |
+
endif()
|
| 114 |
+
|
| 115 |
+
if(LIBXML2_WITH_ICU)
|
| 116 |
+
find_package(ICU REQUIRED COMPONENTS uc)
|
| 117 |
+
endif()
|
| 118 |
+
|
| 119 |
+
if(LIBXML2_WITH_THREADS)
|
| 120 |
+
find_package(Threads REQUIRED)
|
| 121 |
+
set(THREAD_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
| 122 |
+
list(APPEND CMAKE_REQUIRED_LIBRARIES Threads::Threads)
|
| 123 |
+
endif()
|
| 124 |
+
|
| 125 |
+
if(LIBXML2_WITH_ZLIB)
|
| 126 |
+
find_package(ZLIB REQUIRED)
|
| 127 |
+
endif()
|
| 128 |
+
|
| 129 |
+
check_c_source_compiles("
|
| 130 |
+
void __attribute__((destructor))
|
| 131 |
+
f(void) {}
|
| 132 |
+
int main(void) { return 0; }
|
| 133 |
+
" HAVE_FUNC_ATTRIBUTE_DESTRUCTOR)
|
| 134 |
+
check_symbol_exists(getentropy "sys/random.h" HAVE_DECL_GETENTROPY)
|
| 135 |
+
check_symbol_exists(glob "glob.h" HAVE_DECL_GLOB)
|
| 136 |
+
check_symbol_exists(mmap "sys/mman.h" HAVE_DECL_MMAP)
|
| 137 |
+
check_include_files(stdint.h HAVE_STDINT_H)
|
| 138 |
+
|
| 139 |
+
if(LIBXML2_WITH_READLINE)
|
| 140 |
+
check_library_exists(readline readline "" HAVE_LIBREADLINE)
|
| 141 |
+
if (LIBXML2_WITH_HISTORY)
|
| 142 |
+
check_library_exists(history append_history "" HAVE_LIBHISTORY)
|
| 143 |
+
endif()
|
| 144 |
+
endif()
|
| 145 |
+
|
| 146 |
+
if(LIBXML2_WITH_TLS)
|
| 147 |
+
check_c_source_compiles(
|
| 148 |
+
"_Thread_local int v; int main(){return 0;}"
|
| 149 |
+
XML_THREAD_LOCAL_C11
|
| 150 |
+
)
|
| 151 |
+
if (XML_THREAD_LOCAL_C11)
|
| 152 |
+
set(XML_THREAD_LOCAL "_Thread_local")
|
| 153 |
+
else()
|
| 154 |
+
check_c_source_compiles(
|
| 155 |
+
"__thread int v; int main(){return 0;}"
|
| 156 |
+
XML_THREAD_LOCAL_THREAD
|
| 157 |
+
)
|
| 158 |
+
if (XML_THREAD_LOCAL_THREAD)
|
| 159 |
+
set(XML_THREAD_LOCAL "__thread")
|
| 160 |
+
else()
|
| 161 |
+
check_c_source_compiles(
|
| 162 |
+
"__declspec(thread) int v; int main(){return 0;}"
|
| 163 |
+
XML_THREAD_LOCAL_DECLSPEC
|
| 164 |
+
)
|
| 165 |
+
if (XML_THREAD_LOCAL_DECLSPEC)
|
| 166 |
+
set(XML_THREAD_LOCAL "__declspec(thread)")
|
| 167 |
+
endif()
|
| 168 |
+
endif()
|
| 169 |
+
endif()
|
| 170 |
+
endif()
|
| 171 |
+
|
| 172 |
+
set(
|
| 173 |
+
LIBXML2_HDRS
|
| 174 |
+
include/libxml/c14n.h
|
| 175 |
+
include/libxml/catalog.h
|
| 176 |
+
include/libxml/chvalid.h
|
| 177 |
+
include/libxml/debugXML.h
|
| 178 |
+
include/libxml/dict.h
|
| 179 |
+
include/libxml/encoding.h
|
| 180 |
+
include/libxml/entities.h
|
| 181 |
+
include/libxml/globals.h
|
| 182 |
+
include/libxml/hash.h
|
| 183 |
+
include/libxml/HTMLparser.h
|
| 184 |
+
include/libxml/HTMLtree.h
|
| 185 |
+
include/libxml/list.h
|
| 186 |
+
include/libxml/nanoftp.h
|
| 187 |
+
include/libxml/nanohttp.h
|
| 188 |
+
include/libxml/parser.h
|
| 189 |
+
include/libxml/parserInternals.h
|
| 190 |
+
include/libxml/pattern.h
|
| 191 |
+
include/libxml/relaxng.h
|
| 192 |
+
include/libxml/SAX.h
|
| 193 |
+
include/libxml/SAX2.h
|
| 194 |
+
include/libxml/schemasInternals.h
|
| 195 |
+
include/libxml/schematron.h
|
| 196 |
+
include/libxml/threads.h
|
| 197 |
+
include/libxml/tree.h
|
| 198 |
+
include/libxml/uri.h
|
| 199 |
+
include/libxml/valid.h
|
| 200 |
+
include/libxml/xinclude.h
|
| 201 |
+
include/libxml/xlink.h
|
| 202 |
+
include/libxml/xmlIO.h
|
| 203 |
+
include/libxml/xmlautomata.h
|
| 204 |
+
include/libxml/xmlerror.h
|
| 205 |
+
include/libxml/xmlexports.h
|
| 206 |
+
include/libxml/xmlmemory.h
|
| 207 |
+
include/libxml/xmlmodule.h
|
| 208 |
+
include/libxml/xmlreader.h
|
| 209 |
+
include/libxml/xmlregexp.h
|
| 210 |
+
include/libxml/xmlsave.h
|
| 211 |
+
include/libxml/xmlschemas.h
|
| 212 |
+
include/libxml/xmlschemastypes.h
|
| 213 |
+
include/libxml/xmlstring.h
|
| 214 |
+
include/libxml/xmlunicode.h
|
| 215 |
+
include/libxml/xmlwriter.h
|
| 216 |
+
include/libxml/xpath.h
|
| 217 |
+
include/libxml/xpathInternals.h
|
| 218 |
+
include/libxml/xpointer.h
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
set(
|
| 222 |
+
LIBXML2_SRCS
|
| 223 |
+
buf.c
|
| 224 |
+
chvalid.c
|
| 225 |
+
dict.c
|
| 226 |
+
encoding.c
|
| 227 |
+
entities.c
|
| 228 |
+
error.c
|
| 229 |
+
globals.c
|
| 230 |
+
hash.c
|
| 231 |
+
list.c
|
| 232 |
+
parser.c
|
| 233 |
+
parserInternals.c
|
| 234 |
+
SAX2.c
|
| 235 |
+
threads.c
|
| 236 |
+
tree.c
|
| 237 |
+
uri.c
|
| 238 |
+
valid.c
|
| 239 |
+
xmlIO.c
|
| 240 |
+
xmlmemory.c
|
| 241 |
+
xmlstring.c
|
| 242 |
+
)
|
| 243 |
+
if(LIBXML2_WITH_C14N)
|
| 244 |
+
list(APPEND LIBXML2_SRCS c14n.c)
|
| 245 |
+
endif()
|
| 246 |
+
if(LIBXML2_WITH_CATALOG)
|
| 247 |
+
list(APPEND LIBXML2_SRCS catalog.c)
|
| 248 |
+
endif()
|
| 249 |
+
if(LIBXML2_WITH_DEBUG)
|
| 250 |
+
list(APPEND LIBXML2_SRCS debugXML.c)
|
| 251 |
+
endif()
|
| 252 |
+
if(LIBXML2_WITH_HTML)
|
| 253 |
+
list(APPEND LIBXML2_SRCS HTMLparser.c HTMLtree.c)
|
| 254 |
+
endif()
|
| 255 |
+
if(LIBXML2_WITH_HTTP)
|
| 256 |
+
list(APPEND LIBXML2_SRCS nanohttp.c)
|
| 257 |
+
endif()
|
| 258 |
+
if(LIBXML2_WITH_MODULES)
|
| 259 |
+
list(APPEND LIBXML2_SRCS xmlmodule.c)
|
| 260 |
+
endif()
|
| 261 |
+
if(LIBXML2_WITH_OUTPUT)
|
| 262 |
+
list(APPEND LIBXML2_SRCS xmlsave.c)
|
| 263 |
+
endif()
|
| 264 |
+
if(LIBXML2_WITH_PATTERN)
|
| 265 |
+
list(APPEND LIBXML2_SRCS pattern.c)
|
| 266 |
+
endif()
|
| 267 |
+
if(LIBXML2_WITH_READER)
|
| 268 |
+
list(APPEND LIBXML2_SRCS xmlreader.c)
|
| 269 |
+
endif()
|
| 270 |
+
if(LIBXML2_WITH_REGEXPS)
|
| 271 |
+
list(APPEND LIBXML2_SRCS xmlregexp.c)
|
| 272 |
+
endif()
|
| 273 |
+
if(LIBXML2_WITH_RELAXNG)
|
| 274 |
+
list(APPEND LIBXML2_SRCS relaxng.c)
|
| 275 |
+
endif()
|
| 276 |
+
if(LIBXML2_WITH_SCHEMAS)
|
| 277 |
+
list(APPEND LIBXML2_SRCS xmlschemas.c xmlschemastypes.c)
|
| 278 |
+
endif()
|
| 279 |
+
if(LIBXML2_WITH_SCHEMATRON)
|
| 280 |
+
list(APPEND LIBXML2_SRCS schematron.c)
|
| 281 |
+
endif()
|
| 282 |
+
if(LIBXML2_WITH_WRITER)
|
| 283 |
+
list(APPEND LIBXML2_SRCS xmlwriter.c)
|
| 284 |
+
endif()
|
| 285 |
+
if(LIBXML2_WITH_XINCLUDE)
|
| 286 |
+
list(APPEND LIBXML2_SRCS xinclude.c)
|
| 287 |
+
endif()
|
| 288 |
+
if(LIBXML2_WITH_XPATH)
|
| 289 |
+
list(APPEND LIBXML2_SRCS xpath.c)
|
| 290 |
+
endif()
|
| 291 |
+
if(LIBXML2_WITH_XPTR)
|
| 292 |
+
list(APPEND LIBXML2_SRCS xlink.c xpointer.c)
|
| 293 |
+
endif()
|
| 294 |
+
|
| 295 |
+
if(WIN32)
|
| 296 |
+
list(APPEND LIBXML2_SRCS win32/libxml2.rc)
|
| 297 |
+
file(
|
| 298 |
+
WRITE
|
| 299 |
+
${CMAKE_CURRENT_BINARY_DIR}/rcVersion.h
|
| 300 |
+
"#define LIBXML_MAJOR_VERSION ${LIBXML_MAJOR_VERSION}\n"
|
| 301 |
+
"#define LIBXML_MINOR_VERSION ${LIBXML_MINOR_VERSION}\n"
|
| 302 |
+
"#define LIBXML_MICRO_VERSION ${LIBXML_MICRO_VERSION}\n"
|
| 303 |
+
"#define LIBXML_DOTTED_VERSION \"${VERSION}\"\n"
|
| 304 |
+
)
|
| 305 |
+
endif()
|
| 306 |
+
|
| 307 |
+
add_library(LibXml2 ${LIBXML2_HDRS} ${LIBXML2_SRCS})
|
| 308 |
+
add_library(LibXml2::LibXml2 ALIAS LibXml2)
|
| 309 |
+
|
| 310 |
+
target_include_directories(
|
| 311 |
+
LibXml2
|
| 312 |
+
PUBLIC
|
| 313 |
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
| 314 |
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
| 315 |
+
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/libxml2>
|
| 316 |
+
)
|
| 317 |
+
|
| 318 |
+
if(LIBXML2_WITH_MODULES)
|
| 319 |
+
cmake_push_check_state(RESET)
|
| 320 |
+
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
|
| 321 |
+
check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN)
|
| 322 |
+
cmake_pop_check_state()
|
| 323 |
+
if(HAVE_DLOPEN)
|
| 324 |
+
target_link_libraries(LibXml2 PRIVATE ${CMAKE_DL_LIBS})
|
| 325 |
+
list(TRANSFORM CMAKE_DL_LIBS PREPEND "-l" REGEX "^[^-]" OUTPUT_VARIABLE MODULE_LIBS)
|
| 326 |
+
else()
|
| 327 |
+
check_library_exists(dld shl_load "" HAVE_SHLLOAD)
|
| 328 |
+
if(HAVE_SHLLOAD)
|
| 329 |
+
target_link_libraries(LibXml2 PRIVATE dld)
|
| 330 |
+
set(MODULE_LIBS "-ldld")
|
| 331 |
+
endif()
|
| 332 |
+
endif()
|
| 333 |
+
endif()
|
| 334 |
+
|
| 335 |
+
if(UNIX)
|
| 336 |
+
target_link_libraries(LibXml2 PRIVATE m)
|
| 337 |
+
set(LIBM "-lm")
|
| 338 |
+
endif()
|
| 339 |
+
|
| 340 |
+
if(WIN32)
|
| 341 |
+
target_link_libraries(LibXml2 PRIVATE bcrypt)
|
| 342 |
+
set(CRYPTO_LIBS "-lbcrypt")
|
| 343 |
+
endif()
|
| 344 |
+
|
| 345 |
+
if(LIBXML2_WITH_ICONV)
|
| 346 |
+
target_link_libraries(LibXml2 PRIVATE Iconv::Iconv)
|
| 347 |
+
if(NOT Iconv_IS_BUILT_IN)
|
| 348 |
+
set(ICONV_LIBS "-liconv")
|
| 349 |
+
endif()
|
| 350 |
+
endif()
|
| 351 |
+
|
| 352 |
+
if(LIBXML2_WITH_ICU)
|
| 353 |
+
target_link_libraries(LibXml2 PRIVATE ICU::uc)
|
| 354 |
+
set(ICU_LDFLAGS "-licuuc")
|
| 355 |
+
list(APPEND XML_PRIVATE_LIBS "${ICU_LDFLAGS}")
|
| 356 |
+
pkg_check_modules(ICU_PC IMPORTED_TARGET icu-uc)
|
| 357 |
+
if(ICU_PC_FOUND)
|
| 358 |
+
list(APPEND XML_PC_REQUIRES icu-uc)
|
| 359 |
+
else()
|
| 360 |
+
list(APPEND XML_PC_LIBS "${ICU_LDFLAGS}")
|
| 361 |
+
endif()
|
| 362 |
+
endif()
|
| 363 |
+
|
| 364 |
+
if(LIBXML2_WITH_THREADS)
|
| 365 |
+
target_link_libraries(LibXml2 PRIVATE Threads::Threads)
|
| 366 |
+
endif()
|
| 367 |
+
|
| 368 |
+
if(LIBXML2_WITH_ZLIB)
|
| 369 |
+
target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB)
|
| 370 |
+
set(ZLIB_LDFLAGS "-lz")
|
| 371 |
+
list(APPEND XML_PRIVATE_LIBS "${ZLIB_LDFLAGS}")
|
| 372 |
+
pkg_check_modules(ZLIB_PC IMPORTED_TARGET zlib)
|
| 373 |
+
if(ZLIB_PC_FOUND)
|
| 374 |
+
list(APPEND XML_PC_REQUIRES zlib)
|
| 375 |
+
else()
|
| 376 |
+
list(APPEND XML_PC_LIBS "${ZLIB_LDFLAGS}")
|
| 377 |
+
endif()
|
| 378 |
+
endif()
|
| 379 |
+
|
| 380 |
+
if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
| 381 |
+
# These compiler flags can break the checks above so keep them here.
|
| 382 |
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wshadow \
|
| 383 |
+
-Wpointer-arith -Wcast-align -Wwrite-strings \
|
| 384 |
+
-Wstrict-prototypes -Wmissing-prototypes \
|
| 385 |
+
-Wno-long-long -Wno-format-extra-args -Wno-array-bounds")
|
| 386 |
+
endif()
|
| 387 |
+
|
| 388 |
+
set(LIBXML_MINOR_COMPAT 14)
|
| 389 |
+
math(EXPR LIBXML_SOVERSION "${LIBXML_MAJOR_VERSION} + ${LIBXML_MINOR_COMPAT}")
|
| 390 |
+
math(EXPR LIBXML_AGE "${LIBXML_MINOR_VERSION} - ${LIBXML_MINOR_COMPAT}")
|
| 391 |
+
math(EXPR LIBXML_MACHO_COMPAT "${LIBXML_MAJOR_VERSION} + ${LIBXML_MINOR_VERSION} + 1")
|
| 392 |
+
set_target_properties(
|
| 393 |
+
LibXml2
|
| 394 |
+
PROPERTIES
|
| 395 |
+
IMPORT_PREFIX lib
|
| 396 |
+
OUTPUT_NAME xml2
|
| 397 |
+
POSITION_INDEPENDENT_CODE ON
|
| 398 |
+
PREFIX lib
|
| 399 |
+
VERSION "${LIBXML_SOVERSION}.${LIBXML_AGE}.${LIBXML_MICRO_VERSION}"
|
| 400 |
+
SOVERSION ${LIBXML_SOVERSION}
|
| 401 |
+
MACHO_COMPATIBILITY_VERSION ${LIBXML_MACHO_COMPAT}
|
| 402 |
+
MACHO_CURRENT_VERSION "${LIBXML_MACHO_COMPAT}.${LIBXML_MICRO_VERSION}"
|
| 403 |
+
)
|
| 404 |
+
|
| 405 |
+
if(MSVC)
|
| 406 |
+
if(BUILD_SHARED_LIBS)
|
| 407 |
+
set_target_properties(
|
| 408 |
+
LibXml2
|
| 409 |
+
PROPERTIES
|
| 410 |
+
DEBUG_POSTFIX d
|
| 411 |
+
)
|
| 412 |
+
else()
|
| 413 |
+
set_target_properties(
|
| 414 |
+
LibXml2
|
| 415 |
+
PROPERTIES
|
| 416 |
+
DEBUG_POSTFIX sd
|
| 417 |
+
MINSIZEREL_POSTFIX s
|
| 418 |
+
RELEASE_POSTFIX s
|
| 419 |
+
RELWITHDEBINFO_POSTFIX s
|
| 420 |
+
)
|
| 421 |
+
endif()
|
| 422 |
+
endif()
|
| 423 |
+
|
| 424 |
+
set(XML_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
| 425 |
+
|
| 426 |
+
install(FILES ${LIBXML2_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development)
|
| 427 |
+
|
| 428 |
+
install(
|
| 429 |
+
TARGETS LibXml2
|
| 430 |
+
EXPORT LibXml2
|
| 431 |
+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development
|
| 432 |
+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_COMPONENT development
|
| 433 |
+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
|
| 434 |
+
)
|
| 435 |
+
|
| 436 |
+
if(MSVC AND BUILD_SHARED_LIBS)
|
| 437 |
+
install(FILES $<TARGET_PDB_FILE:LibXml2> DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug)
|
| 438 |
+
endif()
|
| 439 |
+
|
| 440 |
+
if(LIBXML2_WITH_PROGRAMS)
|
| 441 |
+
add_executable(xmllint xmllint.c shell.c lintmain.c)
|
| 442 |
+
set(PROGRAMS xmllint)
|
| 443 |
+
if(LIBXML2_WITH_CATALOG AND LIBXML2_WITH_OUTPUT)
|
| 444 |
+
add_executable(xmlcatalog xmlcatalog.c)
|
| 445 |
+
list(APPEND PROGRAMS xmlcatalog)
|
| 446 |
+
endif()
|
| 447 |
+
foreach(PROGRAM ${PROGRAMS})
|
| 448 |
+
add_executable(LibXml2::${PROGRAM} ALIAS ${PROGRAM})
|
| 449 |
+
target_link_libraries(${PROGRAM} LibXml2)
|
| 450 |
+
if(HAVE_LIBHISTORY)
|
| 451 |
+
target_link_libraries(${PROGRAM} history)
|
| 452 |
+
endif()
|
| 453 |
+
if(HAVE_LIBREADLINE)
|
| 454 |
+
target_link_libraries(${PROGRAM} readline)
|
| 455 |
+
endif()
|
| 456 |
+
install(TARGETS ${PROGRAM} EXPORT LibXml2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT programs)
|
| 457 |
+
endforeach()
|
| 458 |
+
endif()
|
| 459 |
+
|
| 460 |
+
if(LIBXML2_WITH_TESTS)
|
| 461 |
+
enable_testing()
|
| 462 |
+
set(
|
| 463 |
+
TESTS
|
| 464 |
+
runtest
|
| 465 |
+
runxmlconf
|
| 466 |
+
runsuite
|
| 467 |
+
testapi
|
| 468 |
+
testchar
|
| 469 |
+
testdict
|
| 470 |
+
testModule
|
| 471 |
+
testlimits
|
| 472 |
+
testparser
|
| 473 |
+
testrecurse
|
| 474 |
+
)
|
| 475 |
+
foreach(TEST ${TESTS})
|
| 476 |
+
add_executable(${TEST} ${TEST}.c)
|
| 477 |
+
target_link_libraries(${TEST} LibXml2)
|
| 478 |
+
endforeach()
|
| 479 |
+
if(Threads_FOUND)
|
| 480 |
+
foreach(TEST runtest)
|
| 481 |
+
target_link_libraries(${TEST} Threads::Threads)
|
| 482 |
+
endforeach()
|
| 483 |
+
endif()
|
| 484 |
+
add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
| 485 |
+
add_test(NAME runsuite COMMAND runsuite WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
| 486 |
+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/xmlconf/xmlconf.xml)
|
| 487 |
+
add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
| 488 |
+
endif()
|
| 489 |
+
add_test(NAME testapi COMMAND testapi)
|
| 490 |
+
add_test(NAME testchar COMMAND testchar)
|
| 491 |
+
add_test(NAME testdict COMMAND testdict)
|
| 492 |
+
add_test(NAME testparser COMMAND testparser WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
| 493 |
+
add_test(NAME testrecurse COMMAND testrecurse WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
| 494 |
+
endif()
|
| 495 |
+
|
| 496 |
+
if(LIBXML2_WITH_DOCS OR LIBXML2_WITH_PYTHON)
|
| 497 |
+
set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile)
|
| 498 |
+
add_custom_command(
|
| 499 |
+
OUTPUT doc/html doc/xml
|
| 500 |
+
COMMAND ${CMAKE_COMMAND} -E env
|
| 501 |
+
SOURCE_ROOT=${CMAKE_CURRENT_SOURCE_DIR}/
|
| 502 |
+
BUILD_ROOT=${CMAKE_CURRENT_BINARY_DIR}/
|
| 503 |
+
doxygen -q ${DOXYFILE}
|
| 504 |
+
MAIN_DEPENDENCY ${DOXYFILE}
|
| 505 |
+
DEPENDS ${LIBXML2_HDRS} ${LIBXML2_SRCS}
|
| 506 |
+
)
|
| 507 |
+
add_custom_target(Doxygen ALL DEPENDS doc/html doc/xml)
|
| 508 |
+
endif()
|
| 509 |
+
|
| 510 |
+
if(LIBXML2_WITH_PYTHON)
|
| 511 |
+
add_custom_command(
|
| 512 |
+
OUTPUT
|
| 513 |
+
libxml2-py.c
|
| 514 |
+
libxml2-py.h
|
| 515 |
+
libxml2.py
|
| 516 |
+
COMMAND
|
| 517 |
+
${Python3_EXECUTABLE}
|
| 518 |
+
${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py
|
| 519 |
+
${CMAKE_CURRENT_BINARY_DIR}
|
| 520 |
+
DEPENDS
|
| 521 |
+
python/generator.py
|
| 522 |
+
Doxygen
|
| 523 |
+
)
|
| 524 |
+
|
| 525 |
+
Python3_add_library(
|
| 526 |
+
LibXml2Mod MODULE WITH_SOABI
|
| 527 |
+
libxml2-py.c
|
| 528 |
+
libxml2-py.h
|
| 529 |
+
python/libxml.c
|
| 530 |
+
python/libxml_wrap.h
|
| 531 |
+
python/types.c
|
| 532 |
+
)
|
| 533 |
+
target_include_directories(
|
| 534 |
+
LibXml2Mod
|
| 535 |
+
PRIVATE
|
| 536 |
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/python>
|
| 537 |
+
)
|
| 538 |
+
target_link_libraries(LibXml2Mod PRIVATE LibXml2)
|
| 539 |
+
set_target_properties(
|
| 540 |
+
LibXml2Mod
|
| 541 |
+
PROPERTIES
|
| 542 |
+
IMPORT_PREFIX lib
|
| 543 |
+
OUTPUT_NAME xml2mod
|
| 544 |
+
PREFIX lib
|
| 545 |
+
)
|
| 546 |
+
install(
|
| 547 |
+
TARGETS LibXml2Mod
|
| 548 |
+
ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development
|
| 549 |
+
LIBRARY DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime NAMELINK_COMPONENT development
|
| 550 |
+
RUNTIME DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime
|
| 551 |
+
)
|
| 552 |
+
if(MSVC AND BUILD_SHARED_LIBS)
|
| 553 |
+
install(FILES $<TARGET_PDB_FILE:LibXml2Mod> DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug)
|
| 554 |
+
endif()
|
| 555 |
+
install(FILES python/drv_libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime)
|
| 556 |
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime)
|
| 557 |
+
endif()
|
| 558 |
+
|
| 559 |
+
if (LIBXML2_WITH_DOCS)
|
| 560 |
+
set(MAN_PAGES doc/xml2-config.1)
|
| 561 |
+
|
| 562 |
+
if(LIBXML2_WITH_PROGRAMS)
|
| 563 |
+
set(PROGNAMES xmllint)
|
| 564 |
+
if(LIBXML2_WITH_CATALOG AND LIBXML2_WITH_OUTPUT)
|
| 565 |
+
list(APPEND PROGNAMES xmlcatalog)
|
| 566 |
+
endif()
|
| 567 |
+
foreach(PROG IN ITEMS ${PROGNAMES})
|
| 568 |
+
set(XML_SRC ${CMAKE_CURRENT_SOURCE_DIR}/doc/${PROG}.xml)
|
| 569 |
+
|
| 570 |
+
add_custom_command(
|
| 571 |
+
OUTPUT ${PROG}.1
|
| 572 |
+
COMMAND xsltproc
|
| 573 |
+
--nonet --novalid
|
| 574 |
+
--param man.output.quietly 1
|
| 575 |
+
-o ${PROG}.1
|
| 576 |
+
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
|
| 577 |
+
${XML_SRC}
|
| 578 |
+
MAIN_DEPENDENCY ${XML_SRC}
|
| 579 |
+
)
|
| 580 |
+
list(APPEND MAN_PAGES ${CMAKE_CURRENT_BINARY_DIR}/${PROG}.1)
|
| 581 |
+
|
| 582 |
+
add_custom_command(
|
| 583 |
+
OUTPUT ${PROG}.html
|
| 584 |
+
COMMAND xsltproc
|
| 585 |
+
--nonet --novalid
|
| 586 |
+
-o ${PROG}.html
|
| 587 |
+
http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
|
| 588 |
+
${XML_SRC}
|
| 589 |
+
MAIN_DEPENDENCY ${XML_SRC}
|
| 590 |
+
)
|
| 591 |
+
list(APPEND HTML_PAGES ${CMAKE_CURRENT_BINARY_DIR}/${PROG}.html)
|
| 592 |
+
endforeach()
|
| 593 |
+
|
| 594 |
+
add_custom_target(DocBook ALL DEPENDS ${MAN_PAGES} ${HTML_PAGES})
|
| 595 |
+
|
| 596 |
+
install(
|
| 597 |
+
FILES ${HTML_PAGES}
|
| 598 |
+
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
| 599 |
+
COMPONENT documentation
|
| 600 |
+
)
|
| 601 |
+
endif()
|
| 602 |
+
|
| 603 |
+
install(
|
| 604 |
+
FILES ${MAN_PAGES}
|
| 605 |
+
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
| 606 |
+
COMPONENT documentation
|
| 607 |
+
)
|
| 608 |
+
install(
|
| 609 |
+
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html
|
| 610 |
+
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
| 611 |
+
COMPONENT documentation
|
| 612 |
+
)
|
| 613 |
+
endif()
|
| 614 |
+
|
| 615 |
+
configure_package_config_file(
|
| 616 |
+
libxml2-config.cmake.cmake.in libxml2-config.cmake
|
| 617 |
+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
|
| 618 |
+
)
|
| 619 |
+
|
| 620 |
+
install(
|
| 621 |
+
FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config.cmake
|
| 622 |
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
|
| 623 |
+
COMPONENT development
|
| 624 |
+
)
|
| 625 |
+
|
| 626 |
+
write_basic_package_version_file(
|
| 627 |
+
${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
|
| 628 |
+
VERSION ${PROJECT_VERSION}
|
| 629 |
+
COMPATIBILITY SameMajorVersion
|
| 630 |
+
)
|
| 631 |
+
|
| 632 |
+
install(
|
| 633 |
+
FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
|
| 634 |
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
|
| 635 |
+
COMPONENT development
|
| 636 |
+
)
|
| 637 |
+
|
| 638 |
+
install(
|
| 639 |
+
EXPORT LibXml2
|
| 640 |
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
|
| 641 |
+
NAMESPACE LibXml2::
|
| 642 |
+
FILE libxml2-export.cmake
|
| 643 |
+
COMPONENT development
|
| 644 |
+
)
|
| 645 |
+
|
| 646 |
+
configure_file(config.h.cmake.in config.h)
|
| 647 |
+
configure_file(include/libxml/xmlversion.h.in libxml/xmlversion.h)
|
| 648 |
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml/xmlversion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development)
|
| 649 |
+
|
| 650 |
+
if(LIBXML2_WITH_PYTHON)
|
| 651 |
+
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
| 652 |
+
configure_file(python/setup.py.in setup.py @ONLY)
|
| 653 |
+
endif()
|
| 654 |
+
|
| 655 |
+
set(NON_PC_LIBS "${THREAD_LIBS} ${ICONV_LIBS} ${LIBM} ${WINSOCK_LIBS} ${CRYPTO_LIBS} ${MODULE_LIBS}")
|
| 656 |
+
list(APPEND XML_PC_LIBS "${NON_PC_LIBS}")
|
| 657 |
+
list(APPEND XML_PRIVATE_LIBS "${NON_PC_LIBS}")
|
| 658 |
+
list(REMOVE_DUPLICATES XML_PC_LIBS)
|
| 659 |
+
list(REMOVE_DUPLICATES XML_PRIVATE_LIBS)
|
| 660 |
+
|
| 661 |
+
list(JOIN XML_PC_REQUIRES " " XML_PC_REQUIRES)
|
| 662 |
+
list(JOIN XML_PC_LIBS " " XML_PC_LIBS)
|
| 663 |
+
list(JOIN XML_PRIVATE_LIBS " " XML_PRIVATE_LIBS)
|
| 664 |
+
|
| 665 |
+
set(XML_INCLUDEDIR "-I\${includedir}/libxml2")
|
| 666 |
+
set(XML_LIBDIR "-L\${libdir}")
|
| 667 |
+
set(XML_LIBS "-lxml2")
|
| 668 |
+
|
| 669 |
+
if(BUILD_SHARED_LIBS)
|
| 670 |
+
set(XML_PC_PRIVATE ".private")
|
| 671 |
+
set(XML_PC_LIBS_PRIVATE "
|
| 672 |
+
Libs.private:")
|
| 673 |
+
else()
|
| 674 |
+
set(XML_PRIVATE_LIBS_NO_SHARED "${XML_PRIVATE_LIBS}")
|
| 675 |
+
endif()
|
| 676 |
+
|
| 677 |
+
if(WIN32)
|
| 678 |
+
set(XML_STATIC_CFLAGS "-DLIBXML_STATIC")
|
| 679 |
+
if (BUILD_SHARED_LIBS)
|
| 680 |
+
set(XML_PC_CFLAGS_PRIVATE "
|
| 681 |
+
Cflags.private:")
|
| 682 |
+
else()
|
| 683 |
+
target_compile_definitions(LibXml2 PUBLIC LIBXML_STATIC)
|
| 684 |
+
set(XML_CFLAGS "${XML_STATIC_CFLAGS}")
|
| 685 |
+
endif()
|
| 686 |
+
endif()
|
| 687 |
+
|
| 688 |
+
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
|
| 689 |
+
string(REGEX REPLACE "/$" "" PACKAGE_RELATIVE_PATH "${PACKAGE_RELATIVE_PATH}")
|
| 690 |
+
|
| 691 |
+
if(WIN32)
|
| 692 |
+
set(prefix "\${pcfiledir}/${PACKAGE_RELATIVE_PATH}")
|
| 693 |
+
else()
|
| 694 |
+
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
| 695 |
+
endif()
|
| 696 |
+
set(exec_prefix "\${prefix}")
|
| 697 |
+
set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
| 698 |
+
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
| 699 |
+
configure_file(libxml-2.0.pc.in libxml-2.0.pc @ONLY)
|
| 700 |
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml-2.0.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT development)
|
| 701 |
+
|
| 702 |
+
if(WIN32)
|
| 703 |
+
set(prefix "\$(cd \"\$(dirname \"\$0\")\"; pwd -P)/..")
|
| 704 |
+
endif()
|
| 705 |
+
configure_file(xml2-config.in xml2-config @ONLY)
|
| 706 |
+
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xml2-config DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT development)
|
| 707 |
+
|
| 708 |
+
set(XML_INCLUDEDIR "-I${CMAKE_INSTALL_FULL_INCLUDEDIR}/libxml2")
|
| 709 |
+
set(XML_LIBDIR "-L${CMAKE_INSTALL_FULL_LIBDIR}")
|
| 710 |
+
|
| 711 |
+
set(CPACK_COMPONENT_DEVELOPMENT_DEPENDS runtime)
|
| 712 |
+
set(CPACK_COMPONENT_PROGRAMS_DEPENDS runtime)
|
| 713 |
+
set(CPACK_DEB_COMPONENT_INSTALL ON)
|
| 714 |
+
set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_DEPENDS "${PACKAGE_TARNAME}")
|
| 715 |
+
set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_NAME "${PACKAGE_TARNAME}-dev")
|
| 716 |
+
set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_SECTION "libdevel")
|
| 717 |
+
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${PACKAGE_URL})
|
| 718 |
+
set(CPACK_DEBIAN_PACKAGE_NAME ${PACKAGE_TARNAME})
|
| 719 |
+
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
| 720 |
+
set(CPACK_DEBIAN_PROGRAMS_PACKAGE_DEPENDS "${PACKAGE_TARNAME}")
|
| 721 |
+
set(CPACK_DEBIAN_PROGRAMS_PACKAGE_NAME "${PACKAGE_TARNAME}-utils")
|
| 722 |
+
set(CPACK_DEBIAN_PROGRAMS_PACKAGE_SECTION "utils")
|
| 723 |
+
set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME ${PACKAGE_TARNAME})
|
| 724 |
+
set(CPACK_DEBIAN_RUNTIME_PACKAGE_RECOMMENDS "${PACKAGE_TARNAME}-utils")
|
| 725 |
+
set(CPACK_DEBIAN_RUNTIME_PACKAGE_SECTION "libs")
|
| 726 |
+
set(CPACK_NSIS_PACKAGE_NAME ${PACKAGE_STRING})
|
| 727 |
+
set(CPACK_NSIS_URL_INFO_ABOUT ${PACKAGE_URL})
|
| 728 |
+
set(CPACK_PACKAGE_DISPLAY_NAME ${PACKAGE_STRING})
|
| 729 |
+
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PACKAGE_TARNAME}-${PACKAGE_VERSION}")
|
| 730 |
+
set(CPACK_PACKAGE_NAME ${PACKAGE_TARNAME})
|
| 731 |
+
set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION})
|
| 732 |
+
set(CPACK_PACKAGE_VERSION_MAJOR ${LIBXML_MAJOR_VERSION})
|
| 733 |
+
set(CPACK_PACKAGE_VERSION_MINOR ${LIBXML_MINOR_VERSION})
|
| 734 |
+
set(CPACK_PACKAGE_VERSION_PATCH ${LIBXML_MICRO_VERSION})
|
| 735 |
+
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/Copyright)
|
| 736 |
+
set(CPACK_RPM_COMPONENT_INSTALL ON)
|
| 737 |
+
set(CPACK_RPM_development_PACKAGE_NAME "${PACKAGE_NAME}-devel")
|
| 738 |
+
set(CPACK_RPM_development_PACKAGE_REQUIRES "${PACKAGE_NAME}")
|
| 739 |
+
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
|
| 740 |
+
set(CPACK_RPM_PACKAGE_NAME ${PACKAGE_TARNAME})
|
| 741 |
+
set(CPACK_RPM_PACKAGE_URL ${PACKAGE_URL})
|
| 742 |
+
set(CPACK_RPM_programs_PACKAGE_NAME "${PACKAGE_NAME}-utils")
|
| 743 |
+
set(CPACK_RPM_programs_PACKAGE_REQUIRES "${PACKAGE_NAME}")
|
| 744 |
+
set(CPACK_RPM_runtime_PACKAGE_NAME "${PACKAGE_NAME}")
|
| 745 |
+
set(CPACK_RPM_runtime_PACKAGE_SUGGESTS "${PACKAGE_NAME}-utils")
|
| 746 |
+
|
| 747 |
+
include(CPack)
|
Copyright
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Except where otherwise noted in the source code (e.g. the files dict.c and
|
| 2 |
+
list.c, which are covered by a similar licence but with different Copyright
|
| 3 |
+
notices) all the files are:
|
| 4 |
+
|
| 5 |
+
Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
|
| 6 |
+
Copyright (C) The Libxml2 Contributors.
|
| 7 |
+
|
| 8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 9 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 10 |
+
in the Software without restriction, including without limitation the rights
|
| 11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 12 |
+
copies of the Software, and to permit persons to whom the Software is fur-
|
| 13 |
+
nished to do so, subject to the following conditions:
|
| 14 |
+
|
| 15 |
+
The above copyright notice and this permission notice shall be included in
|
| 16 |
+
all copies or substantial portions of the Software.
|
| 17 |
+
|
| 18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
| 20 |
+
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 24 |
+
THE SOFTWARE.
|
HTM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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* HTMLtree.c : implementation of access function for an HTML tree.
|
| 3 |
+
*
|
| 4 |
+
* See Copyright for the status of this software.
|
| 5 |
+
*
|
| 6 |
+
* Author: Daniel Veillard
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
#define IN_LIBXML
|
| 11 |
+
#include "libxml.h"
|
| 12 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 13 |
+
|
| 14 |
+
#include <string.h> /* for memset() only ! */
|
| 15 |
+
#include <ctype.h>
|
| 16 |
+
#include <stdlib.h>
|
| 17 |
+
|
| 18 |
+
#include <libxml/xmlmemory.h>
|
| 19 |
+
#include <libxml/HTMLparser.h>
|
| 20 |
+
#include <libxml/HTMLtree.h>
|
| 21 |
+
#include <libxml/entities.h>
|
| 22 |
+
#include <libxml/xmlerror.h>
|
| 23 |
+
#include <libxml/parserInternals.h>
|
| 24 |
+
#include <libxml/uri.h>
|
| 25 |
+
|
| 26 |
+
#include "private/buf.h"
|
| 27 |
+
#include "private/html.h"
|
| 28 |
+
#include "private/error.h"
|
| 29 |
+
#include "private/html.h"
|
| 30 |
+
#include "private/io.h"
|
| 31 |
+
#include "private/save.h"
|
| 32 |
+
#include "private/tree.h"
|
| 33 |
+
|
| 34 |
+
/************************************************************************
|
| 35 |
+
* *
|
| 36 |
+
* Getting/Setting encoding meta tags *
|
| 37 |
+
* *
|
| 38 |
+
************************************************************************/
|
| 39 |
+
|
| 40 |
+
typedef struct {
|
| 41 |
+
xmlAttrPtr attr; /* charset or content */
|
| 42 |
+
const xmlChar *attrValue;
|
| 43 |
+
htmlMetaEncodingOffsets off;
|
| 44 |
+
} htmlMetaEncoding;
|
| 45 |
+
|
| 46 |
+
static htmlNodePtr
|
| 47 |
+
htmlFindFirstChild(htmlNodePtr parent, const char *name) {
|
| 48 |
+
htmlNodePtr child;
|
| 49 |
+
|
| 50 |
+
for (child = parent->children; child != NULL; child = child->next) {
|
| 51 |
+
if ((child->type == XML_ELEMENT_NODE) &&
|
| 52 |
+
(xmlStrcasecmp(child->name, BAD_CAST name) == 0))
|
| 53 |
+
return(child);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
return(NULL);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
static htmlNodePtr
|
| 60 |
+
htmlFindHead(htmlDocPtr doc) {
|
| 61 |
+
htmlNodePtr html;
|
| 62 |
+
|
| 63 |
+
if (doc == NULL)
|
| 64 |
+
return(NULL);
|
| 65 |
+
|
| 66 |
+
html = htmlFindFirstChild((htmlNodePtr) doc, "html");
|
| 67 |
+
if (html == NULL)
|
| 68 |
+
return(NULL);
|
| 69 |
+
|
| 70 |
+
return(htmlFindFirstChild(html, "head"));
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
int
|
| 74 |
+
htmlParseContentType(const xmlChar *val, htmlMetaEncodingOffsets *off) {
|
| 75 |
+
const xmlChar *p = val;
|
| 76 |
+
|
| 77 |
+
while (1) {
|
| 78 |
+
size_t start, end;
|
| 79 |
+
|
| 80 |
+
while ((*p != 'c') && (*p != 'C')) {
|
| 81 |
+
if (*p == 0)
|
| 82 |
+
return(0);
|
| 83 |
+
p += 1;
|
| 84 |
+
}
|
| 85 |
+
p += 1;
|
| 86 |
+
|
| 87 |
+
if (xmlStrncasecmp(p, BAD_CAST "harset", 6) != 0)
|
| 88 |
+
continue;
|
| 89 |
+
|
| 90 |
+
p += 6;
|
| 91 |
+
while (IS_WS_HTML(*p)) p += 1;
|
| 92 |
+
|
| 93 |
+
if (*p != '=')
|
| 94 |
+
continue;
|
| 95 |
+
|
| 96 |
+
p += 1;
|
| 97 |
+
while (IS_WS_HTML(*p)) p += 1;
|
| 98 |
+
|
| 99 |
+
if (*p == 0)
|
| 100 |
+
return(0);
|
| 101 |
+
|
| 102 |
+
if ((*p == '"') || (*p == '\'')) {
|
| 103 |
+
int quote = *p;
|
| 104 |
+
|
| 105 |
+
p += 1;
|
| 106 |
+
while (IS_WS_HTML(*p)) p += 1;
|
| 107 |
+
|
| 108 |
+
start = p - val;
|
| 109 |
+
end = start;
|
| 110 |
+
|
| 111 |
+
while (*p != quote) {
|
| 112 |
+
if (*p == 0)
|
| 113 |
+
return(0);
|
| 114 |
+
if (!IS_WS_HTML(*p))
|
| 115 |
+
end = p + 1 - val;
|
| 116 |
+
p += 1;
|
| 117 |
+
}
|
| 118 |
+
} else {
|
| 119 |
+
start = p - val;
|
| 120 |
+
|
| 121 |
+
while ((*p != 0) && (*p != ';') && (!IS_WS_HTML(*p)))
|
| 122 |
+
p += 1;
|
| 123 |
+
|
| 124 |
+
end = p - val;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
off->start = start;
|
| 128 |
+
off->end = end;
|
| 129 |
+
off->size = p - val + strlen((char *) p);
|
| 130 |
+
|
| 131 |
+
return(1);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
return(0);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
static xmlAttrPtr
|
| 138 |
+
htmlFindMetaEncodingAttr(htmlNodePtr elem, int *outIsContentType) {
|
| 139 |
+
xmlAttrPtr attr, contentAttr = NULL;
|
| 140 |
+
int isContentType = 0;
|
| 141 |
+
|
| 142 |
+
if (xmlStrcasecmp(elem->name, BAD_CAST "meta") != 0)
|
| 143 |
+
return(NULL);
|
| 144 |
+
|
| 145 |
+
for (attr = elem->properties; attr != NULL; attr = attr->next) {
|
| 146 |
+
if (attr->ns != NULL)
|
| 147 |
+
continue;
|
| 148 |
+
if (xmlStrcasecmp(attr->name, BAD_CAST "charset") == 0) {
|
| 149 |
+
*outIsContentType = 0;
|
| 150 |
+
return(attr);
|
| 151 |
+
}
|
| 152 |
+
if (xmlStrcasecmp(attr->name, BAD_CAST "content") == 0)
|
| 153 |
+
contentAttr = attr;
|
| 154 |
+
if ((xmlStrcasecmp(attr->name, BAD_CAST "http-equiv") == 0) &&
|
| 155 |
+
(attr->children != NULL) &&
|
| 156 |
+
(attr->children->type == XML_TEXT_NODE) &&
|
| 157 |
+
(attr->children->next == NULL) &&
|
| 158 |
+
(xmlStrcasecmp(attr->children->content,
|
| 159 |
+
BAD_CAST "Content-Type") == 0))
|
| 160 |
+
isContentType = 1;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
if ((isContentType) && (contentAttr != NULL)) {
|
| 164 |
+
*outIsContentType = 1;
|
| 165 |
+
return(contentAttr);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
return(NULL);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
static int
|
| 172 |
+
htmlParseMetaEncoding(htmlNodePtr elem, htmlMetaEncoding *menc) {
|
| 173 |
+
xmlAttrPtr attr;
|
| 174 |
+
const xmlChar *val = NULL;
|
| 175 |
+
int isContentType;
|
| 176 |
+
|
| 177 |
+
if ((elem->type != XML_ELEMENT_NODE) ||
|
| 178 |
+
(xmlStrcasecmp(elem->name, BAD_CAST "meta") != 0))
|
| 179 |
+
return(0);
|
| 180 |
+
|
| 181 |
+
attr = htmlFindMetaEncodingAttr(elem, &isContentType);
|
| 182 |
+
if (attr == NULL)
|
| 183 |
+
return(0);
|
| 184 |
+
|
| 185 |
+
if ((attr->children != NULL) &&
|
| 186 |
+
(attr->children->type == XML_TEXT_NODE) &&
|
| 187 |
+
(attr->children->next == NULL) &&
|
| 188 |
+
(attr->children->content != NULL))
|
| 189 |
+
val = attr->children->content;
|
| 190 |
+
else
|
| 191 |
+
val = BAD_CAST "";
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
if (!isContentType) {
|
| 195 |
+
size_t size = strlen((char *) val);
|
| 196 |
+
size_t start = 0;
|
| 197 |
+
size_t end = size;
|
| 198 |
+
|
| 199 |
+
while ((start < size) && (IS_WS_HTML(val[start])))
|
| 200 |
+
start += 1;
|
| 201 |
+
|
| 202 |
+
while ((end > 0) && (IS_WS_HTML(val[end-1])))
|
| 203 |
+
end -= 1;
|
| 204 |
+
|
| 205 |
+
menc->attr = attr;
|
| 206 |
+
menc->attrValue = val;
|
| 207 |
+
menc->off.start = start;
|
| 208 |
+
menc->off.end = end;
|
| 209 |
+
menc->off.size = size;
|
| 210 |
+
|
| 211 |
+
return(1);
|
| 212 |
+
} else {
|
| 213 |
+
if (htmlParseContentType(val, &menc->off)) {
|
| 214 |
+
menc->attr = attr;
|
| 215 |
+
menc->attrValue = val;
|
| 216 |
+
|
| 217 |
+
return(1);
|
| 218 |
+
}
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
return(0);
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
static xmlChar *
|
| 225 |
+
htmlUpdateMetaEncoding(htmlMetaEncoding *menc, const char *encoding) {
|
| 226 |
+
xmlChar *newVal, *p;
|
| 227 |
+
size_t size, oldEncSize, newEncSize;
|
| 228 |
+
|
| 229 |
+
/*
|
| 230 |
+
* The pseudo "HTML" encoding only produces ASCII.
|
| 231 |
+
*/
|
| 232 |
+
if (xmlStrcasecmp(BAD_CAST encoding, BAD_CAST "HTML") == 0)
|
| 233 |
+
encoding = "ASCII";
|
| 234 |
+
|
| 235 |
+
oldEncSize = menc->off.end - menc->off.start;
|
| 236 |
+
newEncSize = strlen((char *) encoding);
|
| 237 |
+
size = menc->off.size - oldEncSize + newEncSize;
|
| 238 |
+
newVal = xmlMalloc(size + 1);
|
| 239 |
+
if (newVal == NULL)
|
| 240 |
+
return(NULL);
|
| 241 |
+
|
| 242 |
+
p = newVal;
|
| 243 |
+
memcpy(p, menc->attrValue, menc->off.start);
|
| 244 |
+
p += menc->off.start;
|
| 245 |
+
memcpy(p, encoding, newEncSize);
|
| 246 |
+
p += newEncSize;
|
| 247 |
+
memcpy(p, menc->attrValue + menc->off.end, menc->off.size - menc->off.end);
|
| 248 |
+
newVal[size] = 0;
|
| 249 |
+
|
| 250 |
+
return(newVal);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
/**
|
| 254 |
+
* Look up and encoding declaration in the meta tags.
|
| 255 |
+
*
|
| 256 |
+
* The returned string points into attribute content and can contain
|
| 257 |
+
* trailing garbage. It should be copied before modifying or freeing
|
| 258 |
+
* nodes.
|
| 259 |
+
*
|
| 260 |
+
* @param doc the document
|
| 261 |
+
* @returns the encoding ot NULL if not found.
|
| 262 |
+
*/
|
| 263 |
+
const xmlChar *
|
| 264 |
+
htmlGetMetaEncoding(xmlDoc *doc) {
|
| 265 |
+
htmlNodePtr head, node;
|
| 266 |
+
|
| 267 |
+
head = htmlFindHead(doc);
|
| 268 |
+
if (head == NULL)
|
| 269 |
+
return(NULL);
|
| 270 |
+
|
| 271 |
+
for (node = head->children; node != NULL; node = node->next) {
|
| 272 |
+
htmlMetaEncoding menc;
|
| 273 |
+
|
| 274 |
+
if (htmlParseMetaEncoding(node, &menc)) {
|
| 275 |
+
/*
|
| 276 |
+
* Returning a `const xmlChar *` only allows to return
|
| 277 |
+
* a suffix. In http-equiv meta tags, there could be
|
| 278 |
+
* more data after the charset, although it's probably
|
| 279 |
+
* rare in practice.
|
| 280 |
+
*/
|
| 281 |
+
return(menc.attrValue + menc.off.start);
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
return(NULL);
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
/**
|
| 289 |
+
* Creates or updates a meta tag with an encoding declaration.
|
| 290 |
+
*
|
| 291 |
+
* NOTE: This will not change the document content encoding.
|
| 292 |
+
*
|
| 293 |
+
* @param doc the document
|
| 294 |
+
* @param encoding the encoding string
|
| 295 |
+
* @returns 0 in case of success, 1 if no head element was found or
|
| 296 |
+
* arguments are invalid and -1 if memory allocation failed.
|
| 297 |
+
*/
|
| 298 |
+
int
|
| 299 |
+
htmlSetMetaEncoding(xmlDoc *doc, const xmlChar *encoding) {
|
| 300 |
+
htmlNodePtr head, meta;
|
| 301 |
+
int found = 0;
|
| 302 |
+
|
| 303 |
+
if (encoding == NULL)
|
| 304 |
+
return(1);
|
| 305 |
+
|
| 306 |
+
head = htmlFindHead(doc);
|
| 307 |
+
if (head == NULL)
|
| 308 |
+
return(1);
|
| 309 |
+
|
| 310 |
+
for (meta = head->children; meta != NULL; meta = meta->next) {
|
| 311 |
+
htmlMetaEncoding menc;
|
| 312 |
+
|
| 313 |
+
if (htmlParseMetaEncoding(meta, &menc)) {
|
| 314 |
+
xmlChar *newVal;
|
| 315 |
+
int ret;
|
| 316 |
+
|
| 317 |
+
found = 1;
|
| 318 |
+
|
| 319 |
+
newVal = htmlUpdateMetaEncoding(&menc, (char *) encoding);
|
| 320 |
+
if (newVal == NULL)
|
| 321 |
+
return(-1);
|
| 322 |
+
xmlNodeSetContent((xmlNodePtr) menc.attr, NULL);
|
| 323 |
+
ret = xmlNodeAddContent((xmlNodePtr) menc.attr, newVal);
|
| 324 |
+
xmlFree(newVal);
|
| 325 |
+
|
| 326 |
+
if (ret < 0)
|
| 327 |
+
return(-1);
|
| 328 |
+
}
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
if (found)
|
| 332 |
+
return(0);
|
| 333 |
+
|
| 334 |
+
meta = xmlNewDocNode(head->doc, NULL, BAD_CAST "meta", NULL);
|
| 335 |
+
if (meta == NULL)
|
| 336 |
+
return(-1);
|
| 337 |
+
|
| 338 |
+
if (xmlNewProp(meta, BAD_CAST "charset", encoding) == NULL) {
|
| 339 |
+
xmlFreeNode(meta);
|
| 340 |
+
return(-1);
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
if (head->children == NULL)
|
| 344 |
+
xmlAddChild(head, meta);
|
| 345 |
+
else
|
| 346 |
+
xmlAddPrevSibling(head->children, meta);
|
| 347 |
+
|
| 348 |
+
return(0);
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
/**
|
| 352 |
+
* Determine if a given attribute is a boolean attribute. This
|
| 353 |
+
* doesn't handle HTML5.
|
| 354 |
+
*
|
| 355 |
+
* @deprecated Internal function, don't use.
|
| 356 |
+
*
|
| 357 |
+
* @param name the name of the attribute to check
|
| 358 |
+
* @returns false if the attribute is not boolean, true otherwise.
|
| 359 |
+
*/
|
| 360 |
+
int
|
| 361 |
+
htmlIsBooleanAttr(const xmlChar *name)
|
| 362 |
+
{
|
| 363 |
+
const char *str = NULL;
|
| 364 |
+
|
| 365 |
+
if (name == NULL)
|
| 366 |
+
return(0);
|
| 367 |
+
|
| 368 |
+
/*
|
| 369 |
+
* These are the HTML attributes which will be output
|
| 370 |
+
* in minimized form, i.e. `<option selected="selected">` will be
|
| 371 |
+
* output as `<option selected>`, as per XSLT 1.0 16.2 "HTML Output
|
| 372 |
+
* Method":
|
| 373 |
+
*
|
| 374 |
+
* "checked", "compact", "declare", "defer", "disabled", "ismap",
|
| 375 |
+
* "multiple", "nohref", "noresize", "noshade", "nowrap", "readonly",
|
| 376 |
+
* "selected"
|
| 377 |
+
*
|
| 378 |
+
* Additional attributes from HTML5 (not implemented yet):
|
| 379 |
+
*
|
| 380 |
+
* "allowfullscreen", "alpha", "async", "autofocus", "autoplay",
|
| 381 |
+
* "controls", "default", "formnovalidate", "inert", "itemscope",
|
| 382 |
+
* "loop", "muted", "nomodule", "novalidate", "open", "playsinline",
|
| 383 |
+
* "required", "reversed", "shadowrootdelegatesfocus",
|
| 384 |
+
* "shadowrootclonable", "shadowrootserializable",
|
| 385 |
+
* "shadowrootcustomelementregistry", "truespeed"
|
| 386 |
+
*/
|
| 387 |
+
|
| 388 |
+
switch (name[0] | 0x20) {
|
| 389 |
+
case 'c':
|
| 390 |
+
name += 1;
|
| 391 |
+
switch (name[0] | 0x20) {
|
| 392 |
+
case 'h': str = "ecked"; break;
|
| 393 |
+
case 'o': str = "mpact"; break;
|
| 394 |
+
}
|
| 395 |
+
break;
|
| 396 |
+
case 'd':
|
| 397 |
+
name += 1;
|
| 398 |
+
switch (name[0] | 0x20) {
|
| 399 |
+
case 'e':
|
| 400 |
+
name += 1;
|
| 401 |
+
switch (name[0] | 0x20) {
|
| 402 |
+
case 'c': str = "lare"; break;
|
| 403 |
+
case 'f': str = "er"; break;
|
| 404 |
+
}
|
| 405 |
+
break;
|
| 406 |
+
case 'i': str = "sabled"; break;
|
| 407 |
+
}
|
| 408 |
+
break;
|
| 409 |
+
case 'i':
|
| 410 |
+
str = "smap";
|
| 411 |
+
break;
|
| 412 |
+
case 'm':
|
| 413 |
+
str = "ultiple";
|
| 414 |
+
break;
|
| 415 |
+
case 'n':
|
| 416 |
+
name += 1;
|
| 417 |
+
if ((name[0] | 0x20) != 'o')
|
| 418 |
+
break;
|
| 419 |
+
name += 1;
|
| 420 |
+
switch (name[0] | 0x20) {
|
| 421 |
+
case 'h': str = "ref"; break;
|
| 422 |
+
case 'r': str = "esize"; break;
|
| 423 |
+
case 's': str = "hade"; break;
|
| 424 |
+
case 'w': str = "rap"; break;
|
| 425 |
+
}
|
| 426 |
+
break;
|
| 427 |
+
case 'r':
|
| 428 |
+
str = "eadonly";
|
| 429 |
+
break;
|
| 430 |
+
case 's':
|
| 431 |
+
str = "elected";
|
| 432 |
+
break;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
if (str == NULL)
|
| 436 |
+
return(0);
|
| 437 |
+
|
| 438 |
+
return(xmlStrcasecmp(name + 1, BAD_CAST str) == 0);
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
| 442 |
+
/************************************************************************
|
| 443 |
+
* *
|
| 444 |
+
* Dumping HTML tree content to a simple buffer *
|
| 445 |
+
* *
|
| 446 |
+
************************************************************************/
|
| 447 |
+
|
| 448 |
+
static xmlParserErrors
|
| 449 |
+
htmlFindOutputEncoder(const char *encoding, xmlCharEncodingHandler **out) {
|
| 450 |
+
/*
|
| 451 |
+
* Fallback to HTML if the encoding is unspecified
|
| 452 |
+
*/
|
| 453 |
+
if (encoding == NULL)
|
| 454 |
+
encoding = "HTML";
|
| 455 |
+
|
| 456 |
+
return(xmlOpenCharEncodingHandler(encoding, /* output */ 1, out));
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
/**
|
| 460 |
+
* Serialize an HTML document to an xmlBuf.
|
| 461 |
+
*
|
| 462 |
+
* @param buf the xmlBuf output
|
| 463 |
+
* @param doc the document (unused)
|
| 464 |
+
* @param cur the current node
|
| 465 |
+
* @param format should formatting newlines been added
|
| 466 |
+
* @returns the number of bytes written or -1 in case of error
|
| 467 |
+
*/
|
| 468 |
+
static size_t
|
| 469 |
+
htmlBufNodeDumpFormat(xmlBufPtr buf, xmlDocPtr doc ATTRIBUTE_UNUSED,
|
| 470 |
+
xmlNodePtr cur, int format) {
|
| 471 |
+
size_t use;
|
| 472 |
+
size_t ret;
|
| 473 |
+
xmlOutputBufferPtr outbuf;
|
| 474 |
+
|
| 475 |
+
if (cur == NULL) {
|
| 476 |
+
return ((size_t) -1);
|
| 477 |
+
}
|
| 478 |
+
if (buf == NULL) {
|
| 479 |
+
return ((size_t) -1);
|
| 480 |
+
}
|
| 481 |
+
outbuf = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer));
|
| 482 |
+
if (outbuf == NULL)
|
| 483 |
+
return ((size_t) -1);
|
| 484 |
+
memset(outbuf, 0, sizeof(xmlOutputBuffer));
|
| 485 |
+
outbuf->buffer = buf;
|
| 486 |
+
outbuf->encoder = NULL;
|
| 487 |
+
outbuf->writecallback = NULL;
|
| 488 |
+
outbuf->closecallback = NULL;
|
| 489 |
+
outbuf->context = NULL;
|
| 490 |
+
outbuf->written = 0;
|
| 491 |
+
|
| 492 |
+
use = xmlBufUse(buf);
|
| 493 |
+
htmlNodeDumpInternal(outbuf, cur, NULL, format);
|
| 494 |
+
if (outbuf->error)
|
| 495 |
+
ret = (size_t) -1;
|
| 496 |
+
else
|
| 497 |
+
ret = xmlBufUse(buf) - use;
|
| 498 |
+
xmlFree(outbuf);
|
| 499 |
+
return (ret);
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
/**
|
| 503 |
+
* Serialize an HTML node to an xmlBuffer. Always uses UTF-8.
|
| 504 |
+
*
|
| 505 |
+
* @param buf the HTML buffer output
|
| 506 |
+
* @param doc the document
|
| 507 |
+
* @param cur the current node
|
| 508 |
+
* @returns the number of bytes written or -1 in case of error
|
| 509 |
+
*/
|
| 510 |
+
int
|
| 511 |
+
htmlNodeDump(xmlBuffer *buf, xmlDoc *doc, xmlNode *cur) {
|
| 512 |
+
xmlBufPtr buffer;
|
| 513 |
+
size_t ret1;
|
| 514 |
+
int ret2;
|
| 515 |
+
|
| 516 |
+
if ((buf == NULL) || (cur == NULL))
|
| 517 |
+
return(-1);
|
| 518 |
+
|
| 519 |
+
xmlInitParser();
|
| 520 |
+
buffer = xmlBufFromBuffer(buf);
|
| 521 |
+
if (buffer == NULL)
|
| 522 |
+
return(-1);
|
| 523 |
+
|
| 524 |
+
ret1 = htmlBufNodeDumpFormat(buffer, doc, cur, 1);
|
| 525 |
+
|
| 526 |
+
ret2 = xmlBufBackToBuffer(buffer, buf);
|
| 527 |
+
|
| 528 |
+
if ((ret1 == (size_t) -1) || (ret2 < 0))
|
| 529 |
+
return(-1);
|
| 530 |
+
return(ret1 > INT_MAX ? INT_MAX : ret1);
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
/**
|
| 534 |
+
* Serialize an HTML node to an xmlBuffer.
|
| 535 |
+
*
|
| 536 |
+
* If encoding is NULL, ASCII with HTML 4.0 named character entities
|
| 537 |
+
* will be used. This is inefficient compared to UTF-8 and might be
|
| 538 |
+
* changed in a future version.
|
| 539 |
+
*
|
| 540 |
+
* @param out the FILE pointer
|
| 541 |
+
* @param doc the document (unused)
|
| 542 |
+
* @param cur the current node
|
| 543 |
+
* @param encoding the document encoding (optional)
|
| 544 |
+
* @param format should formatting newlines been added
|
| 545 |
+
* @returns the number of bytes written or -1 in case of failure.
|
| 546 |
+
*/
|
| 547 |
+
int
|
| 548 |
+
htmlNodeDumpFileFormat(FILE *out, xmlDoc *doc ATTRIBUTE_UNUSED,
|
| 549 |
+
xmlNode *cur, const char *encoding, int format) {
|
| 550 |
+
xmlOutputBufferPtr buf;
|
| 551 |
+
xmlCharEncodingHandlerPtr handler;
|
| 552 |
+
int ret;
|
| 553 |
+
|
| 554 |
+
xmlInitParser();
|
| 555 |
+
|
| 556 |
+
/*
|
| 557 |
+
* save the content to a temp buffer.
|
| 558 |
+
*/
|
| 559 |
+
if (htmlFindOutputEncoder(encoding, &handler) != XML_ERR_OK)
|
| 560 |
+
return(-1);
|
| 561 |
+
buf = xmlOutputBufferCreateFile(out, handler);
|
| 562 |
+
if (buf == NULL) {
|
| 563 |
+
xmlCharEncCloseFunc(handler);
|
| 564 |
+
return(-1);
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
htmlNodeDumpInternal(buf, cur, NULL, format);
|
| 568 |
+
|
| 569 |
+
ret = xmlOutputBufferClose(buf);
|
| 570 |
+
return(ret);
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
/**
|
| 574 |
+
* Same as #htmlNodeDumpFileFormat with `format` set to 1 which is
|
| 575 |
+
* typically undesired. Use of this function is DISCOURAGED in favor
|
| 576 |
+
* of #htmlNodeDumpFileFormat.
|
| 577 |
+
*
|
| 578 |
+
* @param out the FILE pointer
|
| 579 |
+
* @param doc the document
|
| 580 |
+
* @param cur the current node
|
| 581 |
+
*/
|
| 582 |
+
void
|
| 583 |
+
htmlNodeDumpFile(FILE *out, xmlDoc *doc, xmlNode *cur) {
|
| 584 |
+
htmlNodeDumpFileFormat(out, doc, cur, NULL, 1);
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
/**
|
| 588 |
+
* Serialize an HTML node to a memory, also returning the size of
|
| 589 |
+
* the result. It's up to the caller to free the memory.
|
| 590 |
+
*
|
| 591 |
+
* Uses the encoding of the document. If the document has no
|
| 592 |
+
* encoding, ASCII with HTML 4.0 named character entities will
|
| 593 |
+
* be used. This is inefficient compared to UTF-8 and might be
|
| 594 |
+
* changed in a future version.
|
| 595 |
+
*
|
| 596 |
+
* @param cur the document
|
| 597 |
+
* @param mem OUT: the memory pointer
|
| 598 |
+
* @param size OUT: the memory length
|
| 599 |
+
* @param format should formatting newlines been added
|
| 600 |
+
*/
|
| 601 |
+
void
|
| 602 |
+
htmlDocDumpMemoryFormat(xmlDoc *cur, xmlChar**mem, int *size, int format) {
|
| 603 |
+
xmlOutputBufferPtr buf;
|
| 604 |
+
xmlCharEncodingHandlerPtr handler = NULL;
|
| 605 |
+
|
| 606 |
+
xmlInitParser();
|
| 607 |
+
|
| 608 |
+
if ((mem == NULL) || (size == NULL))
|
| 609 |
+
return;
|
| 610 |
+
*mem = NULL;
|
| 611 |
+
*size = 0;
|
| 612 |
+
if (cur == NULL)
|
| 613 |
+
return;
|
| 614 |
+
|
| 615 |
+
if (htmlFindOutputEncoder((char *) cur->encoding, &handler) != XML_ERR_OK)
|
| 616 |
+
return;
|
| 617 |
+
buf = xmlAllocOutputBuffer(handler);
|
| 618 |
+
if (buf == NULL) {
|
| 619 |
+
xmlCharEncCloseFunc(handler);
|
| 620 |
+
return;
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
htmlDocContentDumpFormatOutput(buf, cur, NULL, format);
|
| 624 |
+
|
| 625 |
+
xmlOutputBufferFlush(buf);
|
| 626 |
+
|
| 627 |
+
if (!buf->error) {
|
| 628 |
+
if (buf->conv != NULL) {
|
| 629 |
+
*size = xmlBufUse(buf->conv);
|
| 630 |
+
*mem = xmlStrndup(xmlBufContent(buf->conv), *size);
|
| 631 |
+
} else {
|
| 632 |
+
*size = xmlBufUse(buf->buffer);
|
| 633 |
+
*mem = xmlStrndup(xmlBufContent(buf->buffer), *size);
|
| 634 |
+
}
|
| 635 |
+
}
|
| 636 |
+
|
| 637 |
+
xmlOutputBufferClose(buf);
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
/**
|
| 641 |
+
* Same as #htmlDocDumpMemoryFormat with `format` set to 1 which
|
| 642 |
+
* is typically undesired. Also see the warnings there. Use of
|
| 643 |
+
* this function is DISCOURAGED in favor of
|
| 644 |
+
* #htmlDocContentDumpFormatOutput.
|
| 645 |
+
*
|
| 646 |
+
* @param cur the document
|
| 647 |
+
* @param mem OUT: the memory pointer
|
| 648 |
+
* @param size OUT: the memory length
|
| 649 |
+
*/
|
| 650 |
+
void
|
| 651 |
+
htmlDocDumpMemory(xmlDoc *cur, xmlChar**mem, int *size) {
|
| 652 |
+
htmlDocDumpMemoryFormat(cur, mem, size, 1);
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
|
| 656 |
+
/************************************************************************
|
| 657 |
+
* *
|
| 658 |
+
* Dumping HTML tree content to an I/O output buffer *
|
| 659 |
+
* *
|
| 660 |
+
************************************************************************/
|
| 661 |
+
|
| 662 |
+
/**
|
| 663 |
+
* Serialize the HTML document's DTD, if any.
|
| 664 |
+
*
|
| 665 |
+
* Ignores `encoding` and uses the encoding of the output buffer.
|
| 666 |
+
*
|
| 667 |
+
* @param buf the HTML buffer output
|
| 668 |
+
* @param doc the document
|
| 669 |
+
* @param encoding the encoding string (unused)
|
| 670 |
+
*/
|
| 671 |
+
static void
|
| 672 |
+
htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
| 673 |
+
const char *encoding ATTRIBUTE_UNUSED) {
|
| 674 |
+
xmlDtdPtr cur = doc->intSubset;
|
| 675 |
+
|
| 676 |
+
if (cur == NULL)
|
| 677 |
+
return;
|
| 678 |
+
xmlOutputBufferWrite(buf, 10, "<!DOCTYPE ");
|
| 679 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->name);
|
| 680 |
+
if (cur->ExternalID != NULL) {
|
| 681 |
+
xmlOutputBufferWrite(buf, 8, " PUBLIC ");
|
| 682 |
+
xmlOutputBufferWriteQuotedString(buf, cur->ExternalID);
|
| 683 |
+
if (cur->SystemID != NULL) {
|
| 684 |
+
xmlOutputBufferWrite(buf, 1, " ");
|
| 685 |
+
xmlOutputBufferWriteQuotedString(buf, cur->SystemID);
|
| 686 |
+
}
|
| 687 |
+
} else if (cur->SystemID != NULL &&
|
| 688 |
+
xmlStrcmp(cur->SystemID, BAD_CAST "about:legacy-compat")) {
|
| 689 |
+
xmlOutputBufferWrite(buf, 8, " SYSTEM ");
|
| 690 |
+
xmlOutputBufferWriteQuotedString(buf, cur->SystemID);
|
| 691 |
+
}
|
| 692 |
+
xmlOutputBufferWrite(buf, 2, ">\n");
|
| 693 |
+
}
|
| 694 |
+
|
| 695 |
+
static void
|
| 696 |
+
htmlSerializeUri(xmlOutputBufferPtr buf, const xmlChar *content) {
|
| 697 |
+
const xmlChar *tmp = content;
|
| 698 |
+
|
| 699 |
+
/*
|
| 700 |
+
* See appendix "B.2.1 Non-ASCII characters in URI attribute
|
| 701 |
+
* values" in the HTML 4.01 spec. This is also recommended
|
| 702 |
+
* by the HTML output method of the XSLT 1.0 spec.
|
| 703 |
+
*
|
| 704 |
+
* We also escape space and control chars.
|
| 705 |
+
*/
|
| 706 |
+
|
| 707 |
+
/* Skip over initial whitespace */
|
| 708 |
+
while (IS_WS_HTML(*tmp)) tmp++;
|
| 709 |
+
if (tmp > content) {
|
| 710 |
+
xmlOutputBufferWrite(buf, tmp - content, (char *) content);
|
| 711 |
+
content = tmp;
|
| 712 |
+
}
|
| 713 |
+
|
| 714 |
+
while (1) {
|
| 715 |
+
char escbuf[3];
|
| 716 |
+
const char *repl;
|
| 717 |
+
int replSize;
|
| 718 |
+
int c = *tmp;
|
| 719 |
+
|
| 720 |
+
while ((c > 0x20) && (c < 0x7F) && (c != '"') && (c != '&')) {
|
| 721 |
+
tmp += 1;
|
| 722 |
+
c = *tmp;
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
if (tmp > content)
|
| 726 |
+
xmlOutputBufferWrite(buf, tmp - content, (char *) content);
|
| 727 |
+
|
| 728 |
+
if ((c <= 0x20) || (c >= 0x7F)) {
|
| 729 |
+
static const char hex[16] = {
|
| 730 |
+
'0', '1', '2', '3', '4', '5', '6', '7',
|
| 731 |
+
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
| 732 |
+
};
|
| 733 |
+
|
| 734 |
+
if (c == 0)
|
| 735 |
+
break;
|
| 736 |
+
|
| 737 |
+
escbuf[0] = '%';
|
| 738 |
+
escbuf[1] = hex[(c >> 4) & 0x0F];
|
| 739 |
+
escbuf[2] = hex[c & 0x0F];
|
| 740 |
+
repl = escbuf;
|
| 741 |
+
replSize = 3;
|
| 742 |
+
} else if (c == '"') {
|
| 743 |
+
repl = """;
|
| 744 |
+
replSize = 6;
|
| 745 |
+
} else {
|
| 746 |
+
repl = "&";
|
| 747 |
+
replSize = 5;
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
xmlOutputBufferWrite(buf, replSize, repl);
|
| 751 |
+
tmp += 1;
|
| 752 |
+
content = tmp;
|
| 753 |
+
}
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
/**
|
| 757 |
+
* Serialize an HTML attribute.
|
| 758 |
+
*
|
| 759 |
+
* @param buf the HTML buffer output
|
| 760 |
+
* @param cur the attribute pointer
|
| 761 |
+
*/
|
| 762 |
+
static void
|
| 763 |
+
htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlAttrPtr cur) {
|
| 764 |
+
xmlOutputBufferWrite(buf, 1, " ");
|
| 765 |
+
|
| 766 |
+
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
|
| 767 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
|
| 768 |
+
xmlOutputBufferWrite(buf, 1, ":");
|
| 769 |
+
}
|
| 770 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->name);
|
| 771 |
+
|
| 772 |
+
/*
|
| 773 |
+
* The HTML5 spec requires to always serialize empty attribute
|
| 774 |
+
* values as `=""`. We should probably align with HTML5 at some
|
| 775 |
+
* point.
|
| 776 |
+
*/
|
| 777 |
+
if ((cur->children != NULL) && (!htmlIsBooleanAttr(cur->name))) {
|
| 778 |
+
xmlNodePtr child;
|
| 779 |
+
int isUri;
|
| 780 |
+
|
| 781 |
+
xmlOutputBufferWrite(buf, 2, "=\"");
|
| 782 |
+
|
| 783 |
+
/*
|
| 784 |
+
* Special handling of URIs doesn't conform to HTML5 and
|
| 785 |
+
* should probably be removed at some point.
|
| 786 |
+
*/
|
| 787 |
+
isUri = (cur->ns == NULL) && (cur->parent != NULL) &&
|
| 788 |
+
(cur->parent->ns == NULL) &&
|
| 789 |
+
((!xmlStrcasecmp(cur->name, BAD_CAST "href")) ||
|
| 790 |
+
(!xmlStrcasecmp(cur->name, BAD_CAST "action")) ||
|
| 791 |
+
(!xmlStrcasecmp(cur->name, BAD_CAST "src")) ||
|
| 792 |
+
((!xmlStrcasecmp(cur->name, BAD_CAST "name")) &&
|
| 793 |
+
(!xmlStrcasecmp(cur->parent->name, BAD_CAST "a"))));
|
| 794 |
+
|
| 795 |
+
for (child = cur->children; child != NULL; child = child->next) {
|
| 796 |
+
if (child->type == XML_TEXT_NODE) {
|
| 797 |
+
const xmlChar *content = child->content;
|
| 798 |
+
|
| 799 |
+
if (content == NULL)
|
| 800 |
+
continue;
|
| 801 |
+
|
| 802 |
+
if (isUri) {
|
| 803 |
+
htmlSerializeUri(buf, content);
|
| 804 |
+
} else {
|
| 805 |
+
xmlSerializeText(buf, content, SIZE_MAX,
|
| 806 |
+
XML_ESCAPE_HTML | XML_ESCAPE_ATTR);
|
| 807 |
+
}
|
| 808 |
+
} else if (child->type == XML_ENTITY_REF_NODE) {
|
| 809 |
+
/* TODO: We should probably expand entity refs */
|
| 810 |
+
xmlOutputBufferWrite(buf, 1, "&");
|
| 811 |
+
xmlOutputBufferWriteString(buf, (char *) child->name);
|
| 812 |
+
xmlOutputBufferWrite(buf, 1, ";");
|
| 813 |
+
}
|
| 814 |
+
}
|
| 815 |
+
|
| 816 |
+
xmlOutputBufferWrite(buf, 1, "\"");
|
| 817 |
+
}
|
| 818 |
+
}
|
| 819 |
+
|
| 820 |
+
/**
|
| 821 |
+
* Serialize an HTML node to an output buffer.
|
| 822 |
+
*
|
| 823 |
+
* If `encoding` is specified, it is used to create or update meta
|
| 824 |
+
* tags containing the character encoding.
|
| 825 |
+
*
|
| 826 |
+
* @param buf the HTML buffer output
|
| 827 |
+
* @param cur the current node
|
| 828 |
+
* @param encoding the encoding string (optional)
|
| 829 |
+
* @param format should formatting newlines been added
|
| 830 |
+
*/
|
| 831 |
+
void
|
| 832 |
+
htmlNodeDumpInternal(xmlOutputBuffer *buf, xmlNode *cur,
|
| 833 |
+
const char *encoding, int format) {
|
| 834 |
+
xmlNodePtr root, parent, metaHead = NULL;
|
| 835 |
+
xmlAttrPtr attr;
|
| 836 |
+
const htmlElemDesc * info;
|
| 837 |
+
int isRaw = 0;
|
| 838 |
+
|
| 839 |
+
xmlInitParser();
|
| 840 |
+
|
| 841 |
+
if ((cur == NULL) || (buf == NULL)) {
|
| 842 |
+
return;
|
| 843 |
+
}
|
| 844 |
+
|
| 845 |
+
root = cur;
|
| 846 |
+
parent = cur->parent;
|
| 847 |
+
while (1) {
|
| 848 |
+
switch (cur->type) {
|
| 849 |
+
case XML_HTML_DOCUMENT_NODE:
|
| 850 |
+
case XML_DOCUMENT_NODE:
|
| 851 |
+
if (((xmlDocPtr) cur)->intSubset != NULL) {
|
| 852 |
+
htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
|
| 853 |
+
}
|
| 854 |
+
if (cur->children != NULL) {
|
| 855 |
+
/* Always validate cur->parent when descending. */
|
| 856 |
+
if (cur->parent == parent) {
|
| 857 |
+
parent = cur;
|
| 858 |
+
cur = cur->children;
|
| 859 |
+
continue;
|
| 860 |
+
}
|
| 861 |
+
} else {
|
| 862 |
+
xmlOutputBufferWrite(buf, 1, "\n");
|
| 863 |
+
}
|
| 864 |
+
break;
|
| 865 |
+
|
| 866 |
+
case XML_ELEMENT_NODE: {
|
| 867 |
+
htmlMetaEncoding menc;
|
| 868 |
+
int isMeta = 0;
|
| 869 |
+
int addMeta = 0;
|
| 870 |
+
|
| 871 |
+
/*
|
| 872 |
+
* Some users like lxml are known to pass nodes with a corrupted
|
| 873 |
+
* tree structure. Fall back to a recursive call to handle this
|
| 874 |
+
* case.
|
| 875 |
+
*/
|
| 876 |
+
if ((cur->parent != parent) && (cur->children != NULL)) {
|
| 877 |
+
htmlNodeDumpInternal(buf, cur, encoding, format);
|
| 878 |
+
break;
|
| 879 |
+
}
|
| 880 |
+
|
| 881 |
+
/*
|
| 882 |
+
* Get specific HTML info for that node.
|
| 883 |
+
*/
|
| 884 |
+
if (cur->ns == NULL)
|
| 885 |
+
info = htmlTagLookup(cur->name);
|
| 886 |
+
else
|
| 887 |
+
info = NULL;
|
| 888 |
+
|
| 889 |
+
if (encoding != NULL) {
|
| 890 |
+
isMeta = htmlParseMetaEncoding(cur, &menc);
|
| 891 |
+
|
| 892 |
+
/*
|
| 893 |
+
* Don't add meta tag for "HTML" encoding.
|
| 894 |
+
*/
|
| 895 |
+
if ((xmlStrcasecmp(BAD_CAST encoding,
|
| 896 |
+
BAD_CAST "HTML") != 0) &&
|
| 897 |
+
(xmlStrcasecmp(cur->name, BAD_CAST "head") == 0) &&
|
| 898 |
+
(parent != NULL) &&
|
| 899 |
+
(xmlStrcasecmp(parent->name, BAD_CAST "html") == 0) &&
|
| 900 |
+
(parent->parent != NULL) &&
|
| 901 |
+
(parent->parent->parent == NULL) &&
|
| 902 |
+
(metaHead == NULL)) {
|
| 903 |
+
xmlNodePtr n;
|
| 904 |
+
|
| 905 |
+
metaHead = cur;
|
| 906 |
+
addMeta = 1;
|
| 907 |
+
|
| 908 |
+
for (n = cur->children; n != NULL; n = n->next) {
|
| 909 |
+
int unused;
|
| 910 |
+
|
| 911 |
+
if (htmlFindMetaEncodingAttr(n, &unused) != NULL) {
|
| 912 |
+
metaHead = NULL;
|
| 913 |
+
addMeta = 0;
|
| 914 |
+
break;
|
| 915 |
+
}
|
| 916 |
+
}
|
| 917 |
+
}
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
xmlOutputBufferWrite(buf, 1, "<");
|
| 921 |
+
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
|
| 922 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
|
| 923 |
+
xmlOutputBufferWrite(buf, 1, ":");
|
| 924 |
+
}
|
| 925 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->name);
|
| 926 |
+
if (cur->nsDef)
|
| 927 |
+
xmlNsListDumpOutput(buf, cur->nsDef);
|
| 928 |
+
attr = cur->properties;
|
| 929 |
+
while (attr != NULL) {
|
| 930 |
+
if ((!isMeta) || (attr != menc.attr)) {
|
| 931 |
+
htmlAttrDumpOutput(buf, attr);
|
| 932 |
+
} else {
|
| 933 |
+
xmlOutputBufferWrite(buf, 1, " ");
|
| 934 |
+
xmlOutputBufferWriteString(buf, (char *) attr->name);
|
| 935 |
+
|
| 936 |
+
xmlOutputBufferWrite(buf, 2, "=\"");
|
| 937 |
+
xmlSerializeText(buf, menc.attrValue, menc.off.start,
|
| 938 |
+
XML_ESCAPE_HTML | XML_ESCAPE_ATTR);
|
| 939 |
+
xmlSerializeText(buf, BAD_CAST encoding, SIZE_MAX,
|
| 940 |
+
XML_ESCAPE_HTML | XML_ESCAPE_ATTR);
|
| 941 |
+
xmlSerializeText(buf, menc.attrValue + menc.off.end,
|
| 942 |
+
menc.off.size - menc.off.end,
|
| 943 |
+
XML_ESCAPE_HTML | XML_ESCAPE_ATTR);
|
| 944 |
+
xmlOutputBufferWrite(buf, 1, "\"");
|
| 945 |
+
}
|
| 946 |
+
attr = attr->next;
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
if ((info != NULL) && (info->empty)) {
|
| 950 |
+
xmlOutputBufferWrite(buf, 1, ">");
|
| 951 |
+
} else if (cur->children == NULL) {
|
| 952 |
+
if (addMeta) {
|
| 953 |
+
xmlOutputBufferWrite(buf, 16, "><meta charset=\"");
|
| 954 |
+
xmlSerializeText(buf, BAD_CAST encoding, SIZE_MAX,
|
| 955 |
+
XML_ESCAPE_HTML | XML_ESCAPE_ATTR);
|
| 956 |
+
xmlOutputBufferWrite(buf, 4, "\"></");
|
| 957 |
+
} else {
|
| 958 |
+
xmlOutputBufferWrite(buf, 3, "></");
|
| 959 |
+
}
|
| 960 |
+
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
|
| 961 |
+
xmlOutputBufferWriteString(buf,
|
| 962 |
+
(const char *)cur->ns->prefix);
|
| 963 |
+
xmlOutputBufferWrite(buf, 1, ":");
|
| 964 |
+
}
|
| 965 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->name);
|
| 966 |
+
xmlOutputBufferWrite(buf, 1, ">");
|
| 967 |
+
} else {
|
| 968 |
+
xmlOutputBufferWrite(buf, 1, ">");
|
| 969 |
+
if ((format) &&
|
| 970 |
+
((addMeta) ||
|
| 971 |
+
((info != NULL) && (!info->isinline) &&
|
| 972 |
+
(cur->children->type != HTML_TEXT_NODE) &&
|
| 973 |
+
(cur->children->type != HTML_ENTITY_REF_NODE) &&
|
| 974 |
+
(cur->children != cur->last) &&
|
| 975 |
+
(cur->name != NULL) &&
|
| 976 |
+
(cur->name[0] != 'p')))) /* p, pre, param */
|
| 977 |
+
xmlOutputBufferWrite(buf, 1, "\n");
|
| 978 |
+
if (addMeta) {
|
| 979 |
+
xmlOutputBufferWrite(buf, 15, "<meta charset=\"");
|
| 980 |
+
xmlSerializeText(buf, BAD_CAST encoding, SIZE_MAX,
|
| 981 |
+
XML_ESCAPE_HTML | XML_ESCAPE_ATTR);
|
| 982 |
+
xmlOutputBufferWrite(buf, 2, "\">");
|
| 983 |
+
if ((format) &&
|
| 984 |
+
(cur->children->type != HTML_TEXT_NODE) &&
|
| 985 |
+
(cur->children->type != HTML_ENTITY_REF_NODE))
|
| 986 |
+
xmlOutputBufferWrite(buf, 1, "\n");
|
| 987 |
+
}
|
| 988 |
+
|
| 989 |
+
if ((info != NULL) && (info->dataMode >= DATA_RAWTEXT))
|
| 990 |
+
isRaw = 1;
|
| 991 |
+
|
| 992 |
+
parent = cur;
|
| 993 |
+
cur = cur->children;
|
| 994 |
+
continue;
|
| 995 |
+
}
|
| 996 |
+
|
| 997 |
+
if ((format) && (cur->next != NULL) &&
|
| 998 |
+
(info != NULL) && (!info->isinline)) {
|
| 999 |
+
if ((cur->next->type != HTML_TEXT_NODE) &&
|
| 1000 |
+
(cur->next->type != HTML_ENTITY_REF_NODE) &&
|
| 1001 |
+
(parent != NULL) &&
|
| 1002 |
+
(parent->name != NULL) &&
|
| 1003 |
+
(parent->name[0] != 'p')) /* p, pre, param */
|
| 1004 |
+
xmlOutputBufferWrite(buf, 1, "\n");
|
| 1005 |
+
}
|
| 1006 |
+
|
| 1007 |
+
break;
|
| 1008 |
+
}
|
| 1009 |
+
|
| 1010 |
+
case XML_ATTRIBUTE_NODE:
|
| 1011 |
+
htmlAttrDumpOutput(buf, (xmlAttrPtr) cur);
|
| 1012 |
+
break;
|
| 1013 |
+
|
| 1014 |
+
case HTML_TEXT_NODE:
|
| 1015 |
+
if (cur->content == NULL)
|
| 1016 |
+
break;
|
| 1017 |
+
if ((cur->name == (const xmlChar *)xmlStringTextNoenc) ||
|
| 1018 |
+
(isRaw)) {
|
| 1019 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->content);
|
| 1020 |
+
} else {
|
| 1021 |
+
xmlSerializeText(buf, cur->content, SIZE_MAX, XML_ESCAPE_HTML);
|
| 1022 |
+
}
|
| 1023 |
+
break;
|
| 1024 |
+
|
| 1025 |
+
case HTML_COMMENT_NODE:
|
| 1026 |
+
if (cur->content != NULL) {
|
| 1027 |
+
xmlOutputBufferWrite(buf, 4, "<!--");
|
| 1028 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->content);
|
| 1029 |
+
xmlOutputBufferWrite(buf, 3, "-->");
|
| 1030 |
+
}
|
| 1031 |
+
break;
|
| 1032 |
+
|
| 1033 |
+
case HTML_PI_NODE:
|
| 1034 |
+
if (cur->name != NULL) {
|
| 1035 |
+
xmlOutputBufferWrite(buf, 2, "<?");
|
| 1036 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->name);
|
| 1037 |
+
if (cur->content != NULL) {
|
| 1038 |
+
xmlOutputBufferWrite(buf, 1, " ");
|
| 1039 |
+
xmlOutputBufferWriteString(buf,
|
| 1040 |
+
(const char *)cur->content);
|
| 1041 |
+
}
|
| 1042 |
+
xmlOutputBufferWrite(buf, 1, ">");
|
| 1043 |
+
}
|
| 1044 |
+
break;
|
| 1045 |
+
|
| 1046 |
+
case HTML_ENTITY_REF_NODE:
|
| 1047 |
+
xmlOutputBufferWrite(buf, 1, "&");
|
| 1048 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->name);
|
| 1049 |
+
xmlOutputBufferWrite(buf, 1, ";");
|
| 1050 |
+
break;
|
| 1051 |
+
|
| 1052 |
+
case HTML_PRESERVE_NODE:
|
| 1053 |
+
if (cur->content != NULL) {
|
| 1054 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->content);
|
| 1055 |
+
}
|
| 1056 |
+
break;
|
| 1057 |
+
|
| 1058 |
+
default:
|
| 1059 |
+
break;
|
| 1060 |
+
}
|
| 1061 |
+
|
| 1062 |
+
while (1) {
|
| 1063 |
+
if (cur == root)
|
| 1064 |
+
return;
|
| 1065 |
+
if (cur->next != NULL) {
|
| 1066 |
+
cur = cur->next;
|
| 1067 |
+
break;
|
| 1068 |
+
}
|
| 1069 |
+
|
| 1070 |
+
isRaw = 0;
|
| 1071 |
+
|
| 1072 |
+
cur = parent;
|
| 1073 |
+
/* cur->parent was validated when descending. */
|
| 1074 |
+
parent = cur->parent;
|
| 1075 |
+
|
| 1076 |
+
if ((cur->type == XML_HTML_DOCUMENT_NODE) ||
|
| 1077 |
+
(cur->type == XML_DOCUMENT_NODE)) {
|
| 1078 |
+
xmlOutputBufferWrite(buf, 1, "\n");
|
| 1079 |
+
} else {
|
| 1080 |
+
if ((format) && (cur->ns == NULL))
|
| 1081 |
+
info = htmlTagLookup(cur->name);
|
| 1082 |
+
else
|
| 1083 |
+
info = NULL;
|
| 1084 |
+
|
| 1085 |
+
if ((format) && (info != NULL) && (!info->isinline) &&
|
| 1086 |
+
(cur->last->type != HTML_TEXT_NODE) &&
|
| 1087 |
+
(cur->last->type != HTML_ENTITY_REF_NODE) &&
|
| 1088 |
+
((cur->children != cur->last) || (cur == metaHead)) &&
|
| 1089 |
+
(cur->name != NULL) &&
|
| 1090 |
+
(cur->name[0] != 'p')) /* p, pre, param */
|
| 1091 |
+
xmlOutputBufferWrite(buf, 1, "\n");
|
| 1092 |
+
|
| 1093 |
+
xmlOutputBufferWrite(buf, 2, "</");
|
| 1094 |
+
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
|
| 1095 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
|
| 1096 |
+
xmlOutputBufferWrite(buf, 1, ":");
|
| 1097 |
+
}
|
| 1098 |
+
xmlOutputBufferWriteString(buf, (const char *)cur->name);
|
| 1099 |
+
xmlOutputBufferWrite(buf, 1, ">");
|
| 1100 |
+
|
| 1101 |
+
if ((format) && (info != NULL) && (!info->isinline) &&
|
| 1102 |
+
(cur->next != NULL)) {
|
| 1103 |
+
if ((cur->next->type != HTML_TEXT_NODE) &&
|
| 1104 |
+
(cur->next->type != HTML_ENTITY_REF_NODE) &&
|
| 1105 |
+
(parent != NULL) &&
|
| 1106 |
+
(parent->name != NULL) &&
|
| 1107 |
+
(parent->name[0] != 'p')) /* p, pre, param */
|
| 1108 |
+
xmlOutputBufferWrite(buf, 1, "\n");
|
| 1109 |
+
}
|
| 1110 |
+
|
| 1111 |
+
if (cur == metaHead)
|
| 1112 |
+
metaHead = NULL;
|
| 1113 |
+
}
|
| 1114 |
+
}
|
| 1115 |
+
}
|
| 1116 |
+
}
|
| 1117 |
+
|
| 1118 |
+
/**
|
| 1119 |
+
* Serialize an HTML node to an output buffer.
|
| 1120 |
+
*
|
| 1121 |
+
* @param buf the HTML buffer output
|
| 1122 |
+
* @param doc the document (unused)
|
| 1123 |
+
* @param cur the current node
|
| 1124 |
+
* @param encoding the encoding string (unused)
|
| 1125 |
+
* @param format should formatting newlines been added
|
| 1126 |
+
*/
|
| 1127 |
+
void
|
| 1128 |
+
htmlNodeDumpFormatOutput(xmlOutputBuffer *buf,
|
| 1129 |
+
xmlDoc *doc ATTRIBUTE_UNUSED, xmlNode *cur,
|
| 1130 |
+
const char *encoding ATTRIBUTE_UNUSED, int format) {
|
| 1131 |
+
htmlNodeDumpInternal(buf, cur, NULL, format);
|
| 1132 |
+
}
|
| 1133 |
+
|
| 1134 |
+
/**
|
| 1135 |
+
* Same as #htmlNodeDumpFormatOutput with `format` set to 1 which is
|
| 1136 |
+
* typically undesired. Use of this function is DISCOURAGED in favor
|
| 1137 |
+
* of #htmlNodeDumpFormatOutput.
|
| 1138 |
+
*
|
| 1139 |
+
* @param buf the HTML buffer output
|
| 1140 |
+
* @param doc the document (unused)
|
| 1141 |
+
* @param cur the current node
|
| 1142 |
+
* @param encoding the encoding string (unused)
|
| 1143 |
+
*/
|
| 1144 |
+
void
|
| 1145 |
+
htmlNodeDumpOutput(xmlOutputBuffer *buf, xmlDoc *doc ATTRIBUTE_UNUSED,
|
| 1146 |
+
xmlNode *cur, const char *encoding ATTRIBUTE_UNUSED) {
|
| 1147 |
+
htmlNodeDumpInternal(buf, cur, NULL, 1);
|
| 1148 |
+
}
|
| 1149 |
+
|
| 1150 |
+
/**
|
| 1151 |
+
* Serialize an HTML document to an output buffer.
|
| 1152 |
+
*
|
| 1153 |
+
* @param buf the HTML buffer output
|
| 1154 |
+
* @param cur the document
|
| 1155 |
+
* @param encoding the encoding string (unused)
|
| 1156 |
+
* @param format should formatting newlines been added
|
| 1157 |
+
*/
|
| 1158 |
+
void
|
| 1159 |
+
htmlDocContentDumpFormatOutput(xmlOutputBuffer *buf, xmlDoc *cur,
|
| 1160 |
+
const char *encoding ATTRIBUTE_UNUSED,
|
| 1161 |
+
int format) {
|
| 1162 |
+
htmlNodeDumpInternal(buf, (xmlNodePtr) cur, NULL, format);
|
| 1163 |
+
}
|
| 1164 |
+
|
| 1165 |
+
/**
|
| 1166 |
+
* Same as #htmlDocContentDumpFormatOutput with `format` set to 1
|
| 1167 |
+
* which is typically undesired. Use of this function is DISCOURAGED
|
| 1168 |
+
* in favor of #htmlDocContentDumpFormatOutput.
|
| 1169 |
+
*
|
| 1170 |
+
* @param buf the HTML buffer output
|
| 1171 |
+
* @param cur the document
|
| 1172 |
+
* @param encoding the encoding string (unused)
|
| 1173 |
+
*/
|
| 1174 |
+
void
|
| 1175 |
+
htmlDocContentDumpOutput(xmlOutputBuffer *buf, xmlDoc *cur,
|
| 1176 |
+
const char *encoding ATTRIBUTE_UNUSED) {
|
| 1177 |
+
htmlNodeDumpInternal(buf, (xmlNodePtr) cur, NULL, 1);
|
| 1178 |
+
}
|
| 1179 |
+
|
| 1180 |
+
/************************************************************************
|
| 1181 |
+
* *
|
| 1182 |
+
* Saving functions front-ends *
|
| 1183 |
+
* *
|
| 1184 |
+
************************************************************************/
|
| 1185 |
+
|
| 1186 |
+
/**
|
| 1187 |
+
* Serialize an HTML document to an open `FILE`.
|
| 1188 |
+
*
|
| 1189 |
+
* Uses the encoding of the document. If the document has no
|
| 1190 |
+
* encoding, ASCII with HTML 4.0 named character entities will
|
| 1191 |
+
* be used. This is inefficient compared to UTF-8 and might be
|
| 1192 |
+
* changed in a future version.
|
| 1193 |
+
*
|
| 1194 |
+
* Enables "formatting" unconditionally which is typically
|
| 1195 |
+
* undesired.
|
| 1196 |
+
*
|
| 1197 |
+
* Use of this function is DISCOURAGED in favor of
|
| 1198 |
+
* #htmlNodeDumpFileFormat.
|
| 1199 |
+
*
|
| 1200 |
+
* @param f the FILE*
|
| 1201 |
+
* @param cur the document
|
| 1202 |
+
* @returns the number of bytes written or -1 in case of failure.
|
| 1203 |
+
*/
|
| 1204 |
+
int
|
| 1205 |
+
htmlDocDump(FILE *f, xmlDoc *cur) {
|
| 1206 |
+
xmlOutputBufferPtr buf;
|
| 1207 |
+
xmlCharEncodingHandlerPtr handler = NULL;
|
| 1208 |
+
int ret;
|
| 1209 |
+
|
| 1210 |
+
xmlInitParser();
|
| 1211 |
+
|
| 1212 |
+
if ((cur == NULL) || (f == NULL)) {
|
| 1213 |
+
return(-1);
|
| 1214 |
+
}
|
| 1215 |
+
|
| 1216 |
+
if (htmlFindOutputEncoder((char *) cur->encoding, &handler) != XML_ERR_OK)
|
| 1217 |
+
return(-1);
|
| 1218 |
+
buf = xmlOutputBufferCreateFile(f, handler);
|
| 1219 |
+
if (buf == NULL) {
|
| 1220 |
+
xmlCharEncCloseFunc(handler);
|
| 1221 |
+
return(-1);
|
| 1222 |
+
}
|
| 1223 |
+
htmlDocContentDumpOutput(buf, cur, NULL);
|
| 1224 |
+
|
| 1225 |
+
ret = xmlOutputBufferClose(buf);
|
| 1226 |
+
return(ret);
|
| 1227 |
+
}
|
| 1228 |
+
|
| 1229 |
+
/**
|
| 1230 |
+
* Serialize an HTML document to a file.
|
| 1231 |
+
*
|
| 1232 |
+
* Same as #htmlSaveFileFormat with `encoding` set to NULL and
|
| 1233 |
+
* `format` set to 1 which is typically undesired.
|
| 1234 |
+
*
|
| 1235 |
+
* Use of this function is DISCOURAGED in favor of
|
| 1236 |
+
* #htmlSaveFileFormat.
|
| 1237 |
+
*
|
| 1238 |
+
* @param filename the filename (or URL)
|
| 1239 |
+
* @param cur the document
|
| 1240 |
+
* @returns the number of bytes written or -1 in case of failure.
|
| 1241 |
+
*/
|
| 1242 |
+
int
|
| 1243 |
+
htmlSaveFile(const char *filename, xmlDoc *cur) {
|
| 1244 |
+
return(htmlSaveFileFormat(filename, cur, NULL, 1));
|
| 1245 |
+
}
|
| 1246 |
+
|
| 1247 |
+
/**
|
| 1248 |
+
* Serialize an HTML document to a file using a given encoding.
|
| 1249 |
+
*
|
| 1250 |
+
* If `filename` is `"-"`, stdout is used. This is potentially
|
| 1251 |
+
* insecure and might be changed in a future version.
|
| 1252 |
+
*
|
| 1253 |
+
* If encoding is NULL, ASCII with HTML 4.0 named character entities
|
| 1254 |
+
* will be used. This is inefficient compared to UTF-8 and might be
|
| 1255 |
+
* changed in a future version.
|
| 1256 |
+
*
|
| 1257 |
+
* Sets or updates meta tags containing the character encoding.
|
| 1258 |
+
*
|
| 1259 |
+
* @param filename the filename
|
| 1260 |
+
* @param cur the document
|
| 1261 |
+
* @param format should formatting newlines been added
|
| 1262 |
+
* @param encoding the document encoding (optional)
|
| 1263 |
+
* @returns the number of bytes written or -1 in case of failure.
|
| 1264 |
+
*/
|
| 1265 |
+
int
|
| 1266 |
+
htmlSaveFileFormat(const char *filename, xmlDoc *cur,
|
| 1267 |
+
const char *encoding, int format) {
|
| 1268 |
+
xmlOutputBufferPtr buf;
|
| 1269 |
+
xmlCharEncodingHandlerPtr handler = NULL;
|
| 1270 |
+
int ret;
|
| 1271 |
+
|
| 1272 |
+
if ((cur == NULL) || (filename == NULL))
|
| 1273 |
+
return(-1);
|
| 1274 |
+
|
| 1275 |
+
xmlInitParser();
|
| 1276 |
+
|
| 1277 |
+
if (htmlFindOutputEncoder(encoding, &handler) != XML_ERR_OK)
|
| 1278 |
+
return(-1);
|
| 1279 |
+
|
| 1280 |
+
/*
|
| 1281 |
+
* save the content to a temp buffer.
|
| 1282 |
+
*/
|
| 1283 |
+
buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression);
|
| 1284 |
+
if (buf == NULL) {
|
| 1285 |
+
xmlCharEncCloseFunc(handler);
|
| 1286 |
+
return(0);
|
| 1287 |
+
}
|
| 1288 |
+
|
| 1289 |
+
htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
|
| 1290 |
+
|
| 1291 |
+
ret = xmlOutputBufferClose(buf);
|
| 1292 |
+
return(ret);
|
| 1293 |
+
}
|
| 1294 |
+
|
| 1295 |
+
/**
|
| 1296 |
+
* Serialize an HTML document to a file.
|
| 1297 |
+
*
|
| 1298 |
+
* Same as #htmlSaveFileFormat with `format` set to 1 which is
|
| 1299 |
+
* typically undesired. Also see the warnings there. Use of this
|
| 1300 |
+
* function is DISCOURAGED in favor of #htmlSaveFileFormat.
|
| 1301 |
+
*
|
| 1302 |
+
* @param filename the filename
|
| 1303 |
+
* @param cur the document
|
| 1304 |
+
* @param encoding the document encoding
|
| 1305 |
+
* @returns the number of bytes written or -1 in case of failure.
|
| 1306 |
+
*/
|
| 1307 |
+
int
|
| 1308 |
+
htmlSaveFileEnc(const char *filename, xmlDoc *cur, const char *encoding) {
|
| 1309 |
+
return(htmlSaveFileFormat(filename, cur, encoding, 1));
|
| 1310 |
+
}
|
| 1311 |
+
|
| 1312 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
| 1313 |
+
|
| 1314 |
+
#endif /* LIBXML_HTML_ENABLED */
|
MAINTAINERS.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Maintainer's Guide
|
| 2 |
+
|
| 3 |
+
## Working with the test suite
|
| 4 |
+
|
| 5 |
+
Most of the tests are contained in the `runtest` executable which
|
| 6 |
+
generally reads test cases from the `test` directory and compares output
|
| 7 |
+
to files in the `result` directory.
|
| 8 |
+
|
| 9 |
+
You can simply add new test cases and run `runtest -u` to update the
|
| 10 |
+
results. If you debug test failures, it's also useful to execute
|
| 11 |
+
`runtest -u` and then `git diff result` to get a diff between actual and
|
| 12 |
+
expected results. You can restore the original results by running
|
| 13 |
+
`git restore result` and `git clean -xd result`.
|
| 14 |
+
|
| 15 |
+
## Generated files
|
| 16 |
+
|
| 17 |
+
Some source code is generated with Python scripts in the `tools`
|
| 18 |
+
directory.
|
| 19 |
+
|
| 20 |
+
- `tools/genChRanges.py` generates code to handle character ranges
|
| 21 |
+
from chvalid.def:
|
| 22 |
+
- `chvalid.c`
|
| 23 |
+
- `include/libxml/chvalid.h`
|
| 24 |
+
|
| 25 |
+
- `tools/genEscape prints lookup tables for serialization.
|
| 26 |
+
|
| 27 |
+
- `tools/genHtml5LibTests.py` creates test cases and expected results
|
| 28 |
+
from the html5lib test suite:
|
| 29 |
+
- `test/html-tokenizer`
|
| 30 |
+
- `result/html-tokenizer`
|
| 31 |
+
|
| 32 |
+
- `tools/genHtmlEnt.py` prints lookup tables for HTML5 named character
|
| 33 |
+
references (predefined entities):
|
| 34 |
+
- `html5ent.inc`
|
| 35 |
+
|
| 36 |
+
- `tools/gentest.py` generates test code using the Doxygen XML output:
|
| 37 |
+
- `testapi.c`
|
| 38 |
+
|
| 39 |
+
- `tools/genUnicode.py` generates code to handle Unicode ranges
|
| 40 |
+
from Unicode data files:
|
| 41 |
+
- `xmlunicode.c`
|
| 42 |
+
|
| 43 |
+
## Making a release
|
| 44 |
+
|
| 45 |
+
### Update the NEWS file
|
| 46 |
+
|
| 47 |
+
You can get started by running
|
| 48 |
+
|
| 49 |
+
git log --format='- %s (%an)' [previous-release-tag]..
|
| 50 |
+
|
| 51 |
+
### Bump the version number
|
| 52 |
+
|
| 53 |
+
Update the version number in `VERSION` if you haven't done so already.
|
| 54 |
+
|
| 55 |
+
### Commit and verify tarball
|
| 56 |
+
|
| 57 |
+
Release tarballs are generated with a CI job and the `.gitlab-ci/dist.sh`
|
| 58 |
+
script. Push the release commit and inspect the tarball artifact generated
|
| 59 |
+
by Gitlab CI.
|
| 60 |
+
|
| 61 |
+
### Tag the release
|
| 62 |
+
|
| 63 |
+
Create an annotated tag and push it:
|
| 64 |
+
|
| 65 |
+
git tag -a [version] -m 'Release [version]'
|
| 66 |
+
git push origin [version]
|
| 67 |
+
|
| 68 |
+
This will upload the release to the downloads server using the GNOME
|
| 69 |
+
Release Service. For more details, see
|
| 70 |
+
<https://handbook.gnome.org/maintainers/release-pipeline.html>
|
| 71 |
+
|
| 72 |
+
### Create a GitLab release
|
| 73 |
+
|
| 74 |
+
Create or update a GitLab release on
|
| 75 |
+
<https://gitlab.gnome.org/GNOME/libxml2/-/releases>.
|
| 76 |
+
|
| 77 |
+
### Announce the release
|
| 78 |
+
|
| 79 |
+
Announce the release on https://discourse.gnome.org under topics 'libxml2'
|
| 80 |
+
and 'announcements'.
|
| 81 |
+
|
| 82 |
+
## Removing public API functions
|
| 83 |
+
|
| 84 |
+
General process to remove public API functions (or variables):
|
| 85 |
+
|
| 86 |
+
- Make sure that there's a reasonable alternative.
|
| 87 |
+
- Mark the function as deprecated in the documentation and mention
|
| 88 |
+
alternatives.
|
| 89 |
+
- Mark the function as XML_DEPRECATED in the header files.
|
| 90 |
+
- For whole modules: disable the module by default and only enable
|
| 91 |
+
it in "legacy mode".
|
| 92 |
+
- Remove the function body and make the function return an error code
|
| 93 |
+
or a no-op. Make sure that the symbol is kept and exported. This
|
| 94 |
+
should only be done after allowing users enough time to adjust.
|
| 95 |
+
- At the next ABI bump, remove the symbol completely.
|
| 96 |
+
|
| 97 |
+
You can wait for the next feature release between some of the steps to
|
| 98 |
+
make the process more gradual.
|
| 99 |
+
|
| 100 |
+
## Breaking the ABI
|
| 101 |
+
|
| 102 |
+
Unfortunately, libxml2 exposes many internal structs which makes some
|
| 103 |
+
beneficial changes impossible without breaking the ABI.
|
| 104 |
+
|
| 105 |
+
The following changes are allowed (after careful consideration):
|
| 106 |
+
|
| 107 |
+
- Appending members to structs which client code should never allocate
|
| 108 |
+
directly. A notable example is xmlParserCtxt. Other structs like
|
| 109 |
+
xmlError are allocated directly by client code and must not be changed.
|
| 110 |
+
|
| 111 |
+
- Making a void function return a value.
|
| 112 |
+
|
| 113 |
+
- Making functions accept const pointers unless it's a typedef for a
|
| 114 |
+
callback.
|
| 115 |
+
|
| 116 |
+
- Changing signedness of struct members or function arguments.
|
| 117 |
+
|
| 118 |
+
## Updating the CI Docker image
|
| 119 |
+
|
| 120 |
+
Note that the CI image is used for libxslt as well. First create a
|
| 121 |
+
GitLab access token with maintainer role and `read_registry` and
|
| 122 |
+
`write_registry` permissions. Then run the following commands with the
|
| 123 |
+
Dockerfile in the .gitlab-ci directory:
|
| 124 |
+
|
| 125 |
+
docker login -u <username> -p <access_token> \
|
| 126 |
+
registry.gitlab.gnome.org
|
| 127 |
+
docker build -t registry.gitlab.gnome.org/gnome/libxml2 - \
|
| 128 |
+
< .gitlab-ci/Dockerfile
|
| 129 |
+
docker push registry.gitlab.gnome.org/gnome/libxml2
|
| 130 |
+
|
Makefile.am
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
|
| 3 |
+
ACLOCAL_AMFLAGS = -I m4
|
| 4 |
+
|
| 5 |
+
SUBDIRS = include . example
|
| 6 |
+
if WITH_DOXYGEN
|
| 7 |
+
SUBDIRS += doc
|
| 8 |
+
endif
|
| 9 |
+
if WITH_PYTHON
|
| 10 |
+
SUBDIRS += python
|
| 11 |
+
endif
|
| 12 |
+
if WITH_GLOB
|
| 13 |
+
SUBDIRS += fuzz
|
| 14 |
+
endif
|
| 15 |
+
|
| 16 |
+
DIST_SUBDIRS = include . doc example fuzz python
|
| 17 |
+
|
| 18 |
+
AM_CPPFLAGS = -I$(builddir)/include -I$(srcdir)/include
|
| 19 |
+
|
| 20 |
+
check_PROGRAMS = \
|
| 21 |
+
runsuite \
|
| 22 |
+
runtest \
|
| 23 |
+
runxmlconf \
|
| 24 |
+
testModule \
|
| 25 |
+
testapi \
|
| 26 |
+
testchar \
|
| 27 |
+
testdict \
|
| 28 |
+
testlimits \
|
| 29 |
+
testparser \
|
| 30 |
+
testrecurse
|
| 31 |
+
|
| 32 |
+
bin_PROGRAMS = xmllint
|
| 33 |
+
|
| 34 |
+
bin_SCRIPTS = xml2-config
|
| 35 |
+
|
| 36 |
+
lib_LTLIBRARIES = libxml2.la
|
| 37 |
+
libxml2_la_CFLAGS = $(AM_CFLAGS) $(XML_PRIVATE_CFLAGS)
|
| 38 |
+
libxml2_la_LIBADD = $(XML_PRIVATE_LIBS)
|
| 39 |
+
|
| 40 |
+
libxml2_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
|
| 41 |
+
-version-info $(LIBXML_VERSION_INFO)
|
| 42 |
+
|
| 43 |
+
libxml2_la_SOURCES = buf.c chvalid.c dict.c entities.c encoding.c error.c \
|
| 44 |
+
globals.c hash.c list.c parser.c parserInternals.c \
|
| 45 |
+
SAX2.c threads.c tree.c uri.c valid.c xmlIO.c \
|
| 46 |
+
xmlmemory.c xmlstring.c
|
| 47 |
+
if WITH_C14N_SOURCES
|
| 48 |
+
libxml2_la_SOURCES += c14n.c
|
| 49 |
+
endif
|
| 50 |
+
if WITH_CATALOG_SOURCES
|
| 51 |
+
if WITH_OUTPUT_SOURCES
|
| 52 |
+
bin_PROGRAMS += xmlcatalog
|
| 53 |
+
|
| 54 |
+
xmlcatalog_SOURCES = xmlcatalog.c
|
| 55 |
+
xmlcatalog_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS)
|
| 56 |
+
xmlcatalog_DEPENDENCIES = $(DEPS)
|
| 57 |
+
xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS)
|
| 58 |
+
endif
|
| 59 |
+
|
| 60 |
+
libxml2_la_SOURCES += catalog.c
|
| 61 |
+
endif
|
| 62 |
+
if WITH_DEBUG_SOURCES
|
| 63 |
+
libxml2_la_SOURCES += debugXML.c
|
| 64 |
+
endif
|
| 65 |
+
if WITH_HTML_SOURCES
|
| 66 |
+
libxml2_la_SOURCES += HTMLparser.c HTMLtree.c
|
| 67 |
+
endif
|
| 68 |
+
if WITH_HTTP_SOURCES
|
| 69 |
+
libxml2_la_SOURCES += nanohttp.c
|
| 70 |
+
endif
|
| 71 |
+
if WITH_MODULES_SOURCES
|
| 72 |
+
libxml2_la_SOURCES += xmlmodule.c
|
| 73 |
+
endif
|
| 74 |
+
if WITH_OUTPUT_SOURCES
|
| 75 |
+
libxml2_la_SOURCES += xmlsave.c
|
| 76 |
+
endif
|
| 77 |
+
if WITH_PATTERN_SOURCES
|
| 78 |
+
libxml2_la_SOURCES += pattern.c
|
| 79 |
+
endif
|
| 80 |
+
if WITH_READER_SOURCES
|
| 81 |
+
libxml2_la_SOURCES += xmlreader.c
|
| 82 |
+
endif
|
| 83 |
+
if WITH_REGEXPS_SOURCES
|
| 84 |
+
libxml2_la_SOURCES += xmlregexp.c
|
| 85 |
+
endif
|
| 86 |
+
if WITH_RELAXNG_SOURCES
|
| 87 |
+
libxml2_la_SOURCES += relaxng.c
|
| 88 |
+
endif
|
| 89 |
+
if WITH_SCHEMAS_SOURCES
|
| 90 |
+
libxml2_la_SOURCES += xmlschemas.c xmlschemastypes.c
|
| 91 |
+
endif
|
| 92 |
+
if WITH_SCHEMATRON_SOURCES
|
| 93 |
+
libxml2_la_SOURCES += schematron.c
|
| 94 |
+
endif
|
| 95 |
+
if WITH_WRITER_SOURCES
|
| 96 |
+
libxml2_la_SOURCES += xmlwriter.c
|
| 97 |
+
endif
|
| 98 |
+
if WITH_XINCLUDE_SOURCES
|
| 99 |
+
libxml2_la_SOURCES += xinclude.c
|
| 100 |
+
endif
|
| 101 |
+
if WITH_XPATH_SOURCES
|
| 102 |
+
libxml2_la_SOURCES += xpath.c
|
| 103 |
+
endif
|
| 104 |
+
if WITH_XPTR_SOURCES
|
| 105 |
+
libxml2_la_SOURCES += xlink.c xpointer.c
|
| 106 |
+
endif
|
| 107 |
+
|
| 108 |
+
DEPS = libxml2.la
|
| 109 |
+
LDADDS = libxml2.la
|
| 110 |
+
|
| 111 |
+
runtest_SOURCES=runtest.c
|
| 112 |
+
runtest_DEPENDENCIES = $(DEPS)
|
| 113 |
+
runtest_LDADD= $(THREAD_LIBS) $(LDADDS)
|
| 114 |
+
|
| 115 |
+
testrecurse_SOURCES=testrecurse.c
|
| 116 |
+
testrecurse_DEPENDENCIES = $(DEPS)
|
| 117 |
+
testrecurse_LDADD= $(LDADDS)
|
| 118 |
+
|
| 119 |
+
testlimits_SOURCES=testlimits.c
|
| 120 |
+
testlimits_DEPENDENCIES = $(DEPS)
|
| 121 |
+
testlimits_LDADD= $(LDADDS)
|
| 122 |
+
|
| 123 |
+
testchar_SOURCES=testchar.c
|
| 124 |
+
testchar_DEPENDENCIES = $(DEPS)
|
| 125 |
+
testchar_LDADD= $(LDADDS)
|
| 126 |
+
|
| 127 |
+
testdict_SOURCES=testdict.c
|
| 128 |
+
testdict_DEPENDENCIES = $(DEPS)
|
| 129 |
+
testdict_LDADD= $(LDADDS)
|
| 130 |
+
|
| 131 |
+
testparser_SOURCES=testparser.c
|
| 132 |
+
testparser_DEPENDENCIES = $(DEPS)
|
| 133 |
+
testparser_LDADD= $(LDADDS)
|
| 134 |
+
|
| 135 |
+
runsuite_SOURCES=runsuite.c
|
| 136 |
+
runsuite_DEPENDENCIES = $(DEPS)
|
| 137 |
+
runsuite_LDADD= $(LDADDS)
|
| 138 |
+
|
| 139 |
+
xmllint_SOURCES = xmllint.c shell.c lintmain.c
|
| 140 |
+
xmllint_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS)
|
| 141 |
+
xmllint_DEPENDENCIES = $(DEPS)
|
| 142 |
+
xmllint_LDADD= $(RDL_LIBS) $(LDADDS)
|
| 143 |
+
|
| 144 |
+
testModule_SOURCES=testModule.c
|
| 145 |
+
testModule_DEPENDENCIES = $(DEPS)
|
| 146 |
+
testModule_LDADD= $(LDADDS)
|
| 147 |
+
|
| 148 |
+
check_LTLIBRARIES = testdso.la
|
| 149 |
+
testdso_la_SOURCES = testdso.c
|
| 150 |
+
testdso_la_LDFLAGS = $(AM_LDFLAGS) \
|
| 151 |
+
-module -no-undefined -avoid-version -rpath $(libdir)
|
| 152 |
+
|
| 153 |
+
rebuild_testapi:
|
| 154 |
+
cd $(srcdir) && python3 codegen/genTestApi.py $(abs_builddir)
|
| 155 |
+
|
| 156 |
+
testapi_SOURCES=testapi.c
|
| 157 |
+
testapi_DEPENDENCIES = $(DEPS)
|
| 158 |
+
testapi_LDADD= $(LDADDS)
|
| 159 |
+
|
| 160 |
+
runxmlconf_SOURCES=runxmlconf.c
|
| 161 |
+
runxmlconf_DEPENDENCIES = $(DEPS)
|
| 162 |
+
runxmlconf_LDADD= $(LDADDS)
|
| 163 |
+
|
| 164 |
+
check-local:
|
| 165 |
+
[ -d test ] || $(LN_S) $(srcdir)/test .
|
| 166 |
+
[ -d result ] || $(LN_S) $(srcdir)/result .
|
| 167 |
+
$(CHECKER) ./runtest$(EXEEXT)
|
| 168 |
+
$(CHECKER) ./testrecurse$(EXEEXT)
|
| 169 |
+
$(CHECKER) ./testapi$(EXEEXT)
|
| 170 |
+
$(CHECKER) ./testchar$(EXEEXT)
|
| 171 |
+
$(CHECKER) ./testdict$(EXEEXT)
|
| 172 |
+
$(CHECKER) ./testparser$(EXEEXT)
|
| 173 |
+
$(CHECKER) ./testModule$(EXEEXT)
|
| 174 |
+
$(CHECKER) ./runxmlconf$(EXEEXT) -d $(srcdir)/xmlconf
|
| 175 |
+
$(CHECKER) ./runsuite$(EXEEXT)
|
| 176 |
+
if WITH_OUTPUT_SOURCES
|
| 177 |
+
if WITH_DEBUG_SOURCES
|
| 178 |
+
test/scripts/test.sh ./xmllint$(EXEEXT)
|
| 179 |
+
endif
|
| 180 |
+
if WITH_CATALOG_SOURCES
|
| 181 |
+
ASAN_OPTIONS=detect_leaks=0 test/catalogs/test.sh ./xmlcatalog$(EXEEXT)
|
| 182 |
+
ASAN_OPTIONS=detect_leaks=0 test/catalogs/test_sgml.sh ./xmlcatalog$(EXEEXT)
|
| 183 |
+
endif
|
| 184 |
+
endif
|
| 185 |
+
|
| 186 |
+
# Compatibility name of the check target
|
| 187 |
+
runtests: check
|
| 188 |
+
|
| 189 |
+
check-valgrind valgrind:
|
| 190 |
+
@echo '## Running the regression tests under Valgrind'
|
| 191 |
+
@echo '## Go get a cup of coffee it is gonna take a while ...'
|
| 192 |
+
$(MAKE) CHECKER='valgrind -q' check
|
| 193 |
+
|
| 194 |
+
dist-hook:
|
| 195 |
+
(cd $(srcdir) ; tar -cf - --exclude .git win32 test result) | (cd $(distdir); tar xf -)
|
| 196 |
+
|
| 197 |
+
CLEANFILES = missing.lst runsuite.log runxmlconf.log test.out \
|
| 198 |
+
*.gcda *.gcno *.res
|
| 199 |
+
|
| 200 |
+
EXTRA_DIST = Copyright libxml2-config.cmake.in autogen.sh \
|
| 201 |
+
libxml.h \
|
| 202 |
+
codegen/charset.inc \
|
| 203 |
+
codegen/escape.inc \
|
| 204 |
+
codegen/genCharset.py \
|
| 205 |
+
codegen/genEscape.py \
|
| 206 |
+
codegen/genHtml5Ent.py \
|
| 207 |
+
codegen/genHtml5LibTests.py \
|
| 208 |
+
codegen/genRanges.py \
|
| 209 |
+
codegen/genTestApi.py \
|
| 210 |
+
codegen/genUnicode.py \
|
| 211 |
+
codegen/html5ent.inc \
|
| 212 |
+
codegen/ranges.def \
|
| 213 |
+
codegen/ranges.inc \
|
| 214 |
+
codegen/rangetab.py \
|
| 215 |
+
codegen/unicode.inc \
|
| 216 |
+
codegen/xmlmod.py \
|
| 217 |
+
timsort.h \
|
| 218 |
+
README.zOS README.md \
|
| 219 |
+
CMakeLists.txt config.h.cmake.in libxml2-config.cmake.cmake.in \
|
| 220 |
+
meson.build meson_options.txt xml2-config-meson
|
| 221 |
+
|
| 222 |
+
pkgconfigdir = $(libdir)/pkgconfig
|
| 223 |
+
pkgconfig_DATA = libxml-2.0.pc
|
| 224 |
+
|
| 225 |
+
cmakedir = $(libdir)/cmake/libxml2
|
| 226 |
+
cmake_DATA = libxml2-config.cmake
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
## ------------ Unity Test Framework Support -------------
|
| 230 |
+
|
| 231 |
+
# Pattern rule for Unity test harnesses - add -lm
|
| 232 |
+
tests_%: tests_%.o .libs/libxml2.a unity/unity.o
|
| 233 |
+
$(CC) $(CFLAGS) $(AM_CFLAGS) $(LDFLAGS) -o $@ tests_$*.o .libs/libxml2.a unity/unity.o -lm
|
| 234 |
+
|
| 235 |
+
# Build test objects
|
| 236 |
+
tests_%.o: tests/tests_%.c
|
| 237 |
+
$(CC) $(CFLAGS) $(AM_CFLAGS) -I$(srcdir)/include -I. -c -o $@ tests/tests_$*.c
|
| 238 |
+
|
| 239 |
+
CLEANFILES += tests_*.o tests_* unity/*.o
|
| 240 |
+
|
| 241 |
+
## ------------ End Unity Test Framework Support -------------
|
NEWS
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
| 1 |
+
# libxml2
|
| 2 |
+
|
| 3 |
+
libxml2 is an XML toolkit implemented in C, originally developed for
|
| 4 |
+
the GNOME Project.
|
| 5 |
+
|
| 6 |
+
Official releases can be downloaded from
|
| 7 |
+
<https://download.gnome.org/sources/libxml2/>
|
| 8 |
+
|
| 9 |
+
The git repository is hosted on GNOME's GitLab server:
|
| 10 |
+
<https://gitlab.gnome.org/GNOME/libxml2>
|
| 11 |
+
|
| 12 |
+
Bugs should be reported at
|
| 13 |
+
<https://gitlab.gnome.org/GNOME/libxml2/-/issues>.
|
| 14 |
+
|
| 15 |
+
Documentation is available at
|
| 16 |
+
<https://gitlab.gnome.org/GNOME/libxml2/-/wikis>
|
| 17 |
+
|
| 18 |
+
## License
|
| 19 |
+
|
| 20 |
+
This code is released under the MIT License, see the Copyright file.
|
| 21 |
+
|
| 22 |
+
## Security
|
| 23 |
+
|
| 24 |
+
This is open-source software written by hobbyists, maintained by a single
|
| 25 |
+
volunteer, badly tested, written in a memory-unsafe language and full of
|
| 26 |
+
security bugs. It is foolish to use this software to process untrusted data.
|
| 27 |
+
As such, we treat security issues like any other bug. Each security report
|
| 28 |
+
we receive will be made public immediately and won't be prioritized.
|
| 29 |
+
|
| 30 |
+
## Build instructions
|
| 31 |
+
|
| 32 |
+
libxml2 can be built with GNU Autotools, CMake or meson.
|
| 33 |
+
|
| 34 |
+
### Autotools (for POSIX systems like Linux, BSD, macOS)
|
| 35 |
+
|
| 36 |
+
If you build from a Git tree, you have to install Autotools and start
|
| 37 |
+
by generating the configuration files with:
|
| 38 |
+
|
| 39 |
+
./autogen.sh [configuration options]
|
| 40 |
+
|
| 41 |
+
If you build from a source tarball, extract the archive with:
|
| 42 |
+
|
| 43 |
+
tar xf libxml2-xxx.tar.gz
|
| 44 |
+
cd libxml2-xxx
|
| 45 |
+
|
| 46 |
+
Then you can configure and build the library:
|
| 47 |
+
|
| 48 |
+
./configure [configuration options]
|
| 49 |
+
make
|
| 50 |
+
|
| 51 |
+
The following options disable or enable code modules and relevant symbols:
|
| 52 |
+
|
| 53 |
+
--with-c14n Canonical XML 1.0 support (on)
|
| 54 |
+
--with-catalog XML Catalogs support (on)
|
| 55 |
+
--with-debug debugging module (on)
|
| 56 |
+
--with-docs Build documentation (off)
|
| 57 |
+
--with-history history support for xmllint shell (off)
|
| 58 |
+
--with-readline[=DIR] use readline in DIR for shell (off)
|
| 59 |
+
--with-html HTML parser (on)
|
| 60 |
+
--with-http ABI compatibility for removed HTTP support (off)
|
| 61 |
+
--with-iconv[=DIR] iconv support (on)
|
| 62 |
+
--with-icu ICU support (off)
|
| 63 |
+
--with-iso8859x ISO-8859-X support if no iconv (on)
|
| 64 |
+
--with-modules dynamic modules support (on)
|
| 65 |
+
--with-output serialization support (on)
|
| 66 |
+
--with-pattern xmlPattern selection interface (on)
|
| 67 |
+
--with-push push parser interfaces (on)
|
| 68 |
+
--with-python Python bindings (off)
|
| 69 |
+
--with-reader xmlReader parsing interface (on)
|
| 70 |
+
--with-regexps regular expressions support (on)
|
| 71 |
+
--with-relaxng RELAX NG support (on)
|
| 72 |
+
--with-sax1 older SAX1 interface (on)
|
| 73 |
+
--with-schemas XML Schemas 1.0 support (on)
|
| 74 |
+
--with-schematron Schematron support (off)
|
| 75 |
+
--with-threads multithreading support (on)
|
| 76 |
+
--with-thread-alloc per-thread malloc hooks (off)
|
| 77 |
+
--with-valid DTD validation support (on)
|
| 78 |
+
--with-writer xmlWriter serialization interface (on)
|
| 79 |
+
--with-xinclude XInclude 1.0 support (on)
|
| 80 |
+
--with-xpath XPath 1.0 support (on)
|
| 81 |
+
--with-xptr XPointer support (on)
|
| 82 |
+
--with-zlib[=DIR] use libz in DIR (off)
|
| 83 |
+
|
| 84 |
+
Other options:
|
| 85 |
+
|
| 86 |
+
--prefix=DIR set installation prefix
|
| 87 |
+
--with-minimum build a minimally sized library (off)
|
| 88 |
+
--with-legacy maximum ABI compatibility (off)
|
| 89 |
+
|
| 90 |
+
Note that by default, no optimization options are used. You have to
|
| 91 |
+
enable them manually, for example with:
|
| 92 |
+
|
| 93 |
+
CFLAGS='-O2 -fno-semantic-interposition' ./configure
|
| 94 |
+
|
| 95 |
+
Now you can run the test suite with:
|
| 96 |
+
|
| 97 |
+
make check
|
| 98 |
+
|
| 99 |
+
Please report test failures to the bug tracker.
|
| 100 |
+
|
| 101 |
+
Then you can install the library:
|
| 102 |
+
|
| 103 |
+
make install
|
| 104 |
+
|
| 105 |
+
At that point you may have to rerun ldconfig or a similar utility to
|
| 106 |
+
update your list of installed shared libs.
|
| 107 |
+
|
| 108 |
+
### CMake (mainly for Windows)
|
| 109 |
+
|
| 110 |
+
Example commands:
|
| 111 |
+
|
| 112 |
+
cmake -E tar xf libxml2-xxx.tar.xz
|
| 113 |
+
cmake -S libxml2-xxx -B builddir [options]
|
| 114 |
+
cmake --build builddir
|
| 115 |
+
ctest --test-dir builddir
|
| 116 |
+
cmake --install builddir
|
| 117 |
+
|
| 118 |
+
Common CMake options include:
|
| 119 |
+
|
| 120 |
+
-D BUILD_SHARED_LIBS=OFF # build static libraries
|
| 121 |
+
-D CMAKE_BUILD_TYPE=Release # specify build type (single-config)
|
| 122 |
+
--config Release # specify build type (multi-config)
|
| 123 |
+
-D CMAKE_INSTALL_PREFIX=/usr/local # specify the install path
|
| 124 |
+
-D LIBXML2_WITH_ICONV=OFF # disable iconv
|
| 125 |
+
-D LIBXML2_WITH_ZLIB=ON # enable zlib
|
| 126 |
+
|
| 127 |
+
You can also open the libxml source directory with its CMakeLists.txt
|
| 128 |
+
directly in various IDEs such as CLion, QtCreator, or Visual Studio.
|
| 129 |
+
|
| 130 |
+
### Meson
|
| 131 |
+
|
| 132 |
+
Example commands:
|
| 133 |
+
|
| 134 |
+
meson setup [options] builddir
|
| 135 |
+
ninja -C builddir
|
| 136 |
+
meson test -C builddir
|
| 137 |
+
ninja -C builddir install
|
| 138 |
+
|
| 139 |
+
See the `meson_options.txt` file for options. For example:
|
| 140 |
+
|
| 141 |
+
-Dprefix=$prefix
|
| 142 |
+
-Dhistory=enabled
|
| 143 |
+
-Dschemas=disabled
|
| 144 |
+
-Dzlib=enabled
|
| 145 |
+
|
| 146 |
+
## Dependencies
|
| 147 |
+
|
| 148 |
+
libxml2 supports POSIX and Windows operating systems.
|
| 149 |
+
|
| 150 |
+
The iconv function is required for conversion of character encodings.
|
| 151 |
+
This function is part of POSIX.1-2001. If your platform doesn't provide
|
| 152 |
+
iconv, you need an external libiconv library, for example
|
| 153 |
+
[GNU libiconv](https://www.gnu.org/software/libiconv/). Using
|
| 154 |
+
[ICU](https://icu.unicode.org/) is also supported but discouraged.
|
| 155 |
+
|
| 156 |
+
The xmllint executable uses libreadline and libhistory if enabled.
|
| 157 |
+
|
| 158 |
+
### Build requirements
|
| 159 |
+
|
| 160 |
+
Besides build system tools, only a C compiler should be required.
|
| 161 |
+
Reconfiguration of the Autotools build requires the pkg.m4 macro from
|
| 162 |
+
pkg-config. Building the documentation requires Doxygen, xsltproc and the
|
| 163 |
+
DocBook 4 XSLT stylesheets. Building the Python bindings requires Doxygen.
|
| 164 |
+
|
| 165 |
+
## Contributing
|
| 166 |
+
|
| 167 |
+
The current version of the code can be found in GNOME's GitLab at
|
| 168 |
+
<https://gitlab.gnome.org/GNOME/libxml2>. The best way to get involved
|
| 169 |
+
is by creating issues and merge requests on GitLab.
|
| 170 |
+
|
| 171 |
+
All code must conform to C89 and pass the GitLab CI tests. Add regression
|
| 172 |
+
tests if possible.
|
| 173 |
+
|
| 174 |
+
## Authors
|
| 175 |
+
|
| 176 |
+
- Daniel Veillard
|
| 177 |
+
- Bjorn Reese
|
| 178 |
+
- William Brack
|
| 179 |
+
- Igor Zlatkovic for the Windows port
|
| 180 |
+
- Aleksey Sanin
|
| 181 |
+
- Nick Wellnhofer
|
| 182 |
+
|
README.zOS
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Notes for compiling on zOS:
|
| 2 |
+
|
| 3 |
+
- since testapi.c file is huge (over 52000 lines), it's compilation
|
| 4 |
+
fails: I skipped the problem by removing all references to testapi in the
|
| 5 |
+
Makefile.in, but it would be neater if one can build without test files
|
| 6 |
+
(I didn't find an option in configure...)
|
| 7 |
+
|
| 8 |
+
- since the name of files (or qualifier) in PDS are limited to 8 I had to
|
| 9 |
+
rename xmlschemas.c and xmlschemastypes.c in (resp.) xmlsche.c xmlschet.c
|
| 10 |
+
(and I had to modify all occurrences of these files accordingly in the
|
| 11 |
+
rest of the Makefile !!!).
|
| 12 |
+
|
| 13 |
+
- in order to copy objects to PDS, I had the cp command at line 860
|
| 14 |
+
of Makefile.in
|
| 15 |
+
|
| 16 |
+
libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES)
|
| 17 |
+
$(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS)
|
| 18 |
+
# Copy objects to PDS
|
| 19 |
+
@list='$(libxml2_OBJECTS)' ; for p in $$list; do \
|
| 20 |
+
cp -ACMv $$p "//'<PDS NAME>'"; \
|
| 21 |
+
done
|
| 22 |
+
|
| 23 |
+
with <PDS NAME> stands for the name of my PDS and
|
| 24 |
+
|
| 25 |
+
libxml2_OBJECTS = SAX.o entities.o encoding.o error.o \
|
| 26 |
+
parserInternals.o parser.o tree.o hash.o list.o xmlIO.o \
|
| 27 |
+
xmlmemory.o uri.o valid.o xlink.o HTMLparser.o \
|
| 28 |
+
HTMLtree.o debugXML.o xpath.o xpointer.o xinclude.o \
|
| 29 |
+
nanohttp.o nanoftp.o triostr.o trio.o catalog.o globals.o \
|
| 30 |
+
threads.o c14n.o xmlstring.o buf.o xmlregexp.o \
|
| 31 |
+
xmlsche.o xmlschet.o xmlunicode.o \
|
| 32 |
+
xmlreader.o relaxng.o dict.o SAX2.o \
|
| 33 |
+
xmlwriter.o legacy.o chvalid.o pattern.o xmlsave.o \
|
| 34 |
+
xmlmodule.o schematron.o xzlib.o
|
| 35 |
+
|
| 36 |
+
In order to handle the support of zOS without breaking the existing
|
| 37 |
+
Makefile maybe a new option/flag zOs would copy xmlschemas.c and
|
| 38 |
+
xmlschemastypes.c files and use specifics targets rather than existing
|
| 39 |
+
ones with the longer names... A variable to handle the PDS name has to
|
| 40 |
+
be provided also...
|
| 41 |
+
|
| 42 |
+
See patch below for set of changes to Makefile.in
|
| 43 |
+
|
| 44 |
+
Stéphane Michaut <smichaut@axway.com>
|
| 45 |
+
July 2017
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
--- Makefile.in 2017-08-01 08:17:15.000000000 +0200
|
| 49 |
+
+++ Makefile-new.in 2017-08-01 08:07:26.000000000 +0200
|
| 50 |
+
@@ -41,7 +41,7 @@
|
| 51 |
+
testSAX$(EXEEXT) testHTML$(EXEEXT) testXPath$(EXEEXT) \
|
| 52 |
+
testURI$(EXEEXT) testThreads$(EXEEXT) testC14N$(EXEEXT) \
|
| 53 |
+
testAutomata$(EXEEXT) testRegexp$(EXEEXT) testReader$(EXEEXT) \
|
| 54 |
+
- testapi$(EXEEXT) testModule$(EXEEXT) runtest$(EXEEXT) \
|
| 55 |
+
+ testModule$(EXEEXT) runtest$(EXEEXT) \
|
| 56 |
+
runsuite$(EXEEXT) testchar$(EXEEXT) testdict$(EXEEXT) \
|
| 57 |
+
runxmlconf$(EXEEXT) testrecurse$(EXEEXT) testlimits$(EXEEXT)
|
| 58 |
+
bin_PROGRAMS = xmllint$(EXEEXT) xmlcatalog$(EXEEXT)
|
| 59 |
+
@@ -106,6 +106,7 @@
|
| 60 |
+
debugXML.c xpath.c xpointer.c xinclude.c nanohttp.c nanoftp.c \
|
| 61 |
+
DOCBparser.c catalog.c globals.c threads.c c14n.c xmlstring.c \
|
| 62 |
+
buf.c xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
|
| 63 |
+
+ xmlsche.c xmlschet.c \
|
| 64 |
+
triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \
|
| 65 |
+
xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c xmlmodule.c \
|
| 66 |
+
schematron.c xzlib.c
|
| 67 |
+
@@ -118,10 +119,24 @@
|
| 68 |
+
nanohttp.lo nanoftp.lo $(am__objects_1) catalog.lo globals.lo \
|
| 69 |
+
threads.lo c14n.lo xmlstring.lo buf.lo xmlregexp.lo \
|
| 70 |
+
xmlschemas.lo xmlschemastypes.lo xmlunicode.lo \
|
| 71 |
+
+ xmlsche.lo xmlschet.lo \
|
| 72 |
+
$(am__objects_2) xmlreader.lo relaxng.lo dict.lo SAX2.lo \
|
| 73 |
+
xmlwriter.lo legacy.lo chvalid.lo pattern.lo xmlsave.lo \
|
| 74 |
+
xmlmodule.lo schematron.lo xzlib.lo
|
| 75 |
+
libxml2_la_OBJECTS = $(am_libxml2_la_OBJECTS)
|
| 76 |
+
+
|
| 77 |
+
+libxml2_OBJECTS = SAX.o entities.o encoding.o error.o \
|
| 78 |
+
+ parserInternals.o parser.o tree.o hash.o list.o xmlIO.o \
|
| 79 |
+
+ xmlmemory.o uri.o valid.o xlink.o HTMLparser.o \
|
| 80 |
+
+ HTMLtree.o debugXML.o xpath.o xpointer.o xinclude.o \
|
| 81 |
+
+ nanohttp.o nanoftp.o triostr.o trio.o catalog.o globals.o \
|
| 82 |
+
+ threads.o c14n.o xmlstring.o buf.o xmlregexp.o \
|
| 83 |
+
+ xmlschemas.o xmlschemastypes.o xmlunicode.o \
|
| 84 |
+
+ xmlsche.o xmlschemast.o \
|
| 85 |
+
+ xmlreader.o relaxng.o dict.o SAX2.o \
|
| 86 |
+
+ xmlwriter.o legacy.o chvalid.o pattern.o xmlsave.o \
|
| 87 |
+
+ xmlmodule.o schematron.o xzlib.o
|
| 88 |
+
+
|
| 89 |
+
AM_V_lt = $(am__v_lt_$(V))
|
| 90 |
+
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
| 91 |
+
am__v_lt_0 = --silent
|
| 92 |
+
@@ -216,11 +231,6 @@
|
| 93 |
+
testXPath_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
| 94 |
+
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
| 95 |
+
$(testXPath_LDFLAGS) $(LDFLAGS) -o $@
|
| 96 |
+
-am_testapi_OBJECTS = testapi.$(OBJEXT)
|
| 97 |
+
-testapi_OBJECTS = $(am_testapi_OBJECTS)
|
| 98 |
+
-testapi_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
| 99 |
+
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
| 100 |
+
- $(testapi_LDFLAGS) $(LDFLAGS) -o $@
|
| 101 |
+
am_testchar_OBJECTS = testchar.$(OBJEXT)
|
| 102 |
+
testchar_OBJECTS = $(am_testchar_OBJECTS)
|
| 103 |
+
testchar_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
| 104 |
+
@@ -285,7 +295,7 @@
|
| 105 |
+
$(testReader_SOURCES) $(testRegexp_SOURCES) \
|
| 106 |
+
$(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \
|
| 107 |
+
$(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) \
|
| 108 |
+
- $(testapi_SOURCES) $(testchar_SOURCES) $(testdict_SOURCES) \
|
| 109 |
+
+ $(testchar_SOURCES) $(testdict_SOURCES) \
|
| 110 |
+
$(testlimits_SOURCES) $(testrecurse_SOURCES) \
|
| 111 |
+
$(xmlcatalog_SOURCES) $(xmllint_SOURCES)
|
| 112 |
+
DIST_SOURCES = $(am__libxml2_la_SOURCES_DIST) $(testdso_la_SOURCES) \
|
| 113 |
+
@@ -295,7 +305,7 @@
|
| 114 |
+
$(testReader_SOURCES) $(testRegexp_SOURCES) \
|
| 115 |
+
$(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \
|
| 116 |
+
$(am__testThreads_SOURCES_DIST) $(testURI_SOURCES) \
|
| 117 |
+
- $(testXPath_SOURCES) $(testapi_SOURCES) $(testchar_SOURCES) \
|
| 118 |
+
+ $(testXPath_SOURCES) $(testchar_SOURCES) \
|
| 119 |
+
$(testdict_SOURCES) $(testlimits_SOURCES) \
|
| 120 |
+
$(testrecurse_SOURCES) $(xmlcatalog_SOURCES) \
|
| 121 |
+
$(xmllint_SOURCES)
|
| 122 |
+
@@ -700,11 +710,6 @@
|
| 123 |
+
noinst_LTLIBRARIES = testdso.la
|
| 124 |
+
testdso_la_SOURCES = testdso.c
|
| 125 |
+
testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
|
| 126 |
+
-BUILT_SOURCES = testapi.c
|
| 127 |
+
-testapi_SOURCES = testapi.c
|
| 128 |
+
-testapi_LDFLAGS =
|
| 129 |
+
-testapi_DEPENDENCIES = $(DEPS)
|
| 130 |
+
-testapi_LDADD = $(LDADDS)
|
| 131 |
+
runxmlconf_SOURCES = runxmlconf.c
|
| 132 |
+
runxmlconf_LDFLAGS =
|
| 133 |
+
runxmlconf_DEPENDENCIES = $(DEPS)
|
| 134 |
+
@@ -854,6 +859,12 @@
|
| 135 |
+
done
|
| 136 |
+
libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES)
|
| 137 |
+
$(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS)
|
| 138 |
+
+ # Copie des obj
|
| 139 |
+
+ @list='$(libxml2_OBJECTS)' ; for p in $$list; do \
|
| 140 |
+
+ echo "copy to PDS: $$p"; \
|
| 141 |
+
+ cp -ACMv $$p "//'A009153.XRDEV230.FIC.OBJLIB.LIBXML'"; \
|
| 142 |
+
+ done
|
| 143 |
+
+
|
| 144 |
+
testdso.la: $(testdso_la_OBJECTS) $(testdso_la_DEPENDENCIES)
|
| 145 |
+
$(AM_V_CCLD)$(testdso_la_LINK) $(testdso_la_OBJECTS) $(testdso_la_LIBADD) $(LIBS)
|
| 146 |
+
install-binPROGRAMS: $(bin_PROGRAMS)
|
| 147 |
+
@@ -953,9 +964,6 @@
|
| 148 |
+
testXPath$(EXEEXT): $(testXPath_OBJECTS) $(testXPath_DEPENDENCIES)
|
| 149 |
+
@rm -f testXPath$(EXEEXT)
|
| 150 |
+
$(AM_V_CCLD)$(testXPath_LINK) $(testXPath_OBJECTS) $(testXPath_LDADD) $(LIBS)
|
| 151 |
+
-testapi$(EXEEXT): $(testapi_OBJECTS) $(testapi_DEPENDENCIES)
|
| 152 |
+
- @rm -f testapi$(EXEEXT)
|
| 153 |
+
- $(AM_V_CCLD)$(testapi_LINK) $(testapi_OBJECTS) $(testapi_LDADD) $(LIBS)
|
| 154 |
+
testchar$(EXEEXT): $(testchar_OBJECTS) $(testchar_DEPENDENCIES)
|
| 155 |
+
@rm -f testchar$(EXEEXT)
|
| 156 |
+
$(AM_V_CCLD)$(testchar_LINK) $(testchar_OBJECTS) $(testchar_LDADD) $(LIBS)
|
| 157 |
+
@@ -1056,7 +1064,6 @@
|
| 158 |
+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testThreadsWin32.Po@am__quote@
|
| 159 |
+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testURI.Po@am__quote@
|
| 160 |
+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testXPath.Po@am__quote@
|
| 161 |
+
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testapi.Po@am__quote@
|
| 162 |
+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testchar.Po@am__quote@
|
| 163 |
+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdict.Po@am__quote@
|
| 164 |
+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdso.Plo@am__quote@
|
| 165 |
+
@@ -1755,18 +1762,6 @@
|
| 166 |
+
uninstall-local uninstall-m4dataDATA uninstall-man \
|
| 167 |
+
uninstall-man1 uninstall-man3 uninstall-pkgconfigDATA
|
| 168 |
+
|
| 169 |
+
-
|
| 170 |
+
-# that one forces the rebuild when "make rebuild" is run on doc/
|
| 171 |
+
-rebuild_testapi:
|
| 172 |
+
- -@(if [ "$(PYTHON)" != "" ] ; then \
|
| 173 |
+
- $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
|
| 174 |
+
-
|
| 175 |
+
-# that one is just to make sure it is rebuilt if missing
|
| 176 |
+
-# but adding the dependances generate mess
|
| 177 |
+
-testapi.c: $(srcdir)/gentest.py
|
| 178 |
+
- -@(if [ "$(PYTHON)" != "" ] ; then \
|
| 179 |
+
- $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
|
| 180 |
+
-
|
| 181 |
+
#testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c
|
| 182 |
+
#testOOM_LDFLAGS =
|
| 183 |
+
#testOOM_DEPENDENCIES = $(DEPS)
|
| 184 |
+
@@ -1775,7 +1770,7 @@
|
| 185 |
+
runtests:
|
| 186 |
+
[ -d test ] || $(LN_S) $(srcdir)/test .
|
| 187 |
+
[ -d result ] || $(LN_S) $(srcdir)/result .
|
| 188 |
+
- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
|
| 189 |
+
+ $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
|
| 190 |
+
@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
|
| 191 |
+
$(MAKE) tests ; fi)
|
| 192 |
+
|
| 193 |
+
@@ -1797,10 +1792,6 @@
|
| 194 |
+
$(MAKE) tests ; fi)
|
| 195 |
+
@(cd doc/examples ; $(MAKE) tests)
|
| 196 |
+
|
| 197 |
+
-APItests: testapi$(EXEEXT)
|
| 198 |
+
- @echo "## Running the API regression tests this may take a little while"
|
| 199 |
+
- -@($(CHECKER) $(top_builddir)/testapi -q)
|
| 200 |
+
-
|
| 201 |
+
HTMLtests : testHTML$(EXEEXT)
|
| 202 |
+
@(echo > .memdump)
|
| 203 |
+
@echo "## HTML regression tests"
|
| 204 |
+
@@ -2746,7 +2737,7 @@
|
| 205 |
+
dist-test: distdir
|
| 206 |
+
(mkdir -p $(distdir))
|
| 207 |
+
(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git xstc/Tests) | (cd $(distdir); tar xf -)
|
| 208 |
+
- tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/testapi.c $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz
|
| 209 |
+
+ tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* SAX2.c : Default SAX2 handler to build a tree.
|
| 3 |
+
*
|
| 4 |
+
* See Copyright for the status of this software.
|
| 5 |
+
*
|
| 6 |
+
* Author: Daniel Veillard
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
#define IN_LIBXML
|
| 11 |
+
#include "libxml.h"
|
| 12 |
+
#include <stdlib.h>
|
| 13 |
+
#include <string.h>
|
| 14 |
+
#include <limits.h>
|
| 15 |
+
#include <stddef.h>
|
| 16 |
+
#include <libxml/SAX2.h>
|
| 17 |
+
#include <libxml/xmlmemory.h>
|
| 18 |
+
#include <libxml/tree.h>
|
| 19 |
+
#include <libxml/parser.h>
|
| 20 |
+
#include <libxml/parserInternals.h>
|
| 21 |
+
#include <libxml/valid.h>
|
| 22 |
+
#include <libxml/entities.h>
|
| 23 |
+
#include <libxml/xmlerror.h>
|
| 24 |
+
#include <libxml/xmlIO.h>
|
| 25 |
+
#include <libxml/uri.h>
|
| 26 |
+
#include <libxml/valid.h>
|
| 27 |
+
#include <libxml/HTMLtree.h>
|
| 28 |
+
|
| 29 |
+
#include "private/error.h"
|
| 30 |
+
#include "private/parser.h"
|
| 31 |
+
#include "private/tree.h"
|
| 32 |
+
|
| 33 |
+
#ifndef SIZE_MAX
|
| 34 |
+
#define SIZE_MAX ((size_t) -1)
|
| 35 |
+
#endif
|
| 36 |
+
|
| 37 |
+
/*
|
| 38 |
+
* @param ctxt an XML validation parser context
|
| 39 |
+
* @param msg a string to accompany the error message
|
| 40 |
+
*/
|
| 41 |
+
static void
|
| 42 |
+
xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt) {
|
| 43 |
+
xmlCtxtErrMemory(ctxt);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 47 |
+
/**
|
| 48 |
+
* Handle a validation error
|
| 49 |
+
*
|
| 50 |
+
* @param ctxt an XML validation parser context
|
| 51 |
+
* @param error the error number
|
| 52 |
+
* @param msg the error message
|
| 53 |
+
* @param str1 extra data
|
| 54 |
+
* @param str2 extra data
|
| 55 |
+
*/
|
| 56 |
+
static void LIBXML_ATTR_FORMAT(3,0)
|
| 57 |
+
xmlErrValid(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
| 58 |
+
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
| 59 |
+
{
|
| 60 |
+
xmlCtxtErr(ctxt, NULL, XML_FROM_DTD, error, XML_ERR_ERROR,
|
| 61 |
+
str1, str2, NULL, 0, msg, str1, str2);
|
| 62 |
+
if (ctxt != NULL)
|
| 63 |
+
ctxt->valid = 0;
|
| 64 |
+
}
|
| 65 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Handle a fatal parser error, i.e. violating Well-Formedness constraints
|
| 69 |
+
*
|
| 70 |
+
* @param ctxt an XML parser context
|
| 71 |
+
* @param error the error number
|
| 72 |
+
* @param msg the error message
|
| 73 |
+
* @param str1 an error string
|
| 74 |
+
* @param str2 an error string
|
| 75 |
+
*/
|
| 76 |
+
static void LIBXML_ATTR_FORMAT(3,0)
|
| 77 |
+
xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
| 78 |
+
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
| 79 |
+
{
|
| 80 |
+
xmlCtxtErr(ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL,
|
| 81 |
+
str1, str2, NULL, 0, msg, str1, str2);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Handle an xml:id error
|
| 86 |
+
*
|
| 87 |
+
* @param ctxt an XML validation parser context
|
| 88 |
+
* @param error the error number
|
| 89 |
+
* @param msg the error message
|
| 90 |
+
* @param str1 extra data
|
| 91 |
+
*/
|
| 92 |
+
static void LIBXML_ATTR_FORMAT(3,0)
|
| 93 |
+
xmlErrId(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg,
|
| 94 |
+
const xmlChar *str1)
|
| 95 |
+
{
|
| 96 |
+
xmlCtxtErr(ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_ERROR,
|
| 97 |
+
str1, NULL, NULL, 0, msg, str1);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
* Handle a parser warning
|
| 102 |
+
*
|
| 103 |
+
* @param ctxt an XML parser context
|
| 104 |
+
* @param error the error number
|
| 105 |
+
* @param msg the error message
|
| 106 |
+
* @param str1 an error string
|
| 107 |
+
*/
|
| 108 |
+
static void LIBXML_ATTR_FORMAT(3,0)
|
| 109 |
+
xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
| 110 |
+
const char *msg, const xmlChar *str1)
|
| 111 |
+
{
|
| 112 |
+
xmlCtxtErr(ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_WARNING,
|
| 113 |
+
str1, NULL, NULL, 0, msg, str1);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* Handle a namespace warning
|
| 118 |
+
*
|
| 119 |
+
* @param ctxt an XML parser context
|
| 120 |
+
* @param error the error number
|
| 121 |
+
* @param msg the error message
|
| 122 |
+
* @param str1 an error string
|
| 123 |
+
* @param str2 an error string
|
| 124 |
+
*/
|
| 125 |
+
static void LIBXML_ATTR_FORMAT(3,0)
|
| 126 |
+
xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
| 127 |
+
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
| 128 |
+
{
|
| 129 |
+
xmlCtxtErr(ctxt, NULL, XML_FROM_NAMESPACE, error, XML_ERR_WARNING,
|
| 130 |
+
str1, str2, NULL, 0, msg, str1, str2);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/**
|
| 134 |
+
* Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
|
| 135 |
+
*
|
| 136 |
+
* @param ctx the user data (XML parser context)
|
| 137 |
+
* @returns a xmlChar *
|
| 138 |
+
*/
|
| 139 |
+
const xmlChar *
|
| 140 |
+
xmlSAX2GetPublicId(void *ctx ATTRIBUTE_UNUSED)
|
| 141 |
+
{
|
| 142 |
+
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
|
| 143 |
+
return(NULL);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/**
|
| 147 |
+
* Provides the system ID, basically URL or filename e.g.
|
| 148 |
+
* http://www.sgmlsource.com/dtds/memo.dtd
|
| 149 |
+
*
|
| 150 |
+
* @param ctx the user data (XML parser context)
|
| 151 |
+
* @returns a xmlChar *
|
| 152 |
+
*/
|
| 153 |
+
const xmlChar *
|
| 154 |
+
xmlSAX2GetSystemId(void *ctx)
|
| 155 |
+
{
|
| 156 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 157 |
+
if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL);
|
| 158 |
+
return((const xmlChar *) ctxt->input->filename);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/**
|
| 162 |
+
* Provide the line number of the current parsing point.
|
| 163 |
+
*
|
| 164 |
+
* @param ctx the user data (XML parser context)
|
| 165 |
+
* @returns an int
|
| 166 |
+
*/
|
| 167 |
+
int
|
| 168 |
+
xmlSAX2GetLineNumber(void *ctx)
|
| 169 |
+
{
|
| 170 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 171 |
+
if ((ctx == NULL) || (ctxt->input == NULL)) return(0);
|
| 172 |
+
return(ctxt->input->line);
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
/**
|
| 176 |
+
* Provide the column number of the current parsing point.
|
| 177 |
+
*
|
| 178 |
+
* @param ctx the user data (XML parser context)
|
| 179 |
+
* @returns an int
|
| 180 |
+
*/
|
| 181 |
+
int
|
| 182 |
+
xmlSAX2GetColumnNumber(void *ctx)
|
| 183 |
+
{
|
| 184 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 185 |
+
if ((ctx == NULL) || (ctxt->input == NULL)) return(0);
|
| 186 |
+
return(ctxt->input->col);
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* Is this document tagged standalone ?
|
| 191 |
+
*
|
| 192 |
+
* @param ctx the user data (XML parser context)
|
| 193 |
+
* @returns 1 if true
|
| 194 |
+
*/
|
| 195 |
+
int
|
| 196 |
+
xmlSAX2IsStandalone(void *ctx)
|
| 197 |
+
{
|
| 198 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 199 |
+
if ((ctx == NULL) || (ctxt->myDoc == NULL)) return(0);
|
| 200 |
+
return(ctxt->myDoc->standalone == 1);
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
/**
|
| 204 |
+
* Does this document has an internal subset
|
| 205 |
+
*
|
| 206 |
+
* @param ctx the user data (XML parser context)
|
| 207 |
+
* @returns 1 if true
|
| 208 |
+
*/
|
| 209 |
+
int
|
| 210 |
+
xmlSAX2HasInternalSubset(void *ctx)
|
| 211 |
+
{
|
| 212 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 213 |
+
if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0);
|
| 214 |
+
return(ctxt->myDoc->intSubset != NULL);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* Does this document has an external subset
|
| 219 |
+
*
|
| 220 |
+
* @param ctx the user data (XML parser context)
|
| 221 |
+
* @returns 1 if true
|
| 222 |
+
*/
|
| 223 |
+
int
|
| 224 |
+
xmlSAX2HasExternalSubset(void *ctx)
|
| 225 |
+
{
|
| 226 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 227 |
+
if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0);
|
| 228 |
+
return(ctxt->myDoc->extSubset != NULL);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
/**
|
| 232 |
+
* Callback on internal subset declaration.
|
| 233 |
+
*
|
| 234 |
+
* @param ctx the user data (XML parser context)
|
| 235 |
+
* @param name the root element name
|
| 236 |
+
* @param publicId public identifier of the DTD (optional)
|
| 237 |
+
* @param systemId system identifier (URL) of the DTD
|
| 238 |
+
*/
|
| 239 |
+
void
|
| 240 |
+
xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
|
| 241 |
+
const xmlChar *publicId, const xmlChar *systemId)
|
| 242 |
+
{
|
| 243 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 244 |
+
xmlDtdPtr dtd;
|
| 245 |
+
if (ctx == NULL) return;
|
| 246 |
+
|
| 247 |
+
if (ctxt->myDoc == NULL)
|
| 248 |
+
return;
|
| 249 |
+
if ((ctxt->html) && (ctxt->instate != XML_PARSER_MISC))
|
| 250 |
+
return;
|
| 251 |
+
dtd = xmlGetIntSubset(ctxt->myDoc);
|
| 252 |
+
if (dtd != NULL) {
|
| 253 |
+
xmlUnlinkNode((xmlNodePtr) dtd);
|
| 254 |
+
xmlFreeDtd(dtd);
|
| 255 |
+
ctxt->myDoc->intSubset = NULL;
|
| 256 |
+
}
|
| 257 |
+
ctxt->myDoc->intSubset =
|
| 258 |
+
xmlCreateIntSubset(ctxt->myDoc, name, publicId, systemId);
|
| 259 |
+
if (ctxt->myDoc->intSubset == NULL)
|
| 260 |
+
xmlSAX2ErrMemory(ctxt);
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
/**
|
| 264 |
+
* Callback on external subset declaration.
|
| 265 |
+
*
|
| 266 |
+
* @param ctx the user data (XML parser context)
|
| 267 |
+
* @param name the root element name
|
| 268 |
+
* @param publicId public identifier of the DTD (optional)
|
| 269 |
+
* @param systemId system identifier (URL) of the DTD
|
| 270 |
+
*/
|
| 271 |
+
void
|
| 272 |
+
xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
| 273 |
+
const xmlChar *publicId, const xmlChar *systemId)
|
| 274 |
+
{
|
| 275 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 276 |
+
if (ctx == NULL) return;
|
| 277 |
+
if ((systemId != NULL) &&
|
| 278 |
+
((ctxt->options & XML_PARSE_NO_XXE) == 0) &&
|
| 279 |
+
(((ctxt->validate) || (ctxt->loadsubset & ~XML_SKIP_IDS)) &&
|
| 280 |
+
(ctxt->wellFormed && ctxt->myDoc))) {
|
| 281 |
+
/*
|
| 282 |
+
* Try to fetch and parse the external subset.
|
| 283 |
+
*/
|
| 284 |
+
xmlParserInputPtr oldinput;
|
| 285 |
+
int oldinputNr;
|
| 286 |
+
int oldinputMax;
|
| 287 |
+
xmlParserInputPtr *oldinputTab;
|
| 288 |
+
xmlParserInputPtr input = NULL;
|
| 289 |
+
xmlChar *oldencoding;
|
| 290 |
+
unsigned long consumed;
|
| 291 |
+
size_t buffered;
|
| 292 |
+
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
| 293 |
+
int inputMax = 1;
|
| 294 |
+
#else
|
| 295 |
+
int inputMax = 5;
|
| 296 |
+
#endif
|
| 297 |
+
|
| 298 |
+
/*
|
| 299 |
+
* Ask the Entity resolver to load the damn thing
|
| 300 |
+
*/
|
| 301 |
+
if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
|
| 302 |
+
input = ctxt->sax->resolveEntity(ctxt->userData, publicId,
|
| 303 |
+
systemId);
|
| 304 |
+
if (input == NULL) {
|
| 305 |
+
return;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
if (xmlNewDtd(ctxt->myDoc, name, publicId, systemId) == NULL) {
|
| 309 |
+
xmlSAX2ErrMemory(ctxt);
|
| 310 |
+
xmlFreeInputStream(input);
|
| 311 |
+
return;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
/*
|
| 315 |
+
* make sure we won't destroy the main document context
|
| 316 |
+
*/
|
| 317 |
+
oldinput = ctxt->input;
|
| 318 |
+
oldinputNr = ctxt->inputNr;
|
| 319 |
+
oldinputMax = ctxt->inputMax;
|
| 320 |
+
oldinputTab = ctxt->inputTab;
|
| 321 |
+
oldencoding = ctxt->encoding;
|
| 322 |
+
ctxt->encoding = NULL;
|
| 323 |
+
|
| 324 |
+
ctxt->inputTab = xmlMalloc(inputMax * sizeof(xmlParserInputPtr));
|
| 325 |
+
if (ctxt->inputTab == NULL) {
|
| 326 |
+
xmlSAX2ErrMemory(ctxt);
|
| 327 |
+
goto error;
|
| 328 |
+
}
|
| 329 |
+
ctxt->inputNr = 0;
|
| 330 |
+
ctxt->inputMax = inputMax;
|
| 331 |
+
ctxt->input = NULL;
|
| 332 |
+
if (xmlCtxtPushInput(ctxt, input) < 0)
|
| 333 |
+
goto error;
|
| 334 |
+
|
| 335 |
+
if (input->filename == NULL)
|
| 336 |
+
input->filename = (char *) xmlCanonicPath(systemId);
|
| 337 |
+
input->line = 1;
|
| 338 |
+
input->col = 1;
|
| 339 |
+
input->base = ctxt->input->cur;
|
| 340 |
+
input->cur = ctxt->input->cur;
|
| 341 |
+
input->free = NULL;
|
| 342 |
+
|
| 343 |
+
/*
|
| 344 |
+
* let's parse that entity knowing it's an external subset.
|
| 345 |
+
*/
|
| 346 |
+
xmlParseExternalSubset(ctxt, publicId, systemId);
|
| 347 |
+
|
| 348 |
+
/*
|
| 349 |
+
* Free up the external entities
|
| 350 |
+
*/
|
| 351 |
+
|
| 352 |
+
while (ctxt->inputNr > 1)
|
| 353 |
+
xmlFreeInputStream(xmlCtxtPopInput(ctxt));
|
| 354 |
+
|
| 355 |
+
consumed = ctxt->input->consumed;
|
| 356 |
+
buffered = ctxt->input->cur - ctxt->input->base;
|
| 357 |
+
if (buffered > ULONG_MAX - consumed)
|
| 358 |
+
consumed = ULONG_MAX;
|
| 359 |
+
else
|
| 360 |
+
consumed += buffered;
|
| 361 |
+
if (consumed > ULONG_MAX - ctxt->sizeentities)
|
| 362 |
+
ctxt->sizeentities = ULONG_MAX;
|
| 363 |
+
else
|
| 364 |
+
ctxt->sizeentities += consumed;
|
| 365 |
+
|
| 366 |
+
error:
|
| 367 |
+
xmlFreeInputStream(input);
|
| 368 |
+
xmlFree(ctxt->inputTab);
|
| 369 |
+
|
| 370 |
+
/*
|
| 371 |
+
* Restore the parsing context of the main entity
|
| 372 |
+
*/
|
| 373 |
+
ctxt->input = oldinput;
|
| 374 |
+
ctxt->inputNr = oldinputNr;
|
| 375 |
+
ctxt->inputMax = oldinputMax;
|
| 376 |
+
ctxt->inputTab = oldinputTab;
|
| 377 |
+
if (ctxt->encoding != NULL)
|
| 378 |
+
xmlFree(ctxt->encoding);
|
| 379 |
+
ctxt->encoding = oldencoding;
|
| 380 |
+
/* ctxt->wellFormed = oldwellFormed; */
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
/**
|
| 385 |
+
* This is only used to load DTDs. The preferred way to install
|
| 386 |
+
* custom resolvers is #xmlCtxtSetResourceLoader.
|
| 387 |
+
*
|
| 388 |
+
* @param ctx the user data (XML parser context)
|
| 389 |
+
* @param publicId The public ID of the entity
|
| 390 |
+
* @param systemId The system ID (URL) of the entity
|
| 391 |
+
* @returns a parser input.
|
| 392 |
+
*/
|
| 393 |
+
xmlParserInput *
|
| 394 |
+
xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId,
|
| 395 |
+
const xmlChar *systemId)
|
| 396 |
+
{
|
| 397 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 398 |
+
xmlParserInputPtr ret = NULL;
|
| 399 |
+
xmlChar *URI = NULL;
|
| 400 |
+
|
| 401 |
+
if (ctx == NULL) return(NULL);
|
| 402 |
+
|
| 403 |
+
if (systemId != NULL) {
|
| 404 |
+
const xmlChar *base = NULL;
|
| 405 |
+
int res;
|
| 406 |
+
|
| 407 |
+
if (ctxt->input != NULL)
|
| 408 |
+
base = BAD_CAST ctxt->input->filename;
|
| 409 |
+
|
| 410 |
+
/*
|
| 411 |
+
* We don't really need the 'directory' struct member, but some
|
| 412 |
+
* users set it manually to a base URI for memory streams.
|
| 413 |
+
*/
|
| 414 |
+
if (base == NULL)
|
| 415 |
+
base = BAD_CAST ctxt->directory;
|
| 416 |
+
|
| 417 |
+
if ((xmlStrlen(systemId) > XML_MAX_URI_LENGTH) ||
|
| 418 |
+
(xmlStrlen(base) > XML_MAX_URI_LENGTH)) {
|
| 419 |
+
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT, "URI too long");
|
| 420 |
+
return(NULL);
|
| 421 |
+
}
|
| 422 |
+
res = xmlBuildURISafe(systemId, base, &URI);
|
| 423 |
+
if (URI == NULL) {
|
| 424 |
+
if (res < 0)
|
| 425 |
+
xmlSAX2ErrMemory(ctxt);
|
| 426 |
+
else
|
| 427 |
+
xmlWarnMsg(ctxt, XML_ERR_INVALID_URI,
|
| 428 |
+
"Can't resolve URI: %s\n", systemId);
|
| 429 |
+
return(NULL);
|
| 430 |
+
}
|
| 431 |
+
if (xmlStrlen(URI) > XML_MAX_URI_LENGTH) {
|
| 432 |
+
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT, "URI too long");
|
| 433 |
+
xmlFree(URI);
|
| 434 |
+
return(NULL);
|
| 435 |
+
}
|
| 436 |
+
}
|
| 437 |
+
|
| 438 |
+
ret = xmlLoadResource(ctxt, (const char *) URI,
|
| 439 |
+
(const char *) publicId, XML_RESOURCE_DTD);
|
| 440 |
+
|
| 441 |
+
xmlFree(URI);
|
| 442 |
+
return(ret);
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
/**
|
| 446 |
+
* Get an entity by name
|
| 447 |
+
*
|
| 448 |
+
* @param ctx the user data (XML parser context)
|
| 449 |
+
* @param name The entity name
|
| 450 |
+
* @returns the xmlEntity if found.
|
| 451 |
+
*/
|
| 452 |
+
xmlEntity *
|
| 453 |
+
xmlSAX2GetEntity(void *ctx, const xmlChar *name)
|
| 454 |
+
{
|
| 455 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 456 |
+
xmlEntityPtr ret = NULL;
|
| 457 |
+
|
| 458 |
+
if (ctx == NULL) return(NULL);
|
| 459 |
+
|
| 460 |
+
if (ctxt->inSubset == 0) {
|
| 461 |
+
ret = xmlGetPredefinedEntity(name);
|
| 462 |
+
if (ret != NULL)
|
| 463 |
+
return(ret);
|
| 464 |
+
}
|
| 465 |
+
if ((ctxt->myDoc != NULL) && (ctxt->myDoc->standalone == 1)) {
|
| 466 |
+
if (ctxt->inSubset == 2) {
|
| 467 |
+
ctxt->myDoc->standalone = 0;
|
| 468 |
+
ret = xmlGetDocEntity(ctxt->myDoc, name);
|
| 469 |
+
ctxt->myDoc->standalone = 1;
|
| 470 |
+
} else {
|
| 471 |
+
ret = xmlGetDocEntity(ctxt->myDoc, name);
|
| 472 |
+
if (ret == NULL) {
|
| 473 |
+
ctxt->myDoc->standalone = 0;
|
| 474 |
+
ret = xmlGetDocEntity(ctxt->myDoc, name);
|
| 475 |
+
if (ret != NULL) {
|
| 476 |
+
xmlFatalErrMsg(ctxt, XML_ERR_NOT_STANDALONE,
|
| 477 |
+
"Entity(%s) document marked standalone but requires external subset\n",
|
| 478 |
+
name, NULL);
|
| 479 |
+
}
|
| 480 |
+
ctxt->myDoc->standalone = 1;
|
| 481 |
+
}
|
| 482 |
+
}
|
| 483 |
+
} else {
|
| 484 |
+
ret = xmlGetDocEntity(ctxt->myDoc, name);
|
| 485 |
+
}
|
| 486 |
+
return(ret);
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
/**
|
| 490 |
+
* Get a parameter entity by name
|
| 491 |
+
*
|
| 492 |
+
* @param ctx the user data (XML parser context)
|
| 493 |
+
* @param name The entity name
|
| 494 |
+
* @returns the xmlEntity if found.
|
| 495 |
+
*/
|
| 496 |
+
xmlEntity *
|
| 497 |
+
xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
|
| 498 |
+
{
|
| 499 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 500 |
+
xmlEntityPtr ret;
|
| 501 |
+
|
| 502 |
+
if (ctx == NULL) return(NULL);
|
| 503 |
+
|
| 504 |
+
ret = xmlGetParameterEntity(ctxt->myDoc, name);
|
| 505 |
+
return(ret);
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
/**
|
| 510 |
+
* An entity definition has been parsed
|
| 511 |
+
*
|
| 512 |
+
* @param ctx the user data (XML parser context)
|
| 513 |
+
* @param name the entity name
|
| 514 |
+
* @param type the entity type
|
| 515 |
+
* @param publicId The public ID of the entity
|
| 516 |
+
* @param systemId The system ID of the entity
|
| 517 |
+
* @param content the entity value (without processing).
|
| 518 |
+
*/
|
| 519 |
+
void
|
| 520 |
+
xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
|
| 521 |
+
const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
|
| 522 |
+
{
|
| 523 |
+
xmlEntityPtr ent;
|
| 524 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 525 |
+
int extSubset;
|
| 526 |
+
int res;
|
| 527 |
+
|
| 528 |
+
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
| 529 |
+
return;
|
| 530 |
+
|
| 531 |
+
extSubset = ctxt->inSubset == 2;
|
| 532 |
+
res = xmlAddEntity(ctxt->myDoc, extSubset, name, type, publicId, systemId,
|
| 533 |
+
content, &ent);
|
| 534 |
+
switch (res) {
|
| 535 |
+
case XML_ERR_OK:
|
| 536 |
+
break;
|
| 537 |
+
case XML_ERR_NO_MEMORY:
|
| 538 |
+
xmlSAX2ErrMemory(ctxt);
|
| 539 |
+
return;
|
| 540 |
+
case XML_WAR_ENTITY_REDEFINED:
|
| 541 |
+
if (ctxt->pedantic) {
|
| 542 |
+
if (extSubset)
|
| 543 |
+
xmlWarnMsg(ctxt, res, "Entity(%s) already defined in the"
|
| 544 |
+
" external subset\n", name);
|
| 545 |
+
else
|
| 546 |
+
xmlWarnMsg(ctxt, res, "Entity(%s) already defined in the"
|
| 547 |
+
" internal subset\n", name);
|
| 548 |
+
}
|
| 549 |
+
return;
|
| 550 |
+
case XML_ERR_REDECL_PREDEF_ENTITY:
|
| 551 |
+
/*
|
| 552 |
+
* Technically an error but it's a common mistake to get double
|
| 553 |
+
* escaping according to "4.6 Predefined Entities" wrong.
|
| 554 |
+
*/
|
| 555 |
+
xmlWarnMsg(ctxt, res, "Invalid redeclaration of predefined"
|
| 556 |
+
" entity '%s'", name);
|
| 557 |
+
return;
|
| 558 |
+
default:
|
| 559 |
+
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
|
| 560 |
+
"Unexpected error code from xmlAddEntity\n",
|
| 561 |
+
NULL, NULL);
|
| 562 |
+
return;
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
if ((ent->URI == NULL) && (systemId != NULL)) {
|
| 566 |
+
xmlChar *URI;
|
| 567 |
+
const char *base = NULL;
|
| 568 |
+
int i;
|
| 569 |
+
|
| 570 |
+
for (i = ctxt->inputNr - 1; i >= 0; i--) {
|
| 571 |
+
if (ctxt->inputTab[i]->filename != NULL) {
|
| 572 |
+
base = ctxt->inputTab[i]->filename;
|
| 573 |
+
break;
|
| 574 |
+
}
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
/*
|
| 578 |
+
* We don't really need the 'directory' struct member, but some
|
| 579 |
+
* users set it manually to a base URI for memory streams.
|
| 580 |
+
*/
|
| 581 |
+
if (base == NULL)
|
| 582 |
+
base = ctxt->directory;
|
| 583 |
+
|
| 584 |
+
res = xmlBuildURISafe(systemId, (const xmlChar *) base, &URI);
|
| 585 |
+
|
| 586 |
+
if (URI == NULL) {
|
| 587 |
+
if (res < 0) {
|
| 588 |
+
xmlSAX2ErrMemory(ctxt);
|
| 589 |
+
} else {
|
| 590 |
+
xmlWarnMsg(ctxt, XML_ERR_INVALID_URI,
|
| 591 |
+
"Can't resolve URI: %s\n", systemId);
|
| 592 |
+
}
|
| 593 |
+
} else if (xmlStrlen(URI) > XML_MAX_URI_LENGTH) {
|
| 594 |
+
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT, "URI too long");
|
| 595 |
+
xmlFree(URI);
|
| 596 |
+
} else {
|
| 597 |
+
ent->URI = URI;
|
| 598 |
+
}
|
| 599 |
+
}
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
/**
|
| 603 |
+
* An attribute definition has been parsed
|
| 604 |
+
*
|
| 605 |
+
* @param ctx the user data (XML parser context)
|
| 606 |
+
* @param elem the name of the element
|
| 607 |
+
* @param fullname the attribute name
|
| 608 |
+
* @param type the attribute type
|
| 609 |
+
* @param def the type of default value
|
| 610 |
+
* @param defaultValue the attribute default value
|
| 611 |
+
* @param tree the tree of enumerated value set
|
| 612 |
+
*/
|
| 613 |
+
void
|
| 614 |
+
xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
|
| 615 |
+
int type, int def, const xmlChar *defaultValue,
|
| 616 |
+
xmlEnumeration *tree)
|
| 617 |
+
{
|
| 618 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 619 |
+
xmlAttributePtr attr;
|
| 620 |
+
const xmlChar *name = NULL;
|
| 621 |
+
xmlChar *prefix = NULL;
|
| 622 |
+
|
| 623 |
+
/* Avoid unused variable warning if features are disabled. */
|
| 624 |
+
(void) attr;
|
| 625 |
+
|
| 626 |
+
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
| 627 |
+
return;
|
| 628 |
+
|
| 629 |
+
if ((xmlStrEqual(fullname, BAD_CAST "xml:id")) &&
|
| 630 |
+
(type != XML_ATTRIBUTE_ID)) {
|
| 631 |
+
xmlErrId(ctxt, XML_DTD_XMLID_TYPE,
|
| 632 |
+
"xml:id : attribute type should be ID\n", NULL);
|
| 633 |
+
}
|
| 634 |
+
name = xmlSplitQName4(fullname, &prefix);
|
| 635 |
+
if (name == NULL)
|
| 636 |
+
xmlSAX2ErrMemory(ctxt);
|
| 637 |
+
ctxt->vctxt.valid = 1;
|
| 638 |
+
if (ctxt->inSubset == 1)
|
| 639 |
+
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem,
|
| 640 |
+
name, prefix, (xmlAttributeType) type,
|
| 641 |
+
(xmlAttributeDefault) def, defaultValue, tree);
|
| 642 |
+
else if (ctxt->inSubset == 2)
|
| 643 |
+
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem,
|
| 644 |
+
name, prefix, (xmlAttributeType) type,
|
| 645 |
+
(xmlAttributeDefault) def, defaultValue, tree);
|
| 646 |
+
else {
|
| 647 |
+
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
|
| 648 |
+
"SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n",
|
| 649 |
+
name, NULL);
|
| 650 |
+
xmlFree(prefix);
|
| 651 |
+
xmlFreeEnumeration(tree);
|
| 652 |
+
return;
|
| 653 |
+
}
|
| 654 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 655 |
+
if (ctxt->vctxt.valid == 0)
|
| 656 |
+
ctxt->valid = 0;
|
| 657 |
+
if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) &&
|
| 658 |
+
(ctxt->myDoc->intSubset != NULL))
|
| 659 |
+
ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
|
| 660 |
+
attr);
|
| 661 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 662 |
+
if (prefix != NULL)
|
| 663 |
+
xmlFree(prefix);
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
/**
|
| 667 |
+
* An element definition has been parsed
|
| 668 |
+
*
|
| 669 |
+
* @param ctx the user data (XML parser context)
|
| 670 |
+
* @param name the element name
|
| 671 |
+
* @param type the element type
|
| 672 |
+
* @param content the element value tree
|
| 673 |
+
*/
|
| 674 |
+
void
|
| 675 |
+
xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
|
| 676 |
+
xmlElementContent *content)
|
| 677 |
+
{
|
| 678 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 679 |
+
xmlElementPtr elem = NULL;
|
| 680 |
+
|
| 681 |
+
/* Avoid unused variable warning if features are disabled. */
|
| 682 |
+
(void) elem;
|
| 683 |
+
|
| 684 |
+
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
| 685 |
+
return;
|
| 686 |
+
|
| 687 |
+
if (ctxt->inSubset == 1)
|
| 688 |
+
elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset,
|
| 689 |
+
name, (xmlElementTypeVal) type, content);
|
| 690 |
+
else if (ctxt->inSubset == 2)
|
| 691 |
+
elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset,
|
| 692 |
+
name, (xmlElementTypeVal) type, content);
|
| 693 |
+
else {
|
| 694 |
+
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
|
| 695 |
+
"SAX.xmlSAX2ElementDecl(%s) called while not in subset\n",
|
| 696 |
+
name, NULL);
|
| 697 |
+
return;
|
| 698 |
+
}
|
| 699 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 700 |
+
if (elem == NULL)
|
| 701 |
+
ctxt->valid = 0;
|
| 702 |
+
if (ctxt->validate && ctxt->wellFormed &&
|
| 703 |
+
ctxt->myDoc && ctxt->myDoc->intSubset)
|
| 704 |
+
ctxt->valid &=
|
| 705 |
+
xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem);
|
| 706 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
/**
|
| 710 |
+
* What to do when a notation declaration has been parsed.
|
| 711 |
+
*
|
| 712 |
+
* @param ctx the user data (XML parser context)
|
| 713 |
+
* @param name The name of the notation
|
| 714 |
+
* @param publicId The public ID of the entity
|
| 715 |
+
* @param systemId The system ID of the entity
|
| 716 |
+
*/
|
| 717 |
+
void
|
| 718 |
+
xmlSAX2NotationDecl(void *ctx, const xmlChar *name,
|
| 719 |
+
const xmlChar *publicId, const xmlChar *systemId)
|
| 720 |
+
{
|
| 721 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 722 |
+
xmlNotationPtr nota = NULL;
|
| 723 |
+
|
| 724 |
+
/* Avoid unused variable warning if features are disabled. */
|
| 725 |
+
(void) nota;
|
| 726 |
+
|
| 727 |
+
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
| 728 |
+
return;
|
| 729 |
+
|
| 730 |
+
if ((publicId == NULL) && (systemId == NULL)) {
|
| 731 |
+
xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING,
|
| 732 |
+
"SAX.xmlSAX2NotationDecl(%s) externalID or PublicID missing\n",
|
| 733 |
+
name, NULL);
|
| 734 |
+
return;
|
| 735 |
+
} else if (ctxt->inSubset == 1)
|
| 736 |
+
nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name,
|
| 737 |
+
publicId, systemId);
|
| 738 |
+
else if (ctxt->inSubset == 2)
|
| 739 |
+
nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, name,
|
| 740 |
+
publicId, systemId);
|
| 741 |
+
else {
|
| 742 |
+
xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING,
|
| 743 |
+
"SAX.xmlSAX2NotationDecl(%s) called while not in subset\n",
|
| 744 |
+
name, NULL);
|
| 745 |
+
return;
|
| 746 |
+
}
|
| 747 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 748 |
+
if (nota == NULL) ctxt->valid = 0;
|
| 749 |
+
if ((ctxt->validate) && (ctxt->wellFormed) &&
|
| 750 |
+
(ctxt->myDoc->intSubset != NULL))
|
| 751 |
+
ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc,
|
| 752 |
+
nota);
|
| 753 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
/**
|
| 757 |
+
* What to do when an unparsed entity declaration is parsed
|
| 758 |
+
*
|
| 759 |
+
* @param ctx the user data (XML parser context)
|
| 760 |
+
* @param name The name of the entity
|
| 761 |
+
* @param publicId The public ID of the entity
|
| 762 |
+
* @param systemId The system ID of the entity
|
| 763 |
+
* @param notationName the name of the notation
|
| 764 |
+
*/
|
| 765 |
+
void
|
| 766 |
+
xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name,
|
| 767 |
+
const xmlChar *publicId, const xmlChar *systemId,
|
| 768 |
+
const xmlChar *notationName)
|
| 769 |
+
{
|
| 770 |
+
xmlSAX2EntityDecl(ctx, name, XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
|
| 771 |
+
publicId, systemId, (xmlChar *) notationName);
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
/**
|
| 775 |
+
* Receive the document locator at startup, actually xmlDefaultSAXLocator
|
| 776 |
+
* Everything is available on the context, so this is useless in our case.
|
| 777 |
+
*
|
| 778 |
+
* @param ctx the user data (XML parser context)
|
| 779 |
+
* @param loc A SAX Locator
|
| 780 |
+
*/
|
| 781 |
+
void
|
| 782 |
+
xmlSAX2SetDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocator *loc ATTRIBUTE_UNUSED)
|
| 783 |
+
{
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
/**
|
| 787 |
+
* called when the document start being processed.
|
| 788 |
+
*
|
| 789 |
+
* @param ctx the user data (XML parser context)
|
| 790 |
+
*/
|
| 791 |
+
void
|
| 792 |
+
xmlSAX2StartDocument(void *ctx)
|
| 793 |
+
{
|
| 794 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 795 |
+
xmlDocPtr doc;
|
| 796 |
+
|
| 797 |
+
if (ctx == NULL) return;
|
| 798 |
+
|
| 799 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 800 |
+
if (ctxt->html) {
|
| 801 |
+
if (ctxt->myDoc == NULL)
|
| 802 |
+
ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
|
| 803 |
+
if (ctxt->myDoc == NULL) {
|
| 804 |
+
xmlSAX2ErrMemory(ctxt);
|
| 805 |
+
return;
|
| 806 |
+
}
|
| 807 |
+
ctxt->myDoc->properties = XML_DOC_HTML;
|
| 808 |
+
ctxt->myDoc->parseFlags = ctxt->options;
|
| 809 |
+
} else
|
| 810 |
+
#endif
|
| 811 |
+
{
|
| 812 |
+
doc = ctxt->myDoc = xmlNewDoc(ctxt->version);
|
| 813 |
+
if (doc != NULL) {
|
| 814 |
+
doc->properties = 0;
|
| 815 |
+
if (ctxt->options & XML_PARSE_OLD10)
|
| 816 |
+
doc->properties |= XML_DOC_OLD10;
|
| 817 |
+
doc->parseFlags = ctxt->options;
|
| 818 |
+
doc->standalone = ctxt->standalone;
|
| 819 |
+
} else {
|
| 820 |
+
xmlSAX2ErrMemory(ctxt);
|
| 821 |
+
return;
|
| 822 |
+
}
|
| 823 |
+
if ((ctxt->dictNames) && (doc != NULL)) {
|
| 824 |
+
doc->dict = ctxt->dict;
|
| 825 |
+
xmlDictReference(doc->dict);
|
| 826 |
+
}
|
| 827 |
+
}
|
| 828 |
+
if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) &&
|
| 829 |
+
(ctxt->input != NULL) && (ctxt->input->filename != NULL)) {
|
| 830 |
+
ctxt->myDoc->URL = xmlPathToURI((const xmlChar *)ctxt->input->filename);
|
| 831 |
+
if (ctxt->myDoc->URL == NULL)
|
| 832 |
+
xmlSAX2ErrMemory(ctxt);
|
| 833 |
+
}
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
/**
|
| 837 |
+
* called when the document end has been detected.
|
| 838 |
+
*
|
| 839 |
+
* @param ctx the user data (XML parser context)
|
| 840 |
+
*/
|
| 841 |
+
void
|
| 842 |
+
xmlSAX2EndDocument(void *ctx)
|
| 843 |
+
{
|
| 844 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 845 |
+
xmlDocPtr doc;
|
| 846 |
+
|
| 847 |
+
if (ctx == NULL) return;
|
| 848 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 849 |
+
if (ctxt->validate && ctxt->wellFormed &&
|
| 850 |
+
ctxt->myDoc && ctxt->myDoc->intSubset)
|
| 851 |
+
ctxt->valid &= xmlValidateDocumentFinal(&ctxt->vctxt, ctxt->myDoc);
|
| 852 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 853 |
+
|
| 854 |
+
doc = ctxt->myDoc;
|
| 855 |
+
if (doc == NULL)
|
| 856 |
+
return;
|
| 857 |
+
|
| 858 |
+
if (doc->encoding == NULL) {
|
| 859 |
+
const xmlChar *encoding = xmlGetActualEncoding(ctxt);
|
| 860 |
+
|
| 861 |
+
if (encoding != NULL) {
|
| 862 |
+
doc->encoding = xmlStrdup(encoding);
|
| 863 |
+
if (doc->encoding == NULL)
|
| 864 |
+
xmlSAX2ErrMemory(ctxt);
|
| 865 |
+
}
|
| 866 |
+
}
|
| 867 |
+
|
| 868 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 869 |
+
if (ctxt->html) {
|
| 870 |
+
if (((ctxt->options & HTML_PARSE_NODEFDTD) == 0) &&
|
| 871 |
+
(doc->intSubset == NULL)) {
|
| 872 |
+
doc->intSubset = xmlCreateIntSubset(doc, BAD_CAST "html",
|
| 873 |
+
BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN",
|
| 874 |
+
BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd");
|
| 875 |
+
if (doc->intSubset == NULL)
|
| 876 |
+
xmlSAX2ErrMemory(ctxt);
|
| 877 |
+
}
|
| 878 |
+
} else
|
| 879 |
+
#endif /* LIBXML_HTML_ENABLED */
|
| 880 |
+
{
|
| 881 |
+
if (ctxt->wellFormed) {
|
| 882 |
+
doc->properties |= XML_DOC_WELLFORMED;
|
| 883 |
+
if (ctxt->valid)
|
| 884 |
+
doc->properties |= XML_DOC_DTDVALID;
|
| 885 |
+
if (ctxt->nsWellFormed)
|
| 886 |
+
doc->properties |= XML_DOC_NSVALID;
|
| 887 |
+
}
|
| 888 |
+
|
| 889 |
+
if (ctxt->options & XML_PARSE_OLD10)
|
| 890 |
+
doc->properties |= XML_DOC_OLD10;
|
| 891 |
+
}
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
+
static void
|
| 895 |
+
xmlSAX2AppendChild(xmlParserCtxtPtr ctxt, xmlNodePtr node) {
|
| 896 |
+
xmlNodePtr parent;
|
| 897 |
+
xmlNodePtr last;
|
| 898 |
+
|
| 899 |
+
if (ctxt->inSubset == 1) {
|
| 900 |
+
parent = (xmlNodePtr) ctxt->myDoc->intSubset;
|
| 901 |
+
} else if (ctxt->inSubset == 2) {
|
| 902 |
+
parent = (xmlNodePtr) ctxt->myDoc->extSubset;
|
| 903 |
+
} else {
|
| 904 |
+
parent = ctxt->node;
|
| 905 |
+
if (parent == NULL)
|
| 906 |
+
parent = (xmlNodePtr) ctxt->myDoc;
|
| 907 |
+
}
|
| 908 |
+
|
| 909 |
+
last = parent->last;
|
| 910 |
+
if (last == NULL) {
|
| 911 |
+
parent->children = node;
|
| 912 |
+
} else {
|
| 913 |
+
last->next = node;
|
| 914 |
+
node->prev = last;
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
parent->last = node;
|
| 918 |
+
node->parent = parent;
|
| 919 |
+
|
| 920 |
+
if ((node->type != XML_TEXT_NODE) &&
|
| 921 |
+
(ctxt->input != NULL)) {
|
| 922 |
+
if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
|
| 923 |
+
node->line = ctxt->input->line;
|
| 924 |
+
else
|
| 925 |
+
node->line = USHRT_MAX;
|
| 926 |
+
}
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
#if defined(LIBXML_SAX1_ENABLED)
|
| 930 |
+
/**
|
| 931 |
+
* Handle a namespace error
|
| 932 |
+
*
|
| 933 |
+
* @param ctxt an XML parser context
|
| 934 |
+
* @param error the error number
|
| 935 |
+
* @param msg the error message
|
| 936 |
+
* @param str1 an error string
|
| 937 |
+
* @param str2 an error string
|
| 938 |
+
*/
|
| 939 |
+
static void LIBXML_ATTR_FORMAT(3,0)
|
| 940 |
+
xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
| 941 |
+
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
| 942 |
+
{
|
| 943 |
+
xmlCtxtErr(ctxt, NULL, XML_FROM_NAMESPACE, error, XML_ERR_ERROR,
|
| 944 |
+
str1, str2, NULL, 0, msg, str1, str2);
|
| 945 |
+
}
|
| 946 |
+
|
| 947 |
+
/**
|
| 948 |
+
* Handle an attribute that has been read by the parser.
|
| 949 |
+
*
|
| 950 |
+
* Deprecated SAX1 interface.
|
| 951 |
+
*
|
| 952 |
+
* @param ctxt the parser context
|
| 953 |
+
* @param fullname the attribute name, including namespace prefix
|
| 954 |
+
* @param value the attribute value
|
| 955 |
+
* @param prefix the namespace prefix
|
| 956 |
+
*/
|
| 957 |
+
static void
|
| 958 |
+
xmlSAX1Attribute(xmlParserCtxtPtr ctxt, const xmlChar *fullname,
|
| 959 |
+
const xmlChar *value, const xmlChar *prefix)
|
| 960 |
+
{
|
| 961 |
+
xmlAttrPtr ret;
|
| 962 |
+
const xmlChar *name;
|
| 963 |
+
xmlChar *ns;
|
| 964 |
+
xmlNsPtr namespace;
|
| 965 |
+
|
| 966 |
+
/*
|
| 967 |
+
* Split the full name into a namespace prefix and the tag name
|
| 968 |
+
*/
|
| 969 |
+
name = xmlSplitQName4(fullname, &ns);
|
| 970 |
+
if (name == NULL) {
|
| 971 |
+
xmlSAX2ErrMemory(ctxt);
|
| 972 |
+
return;
|
| 973 |
+
}
|
| 974 |
+
|
| 975 |
+
/*
|
| 976 |
+
* Check whether it's a namespace definition
|
| 977 |
+
*/
|
| 978 |
+
if ((ns == NULL) &&
|
| 979 |
+
(name[0] == 'x') && (name[1] == 'm') && (name[2] == 'l') &&
|
| 980 |
+
(name[3] == 'n') && (name[4] == 's') && (name[5] == 0)) {
|
| 981 |
+
xmlNsPtr nsret;
|
| 982 |
+
xmlChar *val;
|
| 983 |
+
|
| 984 |
+
/* Avoid unused variable warning if features are disabled. */
|
| 985 |
+
(void) nsret;
|
| 986 |
+
|
| 987 |
+
if (!ctxt->replaceEntities) {
|
| 988 |
+
/* TODO: normalize if needed */
|
| 989 |
+
val = xmlExpandEntitiesInAttValue(ctxt, value, /* normalize */ 0);
|
| 990 |
+
if (val == NULL) {
|
| 991 |
+
xmlSAX2ErrMemory(ctxt);
|
| 992 |
+
return;
|
| 993 |
+
}
|
| 994 |
+
} else {
|
| 995 |
+
val = (xmlChar *) value;
|
| 996 |
+
}
|
| 997 |
+
|
| 998 |
+
if (val[0] != 0) {
|
| 999 |
+
xmlURIPtr uri;
|
| 1000 |
+
|
| 1001 |
+
if (xmlParseURISafe((const char *)val, &uri) < 0)
|
| 1002 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1003 |
+
if (uri == NULL) {
|
| 1004 |
+
xmlNsWarnMsg(ctxt, XML_WAR_NS_URI,
|
| 1005 |
+
"xmlns:%s: %s not a valid URI\n", name, value);
|
| 1006 |
+
} else {
|
| 1007 |
+
if (uri->scheme == NULL) {
|
| 1008 |
+
xmlNsWarnMsg(ctxt, XML_WAR_NS_URI_RELATIVE,
|
| 1009 |
+
"xmlns:%s: URI %s is not absolute\n",
|
| 1010 |
+
name, value);
|
| 1011 |
+
}
|
| 1012 |
+
xmlFreeURI(uri);
|
| 1013 |
+
}
|
| 1014 |
+
}
|
| 1015 |
+
|
| 1016 |
+
/* a default namespace definition */
|
| 1017 |
+
nsret = xmlNewNs(ctxt->node, val, NULL);
|
| 1018 |
+
if (nsret == NULL) {
|
| 1019 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1020 |
+
}
|
| 1021 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 1022 |
+
/*
|
| 1023 |
+
* Validate also for namespace decls, they are attributes from
|
| 1024 |
+
* an XML-1.0 perspective
|
| 1025 |
+
*/
|
| 1026 |
+
else if (ctxt->validate && ctxt->wellFormed &&
|
| 1027 |
+
ctxt->myDoc && ctxt->myDoc->intSubset) {
|
| 1028 |
+
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
|
| 1029 |
+
ctxt->node, prefix, nsret, val);
|
| 1030 |
+
}
|
| 1031 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 1032 |
+
if (val != value)
|
| 1033 |
+
xmlFree(val);
|
| 1034 |
+
return;
|
| 1035 |
+
}
|
| 1036 |
+
if ((ns != NULL) && (ns[0] == 'x') && (ns[1] == 'm') && (ns[2] == 'l') &&
|
| 1037 |
+
(ns[3] == 'n') && (ns[4] == 's') && (ns[5] == 0)) {
|
| 1038 |
+
xmlNsPtr nsret;
|
| 1039 |
+
xmlChar *val;
|
| 1040 |
+
|
| 1041 |
+
/* Avoid unused variable warning if features are disabled. */
|
| 1042 |
+
(void) nsret;
|
| 1043 |
+
|
| 1044 |
+
if (!ctxt->replaceEntities) {
|
| 1045 |
+
/* TODO: normalize if needed */
|
| 1046 |
+
val = xmlExpandEntitiesInAttValue(ctxt, value, /* normalize */ 0);
|
| 1047 |
+
if (val == NULL) {
|
| 1048 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1049 |
+
xmlFree(ns);
|
| 1050 |
+
return;
|
| 1051 |
+
}
|
| 1052 |
+
} else {
|
| 1053 |
+
val = (xmlChar *) value;
|
| 1054 |
+
}
|
| 1055 |
+
|
| 1056 |
+
if (val[0] == 0) {
|
| 1057 |
+
xmlNsErrMsg(ctxt, XML_NS_ERR_EMPTY,
|
| 1058 |
+
"Empty namespace name for prefix %s\n", name, NULL);
|
| 1059 |
+
}
|
| 1060 |
+
if ((ctxt->pedantic != 0) && (val[0] != 0)) {
|
| 1061 |
+
xmlURIPtr uri;
|
| 1062 |
+
|
| 1063 |
+
if (xmlParseURISafe((const char *)val, &uri) < 0)
|
| 1064 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1065 |
+
if (uri == NULL) {
|
| 1066 |
+
xmlNsWarnMsg(ctxt, XML_WAR_NS_URI,
|
| 1067 |
+
"xmlns:%s: %s not a valid URI\n", name, value);
|
| 1068 |
+
} else {
|
| 1069 |
+
if (uri->scheme == NULL) {
|
| 1070 |
+
xmlNsWarnMsg(ctxt, XML_WAR_NS_URI_RELATIVE,
|
| 1071 |
+
"xmlns:%s: URI %s is not absolute\n", name, value);
|
| 1072 |
+
}
|
| 1073 |
+
xmlFreeURI(uri);
|
| 1074 |
+
}
|
| 1075 |
+
}
|
| 1076 |
+
|
| 1077 |
+
/* a standard namespace definition */
|
| 1078 |
+
nsret = xmlNewNs(ctxt->node, val, name);
|
| 1079 |
+
xmlFree(ns);
|
| 1080 |
+
|
| 1081 |
+
if (nsret == NULL) {
|
| 1082 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1083 |
+
}
|
| 1084 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 1085 |
+
/*
|
| 1086 |
+
* Validate also for namespace decls, they are attributes from
|
| 1087 |
+
* an XML-1.0 perspective
|
| 1088 |
+
*/
|
| 1089 |
+
else if (ctxt->validate && ctxt->wellFormed &&
|
| 1090 |
+
ctxt->myDoc && ctxt->myDoc->intSubset) {
|
| 1091 |
+
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
|
| 1092 |
+
ctxt->node, prefix, nsret, value);
|
| 1093 |
+
}
|
| 1094 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 1095 |
+
if (val != value)
|
| 1096 |
+
xmlFree(val);
|
| 1097 |
+
return;
|
| 1098 |
+
}
|
| 1099 |
+
|
| 1100 |
+
if (ns != NULL) {
|
| 1101 |
+
int res;
|
| 1102 |
+
|
| 1103 |
+
res = xmlSearchNsSafe(ctxt->node, ns, &namespace);
|
| 1104 |
+
if (res < 0)
|
| 1105 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1106 |
+
|
| 1107 |
+
if (namespace == NULL) {
|
| 1108 |
+
xmlNsErrMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
|
| 1109 |
+
"Namespace prefix %s of attribute %s is not defined\n",
|
| 1110 |
+
ns, name);
|
| 1111 |
+
} else {
|
| 1112 |
+
xmlAttrPtr prop;
|
| 1113 |
+
|
| 1114 |
+
prop = ctxt->node->properties;
|
| 1115 |
+
while (prop != NULL) {
|
| 1116 |
+
if (prop->ns != NULL) {
|
| 1117 |
+
if ((xmlStrEqual(name, prop->name)) &&
|
| 1118 |
+
((namespace == prop->ns) ||
|
| 1119 |
+
(xmlStrEqual(namespace->href, prop->ns->href)))) {
|
| 1120 |
+
xmlCtxtErr(ctxt, NULL, XML_FROM_PARSER,
|
| 1121 |
+
XML_ERR_ATTRIBUTE_REDEFINED, XML_ERR_FATAL,
|
| 1122 |
+
name, NULL, NULL, 0,
|
| 1123 |
+
"Attribute %s in %s redefined\n",
|
| 1124 |
+
name, namespace->href);
|
| 1125 |
+
goto error;
|
| 1126 |
+
}
|
| 1127 |
+
}
|
| 1128 |
+
prop = prop->next;
|
| 1129 |
+
}
|
| 1130 |
+
}
|
| 1131 |
+
} else {
|
| 1132 |
+
namespace = NULL;
|
| 1133 |
+
}
|
| 1134 |
+
|
| 1135 |
+
/* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
|
| 1136 |
+
ret = xmlNewNsProp(ctxt->node, namespace, name, NULL);
|
| 1137 |
+
if (ret == NULL) {
|
| 1138 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1139 |
+
goto error;
|
| 1140 |
+
}
|
| 1141 |
+
|
| 1142 |
+
if (ctxt->replaceEntities == 0) {
|
| 1143 |
+
if (xmlNodeParseAttValue(ret->doc, ret, value, SIZE_MAX, NULL) < 0)
|
| 1144 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1145 |
+
} else if (value != NULL) {
|
| 1146 |
+
ret->children = xmlNewDocText(ctxt->myDoc, value);
|
| 1147 |
+
if (ret->children == NULL) {
|
| 1148 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1149 |
+
} else {
|
| 1150 |
+
ret->last = ret->children;
|
| 1151 |
+
ret->children->parent = (xmlNodePtr) ret;
|
| 1152 |
+
}
|
| 1153 |
+
}
|
| 1154 |
+
|
| 1155 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 1156 |
+
if (ctxt->validate && ctxt->wellFormed &&
|
| 1157 |
+
ctxt->myDoc && ctxt->myDoc->intSubset) {
|
| 1158 |
+
|
| 1159 |
+
/*
|
| 1160 |
+
* If we don't substitute entities, the validation should be
|
| 1161 |
+
* done on a value with replaced entities anyway.
|
| 1162 |
+
*/
|
| 1163 |
+
if (!ctxt->replaceEntities) {
|
| 1164 |
+
xmlChar *val;
|
| 1165 |
+
|
| 1166 |
+
/* TODO: normalize if needed */
|
| 1167 |
+
val = xmlExpandEntitiesInAttValue(ctxt, value, /* normalize */ 0);
|
| 1168 |
+
|
| 1169 |
+
if (val == NULL)
|
| 1170 |
+
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
| 1171 |
+
ctxt->myDoc, ctxt->node, ret, value);
|
| 1172 |
+
else {
|
| 1173 |
+
xmlChar *nvalnorm;
|
| 1174 |
+
|
| 1175 |
+
/*
|
| 1176 |
+
* Do the last stage of the attribute normalization
|
| 1177 |
+
* It need to be done twice ... it's an extra burden related
|
| 1178 |
+
* to the ability to keep xmlSAX2References in attributes
|
| 1179 |
+
*/
|
| 1180 |
+
nvalnorm = xmlValidCtxtNormalizeAttributeValue(
|
| 1181 |
+
&ctxt->vctxt, ctxt->myDoc,
|
| 1182 |
+
ctxt->node, fullname, val);
|
| 1183 |
+
if (nvalnorm != NULL) {
|
| 1184 |
+
xmlFree(val);
|
| 1185 |
+
val = nvalnorm;
|
| 1186 |
+
}
|
| 1187 |
+
|
| 1188 |
+
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
| 1189 |
+
ctxt->myDoc, ctxt->node, ret, val);
|
| 1190 |
+
xmlFree(val);
|
| 1191 |
+
}
|
| 1192 |
+
} else {
|
| 1193 |
+
/*
|
| 1194 |
+
* When replacing entities, make sure that IDs in
|
| 1195 |
+
* entities aren't registered. This also shouldn't be
|
| 1196 |
+
* done when entities aren't replaced, but this would
|
| 1197 |
+
* require to rework IDREF checks.
|
| 1198 |
+
*/
|
| 1199 |
+
if (ctxt->input->entity != NULL)
|
| 1200 |
+
ctxt->vctxt.flags |= XML_VCTXT_IN_ENTITY;
|
| 1201 |
+
|
| 1202 |
+
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc,
|
| 1203 |
+
ctxt->node, ret, value);
|
| 1204 |
+
|
| 1205 |
+
ctxt->vctxt.flags &= ~XML_VCTXT_IN_ENTITY;
|
| 1206 |
+
}
|
| 1207 |
+
} else
|
| 1208 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 1209 |
+
if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
|
| 1210 |
+
(ctxt->input->entity == NULL) &&
|
| 1211 |
+
/* Don't create IDs containing entity references */
|
| 1212 |
+
(ret->children != NULL) &&
|
| 1213 |
+
(ret->children->type == XML_TEXT_NODE) &&
|
| 1214 |
+
(ret->children->next == NULL)) {
|
| 1215 |
+
xmlChar *content = ret->children->content;
|
| 1216 |
+
/*
|
| 1217 |
+
* when validating, the ID registration is done at the attribute
|
| 1218 |
+
* validation level. Otherwise we have to do specific handling here.
|
| 1219 |
+
*/
|
| 1220 |
+
if (xmlStrEqual(fullname, BAD_CAST "xml:id")) {
|
| 1221 |
+
/*
|
| 1222 |
+
* Add the xml:id value
|
| 1223 |
+
*
|
| 1224 |
+
* Open issue: normalization of the value.
|
| 1225 |
+
*/
|
| 1226 |
+
if (xmlValidateNCName(content, 1) != 0) {
|
| 1227 |
+
xmlErrId(ctxt, XML_DTD_XMLID_VALUE,
|
| 1228 |
+
"xml:id : attribute value %s is not an NCName\n",
|
| 1229 |
+
content);
|
| 1230 |
+
}
|
| 1231 |
+
xmlAddID(&ctxt->vctxt, ctxt->myDoc, content, ret);
|
| 1232 |
+
} else {
|
| 1233 |
+
int res = xmlIsID(ctxt->myDoc, ctxt->node, ret);
|
| 1234 |
+
|
| 1235 |
+
if (res < 0)
|
| 1236 |
+
xmlCtxtErrMemory(ctxt);
|
| 1237 |
+
else if (res > 0)
|
| 1238 |
+
xmlAddID(&ctxt->vctxt, ctxt->myDoc, content, ret);
|
| 1239 |
+
else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret))
|
| 1240 |
+
xmlAddRef(&ctxt->vctxt, ctxt->myDoc, content, ret);
|
| 1241 |
+
}
|
| 1242 |
+
}
|
| 1243 |
+
|
| 1244 |
+
error:
|
| 1245 |
+
if (ns != NULL)
|
| 1246 |
+
xmlFree(ns);
|
| 1247 |
+
}
|
| 1248 |
+
|
| 1249 |
+
/*
|
| 1250 |
+
*
|
| 1251 |
+
* Check defaulted attributes from the DTD
|
| 1252 |
+
*
|
| 1253 |
+
* Deprecated SAX1 interface.
|
| 1254 |
+
*/
|
| 1255 |
+
static void
|
| 1256 |
+
xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name,
|
| 1257 |
+
const xmlChar *prefix, const xmlChar **atts) {
|
| 1258 |
+
xmlElementPtr elemDecl;
|
| 1259 |
+
const xmlChar *att;
|
| 1260 |
+
int internal = 1;
|
| 1261 |
+
int i;
|
| 1262 |
+
|
| 1263 |
+
elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->intSubset, name, prefix);
|
| 1264 |
+
if (elemDecl == NULL) {
|
| 1265 |
+
elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, name, prefix);
|
| 1266 |
+
internal = 0;
|
| 1267 |
+
}
|
| 1268 |
+
|
| 1269 |
+
process_external_subset:
|
| 1270 |
+
|
| 1271 |
+
if (elemDecl != NULL) {
|
| 1272 |
+
xmlAttributePtr attr = elemDecl->attributes;
|
| 1273 |
+
|
| 1274 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 1275 |
+
/*
|
| 1276 |
+
* Check against defaulted attributes from the external subset
|
| 1277 |
+
* if the document is stamped as standalone.
|
| 1278 |
+
*
|
| 1279 |
+
* This should be moved to valid.c, but we don't keep track
|
| 1280 |
+
* whether an attribute was defaulted.
|
| 1281 |
+
*/
|
| 1282 |
+
if ((ctxt->myDoc->standalone == 1) &&
|
| 1283 |
+
(ctxt->myDoc->extSubset != NULL) &&
|
| 1284 |
+
(ctxt->validate)) {
|
| 1285 |
+
while (attr != NULL) {
|
| 1286 |
+
if ((attr->defaultValue != NULL) &&
|
| 1287 |
+
(xmlGetDtdQAttrDesc(ctxt->myDoc->extSubset,
|
| 1288 |
+
attr->elem, attr->name,
|
| 1289 |
+
attr->prefix) == attr) &&
|
| 1290 |
+
(xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
|
| 1291 |
+
attr->elem, attr->name,
|
| 1292 |
+
attr->prefix) == NULL)) {
|
| 1293 |
+
xmlChar *fulln;
|
| 1294 |
+
|
| 1295 |
+
if (attr->prefix != NULL) {
|
| 1296 |
+
fulln = xmlStrdup(attr->prefix);
|
| 1297 |
+
if (fulln != NULL)
|
| 1298 |
+
fulln = xmlStrcat(fulln, BAD_CAST ":");
|
| 1299 |
+
if (fulln != NULL)
|
| 1300 |
+
fulln = xmlStrcat(fulln, attr->name);
|
| 1301 |
+
} else {
|
| 1302 |
+
fulln = xmlStrdup(attr->name);
|
| 1303 |
+
}
|
| 1304 |
+
if (fulln == NULL) {
|
| 1305 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1306 |
+
break;
|
| 1307 |
+
}
|
| 1308 |
+
|
| 1309 |
+
/*
|
| 1310 |
+
* Check that the attribute is not declared in the
|
| 1311 |
+
* serialization
|
| 1312 |
+
*/
|
| 1313 |
+
att = NULL;
|
| 1314 |
+
if (atts != NULL) {
|
| 1315 |
+
i = 0;
|
| 1316 |
+
att = atts[i];
|
| 1317 |
+
while (att != NULL) {
|
| 1318 |
+
if (xmlStrEqual(att, fulln))
|
| 1319 |
+
break;
|
| 1320 |
+
i += 2;
|
| 1321 |
+
att = atts[i];
|
| 1322 |
+
}
|
| 1323 |
+
}
|
| 1324 |
+
if (att == NULL) {
|
| 1325 |
+
xmlErrValid(ctxt, XML_DTD_STANDALONE_DEFAULTED,
|
| 1326 |
+
"standalone: attribute %s on %s defaulted from external subset\n",
|
| 1327 |
+
fulln,
|
| 1328 |
+
attr->elem);
|
| 1329 |
+
}
|
| 1330 |
+
xmlFree(fulln);
|
| 1331 |
+
}
|
| 1332 |
+
attr = attr->nexth;
|
| 1333 |
+
}
|
| 1334 |
+
}
|
| 1335 |
+
#endif
|
| 1336 |
+
|
| 1337 |
+
/*
|
| 1338 |
+
* Actually insert defaulted values when needed
|
| 1339 |
+
*/
|
| 1340 |
+
attr = elemDecl->attributes;
|
| 1341 |
+
while (attr != NULL) {
|
| 1342 |
+
/*
|
| 1343 |
+
* Make sure that attributes redefinition occurring in the
|
| 1344 |
+
* internal subset are not overridden by definitions in the
|
| 1345 |
+
* external subset.
|
| 1346 |
+
*/
|
| 1347 |
+
if (attr->defaultValue != NULL) {
|
| 1348 |
+
/*
|
| 1349 |
+
* the element should be instantiated in the tree if:
|
| 1350 |
+
* - this is a namespace prefix
|
| 1351 |
+
* - the user required for completion in the tree
|
| 1352 |
+
* like XSLT
|
| 1353 |
+
* - there isn't already an attribute definition
|
| 1354 |
+
* in the internal subset overriding it.
|
| 1355 |
+
*/
|
| 1356 |
+
if (((attr->prefix != NULL) &&
|
| 1357 |
+
(xmlStrEqual(attr->prefix, BAD_CAST "xmlns"))) ||
|
| 1358 |
+
((attr->prefix == NULL) &&
|
| 1359 |
+
(xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
|
| 1360 |
+
(ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
|
| 1361 |
+
xmlAttributePtr tst;
|
| 1362 |
+
|
| 1363 |
+
tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
|
| 1364 |
+
attr->elem, attr->name,
|
| 1365 |
+
attr->prefix);
|
| 1366 |
+
if ((tst == attr) || (tst == NULL)) {
|
| 1367 |
+
xmlChar fn[50];
|
| 1368 |
+
xmlChar *fulln;
|
| 1369 |
+
|
| 1370 |
+
fulln = xmlBuildQName(attr->name, attr->prefix, fn, 50);
|
| 1371 |
+
if (fulln == NULL) {
|
| 1372 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1373 |
+
return;
|
| 1374 |
+
}
|
| 1375 |
+
|
| 1376 |
+
/*
|
| 1377 |
+
* Check that the attribute is not declared in the
|
| 1378 |
+
* serialization
|
| 1379 |
+
*/
|
| 1380 |
+
att = NULL;
|
| 1381 |
+
if (atts != NULL) {
|
| 1382 |
+
i = 0;
|
| 1383 |
+
att = atts[i];
|
| 1384 |
+
while (att != NULL) {
|
| 1385 |
+
if (xmlStrEqual(att, fulln))
|
| 1386 |
+
break;
|
| 1387 |
+
i += 2;
|
| 1388 |
+
att = atts[i];
|
| 1389 |
+
}
|
| 1390 |
+
}
|
| 1391 |
+
if (att == NULL) {
|
| 1392 |
+
xmlSAX1Attribute(ctxt, fulln,
|
| 1393 |
+
attr->defaultValue, prefix);
|
| 1394 |
+
}
|
| 1395 |
+
if ((fulln != fn) && (fulln != attr->name))
|
| 1396 |
+
xmlFree(fulln);
|
| 1397 |
+
}
|
| 1398 |
+
}
|
| 1399 |
+
}
|
| 1400 |
+
attr = attr->nexth;
|
| 1401 |
+
}
|
| 1402 |
+
if (internal == 1) {
|
| 1403 |
+
elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset,
|
| 1404 |
+
name, prefix);
|
| 1405 |
+
internal = 0;
|
| 1406 |
+
goto process_external_subset;
|
| 1407 |
+
}
|
| 1408 |
+
}
|
| 1409 |
+
}
|
| 1410 |
+
|
| 1411 |
+
/**
|
| 1412 |
+
* called when an opening tag has been processed.
|
| 1413 |
+
*
|
| 1414 |
+
* Deprecated SAX1 interface.
|
| 1415 |
+
*
|
| 1416 |
+
* @param ctx the user data (XML parser context)
|
| 1417 |
+
* @param fullname The element name, including namespace prefix
|
| 1418 |
+
* @param atts An array of name/value attributes pairs, NULL terminated
|
| 1419 |
+
*/
|
| 1420 |
+
static void
|
| 1421 |
+
xmlSAX1StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
|
| 1422 |
+
{
|
| 1423 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 1424 |
+
xmlNodePtr ret;
|
| 1425 |
+
xmlNodePtr parent;
|
| 1426 |
+
xmlNsPtr ns;
|
| 1427 |
+
const xmlChar *name;
|
| 1428 |
+
xmlChar *prefix;
|
| 1429 |
+
const xmlChar *att;
|
| 1430 |
+
const xmlChar *value;
|
| 1431 |
+
int i, res;
|
| 1432 |
+
|
| 1433 |
+
if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return;
|
| 1434 |
+
|
| 1435 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 1436 |
+
/*
|
| 1437 |
+
* First check on validity:
|
| 1438 |
+
*/
|
| 1439 |
+
if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
|
| 1440 |
+
((ctxt->myDoc->intSubset == NULL) ||
|
| 1441 |
+
((ctxt->myDoc->intSubset->notations == NULL) &&
|
| 1442 |
+
(ctxt->myDoc->intSubset->elements == NULL) &&
|
| 1443 |
+
(ctxt->myDoc->intSubset->attributes == NULL) &&
|
| 1444 |
+
(ctxt->myDoc->intSubset->entities == NULL)))) {
|
| 1445 |
+
xmlErrValid(ctxt, XML_ERR_NO_DTD,
|
| 1446 |
+
"Validation failed: no DTD found !", NULL, NULL);
|
| 1447 |
+
ctxt->validate = 0;
|
| 1448 |
+
}
|
| 1449 |
+
#endif
|
| 1450 |
+
|
| 1451 |
+
/*
|
| 1452 |
+
* Split the full name into a namespace prefix and the tag name
|
| 1453 |
+
*/
|
| 1454 |
+
name = xmlSplitQName4(fullname, &prefix);
|
| 1455 |
+
if (name == NULL) {
|
| 1456 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1457 |
+
return;
|
| 1458 |
+
}
|
| 1459 |
+
|
| 1460 |
+
/*
|
| 1461 |
+
* Note : the namespace resolution is deferred until the end of the
|
| 1462 |
+
* attributes parsing, since local namespace can be defined as
|
| 1463 |
+
* an attribute at this level.
|
| 1464 |
+
*/
|
| 1465 |
+
ret = xmlNewDocNode(ctxt->myDoc, NULL, name, NULL);
|
| 1466 |
+
if (ret == NULL) {
|
| 1467 |
+
xmlFree(prefix);
|
| 1468 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1469 |
+
return;
|
| 1470 |
+
}
|
| 1471 |
+
ctxt->nodemem = -1;
|
| 1472 |
+
|
| 1473 |
+
/* Initialize parent before pushing node */
|
| 1474 |
+
parent = ctxt->node;
|
| 1475 |
+
if (parent == NULL)
|
| 1476 |
+
parent = (xmlNodePtr) ctxt->myDoc;
|
| 1477 |
+
|
| 1478 |
+
/*
|
| 1479 |
+
* Link the child element
|
| 1480 |
+
*/
|
| 1481 |
+
xmlSAX2AppendChild(ctxt, ret);
|
| 1482 |
+
|
| 1483 |
+
/*
|
| 1484 |
+
* We are parsing a new node.
|
| 1485 |
+
*/
|
| 1486 |
+
if (nodePush(ctxt, ret) < 0) {
|
| 1487 |
+
xmlUnlinkNode(ret);
|
| 1488 |
+
xmlFreeNode(ret);
|
| 1489 |
+
if (prefix != NULL)
|
| 1490 |
+
xmlFree(prefix);
|
| 1491 |
+
return;
|
| 1492 |
+
}
|
| 1493 |
+
|
| 1494 |
+
/*
|
| 1495 |
+
* Insert all the defaulted attributes from the DTD especially
|
| 1496 |
+
* namespaces
|
| 1497 |
+
*/
|
| 1498 |
+
if ((ctxt->myDoc->intSubset != NULL) ||
|
| 1499 |
+
(ctxt->myDoc->extSubset != NULL)) {
|
| 1500 |
+
xmlCheckDefaultedAttributes(ctxt, name, prefix, atts);
|
| 1501 |
+
}
|
| 1502 |
+
|
| 1503 |
+
/*
|
| 1504 |
+
* process all the attributes whose name start with "xmlns"
|
| 1505 |
+
*/
|
| 1506 |
+
if (atts != NULL) {
|
| 1507 |
+
i = 0;
|
| 1508 |
+
att = atts[i++];
|
| 1509 |
+
value = atts[i++];
|
| 1510 |
+
while ((att != NULL) && (value != NULL)) {
|
| 1511 |
+
if ((att[0] == 'x') && (att[1] == 'm') && (att[2] == 'l') &&
|
| 1512 |
+
(att[3] == 'n') && (att[4] == 's'))
|
| 1513 |
+
xmlSAX1Attribute(ctxt, att, value, prefix);
|
| 1514 |
+
|
| 1515 |
+
att = atts[i++];
|
| 1516 |
+
value = atts[i++];
|
| 1517 |
+
}
|
| 1518 |
+
}
|
| 1519 |
+
|
| 1520 |
+
/*
|
| 1521 |
+
* Search the namespace, note that since the attributes have been
|
| 1522 |
+
* processed, the local namespaces are available.
|
| 1523 |
+
*/
|
| 1524 |
+
res = xmlSearchNsSafe(ret, prefix, &ns);
|
| 1525 |
+
if (res < 0)
|
| 1526 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1527 |
+
if ((ns == NULL) && (parent != NULL)) {
|
| 1528 |
+
res = xmlSearchNsSafe(parent, prefix, &ns);
|
| 1529 |
+
if (res < 0)
|
| 1530 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1531 |
+
}
|
| 1532 |
+
if ((prefix != NULL) && (ns == NULL)) {
|
| 1533 |
+
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
|
| 1534 |
+
"Namespace prefix %s is not defined\n",
|
| 1535 |
+
prefix, NULL);
|
| 1536 |
+
ns = xmlNewNs(ret, NULL, prefix);
|
| 1537 |
+
if (ns == NULL)
|
| 1538 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1539 |
+
}
|
| 1540 |
+
|
| 1541 |
+
/*
|
| 1542 |
+
* set the namespace node, making sure that if the default namespace
|
| 1543 |
+
* is unbound on a parent we simply keep it NULL
|
| 1544 |
+
*/
|
| 1545 |
+
if ((ns != NULL) && (ns->href != NULL) &&
|
| 1546 |
+
((ns->href[0] != 0) || (ns->prefix != NULL)))
|
| 1547 |
+
xmlSetNs(ret, ns);
|
| 1548 |
+
|
| 1549 |
+
/*
|
| 1550 |
+
* process all the other attributes
|
| 1551 |
+
*/
|
| 1552 |
+
if (atts != NULL) {
|
| 1553 |
+
i = 0;
|
| 1554 |
+
att = atts[i++];
|
| 1555 |
+
value = atts[i++];
|
| 1556 |
+
while ((att != NULL) && (value != NULL)) {
|
| 1557 |
+
if ((att[0] != 'x') || (att[1] != 'm') || (att[2] != 'l') ||
|
| 1558 |
+
(att[3] != 'n') || (att[4] != 's'))
|
| 1559 |
+
xmlSAX1Attribute(ctxt, att, value, NULL);
|
| 1560 |
+
|
| 1561 |
+
/*
|
| 1562 |
+
* Next ones
|
| 1563 |
+
*/
|
| 1564 |
+
att = atts[i++];
|
| 1565 |
+
value = atts[i++];
|
| 1566 |
+
}
|
| 1567 |
+
}
|
| 1568 |
+
|
| 1569 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 1570 |
+
/*
|
| 1571 |
+
* If it's the Document root, finish the DTD validation and
|
| 1572 |
+
* check the document root element for validity
|
| 1573 |
+
*/
|
| 1574 |
+
if ((ctxt->validate) &&
|
| 1575 |
+
((ctxt->vctxt.flags & XML_VCTXT_DTD_VALIDATED) == 0)) {
|
| 1576 |
+
int chk;
|
| 1577 |
+
|
| 1578 |
+
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
|
| 1579 |
+
if (chk <= 0)
|
| 1580 |
+
ctxt->valid = 0;
|
| 1581 |
+
if (chk < 0)
|
| 1582 |
+
ctxt->wellFormed = 0;
|
| 1583 |
+
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
| 1584 |
+
ctxt->vctxt.flags |= XML_VCTXT_DTD_VALIDATED;
|
| 1585 |
+
}
|
| 1586 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 1587 |
+
|
| 1588 |
+
if (prefix != NULL)
|
| 1589 |
+
xmlFree(prefix);
|
| 1590 |
+
|
| 1591 |
+
}
|
| 1592 |
+
#endif /* LIBXML_SAX1_ENABLED */
|
| 1593 |
+
|
| 1594 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 1595 |
+
static void
|
| 1596 |
+
xmlSAX2HtmlAttribute(xmlParserCtxtPtr ctxt, const xmlChar *fullname,
|
| 1597 |
+
const xmlChar *value) {
|
| 1598 |
+
xmlAttrPtr ret;
|
| 1599 |
+
xmlChar *nval = NULL;
|
| 1600 |
+
|
| 1601 |
+
ret = xmlNewNsProp(ctxt->node, NULL, fullname, NULL);
|
| 1602 |
+
if (ret == NULL) {
|
| 1603 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1604 |
+
return;
|
| 1605 |
+
}
|
| 1606 |
+
|
| 1607 |
+
if ((value == NULL) && (htmlIsBooleanAttr(fullname))) {
|
| 1608 |
+
nval = xmlStrdup(fullname);
|
| 1609 |
+
if (nval == NULL) {
|
| 1610 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1611 |
+
return;
|
| 1612 |
+
}
|
| 1613 |
+
value = nval;
|
| 1614 |
+
}
|
| 1615 |
+
|
| 1616 |
+
if (value != NULL) {
|
| 1617 |
+
ret->children = xmlNewDocText(ctxt->myDoc, value);
|
| 1618 |
+
if (ret->children == NULL) {
|
| 1619 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1620 |
+
} else {
|
| 1621 |
+
ret->last = ret->children;
|
| 1622 |
+
ret->children->parent = (xmlNodePtr) ret;
|
| 1623 |
+
}
|
| 1624 |
+
}
|
| 1625 |
+
|
| 1626 |
+
if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
|
| 1627 |
+
/*
|
| 1628 |
+
* Don't create IDs containing entity references (should
|
| 1629 |
+
* be always the case with HTML)
|
| 1630 |
+
*/
|
| 1631 |
+
(ret->children != NULL) &&
|
| 1632 |
+
(ret->children->type == XML_TEXT_NODE) &&
|
| 1633 |
+
(ret->children->next == NULL)) {
|
| 1634 |
+
int res = xmlIsID(ctxt->myDoc, ctxt->node, ret);
|
| 1635 |
+
|
| 1636 |
+
if (res < 0)
|
| 1637 |
+
xmlCtxtErrMemory(ctxt);
|
| 1638 |
+
else if (res > 0)
|
| 1639 |
+
xmlAddID(&ctxt->vctxt, ctxt->myDoc, ret->children->content, ret);
|
| 1640 |
+
}
|
| 1641 |
+
|
| 1642 |
+
if (nval != NULL)
|
| 1643 |
+
xmlFree(nval);
|
| 1644 |
+
}
|
| 1645 |
+
|
| 1646 |
+
/**
|
| 1647 |
+
* Called when an opening tag has been processed.
|
| 1648 |
+
*
|
| 1649 |
+
* @param ctxt parser context
|
| 1650 |
+
* @param fullname The element name, including namespace prefix
|
| 1651 |
+
* @param atts An array of name/value attributes pairs, NULL terminated
|
| 1652 |
+
*/
|
| 1653 |
+
static void
|
| 1654 |
+
xmlSAX2StartHtmlElement(xmlParserCtxtPtr ctxt, const xmlChar *fullname,
|
| 1655 |
+
const xmlChar **atts) {
|
| 1656 |
+
xmlNodePtr ret;
|
| 1657 |
+
xmlNodePtr parent;
|
| 1658 |
+
const xmlChar *att;
|
| 1659 |
+
const xmlChar *value;
|
| 1660 |
+
int i;
|
| 1661 |
+
|
| 1662 |
+
ret = xmlNewDocNode(ctxt->myDoc, NULL, fullname, NULL);
|
| 1663 |
+
if (ret == NULL) {
|
| 1664 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1665 |
+
return;
|
| 1666 |
+
}
|
| 1667 |
+
ctxt->nodemem = -1;
|
| 1668 |
+
|
| 1669 |
+
/* Initialize parent before pushing node */
|
| 1670 |
+
parent = ctxt->node;
|
| 1671 |
+
if (parent == NULL)
|
| 1672 |
+
parent = (xmlNodePtr) ctxt->myDoc;
|
| 1673 |
+
|
| 1674 |
+
/*
|
| 1675 |
+
* Link the child element
|
| 1676 |
+
*/
|
| 1677 |
+
xmlSAX2AppendChild(ctxt, ret);
|
| 1678 |
+
|
| 1679 |
+
/*
|
| 1680 |
+
* We are parsing a new node.
|
| 1681 |
+
*/
|
| 1682 |
+
if (nodePush(ctxt, ret) < 0) {
|
| 1683 |
+
xmlUnlinkNode(ret);
|
| 1684 |
+
xmlFreeNode(ret);
|
| 1685 |
+
return;
|
| 1686 |
+
}
|
| 1687 |
+
|
| 1688 |
+
if (atts != NULL) {
|
| 1689 |
+
i = 0;
|
| 1690 |
+
att = atts[i++];
|
| 1691 |
+
value = atts[i++];
|
| 1692 |
+
while (att != NULL) {
|
| 1693 |
+
xmlSAX2HtmlAttribute(ctxt, att, value);
|
| 1694 |
+
att = atts[i++];
|
| 1695 |
+
value = atts[i++];
|
| 1696 |
+
}
|
| 1697 |
+
}
|
| 1698 |
+
}
|
| 1699 |
+
#endif /* LIBXML_HTML_ENABLED */
|
| 1700 |
+
|
| 1701 |
+
/**
|
| 1702 |
+
* Called when an opening tag has been processed.
|
| 1703 |
+
*
|
| 1704 |
+
* @deprecated Don't call this function directly.
|
| 1705 |
+
*
|
| 1706 |
+
* Used for HTML and SAX1.
|
| 1707 |
+
*
|
| 1708 |
+
* @param ctx the user data (XML parser context)
|
| 1709 |
+
* @param fullname The element name, including namespace prefix
|
| 1710 |
+
* @param atts An array of name/value attributes pairs, NULL terminated
|
| 1711 |
+
*/
|
| 1712 |
+
void
|
| 1713 |
+
xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) {
|
| 1714 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 1715 |
+
|
| 1716 |
+
(void) atts;
|
| 1717 |
+
|
| 1718 |
+
if ((ctxt == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL))
|
| 1719 |
+
return;
|
| 1720 |
+
|
| 1721 |
+
#ifdef LIBXML_SAX1_ENABLED
|
| 1722 |
+
if (!ctxt->html) {
|
| 1723 |
+
xmlSAX1StartElement(ctxt, fullname, atts);
|
| 1724 |
+
return;
|
| 1725 |
+
}
|
| 1726 |
+
#endif
|
| 1727 |
+
|
| 1728 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 1729 |
+
if (ctxt->html) {
|
| 1730 |
+
xmlSAX2StartHtmlElement(ctxt, fullname, atts);
|
| 1731 |
+
return;
|
| 1732 |
+
}
|
| 1733 |
+
#endif
|
| 1734 |
+
}
|
| 1735 |
+
|
| 1736 |
+
/**
|
| 1737 |
+
* called when the end of an element has been detected.
|
| 1738 |
+
*
|
| 1739 |
+
* @deprecated Don't call this function directly.
|
| 1740 |
+
*
|
| 1741 |
+
* Used for HTML and SAX1.
|
| 1742 |
+
*
|
| 1743 |
+
* @param ctx the user data (XML parser context)
|
| 1744 |
+
* @param name The element name
|
| 1745 |
+
*/
|
| 1746 |
+
void
|
| 1747 |
+
xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
|
| 1748 |
+
{
|
| 1749 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 1750 |
+
|
| 1751 |
+
if (ctxt == NULL)
|
| 1752 |
+
return;
|
| 1753 |
+
|
| 1754 |
+
#if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_VALID_ENABLED)
|
| 1755 |
+
if (!ctxt->html && ctxt->validate && ctxt->wellFormed &&
|
| 1756 |
+
ctxt->myDoc && ctxt->myDoc->intSubset)
|
| 1757 |
+
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
|
| 1758 |
+
ctxt->node);
|
| 1759 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 1760 |
+
|
| 1761 |
+
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
|
| 1762 |
+
ctxt->nodemem = -1;
|
| 1763 |
+
|
| 1764 |
+
/*
|
| 1765 |
+
* end of parsing of this node.
|
| 1766 |
+
*/
|
| 1767 |
+
nodePop(ctxt);
|
| 1768 |
+
#endif
|
| 1769 |
+
}
|
| 1770 |
+
|
| 1771 |
+
/*
|
| 1772 |
+
* @param ctxt the parser context
|
| 1773 |
+
* @param doc the document
|
| 1774 |
+
* @param str the input string
|
| 1775 |
+
* @param len the string length
|
| 1776 |
+
*
|
| 1777 |
+
* Callback for a text node
|
| 1778 |
+
*
|
| 1779 |
+
* @returns the newly allocated string or NULL if not needed or error
|
| 1780 |
+
*/
|
| 1781 |
+
static xmlNodePtr
|
| 1782 |
+
xmlSAX2TextNode(xmlParserCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *str,
|
| 1783 |
+
int len) {
|
| 1784 |
+
xmlNodePtr ret;
|
| 1785 |
+
const xmlChar *intern = NULL;
|
| 1786 |
+
|
| 1787 |
+
/*
|
| 1788 |
+
* Allocate
|
| 1789 |
+
*/
|
| 1790 |
+
if (ctxt->freeElems != NULL) {
|
| 1791 |
+
ret = ctxt->freeElems;
|
| 1792 |
+
ctxt->freeElems = ret->next;
|
| 1793 |
+
ctxt->freeElemsNr--;
|
| 1794 |
+
} else {
|
| 1795 |
+
ret = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
|
| 1796 |
+
}
|
| 1797 |
+
if (ret == NULL) {
|
| 1798 |
+
xmlCtxtErrMemory(ctxt);
|
| 1799 |
+
return(NULL);
|
| 1800 |
+
}
|
| 1801 |
+
memset(ret, 0, sizeof(xmlNode));
|
| 1802 |
+
/*
|
| 1803 |
+
* intern the formatting blanks found between tags, or the
|
| 1804 |
+
* very short strings
|
| 1805 |
+
*/
|
| 1806 |
+
if ((!ctxt->html) && (ctxt->dictNames)) {
|
| 1807 |
+
xmlChar cur = str[len];
|
| 1808 |
+
|
| 1809 |
+
if ((len < (int) (2 * sizeof(void *))) &&
|
| 1810 |
+
(ctxt->options & XML_PARSE_COMPACT)) {
|
| 1811 |
+
/* store the string in the node overriding properties and nsDef */
|
| 1812 |
+
xmlChar *tmp = (xmlChar *) &(ret->properties);
|
| 1813 |
+
memcpy(tmp, str, len);
|
| 1814 |
+
tmp[len] = 0;
|
| 1815 |
+
intern = tmp;
|
| 1816 |
+
} else if ((len <= 3) && ((cur == '"') || (cur == '\'') ||
|
| 1817 |
+
((cur == '<') && (str[len + 1] != '!')))) {
|
| 1818 |
+
intern = xmlDictLookup(ctxt->dict, str, len);
|
| 1819 |
+
if (intern == NULL) {
|
| 1820 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1821 |
+
xmlFree(ret);
|
| 1822 |
+
return(NULL);
|
| 1823 |
+
}
|
| 1824 |
+
} else if (IS_BLANK_CH(*str) && (len < 60) && (cur == '<') &&
|
| 1825 |
+
(str[len + 1] != '!')) {
|
| 1826 |
+
int i;
|
| 1827 |
+
|
| 1828 |
+
for (i = 1;i < len;i++) {
|
| 1829 |
+
if (!IS_BLANK_CH(str[i])) goto skip;
|
| 1830 |
+
}
|
| 1831 |
+
intern = xmlDictLookup(ctxt->dict, str, len);
|
| 1832 |
+
if (intern == NULL) {
|
| 1833 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1834 |
+
xmlFree(ret);
|
| 1835 |
+
return(NULL);
|
| 1836 |
+
}
|
| 1837 |
+
}
|
| 1838 |
+
}
|
| 1839 |
+
skip:
|
| 1840 |
+
ret->type = XML_TEXT_NODE;
|
| 1841 |
+
ret->doc = doc;
|
| 1842 |
+
|
| 1843 |
+
ret->name = xmlStringText;
|
| 1844 |
+
if (intern == NULL) {
|
| 1845 |
+
ret->content = xmlStrndup(str, len);
|
| 1846 |
+
if (ret->content == NULL) {
|
| 1847 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1848 |
+
xmlFree(ret);
|
| 1849 |
+
return(NULL);
|
| 1850 |
+
}
|
| 1851 |
+
} else
|
| 1852 |
+
ret->content = (xmlChar *) intern;
|
| 1853 |
+
|
| 1854 |
+
if ((xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
|
| 1855 |
+
xmlRegisterNodeDefaultValue(ret);
|
| 1856 |
+
return(ret);
|
| 1857 |
+
}
|
| 1858 |
+
|
| 1859 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 1860 |
+
/*
|
| 1861 |
+
* @param ctxt the parser context
|
| 1862 |
+
* @param str the input string
|
| 1863 |
+
* @param len the string length
|
| 1864 |
+
*
|
| 1865 |
+
* Remove the entities from an attribute value
|
| 1866 |
+
*
|
| 1867 |
+
* @returns the newly allocated string or NULL if not needed or error
|
| 1868 |
+
*/
|
| 1869 |
+
static xmlChar *
|
| 1870 |
+
xmlSAX2DecodeAttrEntities(xmlParserCtxtPtr ctxt, const xmlChar *str,
|
| 1871 |
+
const xmlChar *end) {
|
| 1872 |
+
const xmlChar *in;
|
| 1873 |
+
|
| 1874 |
+
in = str;
|
| 1875 |
+
while (in < end)
|
| 1876 |
+
if (*in++ == '&')
|
| 1877 |
+
goto decode;
|
| 1878 |
+
return(NULL);
|
| 1879 |
+
decode:
|
| 1880 |
+
/*
|
| 1881 |
+
* If the value contains '&', we can be sure it was allocated and is
|
| 1882 |
+
* zero-terminated.
|
| 1883 |
+
*/
|
| 1884 |
+
/* TODO: normalize if needed */
|
| 1885 |
+
return(xmlExpandEntitiesInAttValue(ctxt, str, /* normalize */ 0));
|
| 1886 |
+
}
|
| 1887 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 1888 |
+
|
| 1889 |
+
/**
|
| 1890 |
+
* Handle an attribute that has been read by the parser.
|
| 1891 |
+
* The default handling is to convert the attribute into an
|
| 1892 |
+
* DOM subtree and past it in a new xmlAttr element added to
|
| 1893 |
+
* the element.
|
| 1894 |
+
*
|
| 1895 |
+
* @param ctxt the parser context
|
| 1896 |
+
* @param localname the local name of the attribute
|
| 1897 |
+
* @param prefix the attribute namespace prefix if available
|
| 1898 |
+
* @param value start of the attribute value
|
| 1899 |
+
* @param valueend end of the attribute value
|
| 1900 |
+
* @returns the new attribute or NULL in case of error.
|
| 1901 |
+
*/
|
| 1902 |
+
static xmlAttrPtr
|
| 1903 |
+
xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
|
| 1904 |
+
const xmlChar * localname,
|
| 1905 |
+
const xmlChar * prefix,
|
| 1906 |
+
const xmlChar * value,
|
| 1907 |
+
const xmlChar * valueend)
|
| 1908 |
+
{
|
| 1909 |
+
xmlAttrPtr ret;
|
| 1910 |
+
xmlNsPtr namespace = NULL;
|
| 1911 |
+
xmlChar *dup = NULL;
|
| 1912 |
+
|
| 1913 |
+
/*
|
| 1914 |
+
* Note: if prefix == NULL, the attribute is not in the default namespace
|
| 1915 |
+
*/
|
| 1916 |
+
if (prefix != NULL) {
|
| 1917 |
+
namespace = xmlParserNsLookupSax(ctxt, prefix);
|
| 1918 |
+
if ((namespace == NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) {
|
| 1919 |
+
int res;
|
| 1920 |
+
|
| 1921 |
+
res = xmlSearchNsSafe(ctxt->node, prefix, &namespace);
|
| 1922 |
+
if (res < 0)
|
| 1923 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1924 |
+
}
|
| 1925 |
+
}
|
| 1926 |
+
|
| 1927 |
+
/*
|
| 1928 |
+
* allocate the node
|
| 1929 |
+
*/
|
| 1930 |
+
if (ctxt->freeAttrs != NULL) {
|
| 1931 |
+
ret = ctxt->freeAttrs;
|
| 1932 |
+
ctxt->freeAttrs = ret->next;
|
| 1933 |
+
ctxt->freeAttrsNr--;
|
| 1934 |
+
} else {
|
| 1935 |
+
ret = xmlMalloc(sizeof(*ret));
|
| 1936 |
+
if (ret == NULL) {
|
| 1937 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1938 |
+
return(NULL);
|
| 1939 |
+
}
|
| 1940 |
+
}
|
| 1941 |
+
|
| 1942 |
+
memset(ret, 0, sizeof(xmlAttr));
|
| 1943 |
+
ret->type = XML_ATTRIBUTE_NODE;
|
| 1944 |
+
|
| 1945 |
+
/*
|
| 1946 |
+
* xmlParseBalancedChunkMemoryRecover had a bug that could result in
|
| 1947 |
+
* a mismatch between ctxt->node->doc and ctxt->myDoc. We use
|
| 1948 |
+
* ctxt->node->doc here, but we should somehow make sure that the
|
| 1949 |
+
* document pointers match.
|
| 1950 |
+
*/
|
| 1951 |
+
|
| 1952 |
+
/* assert(ctxt->node->doc == ctxt->myDoc); */
|
| 1953 |
+
|
| 1954 |
+
ret->parent = ctxt->node;
|
| 1955 |
+
ret->doc = ctxt->node->doc;
|
| 1956 |
+
ret->ns = namespace;
|
| 1957 |
+
|
| 1958 |
+
if (ctxt->dictNames) {
|
| 1959 |
+
ret->name = localname;
|
| 1960 |
+
} else {
|
| 1961 |
+
ret->name = xmlStrdup(localname);
|
| 1962 |
+
if (ret->name == NULL)
|
| 1963 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1964 |
+
}
|
| 1965 |
+
|
| 1966 |
+
if ((xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
|
| 1967 |
+
xmlRegisterNodeDefaultValue((xmlNodePtr)ret);
|
| 1968 |
+
|
| 1969 |
+
if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
|
| 1970 |
+
xmlNodePtr tmp;
|
| 1971 |
+
|
| 1972 |
+
/*
|
| 1973 |
+
* We know that if there is an entity reference, then
|
| 1974 |
+
* the string has been dup'ed and terminates with 0
|
| 1975 |
+
* otherwise with ' or "
|
| 1976 |
+
*/
|
| 1977 |
+
if (*valueend != 0) {
|
| 1978 |
+
tmp = xmlSAX2TextNode(ctxt, ret->doc, value, valueend - value);
|
| 1979 |
+
ret->children = tmp;
|
| 1980 |
+
ret->last = tmp;
|
| 1981 |
+
if (tmp != NULL) {
|
| 1982 |
+
tmp->parent = (xmlNodePtr) ret;
|
| 1983 |
+
}
|
| 1984 |
+
} else if (valueend > value) {
|
| 1985 |
+
if (xmlNodeParseAttValue(ret->doc, ret, value, valueend - value,
|
| 1986 |
+
NULL) < 0)
|
| 1987 |
+
xmlSAX2ErrMemory(ctxt);
|
| 1988 |
+
}
|
| 1989 |
+
} else if (value != NULL) {
|
| 1990 |
+
xmlNodePtr tmp;
|
| 1991 |
+
|
| 1992 |
+
tmp = xmlSAX2TextNode(ctxt, ret->doc, value, valueend - value);
|
| 1993 |
+
ret->children = tmp;
|
| 1994 |
+
ret->last = tmp;
|
| 1995 |
+
if (tmp != NULL) {
|
| 1996 |
+
tmp->parent = (xmlNodePtr) ret;
|
| 1997 |
+
}
|
| 1998 |
+
}
|
| 1999 |
+
|
| 2000 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 2001 |
+
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
|
| 2002 |
+
ctxt->myDoc && ctxt->myDoc->intSubset) {
|
| 2003 |
+
/*
|
| 2004 |
+
* If we don't substitute entities, the validation should be
|
| 2005 |
+
* done on a value with replaced entities anyway.
|
| 2006 |
+
*/
|
| 2007 |
+
if (!ctxt->replaceEntities) {
|
| 2008 |
+
dup = xmlSAX2DecodeAttrEntities(ctxt, value, valueend);
|
| 2009 |
+
if (dup == NULL) {
|
| 2010 |
+
if (*valueend == 0) {
|
| 2011 |
+
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
| 2012 |
+
ctxt->myDoc, ctxt->node, ret, value);
|
| 2013 |
+
} else {
|
| 2014 |
+
/*
|
| 2015 |
+
* That should already be normalized.
|
| 2016 |
+
* cheaper to finally allocate here than duplicate
|
| 2017 |
+
* entry points in the full validation code
|
| 2018 |
+
*/
|
| 2019 |
+
dup = xmlStrndup(value, valueend - value);
|
| 2020 |
+
if (dup == NULL)
|
| 2021 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2022 |
+
|
| 2023 |
+
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
| 2024 |
+
ctxt->myDoc, ctxt->node, ret, dup);
|
| 2025 |
+
}
|
| 2026 |
+
} else {
|
| 2027 |
+
/*
|
| 2028 |
+
* dup now contains a string of the flattened attribute
|
| 2029 |
+
* content with entities substituted. Check if we need to
|
| 2030 |
+
* apply an extra layer of normalization.
|
| 2031 |
+
* It need to be done twice ... it's an extra burden related
|
| 2032 |
+
* to the ability to keep references in attributes
|
| 2033 |
+
*/
|
| 2034 |
+
if (ctxt->attsSpecial != NULL) {
|
| 2035 |
+
xmlChar *nvalnorm;
|
| 2036 |
+
xmlChar fn[50];
|
| 2037 |
+
xmlChar *fullname;
|
| 2038 |
+
|
| 2039 |
+
fullname = xmlBuildQName(localname, prefix, fn, 50);
|
| 2040 |
+
if (fullname == NULL) {
|
| 2041 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2042 |
+
} else {
|
| 2043 |
+
ctxt->vctxt.valid = 1;
|
| 2044 |
+
nvalnorm = xmlValidCtxtNormalizeAttributeValue(
|
| 2045 |
+
&ctxt->vctxt, ctxt->myDoc,
|
| 2046 |
+
ctxt->node, fullname, dup);
|
| 2047 |
+
if (ctxt->vctxt.valid != 1)
|
| 2048 |
+
ctxt->valid = 0;
|
| 2049 |
+
|
| 2050 |
+
if ((fullname != fn) && (fullname != localname))
|
| 2051 |
+
xmlFree(fullname);
|
| 2052 |
+
if (nvalnorm != NULL) {
|
| 2053 |
+
xmlFree(dup);
|
| 2054 |
+
dup = nvalnorm;
|
| 2055 |
+
}
|
| 2056 |
+
}
|
| 2057 |
+
}
|
| 2058 |
+
|
| 2059 |
+
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
| 2060 |
+
ctxt->myDoc, ctxt->node, ret, dup);
|
| 2061 |
+
}
|
| 2062 |
+
} else {
|
| 2063 |
+
/*
|
| 2064 |
+
* if entities already have been substituted, then
|
| 2065 |
+
* the attribute as passed is already normalized
|
| 2066 |
+
*/
|
| 2067 |
+
dup = xmlStrndup(value, valueend - value);
|
| 2068 |
+
if (dup == NULL)
|
| 2069 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2070 |
+
|
| 2071 |
+
/*
|
| 2072 |
+
* When replacing entities, make sure that IDs in
|
| 2073 |
+
* entities aren't registered. This also shouldn't be
|
| 2074 |
+
* done when entities aren't replaced, but this would
|
| 2075 |
+
* require to rework IDREF checks.
|
| 2076 |
+
*/
|
| 2077 |
+
if (ctxt->input->entity != NULL)
|
| 2078 |
+
ctxt->vctxt.flags |= XML_VCTXT_IN_ENTITY;
|
| 2079 |
+
|
| 2080 |
+
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
| 2081 |
+
ctxt->myDoc, ctxt->node, ret, dup);
|
| 2082 |
+
|
| 2083 |
+
ctxt->vctxt.flags &= ~XML_VCTXT_IN_ENTITY;
|
| 2084 |
+
}
|
| 2085 |
+
} else
|
| 2086 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 2087 |
+
if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
|
| 2088 |
+
(ctxt->input->entity == NULL) &&
|
| 2089 |
+
/* Don't create IDs containing entity references */
|
| 2090 |
+
(ret->children != NULL) &&
|
| 2091 |
+
(ret->children->type == XML_TEXT_NODE) &&
|
| 2092 |
+
(ret->children->next == NULL)) {
|
| 2093 |
+
xmlChar *content = ret->children->content;
|
| 2094 |
+
/*
|
| 2095 |
+
* when validating, the ID registration is done at the attribute
|
| 2096 |
+
* validation level. Otherwise we have to do specific handling here.
|
| 2097 |
+
*/
|
| 2098 |
+
if ((prefix == ctxt->str_xml) &&
|
| 2099 |
+
(localname[0] == 'i') && (localname[1] == 'd') &&
|
| 2100 |
+
(localname[2] == 0)) {
|
| 2101 |
+
/*
|
| 2102 |
+
* Add the xml:id value
|
| 2103 |
+
*
|
| 2104 |
+
* Open issue: normalization of the value.
|
| 2105 |
+
*/
|
| 2106 |
+
if (xmlValidateNCName(content, 1) != 0) {
|
| 2107 |
+
xmlErrId(ctxt, XML_DTD_XMLID_VALUE,
|
| 2108 |
+
"xml:id : attribute value %s is not an NCName\n",
|
| 2109 |
+
content);
|
| 2110 |
+
}
|
| 2111 |
+
xmlAddID(&ctxt->vctxt, ctxt->myDoc, content, ret);
|
| 2112 |
+
} else {
|
| 2113 |
+
int res = xmlIsID(ctxt->myDoc, ctxt->node, ret);
|
| 2114 |
+
|
| 2115 |
+
if (res < 0)
|
| 2116 |
+
xmlCtxtErrMemory(ctxt);
|
| 2117 |
+
else if (res > 0)
|
| 2118 |
+
xmlAddID(&ctxt->vctxt, ctxt->myDoc, content, ret);
|
| 2119 |
+
else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret))
|
| 2120 |
+
xmlAddRef(&ctxt->vctxt, ctxt->myDoc, content, ret);
|
| 2121 |
+
}
|
| 2122 |
+
}
|
| 2123 |
+
if (dup != NULL)
|
| 2124 |
+
xmlFree(dup);
|
| 2125 |
+
|
| 2126 |
+
return(ret);
|
| 2127 |
+
}
|
| 2128 |
+
|
| 2129 |
+
/**
|
| 2130 |
+
* SAX2 callback when an element start has been detected by the parser.
|
| 2131 |
+
* It provides the namespace information for the element, as well as
|
| 2132 |
+
* the new namespace declarations on the element.
|
| 2133 |
+
*
|
| 2134 |
+
* @param ctx the user data (XML parser context)
|
| 2135 |
+
* @param localname the local name of the element
|
| 2136 |
+
* @param prefix the element namespace prefix if available
|
| 2137 |
+
* @param URI the element namespace name if available
|
| 2138 |
+
* @param nb_namespaces number of namespace definitions on that node
|
| 2139 |
+
* @param namespaces pointer to the array of prefix/URI pairs namespace definitions
|
| 2140 |
+
* @param nb_attributes the number of attributes on that node
|
| 2141 |
+
* @param nb_defaulted the number of defaulted attributes.
|
| 2142 |
+
* @param attributes pointer to the array of (localname/prefix/URI/value/end)
|
| 2143 |
+
* attribute values.
|
| 2144 |
+
*/
|
| 2145 |
+
void
|
| 2146 |
+
xmlSAX2StartElementNs(void *ctx,
|
| 2147 |
+
const xmlChar *localname,
|
| 2148 |
+
const xmlChar *prefix,
|
| 2149 |
+
const xmlChar *URI,
|
| 2150 |
+
int nb_namespaces,
|
| 2151 |
+
const xmlChar **namespaces,
|
| 2152 |
+
int nb_attributes,
|
| 2153 |
+
int nb_defaulted,
|
| 2154 |
+
const xmlChar **attributes)
|
| 2155 |
+
{
|
| 2156 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 2157 |
+
xmlNodePtr ret;
|
| 2158 |
+
xmlNsPtr last = NULL, ns;
|
| 2159 |
+
const xmlChar *uri, *pref;
|
| 2160 |
+
xmlChar *lname = NULL;
|
| 2161 |
+
int i, j;
|
| 2162 |
+
|
| 2163 |
+
if (ctx == NULL) return;
|
| 2164 |
+
|
| 2165 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 2166 |
+
/*
|
| 2167 |
+
* First check on validity:
|
| 2168 |
+
*/
|
| 2169 |
+
if (ctxt->validate &&
|
| 2170 |
+
((ctxt->myDoc == NULL) ||
|
| 2171 |
+
((ctxt->myDoc->extSubset == NULL) &&
|
| 2172 |
+
((ctxt->myDoc->intSubset == NULL) ||
|
| 2173 |
+
((ctxt->myDoc->intSubset->notations == NULL) &&
|
| 2174 |
+
(ctxt->myDoc->intSubset->elements == NULL) &&
|
| 2175 |
+
(ctxt->myDoc->intSubset->attributes == NULL) &&
|
| 2176 |
+
(ctxt->myDoc->intSubset->entities == NULL)))))) {
|
| 2177 |
+
xmlErrValid(ctxt, XML_DTD_NO_DTD,
|
| 2178 |
+
"Validation failed: no DTD found !", NULL, NULL);
|
| 2179 |
+
ctxt->validate = 0;
|
| 2180 |
+
}
|
| 2181 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 2182 |
+
|
| 2183 |
+
/*
|
| 2184 |
+
* Take care of the rare case of an undefined namespace prefix
|
| 2185 |
+
*/
|
| 2186 |
+
if ((prefix != NULL) && (URI == NULL)) {
|
| 2187 |
+
if (ctxt->dictNames) {
|
| 2188 |
+
const xmlChar *fullname;
|
| 2189 |
+
|
| 2190 |
+
fullname = xmlDictQLookup(ctxt->dict, prefix, localname);
|
| 2191 |
+
if (fullname == NULL) {
|
| 2192 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2193 |
+
return;
|
| 2194 |
+
}
|
| 2195 |
+
localname = fullname;
|
| 2196 |
+
} else {
|
| 2197 |
+
lname = xmlBuildQName(localname, prefix, NULL, 0);
|
| 2198 |
+
if (lname == NULL) {
|
| 2199 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2200 |
+
return;
|
| 2201 |
+
}
|
| 2202 |
+
}
|
| 2203 |
+
}
|
| 2204 |
+
/*
|
| 2205 |
+
* allocate the node
|
| 2206 |
+
*/
|
| 2207 |
+
if (ctxt->freeElems != NULL) {
|
| 2208 |
+
ret = ctxt->freeElems;
|
| 2209 |
+
ctxt->freeElems = ret->next;
|
| 2210 |
+
ctxt->freeElemsNr--;
|
| 2211 |
+
memset(ret, 0, sizeof(xmlNode));
|
| 2212 |
+
ret->doc = ctxt->myDoc;
|
| 2213 |
+
ret->type = XML_ELEMENT_NODE;
|
| 2214 |
+
|
| 2215 |
+
if (ctxt->dictNames)
|
| 2216 |
+
ret->name = localname;
|
| 2217 |
+
else {
|
| 2218 |
+
if (lname == NULL)
|
| 2219 |
+
ret->name = xmlStrdup(localname);
|
| 2220 |
+
else
|
| 2221 |
+
ret->name = lname;
|
| 2222 |
+
if (ret->name == NULL) {
|
| 2223 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2224 |
+
xmlFree(ret);
|
| 2225 |
+
return;
|
| 2226 |
+
}
|
| 2227 |
+
}
|
| 2228 |
+
if ((xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
|
| 2229 |
+
xmlRegisterNodeDefaultValue(ret);
|
| 2230 |
+
} else {
|
| 2231 |
+
if (ctxt->dictNames)
|
| 2232 |
+
ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,
|
| 2233 |
+
(xmlChar *) localname, NULL);
|
| 2234 |
+
else if (lname == NULL)
|
| 2235 |
+
ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);
|
| 2236 |
+
else
|
| 2237 |
+
ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, lname, NULL);
|
| 2238 |
+
if (ret == NULL) {
|
| 2239 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2240 |
+
return;
|
| 2241 |
+
}
|
| 2242 |
+
}
|
| 2243 |
+
|
| 2244 |
+
/*
|
| 2245 |
+
* Build the namespace list
|
| 2246 |
+
*/
|
| 2247 |
+
for (i = 0,j = 0;j < nb_namespaces;j++) {
|
| 2248 |
+
pref = namespaces[i++];
|
| 2249 |
+
uri = namespaces[i++];
|
| 2250 |
+
ns = xmlNewNs(NULL, uri, pref);
|
| 2251 |
+
if (ns != NULL) {
|
| 2252 |
+
if (last == NULL) {
|
| 2253 |
+
ret->nsDef = last = ns;
|
| 2254 |
+
} else {
|
| 2255 |
+
last->next = ns;
|
| 2256 |
+
last = ns;
|
| 2257 |
+
}
|
| 2258 |
+
if ((URI != NULL) && (prefix == pref))
|
| 2259 |
+
ret->ns = ns;
|
| 2260 |
+
} else {
|
| 2261 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2262 |
+
continue;
|
| 2263 |
+
}
|
| 2264 |
+
|
| 2265 |
+
xmlParserNsUpdateSax(ctxt, pref, ns);
|
| 2266 |
+
|
| 2267 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 2268 |
+
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
|
| 2269 |
+
ctxt->myDoc && ctxt->myDoc->intSubset) {
|
| 2270 |
+
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
|
| 2271 |
+
ret, prefix, ns, uri);
|
| 2272 |
+
}
|
| 2273 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 2274 |
+
}
|
| 2275 |
+
ctxt->nodemem = -1;
|
| 2276 |
+
|
| 2277 |
+
/*
|
| 2278 |
+
* Link the child element
|
| 2279 |
+
*/
|
| 2280 |
+
xmlSAX2AppendChild(ctxt, ret);
|
| 2281 |
+
|
| 2282 |
+
/*
|
| 2283 |
+
* We are parsing a new node.
|
| 2284 |
+
*/
|
| 2285 |
+
if (nodePush(ctxt, ret) < 0) {
|
| 2286 |
+
xmlUnlinkNode(ret);
|
| 2287 |
+
xmlFreeNode(ret);
|
| 2288 |
+
return;
|
| 2289 |
+
}
|
| 2290 |
+
|
| 2291 |
+
/*
|
| 2292 |
+
* Insert the defaulted attributes from the DTD only if requested:
|
| 2293 |
+
*/
|
| 2294 |
+
if ((nb_defaulted != 0) &&
|
| 2295 |
+
((ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0))
|
| 2296 |
+
nb_attributes -= nb_defaulted;
|
| 2297 |
+
|
| 2298 |
+
/*
|
| 2299 |
+
* Search the namespace if it wasn't already found
|
| 2300 |
+
* Note that, if prefix is NULL, this searches for the default Ns
|
| 2301 |
+
*/
|
| 2302 |
+
if ((URI != NULL) && (ret->ns == NULL)) {
|
| 2303 |
+
ret->ns = xmlParserNsLookupSax(ctxt, prefix);
|
| 2304 |
+
if ((ret->ns == NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) {
|
| 2305 |
+
int res;
|
| 2306 |
+
|
| 2307 |
+
res = xmlSearchNsSafe(ret, prefix, &ret->ns);
|
| 2308 |
+
if (res < 0)
|
| 2309 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2310 |
+
}
|
| 2311 |
+
if (ret->ns == NULL) {
|
| 2312 |
+
ns = xmlNewNs(ret, NULL, prefix);
|
| 2313 |
+
if (ns == NULL) {
|
| 2314 |
+
|
| 2315 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2316 |
+
return;
|
| 2317 |
+
}
|
| 2318 |
+
if (prefix != NULL)
|
| 2319 |
+
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
|
| 2320 |
+
"Namespace prefix %s was not found\n",
|
| 2321 |
+
prefix, NULL);
|
| 2322 |
+
else
|
| 2323 |
+
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
|
| 2324 |
+
"Namespace default prefix was not found\n",
|
| 2325 |
+
NULL, NULL);
|
| 2326 |
+
}
|
| 2327 |
+
}
|
| 2328 |
+
|
| 2329 |
+
/*
|
| 2330 |
+
* process all the other attributes
|
| 2331 |
+
*/
|
| 2332 |
+
if (nb_attributes > 0) {
|
| 2333 |
+
xmlAttrPtr prev = NULL;
|
| 2334 |
+
|
| 2335 |
+
for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
|
| 2336 |
+
xmlAttrPtr attr = NULL;
|
| 2337 |
+
|
| 2338 |
+
/*
|
| 2339 |
+
* Handle the rare case of an undefined attribute prefix
|
| 2340 |
+
*/
|
| 2341 |
+
if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) {
|
| 2342 |
+
if (ctxt->dictNames) {
|
| 2343 |
+
const xmlChar *fullname;
|
| 2344 |
+
|
| 2345 |
+
fullname = xmlDictQLookup(ctxt->dict, attributes[j+1],
|
| 2346 |
+
attributes[j]);
|
| 2347 |
+
if (fullname == NULL) {
|
| 2348 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2349 |
+
return;
|
| 2350 |
+
}
|
| 2351 |
+
attr = xmlSAX2AttributeNs(ctxt, fullname, NULL,
|
| 2352 |
+
attributes[j+3],
|
| 2353 |
+
attributes[j+4]);
|
| 2354 |
+
goto have_attr;
|
| 2355 |
+
} else {
|
| 2356 |
+
lname = xmlBuildQName(attributes[j], attributes[j+1],
|
| 2357 |
+
NULL, 0);
|
| 2358 |
+
if (lname == NULL) {
|
| 2359 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2360 |
+
return;
|
| 2361 |
+
}
|
| 2362 |
+
attr = xmlSAX2AttributeNs(ctxt, lname, NULL,
|
| 2363 |
+
attributes[j+3],
|
| 2364 |
+
attributes[j+4]);
|
| 2365 |
+
xmlFree(lname);
|
| 2366 |
+
goto have_attr;
|
| 2367 |
+
}
|
| 2368 |
+
}
|
| 2369 |
+
attr = xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1],
|
| 2370 |
+
attributes[j+3], attributes[j+4]);
|
| 2371 |
+
have_attr:
|
| 2372 |
+
if (attr == NULL)
|
| 2373 |
+
continue;
|
| 2374 |
+
|
| 2375 |
+
/* link at the end to preserve order */
|
| 2376 |
+
if (prev == NULL) {
|
| 2377 |
+
ctxt->node->properties = attr;
|
| 2378 |
+
} else {
|
| 2379 |
+
prev->next = attr;
|
| 2380 |
+
attr->prev = prev;
|
| 2381 |
+
}
|
| 2382 |
+
|
| 2383 |
+
prev = attr;
|
| 2384 |
+
}
|
| 2385 |
+
}
|
| 2386 |
+
|
| 2387 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 2388 |
+
/*
|
| 2389 |
+
* If it's the Document root, finish the DTD validation and
|
| 2390 |
+
* check the document root element for validity
|
| 2391 |
+
*/
|
| 2392 |
+
if ((ctxt->validate) &&
|
| 2393 |
+
((ctxt->vctxt.flags & XML_VCTXT_DTD_VALIDATED) == 0)) {
|
| 2394 |
+
int chk;
|
| 2395 |
+
|
| 2396 |
+
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
|
| 2397 |
+
if (chk <= 0)
|
| 2398 |
+
ctxt->valid = 0;
|
| 2399 |
+
if (chk < 0)
|
| 2400 |
+
ctxt->wellFormed = 0;
|
| 2401 |
+
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
| 2402 |
+
ctxt->vctxt.flags |= XML_VCTXT_DTD_VALIDATED;
|
| 2403 |
+
}
|
| 2404 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 2405 |
+
}
|
| 2406 |
+
|
| 2407 |
+
/**
|
| 2408 |
+
* SAX2 callback when an element end has been detected by the parser.
|
| 2409 |
+
* It provides the namespace information for the element.
|
| 2410 |
+
*
|
| 2411 |
+
* @param ctx the user data (XML parser context)
|
| 2412 |
+
* @param localname the local name of the element
|
| 2413 |
+
* @param prefix the element namespace prefix if available
|
| 2414 |
+
* @param URI the element namespace name if available
|
| 2415 |
+
*/
|
| 2416 |
+
void
|
| 2417 |
+
xmlSAX2EndElementNs(void *ctx,
|
| 2418 |
+
const xmlChar * localname ATTRIBUTE_UNUSED,
|
| 2419 |
+
const xmlChar * prefix ATTRIBUTE_UNUSED,
|
| 2420 |
+
const xmlChar * URI ATTRIBUTE_UNUSED)
|
| 2421 |
+
{
|
| 2422 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 2423 |
+
|
| 2424 |
+
if (ctx == NULL) return;
|
| 2425 |
+
ctxt->nodemem = -1;
|
| 2426 |
+
|
| 2427 |
+
#ifdef LIBXML_VALID_ENABLED
|
| 2428 |
+
if (ctxt->validate && ctxt->wellFormed &&
|
| 2429 |
+
ctxt->myDoc && ctxt->myDoc->intSubset)
|
| 2430 |
+
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
|
| 2431 |
+
ctxt->node);
|
| 2432 |
+
#endif /* LIBXML_VALID_ENABLED */
|
| 2433 |
+
|
| 2434 |
+
/*
|
| 2435 |
+
* end of parsing of this node.
|
| 2436 |
+
*/
|
| 2437 |
+
nodePop(ctxt);
|
| 2438 |
+
}
|
| 2439 |
+
|
| 2440 |
+
/**
|
| 2441 |
+
* called when an entity #xmlSAX2Reference is detected.
|
| 2442 |
+
*
|
| 2443 |
+
* @param ctx the user data (XML parser context)
|
| 2444 |
+
* @param name The entity name
|
| 2445 |
+
*/
|
| 2446 |
+
void
|
| 2447 |
+
xmlSAX2Reference(void *ctx, const xmlChar *name)
|
| 2448 |
+
{
|
| 2449 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 2450 |
+
xmlNodePtr ret;
|
| 2451 |
+
|
| 2452 |
+
if (ctx == NULL) return;
|
| 2453 |
+
ret = xmlNewReference(ctxt->myDoc, name);
|
| 2454 |
+
if (ret == NULL) {
|
| 2455 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2456 |
+
return;
|
| 2457 |
+
}
|
| 2458 |
+
|
| 2459 |
+
xmlSAX2AppendChild(ctxt, ret);
|
| 2460 |
+
}
|
| 2461 |
+
|
| 2462 |
+
/**
|
| 2463 |
+
* Append characters.
|
| 2464 |
+
*
|
| 2465 |
+
* @param ctxt the parser context
|
| 2466 |
+
* @param ch a xmlChar string
|
| 2467 |
+
* @param len the number of xmlChar
|
| 2468 |
+
* @param type text or cdata
|
| 2469 |
+
*/
|
| 2470 |
+
static void
|
| 2471 |
+
xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len,
|
| 2472 |
+
xmlElementType type)
|
| 2473 |
+
{
|
| 2474 |
+
xmlNodePtr lastChild;
|
| 2475 |
+
xmlNodePtr parent;
|
| 2476 |
+
|
| 2477 |
+
if (ctxt == NULL)
|
| 2478 |
+
return;
|
| 2479 |
+
|
| 2480 |
+
parent = ctxt->node;
|
| 2481 |
+
if (parent == NULL)
|
| 2482 |
+
return;
|
| 2483 |
+
lastChild = parent->last;
|
| 2484 |
+
|
| 2485 |
+
/*
|
| 2486 |
+
* Try to merge with previous text node using size and capacity
|
| 2487 |
+
* stored in the parser context to avoid naive concatenation.
|
| 2488 |
+
*
|
| 2489 |
+
* Don't merge CDATA sections. In HTML mode, CDATA is used for
|
| 2490 |
+
* raw text which should be merged.
|
| 2491 |
+
*/
|
| 2492 |
+
if ((lastChild == NULL) ||
|
| 2493 |
+
(lastChild->type != type) ||
|
| 2494 |
+
((!ctxt->html) && (type != XML_TEXT_NODE))) {
|
| 2495 |
+
xmlNode *node;
|
| 2496 |
+
|
| 2497 |
+
if (type == XML_TEXT_NODE)
|
| 2498 |
+
node = xmlSAX2TextNode(ctxt, parent->doc, ch, len);
|
| 2499 |
+
else
|
| 2500 |
+
node = xmlNewCDataBlock(parent->doc, ch, len);
|
| 2501 |
+
if (node == NULL) {
|
| 2502 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2503 |
+
return;
|
| 2504 |
+
}
|
| 2505 |
+
|
| 2506 |
+
if (lastChild == NULL) {
|
| 2507 |
+
parent->children = node;
|
| 2508 |
+
parent->last = node;
|
| 2509 |
+
node->parent = parent;
|
| 2510 |
+
} else {
|
| 2511 |
+
xmlSAX2AppendChild(ctxt, node);
|
| 2512 |
+
}
|
| 2513 |
+
|
| 2514 |
+
ctxt->nodelen = len;
|
| 2515 |
+
ctxt->nodemem = len + 1;
|
| 2516 |
+
lastChild = node;
|
| 2517 |
+
} else {
|
| 2518 |
+
xmlChar *content;
|
| 2519 |
+
int oldSize, newSize, capacity;
|
| 2520 |
+
int maxSize = (ctxt->options & XML_PARSE_HUGE) ?
|
| 2521 |
+
XML_MAX_HUGE_LENGTH :
|
| 2522 |
+
XML_MAX_TEXT_LENGTH;
|
| 2523 |
+
|
| 2524 |
+
content = lastChild->content;
|
| 2525 |
+
oldSize = ctxt->nodelen;
|
| 2526 |
+
capacity = ctxt->nodemem;
|
| 2527 |
+
|
| 2528 |
+
/* Shouldn't happen */
|
| 2529 |
+
if ((content == NULL) || (capacity <= 0)) {
|
| 2530 |
+
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
|
| 2531 |
+
"xmlSAX2Text: no content");
|
| 2532 |
+
return;
|
| 2533 |
+
}
|
| 2534 |
+
|
| 2535 |
+
if ((len > maxSize) || (oldSize > maxSize - len)) {
|
| 2536 |
+
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT,
|
| 2537 |
+
"Text node too long, try XML_PARSE_HUGE");
|
| 2538 |
+
return;
|
| 2539 |
+
}
|
| 2540 |
+
|
| 2541 |
+
newSize = oldSize + len;
|
| 2542 |
+
|
| 2543 |
+
if (newSize >= capacity) {
|
| 2544 |
+
if (newSize <= 20)
|
| 2545 |
+
capacity = 40;
|
| 2546 |
+
else
|
| 2547 |
+
capacity = newSize > INT_MAX / 2 ? INT_MAX : newSize * 2;
|
| 2548 |
+
|
| 2549 |
+
/*
|
| 2550 |
+
* If the content was stored in properties or in
|
| 2551 |
+
* the dictionary, don't realloc.
|
| 2552 |
+
*/
|
| 2553 |
+
if ((content == (xmlChar *) &lastChild->properties) ||
|
| 2554 |
+
((ctxt->nodemem == oldSize + 1) &&
|
| 2555 |
+
(xmlDictOwns(ctxt->dict, content)))) {
|
| 2556 |
+
xmlChar *newContent;
|
| 2557 |
+
|
| 2558 |
+
newContent = xmlMalloc(capacity);
|
| 2559 |
+
if (newContent == NULL) {
|
| 2560 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2561 |
+
return;
|
| 2562 |
+
}
|
| 2563 |
+
|
| 2564 |
+
memcpy(newContent, content, oldSize);
|
| 2565 |
+
lastChild->properties = NULL;
|
| 2566 |
+
content = newContent;
|
| 2567 |
+
} else {
|
| 2568 |
+
content = xmlRealloc(content, capacity);
|
| 2569 |
+
if (content == NULL) {
|
| 2570 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2571 |
+
return;
|
| 2572 |
+
}
|
| 2573 |
+
}
|
| 2574 |
+
|
| 2575 |
+
ctxt->nodemem = capacity;
|
| 2576 |
+
lastChild->content = content;
|
| 2577 |
+
}
|
| 2578 |
+
|
| 2579 |
+
memcpy(&content[oldSize], ch, len);
|
| 2580 |
+
content[newSize] = 0;
|
| 2581 |
+
ctxt->nodelen = newSize;
|
| 2582 |
+
}
|
| 2583 |
+
|
| 2584 |
+
if ((lastChild != NULL) &&
|
| 2585 |
+
(type == XML_TEXT_NODE) &&
|
| 2586 |
+
(ctxt->input != NULL)) {
|
| 2587 |
+
if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
|
| 2588 |
+
lastChild->line = ctxt->input->line;
|
| 2589 |
+
else {
|
| 2590 |
+
lastChild->line = USHRT_MAX;
|
| 2591 |
+
if (ctxt->options & XML_PARSE_BIG_LINES)
|
| 2592 |
+
lastChild->psvi = XML_INT_TO_PTR(ctxt->input->line);
|
| 2593 |
+
}
|
| 2594 |
+
}
|
| 2595 |
+
}
|
| 2596 |
+
|
| 2597 |
+
/**
|
| 2598 |
+
* receiving some chars from the parser.
|
| 2599 |
+
*
|
| 2600 |
+
* @param ctx the user data (XML parser context)
|
| 2601 |
+
* @param ch a xmlChar string
|
| 2602 |
+
* @param len the number of xmlChar
|
| 2603 |
+
*/
|
| 2604 |
+
void
|
| 2605 |
+
xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
|
| 2606 |
+
{
|
| 2607 |
+
xmlSAX2Text((xmlParserCtxtPtr) ctx, ch, len, XML_TEXT_NODE);
|
| 2608 |
+
}
|
| 2609 |
+
|
| 2610 |
+
/**
|
| 2611 |
+
* receiving some ignorable whitespaces from the parser.
|
| 2612 |
+
* UNUSED: by default the DOM building will use #xmlSAX2Characters
|
| 2613 |
+
*
|
| 2614 |
+
* @param ctx the user data (XML parser context)
|
| 2615 |
+
* @param ch a xmlChar string
|
| 2616 |
+
* @param len the number of xmlChar
|
| 2617 |
+
*/
|
| 2618 |
+
void
|
| 2619 |
+
xmlSAX2IgnorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
|
| 2620 |
+
{
|
| 2621 |
+
}
|
| 2622 |
+
|
| 2623 |
+
/**
|
| 2624 |
+
* A processing instruction has been parsed.
|
| 2625 |
+
*
|
| 2626 |
+
* @param ctx the user data (XML parser context)
|
| 2627 |
+
* @param target the target name
|
| 2628 |
+
* @param data the PI data's
|
| 2629 |
+
*/
|
| 2630 |
+
void
|
| 2631 |
+
xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
|
| 2632 |
+
const xmlChar *data)
|
| 2633 |
+
{
|
| 2634 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 2635 |
+
xmlNodePtr ret;
|
| 2636 |
+
|
| 2637 |
+
if (ctx == NULL) return;
|
| 2638 |
+
|
| 2639 |
+
ret = xmlNewDocPI(ctxt->myDoc, target, data);
|
| 2640 |
+
if (ret == NULL) {
|
| 2641 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2642 |
+
return;
|
| 2643 |
+
}
|
| 2644 |
+
|
| 2645 |
+
xmlSAX2AppendChild(ctxt, ret);
|
| 2646 |
+
}
|
| 2647 |
+
|
| 2648 |
+
/**
|
| 2649 |
+
* A #xmlSAX2Comment has been parsed.
|
| 2650 |
+
*
|
| 2651 |
+
* @param ctx the user data (XML parser context)
|
| 2652 |
+
* @param value the #xmlSAX2Comment content
|
| 2653 |
+
*/
|
| 2654 |
+
void
|
| 2655 |
+
xmlSAX2Comment(void *ctx, const xmlChar *value)
|
| 2656 |
+
{
|
| 2657 |
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
| 2658 |
+
xmlNodePtr ret;
|
| 2659 |
+
|
| 2660 |
+
if (ctx == NULL) return;
|
| 2661 |
+
|
| 2662 |
+
ret = xmlNewDocComment(ctxt->myDoc, value);
|
| 2663 |
+
if (ret == NULL) {
|
| 2664 |
+
xmlSAX2ErrMemory(ctxt);
|
| 2665 |
+
return;
|
| 2666 |
+
}
|
| 2667 |
+
|
| 2668 |
+
xmlSAX2AppendChild(ctxt, ret);
|
| 2669 |
+
}
|
| 2670 |
+
|
| 2671 |
+
/**
|
| 2672 |
+
* called when a pcdata block has been parsed
|
| 2673 |
+
*
|
| 2674 |
+
* @param ctx the user data (XML parser context)
|
| 2675 |
+
* @param value The pcdata content
|
| 2676 |
+
* @param len the block length
|
| 2677 |
+
*/
|
| 2678 |
+
void
|
| 2679 |
+
xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
|
| 2680 |
+
{
|
| 2681 |
+
xmlSAX2Text((xmlParserCtxtPtr) ctx, value, len, XML_CDATA_SECTION_NODE);
|
| 2682 |
+
}
|
| 2683 |
+
|
| 2684 |
+
#ifdef LIBXML_SAX1_ENABLED
|
| 2685 |
+
/**
|
| 2686 |
+
* Has no effect.
|
| 2687 |
+
*
|
| 2688 |
+
* @deprecated Use parser option XML_PARSE_SAX1.
|
| 2689 |
+
*
|
| 2690 |
+
* @param version the version, must be 2
|
| 2691 |
+
* @returns 2 in case of success and -1 in case of error.
|
| 2692 |
+
*/
|
| 2693 |
+
int
|
| 2694 |
+
xmlSAXDefaultVersion(int version)
|
| 2695 |
+
{
|
| 2696 |
+
if (version != 2)
|
| 2697 |
+
return(-1);
|
| 2698 |
+
return(2);
|
| 2699 |
+
}
|
| 2700 |
+
#endif /* LIBXML_SAX1_ENABLED */
|
| 2701 |
+
|
| 2702 |
+
/**
|
| 2703 |
+
* Initialize the default XML SAX handler according to the version
|
| 2704 |
+
*
|
| 2705 |
+
* @param hdlr the SAX handler
|
| 2706 |
+
* @param version the version, 1 or 2
|
| 2707 |
+
* @returns 0 in case of success and -1 in case of error.
|
| 2708 |
+
*/
|
| 2709 |
+
int
|
| 2710 |
+
xmlSAXVersion(xmlSAXHandler *hdlr, int version)
|
| 2711 |
+
{
|
| 2712 |
+
if (hdlr == NULL) return(-1);
|
| 2713 |
+
if (version == 2) {
|
| 2714 |
+
hdlr->startElementNs = xmlSAX2StartElementNs;
|
| 2715 |
+
hdlr->endElementNs = xmlSAX2EndElementNs;
|
| 2716 |
+
hdlr->serror = NULL;
|
| 2717 |
+
hdlr->initialized = XML_SAX2_MAGIC;
|
| 2718 |
+
#ifdef LIBXML_SAX1_ENABLED
|
| 2719 |
+
} else if (version == 1) {
|
| 2720 |
+
hdlr->initialized = 1;
|
| 2721 |
+
#endif /* LIBXML_SAX1_ENABLED */
|
| 2722 |
+
} else
|
| 2723 |
+
return(-1);
|
| 2724 |
+
#ifdef LIBXML_SAX1_ENABLED
|
| 2725 |
+
hdlr->startElement = xmlSAX2StartElement;
|
| 2726 |
+
hdlr->endElement = xmlSAX2EndElement;
|
| 2727 |
+
#else
|
| 2728 |
+
hdlr->startElement = NULL;
|
| 2729 |
+
hdlr->endElement = NULL;
|
| 2730 |
+
#endif /* LIBXML_SAX1_ENABLED */
|
| 2731 |
+
hdlr->internalSubset = xmlSAX2InternalSubset;
|
| 2732 |
+
hdlr->externalSubset = xmlSAX2ExternalSubset;
|
| 2733 |
+
hdlr->isStandalone = xmlSAX2IsStandalone;
|
| 2734 |
+
hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
|
| 2735 |
+
hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
|
| 2736 |
+
hdlr->resolveEntity = xmlSAX2ResolveEntity;
|
| 2737 |
+
hdlr->getEntity = xmlSAX2GetEntity;
|
| 2738 |
+
hdlr->getParameterEntity = xmlSAX2GetParameterEntity;
|
| 2739 |
+
hdlr->entityDecl = xmlSAX2EntityDecl;
|
| 2740 |
+
hdlr->attributeDecl = xmlSAX2AttributeDecl;
|
| 2741 |
+
hdlr->elementDecl = xmlSAX2ElementDecl;
|
| 2742 |
+
hdlr->notationDecl = xmlSAX2NotationDecl;
|
| 2743 |
+
hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
|
| 2744 |
+
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
| 2745 |
+
hdlr->startDocument = xmlSAX2StartDocument;
|
| 2746 |
+
hdlr->endDocument = xmlSAX2EndDocument;
|
| 2747 |
+
hdlr->reference = xmlSAX2Reference;
|
| 2748 |
+
hdlr->characters = xmlSAX2Characters;
|
| 2749 |
+
hdlr->cdataBlock = xmlSAX2CDataBlock;
|
| 2750 |
+
hdlr->ignorableWhitespace = xmlSAX2Characters;
|
| 2751 |
+
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
|
| 2752 |
+
hdlr->comment = xmlSAX2Comment;
|
| 2753 |
+
hdlr->warning = xmlParserWarning;
|
| 2754 |
+
hdlr->error = xmlParserError;
|
| 2755 |
+
hdlr->fatalError = xmlParserError;
|
| 2756 |
+
|
| 2757 |
+
return(0);
|
| 2758 |
+
}
|
| 2759 |
+
|
| 2760 |
+
/**
|
| 2761 |
+
* Initialize the default XML SAX2 handler
|
| 2762 |
+
*
|
| 2763 |
+
* @param hdlr the SAX handler
|
| 2764 |
+
* @param warning flag if non-zero sets the handler warning procedure
|
| 2765 |
+
*/
|
| 2766 |
+
void
|
| 2767 |
+
xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
|
| 2768 |
+
{
|
| 2769 |
+
if ((hdlr == NULL) || (hdlr->initialized != 0))
|
| 2770 |
+
return;
|
| 2771 |
+
|
| 2772 |
+
xmlSAXVersion(hdlr, 2);
|
| 2773 |
+
if (warning == 0)
|
| 2774 |
+
hdlr->warning = NULL;
|
| 2775 |
+
}
|
| 2776 |
+
|
| 2777 |
+
/**
|
| 2778 |
+
* Initialize the default SAX2 handler
|
| 2779 |
+
*
|
| 2780 |
+
* @deprecated This function is a no-op. Call #xmlInitParser to
|
| 2781 |
+
* initialize the library.
|
| 2782 |
+
*
|
| 2783 |
+
*/
|
| 2784 |
+
void
|
| 2785 |
+
xmlDefaultSAXHandlerInit(void)
|
| 2786 |
+
{
|
| 2787 |
+
}
|
| 2788 |
+
|
| 2789 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 2790 |
+
|
| 2791 |
+
/**
|
| 2792 |
+
* Initialize the default HTML SAX2 handler
|
| 2793 |
+
*
|
| 2794 |
+
* @param hdlr the SAX handler
|
| 2795 |
+
*/
|
| 2796 |
+
void
|
| 2797 |
+
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
|
| 2798 |
+
{
|
| 2799 |
+
if ((hdlr == NULL) || (hdlr->initialized != 0))
|
| 2800 |
+
return;
|
| 2801 |
+
|
| 2802 |
+
hdlr->internalSubset = xmlSAX2InternalSubset;
|
| 2803 |
+
hdlr->externalSubset = NULL;
|
| 2804 |
+
hdlr->isStandalone = NULL;
|
| 2805 |
+
hdlr->hasInternalSubset = NULL;
|
| 2806 |
+
hdlr->hasExternalSubset = NULL;
|
| 2807 |
+
hdlr->resolveEntity = NULL;
|
| 2808 |
+
hdlr->getEntity = xmlSAX2GetEntity;
|
| 2809 |
+
hdlr->getParameterEntity = NULL;
|
| 2810 |
+
hdlr->entityDecl = NULL;
|
| 2811 |
+
hdlr->attributeDecl = NULL;
|
| 2812 |
+
hdlr->elementDecl = NULL;
|
| 2813 |
+
hdlr->notationDecl = NULL;
|
| 2814 |
+
hdlr->unparsedEntityDecl = NULL;
|
| 2815 |
+
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
| 2816 |
+
hdlr->startDocument = xmlSAX2StartDocument;
|
| 2817 |
+
hdlr->endDocument = xmlSAX2EndDocument;
|
| 2818 |
+
hdlr->startElement = xmlSAX2StartElement;
|
| 2819 |
+
hdlr->endElement = xmlSAX2EndElement;
|
| 2820 |
+
hdlr->reference = NULL;
|
| 2821 |
+
hdlr->characters = xmlSAX2Characters;
|
| 2822 |
+
hdlr->cdataBlock = xmlSAX2CDataBlock;
|
| 2823 |
+
hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
| 2824 |
+
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
|
| 2825 |
+
hdlr->comment = xmlSAX2Comment;
|
| 2826 |
+
hdlr->warning = xmlParserWarning;
|
| 2827 |
+
hdlr->error = xmlParserError;
|
| 2828 |
+
hdlr->fatalError = xmlParserError;
|
| 2829 |
+
|
| 2830 |
+
hdlr->initialized = 1;
|
| 2831 |
+
}
|
| 2832 |
+
|
| 2833 |
+
/**
|
| 2834 |
+
* @deprecated This function is a no-op. Call #xmlInitParser to
|
| 2835 |
+
* initialize the library.
|
| 2836 |
+
*/
|
| 2837 |
+
void
|
| 2838 |
+
htmlDefaultSAXHandlerInit(void)
|
| 2839 |
+
{
|
| 2840 |
+
}
|
| 2841 |
+
|
| 2842 |
+
#endif /* LIBXML_HTML_ENABLED */
|
VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
2.16.0
|
autogen.sh
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# Run this to generate all the initial makefiles, etc.
|
| 3 |
+
|
| 4 |
+
THEDIR=`pwd`
|
| 5 |
+
cd `dirname $0`
|
| 6 |
+
srcdir=`pwd`
|
| 7 |
+
|
| 8 |
+
DIE=0
|
| 9 |
+
|
| 10 |
+
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
| 11 |
+
echo
|
| 12 |
+
echo "You must have autoconf installed to compile libxml."
|
| 13 |
+
echo "Download the appropriate package for your distribution,"
|
| 14 |
+
echo "or see http://www.gnu.org/software/autoconf"
|
| 15 |
+
DIE=1
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
(libtoolize --version) < /dev/null > /dev/null 2>&1 ||
|
| 19 |
+
(glibtoolize --version) < /dev/null > /dev/null 2>&1 || {
|
| 20 |
+
echo
|
| 21 |
+
echo "You must have libtool installed to compile libxml."
|
| 22 |
+
echo "Download the appropriate package for your distribution,"
|
| 23 |
+
echo "or see http://www.gnu.org/software/libtool"
|
| 24 |
+
DIE=1
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
| 28 |
+
echo
|
| 29 |
+
DIE=1
|
| 30 |
+
echo "You must have automake installed to compile libxml."
|
| 31 |
+
echo "Download the appropriate package for your distribution,"
|
| 32 |
+
echo "or see http://www.gnu.org/software/automake"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
if test "$DIE" -eq 1; then
|
| 36 |
+
exit 1
|
| 37 |
+
fi
|
| 38 |
+
|
| 39 |
+
test -f entities.c || {
|
| 40 |
+
echo "You must run this script in the top-level libxml directory"
|
| 41 |
+
exit 1
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
EXTRA_ARGS=
|
| 45 |
+
if test "x$1" = "x--system"; then
|
| 46 |
+
shift
|
| 47 |
+
prefix=/usr
|
| 48 |
+
libdir=$prefix/lib
|
| 49 |
+
sysconfdir=/etc
|
| 50 |
+
localstatedir=/var
|
| 51 |
+
if [ -d /usr/lib64 ]; then
|
| 52 |
+
libdir=$prefix/lib64
|
| 53 |
+
fi
|
| 54 |
+
EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
|
| 55 |
+
echo "Running ./configure with $EXTRA_ARGS $@"
|
| 56 |
+
else
|
| 57 |
+
if test -z "$NOCONFIGURE" && test -z "$*"; then
|
| 58 |
+
echo "I am going to run ./configure with no arguments - if you wish "
|
| 59 |
+
echo "to pass any to it, please specify them on the $0 command line."
|
| 60 |
+
fi
|
| 61 |
+
fi
|
| 62 |
+
|
| 63 |
+
if [ ! -d $srcdir/m4 ]; then
|
| 64 |
+
mkdir $srcdir/m4
|
| 65 |
+
fi
|
| 66 |
+
|
| 67 |
+
aclocal
|
| 68 |
+
|
| 69 |
+
if ! grep -q pkg.m4 aclocal.m4; then
|
| 70 |
+
cat <<EOF
|
| 71 |
+
|
| 72 |
+
Couldn't find pkg.m4 from pkg-config. Install the appropriate package for
|
| 73 |
+
your distribution or set ACLOCAL_PATH to the directory containing pkg.m4.
|
| 74 |
+
EOF
|
| 75 |
+
exit 1
|
| 76 |
+
fi
|
| 77 |
+
|
| 78 |
+
autoreconf -if -Wall || exit 1
|
| 79 |
+
|
| 80 |
+
cd $THEDIR
|
| 81 |
+
|
| 82 |
+
if test x$OBJ_DIR != x; then
|
| 83 |
+
mkdir -p "$OBJ_DIR"
|
| 84 |
+
cd "$OBJ_DIR"
|
| 85 |
+
fi
|
| 86 |
+
|
| 87 |
+
if test -z "$NOCONFIGURE"; then
|
| 88 |
+
$srcdir/configure $EXTRA_ARGS "$@"
|
| 89 |
+
if test "$?" -ne 0; then
|
| 90 |
+
echo
|
| 91 |
+
echo "Configure script failed, check config.log for more info."
|
| 92 |
+
exit 1
|
| 93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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* buf.c: memory buffers for libxml2
|
| 3 |
+
*
|
| 4 |
+
* new buffer structures and entry points to simplify the maintenance
|
| 5 |
+
* of libxml2 and ensure we keep good control over memory allocations
|
| 6 |
+
* and stay 64 bits clean.
|
| 7 |
+
* The new entry point use the xmlBuf opaque structure and
|
| 8 |
+
* xmlBuf...() counterparts to the old xmlBuf...() functions
|
| 9 |
+
*
|
| 10 |
+
* See Copyright for the status of this software.
|
| 11 |
+
*
|
| 12 |
+
* Author: Daniel Veillard
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#define IN_LIBXML
|
| 16 |
+
#include "libxml.h"
|
| 17 |
+
|
| 18 |
+
#include <string.h>
|
| 19 |
+
#include <limits.h>
|
| 20 |
+
|
| 21 |
+
#include <libxml/parser.h>
|
| 22 |
+
#include <libxml/tree.h>
|
| 23 |
+
|
| 24 |
+
#include "private/buf.h"
|
| 25 |
+
|
| 26 |
+
#ifndef SIZE_MAX
|
| 27 |
+
#define SIZE_MAX ((size_t) -1)
|
| 28 |
+
#endif
|
| 29 |
+
|
| 30 |
+
#define BUF_FLAG_OOM (1u << 0)
|
| 31 |
+
#define BUF_FLAG_OVERFLOW (1u << 1)
|
| 32 |
+
#define BUF_FLAG_STATIC (1u << 2)
|
| 33 |
+
|
| 34 |
+
#define BUF_ERROR(buf) ((buf)->flags & (BUF_FLAG_OOM | BUF_FLAG_OVERFLOW))
|
| 35 |
+
#define BUF_STATIC(buf) ((buf)->flags & BUF_FLAG_STATIC)
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* A buffer structure. The base of the structure is somehow compatible
|
| 39 |
+
* with struct _xmlBuffer to limit risks on application which accessed
|
| 40 |
+
* directly the input->buf->buffer structures.
|
| 41 |
+
*/
|
| 42 |
+
|
| 43 |
+
struct _xmlBuf {
|
| 44 |
+
xmlChar *content; /* The buffer content UTF8 */
|
| 45 |
+
xmlChar *mem; /* Start of the allocation */
|
| 46 |
+
size_t use; /* The buffer size used */
|
| 47 |
+
size_t size; /* The buffer size, excluding terminating 0 */
|
| 48 |
+
size_t maxSize; /* The maximum buffer size */
|
| 49 |
+
unsigned flags; /* flags */
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Handle an out of memory condition
|
| 54 |
+
* To be improved...
|
| 55 |
+
*
|
| 56 |
+
* @param buf the buffer
|
| 57 |
+
*/
|
| 58 |
+
static void
|
| 59 |
+
xmlBufMemoryError(xmlBufPtr buf)
|
| 60 |
+
{
|
| 61 |
+
if (!BUF_ERROR(buf))
|
| 62 |
+
buf->flags |= BUF_FLAG_OOM;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Handle a buffer overflow error
|
| 67 |
+
* To be improved...
|
| 68 |
+
*
|
| 69 |
+
* @param buf the buffer
|
| 70 |
+
*/
|
| 71 |
+
static void
|
| 72 |
+
xmlBufOverflowError(xmlBufPtr buf)
|
| 73 |
+
{
|
| 74 |
+
if (!BUF_ERROR(buf))
|
| 75 |
+
buf->flags |= BUF_FLAG_OVERFLOW;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Create a buffer.
|
| 80 |
+
*
|
| 81 |
+
* @param size initial buffer size
|
| 82 |
+
* @returns the new structure
|
| 83 |
+
*/
|
| 84 |
+
xmlBuf *
|
| 85 |
+
xmlBufCreate(size_t size) {
|
| 86 |
+
xmlBufPtr ret;
|
| 87 |
+
|
| 88 |
+
if (size == SIZE_MAX)
|
| 89 |
+
return(NULL);
|
| 90 |
+
|
| 91 |
+
ret = xmlMalloc(sizeof(*ret));
|
| 92 |
+
if (ret == NULL)
|
| 93 |
+
return(NULL);
|
| 94 |
+
|
| 95 |
+
ret->use = 0;
|
| 96 |
+
ret->flags = 0;
|
| 97 |
+
ret->size = size;
|
| 98 |
+
ret->maxSize = SIZE_MAX - 1;
|
| 99 |
+
|
| 100 |
+
ret->mem = xmlMalloc(ret->size + 1);
|
| 101 |
+
if (ret->mem == NULL) {
|
| 102 |
+
xmlFree(ret);
|
| 103 |
+
return(NULL);
|
| 104 |
+
}
|
| 105 |
+
ret->content = ret->mem;
|
| 106 |
+
ret->content[0] = 0;
|
| 107 |
+
|
| 108 |
+
return(ret);
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* Create a buffer initialized with memory.
|
| 113 |
+
*
|
| 114 |
+
* If `isStatic` is set, uses the memory area directly as backing store.
|
| 115 |
+
* The memory must be zero-terminated and not be modified for the
|
| 116 |
+
* lifetime of the buffer. A static buffer can't be grown, modified or
|
| 117 |
+
* detached, but it can be shrunk.
|
| 118 |
+
*
|
| 119 |
+
* @param mem a memory area
|
| 120 |
+
* @param size size of the buffer excluding terminator
|
| 121 |
+
* @param isStatic whether the memory area is static
|
| 122 |
+
* @returns a new buffer.
|
| 123 |
+
*/
|
| 124 |
+
xmlBuf *
|
| 125 |
+
xmlBufCreateMem(const xmlChar *mem, size_t size, int isStatic) {
|
| 126 |
+
xmlBufPtr ret;
|
| 127 |
+
|
| 128 |
+
if (mem == NULL)
|
| 129 |
+
return(NULL);
|
| 130 |
+
|
| 131 |
+
ret = xmlMalloc(sizeof(*ret));
|
| 132 |
+
if (ret == NULL)
|
| 133 |
+
return(NULL);
|
| 134 |
+
|
| 135 |
+
if (isStatic) {
|
| 136 |
+
/* Check that memory is zero-terminated */
|
| 137 |
+
if (mem[size] != 0) {
|
| 138 |
+
xmlFree(ret);
|
| 139 |
+
return(NULL);
|
| 140 |
+
}
|
| 141 |
+
ret->flags = BUF_FLAG_STATIC;
|
| 142 |
+
ret->mem = (xmlChar *) mem;
|
| 143 |
+
} else {
|
| 144 |
+
ret->flags = 0;
|
| 145 |
+
ret->mem = xmlMalloc(size + 1);
|
| 146 |
+
if (ret->mem == NULL) {
|
| 147 |
+
xmlFree(ret);
|
| 148 |
+
return(NULL);
|
| 149 |
+
}
|
| 150 |
+
memcpy(ret->mem, mem, size);
|
| 151 |
+
ret->mem[size] = 0;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
ret->use = size;
|
| 155 |
+
ret->size = size;
|
| 156 |
+
ret->maxSize = SIZE_MAX - 1;
|
| 157 |
+
ret->content = ret->mem;
|
| 158 |
+
|
| 159 |
+
return(ret);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/**
|
| 163 |
+
* Extract buffer content.
|
| 164 |
+
*
|
| 165 |
+
* Return the content of the buffer as an `xmlChar` string,
|
| 166 |
+
* clearing the buffer.
|
| 167 |
+
*
|
| 168 |
+
* This doesn't work with static buffers as they can't be reset.
|
| 169 |
+
*
|
| 170 |
+
* @param buf the buffer
|
| 171 |
+
* @returns the buffer content
|
| 172 |
+
*/
|
| 173 |
+
xmlChar *
|
| 174 |
+
xmlBufDetach(xmlBuf *buf) {
|
| 175 |
+
xmlChar *ret;
|
| 176 |
+
|
| 177 |
+
if ((buf == NULL) || (BUF_ERROR(buf)) || (BUF_STATIC(buf)))
|
| 178 |
+
return(NULL);
|
| 179 |
+
|
| 180 |
+
if (buf->content != buf->mem) {
|
| 181 |
+
ret = xmlStrndup(buf->content, buf->use);
|
| 182 |
+
xmlFree(buf->mem);
|
| 183 |
+
} else {
|
| 184 |
+
ret = buf->mem;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
buf->content = NULL;
|
| 188 |
+
buf->mem = NULL;
|
| 189 |
+
buf->size = 0;
|
| 190 |
+
buf->use = 0;
|
| 191 |
+
|
| 192 |
+
return ret;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
/**
|
| 196 |
+
* Free a buffer.
|
| 197 |
+
*
|
| 198 |
+
* @param buf the buffer to free
|
| 199 |
+
*/
|
| 200 |
+
void
|
| 201 |
+
xmlBufFree(xmlBuf *buf) {
|
| 202 |
+
if (buf == NULL)
|
| 203 |
+
return;
|
| 204 |
+
|
| 205 |
+
if (!BUF_STATIC(buf))
|
| 206 |
+
xmlFree(buf->mem);
|
| 207 |
+
xmlFree(buf);
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
/**
|
| 211 |
+
* Empty a buffer.
|
| 212 |
+
*
|
| 213 |
+
* @param buf the buffer
|
| 214 |
+
*/
|
| 215 |
+
void
|
| 216 |
+
xmlBufEmpty(xmlBuf *buf) {
|
| 217 |
+
if ((buf == NULL) || (BUF_ERROR(buf)) || (BUF_STATIC(buf)))
|
| 218 |
+
return;
|
| 219 |
+
if (buf->mem == NULL)
|
| 220 |
+
return;
|
| 221 |
+
|
| 222 |
+
buf->use = 0;
|
| 223 |
+
buf->size += buf->content - buf->mem;
|
| 224 |
+
buf->content = buf->mem;
|
| 225 |
+
buf->content[0] = 0;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
/**
|
| 229 |
+
* Discard bytes at the start of a buffer.
|
| 230 |
+
*
|
| 231 |
+
* NOTE that the return value differs from #xmlBufferShrink
|
| 232 |
+
* as it will return 0 on error instead of -1 due to size_t being
|
| 233 |
+
* used as the return type.
|
| 234 |
+
*
|
| 235 |
+
* @deprecated Internal function, don't use.
|
| 236 |
+
*
|
| 237 |
+
* @param buf the buffer
|
| 238 |
+
* @param len the number of bytes to remove
|
| 239 |
+
* @returns the number of bytes removed or 0 in case of failure
|
| 240 |
+
*/
|
| 241 |
+
size_t
|
| 242 |
+
xmlBufShrink(xmlBuf *buf, size_t len) {
|
| 243 |
+
if ((buf == NULL) || (BUF_ERROR(buf)))
|
| 244 |
+
return(0);
|
| 245 |
+
if (len == 0)
|
| 246 |
+
return(0);
|
| 247 |
+
|
| 248 |
+
if (len > buf->use)
|
| 249 |
+
return(0);
|
| 250 |
+
|
| 251 |
+
buf->use -= len;
|
| 252 |
+
buf->content += len;
|
| 253 |
+
buf->size -= len;
|
| 254 |
+
|
| 255 |
+
return(len);
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
/**
|
| 259 |
+
* Grow a buffer.
|
| 260 |
+
*
|
| 261 |
+
* Increase the capacity of a buffer. `len` is the amount of
|
| 262 |
+
* free space required after the current end of the buffer.
|
| 263 |
+
*
|
| 264 |
+
* Assumes `len > buf->size - buf->use`.
|
| 265 |
+
*
|
| 266 |
+
* @param buf the buffer
|
| 267 |
+
* @param len number of extra bytes to allocate
|
| 268 |
+
* @returns 0 on success, -1 in case of error
|
| 269 |
+
*/
|
| 270 |
+
static int
|
| 271 |
+
xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
|
| 272 |
+
size_t size;
|
| 273 |
+
size_t start;
|
| 274 |
+
xmlChar *newbuf;
|
| 275 |
+
|
| 276 |
+
/*
|
| 277 |
+
* If there's enough space at the start of the buffer,
|
| 278 |
+
* move the contents.
|
| 279 |
+
*/
|
| 280 |
+
start = buf->content - buf->mem;
|
| 281 |
+
if (len <= start + buf->size - buf->use) {
|
| 282 |
+
memmove(buf->mem, buf->content, buf->use + 1);
|
| 283 |
+
buf->size += start;
|
| 284 |
+
buf->content = buf->mem;
|
| 285 |
+
return(0);
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
if (len > buf->maxSize - buf->use) {
|
| 289 |
+
xmlBufOverflowError(buf);
|
| 290 |
+
return(-1);
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
if (buf->size > (size_t) len) {
|
| 294 |
+
if (buf->size <= buf->maxSize / 2)
|
| 295 |
+
size = buf->size * 2;
|
| 296 |
+
else
|
| 297 |
+
size = buf->maxSize;
|
| 298 |
+
} else {
|
| 299 |
+
size = buf->use + len;
|
| 300 |
+
if (size <= buf->maxSize - 100)
|
| 301 |
+
size += 100;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
if (buf->content == buf->mem) {
|
| 305 |
+
newbuf = xmlRealloc(buf->mem, size + 1);
|
| 306 |
+
if (newbuf == NULL) {
|
| 307 |
+
xmlBufMemoryError(buf);
|
| 308 |
+
return(-1);
|
| 309 |
+
}
|
| 310 |
+
} else {
|
| 311 |
+
newbuf = xmlMalloc(size + 1);
|
| 312 |
+
if (newbuf == NULL) {
|
| 313 |
+
xmlBufMemoryError(buf);
|
| 314 |
+
return(-1);
|
| 315 |
+
}
|
| 316 |
+
if (buf->content != NULL)
|
| 317 |
+
memcpy(newbuf, buf->content, buf->use + 1);
|
| 318 |
+
xmlFree(buf->mem);
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
buf->mem = newbuf;
|
| 322 |
+
buf->content = newbuf;
|
| 323 |
+
buf->size = size;
|
| 324 |
+
|
| 325 |
+
return(0);
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
/**
|
| 329 |
+
* Grow a buffer.
|
| 330 |
+
*
|
| 331 |
+
* Increase the capacity of a buffer. `len` is the amount of
|
| 332 |
+
* free space required after the current end of the buffer.
|
| 333 |
+
*
|
| 334 |
+
* @param buf the buffer
|
| 335 |
+
* @param len number of extra bytes to allocate
|
| 336 |
+
* @returns 0 on success, -1 in case of error
|
| 337 |
+
*/
|
| 338 |
+
int
|
| 339 |
+
xmlBufGrow(xmlBuf *buf, size_t len) {
|
| 340 |
+
if ((buf == NULL) || (BUF_ERROR(buf)) || (BUF_STATIC(buf)))
|
| 341 |
+
return(-1);
|
| 342 |
+
|
| 343 |
+
if (len <= buf->size - buf->use)
|
| 344 |
+
return(0);
|
| 345 |
+
|
| 346 |
+
if (xmlBufGrowInternal(buf, len) < 0)
|
| 347 |
+
return(-1);
|
| 348 |
+
|
| 349 |
+
return(0);
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
/**
|
| 353 |
+
* Get pointer into buffer content.
|
| 354 |
+
*
|
| 355 |
+
* @param buf the buffer
|
| 356 |
+
* @returns the internal content or NULL in case of error
|
| 357 |
+
*/
|
| 358 |
+
xmlChar *
|
| 359 |
+
xmlBufContent(const xmlBuf *buf)
|
| 360 |
+
{
|
| 361 |
+
if ((!buf) || (BUF_ERROR(buf)))
|
| 362 |
+
return NULL;
|
| 363 |
+
|
| 364 |
+
return(buf->content);
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/**
|
| 368 |
+
* Return a pointer to the end of the buffer content.
|
| 369 |
+
*
|
| 370 |
+
* @param buf the buffer
|
| 371 |
+
* @returns the end of the internal content or NULL in case of error
|
| 372 |
+
*/
|
| 373 |
+
xmlChar *
|
| 374 |
+
xmlBufEnd(xmlBuf *buf)
|
| 375 |
+
{
|
| 376 |
+
if ((!buf) || (BUF_ERROR(buf)))
|
| 377 |
+
return NULL;
|
| 378 |
+
|
| 379 |
+
return(&buf->content[buf->use]);
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
/**
|
| 383 |
+
* Increase the size of the buffer content.
|
| 384 |
+
*
|
| 385 |
+
* If data was appended by writing directly into the content
|
| 386 |
+
* array, this function increases the buffer size.
|
| 387 |
+
*
|
| 388 |
+
* @param buf the buffer
|
| 389 |
+
* @param len number of bytes to add
|
| 390 |
+
* @returns 0 on success, -1 in case of error
|
| 391 |
+
*/
|
| 392 |
+
int
|
| 393 |
+
xmlBufAddLen(xmlBuf *buf, size_t len) {
|
| 394 |
+
if ((buf == NULL) || (BUF_ERROR(buf)) || (BUF_STATIC(buf)))
|
| 395 |
+
return(-1);
|
| 396 |
+
if (len > buf->size - buf->use)
|
| 397 |
+
return(-1);
|
| 398 |
+
buf->use += len;
|
| 399 |
+
buf->content[buf->use] = 0;
|
| 400 |
+
return(0);
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
/**
|
| 404 |
+
* Return the size of the buffer content.
|
| 405 |
+
*
|
| 406 |
+
* @param buf the buffer
|
| 407 |
+
* @returns size of buffer content in bytes
|
| 408 |
+
*/
|
| 409 |
+
size_t
|
| 410 |
+
xmlBufUse(xmlBuf *buf)
|
| 411 |
+
{
|
| 412 |
+
if ((!buf) || (BUF_ERROR(buf)))
|
| 413 |
+
return 0;
|
| 414 |
+
|
| 415 |
+
return(buf->use);
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
/**
|
| 419 |
+
* Return the size of available space at the end of a buffer.
|
| 420 |
+
*
|
| 421 |
+
* @param buf the buffer
|
| 422 |
+
* @returns available space in bytes
|
| 423 |
+
*/
|
| 424 |
+
size_t
|
| 425 |
+
xmlBufAvail(xmlBuf *buf)
|
| 426 |
+
{
|
| 427 |
+
if ((!buf) || (BUF_ERROR(buf)))
|
| 428 |
+
return 0;
|
| 429 |
+
|
| 430 |
+
return(buf->size - buf->use);
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
/**
|
| 434 |
+
* Tell if a buffer is empty
|
| 435 |
+
*
|
| 436 |
+
* @param buf the buffer
|
| 437 |
+
* @returns 0 if no, 1 if yes and -1 in case of error
|
| 438 |
+
*/
|
| 439 |
+
int
|
| 440 |
+
xmlBufIsEmpty(xmlBuf *buf)
|
| 441 |
+
{
|
| 442 |
+
if ((!buf) || (BUF_ERROR(buf)))
|
| 443 |
+
return(-1);
|
| 444 |
+
|
| 445 |
+
return(buf->use == 0);
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
/**
|
| 449 |
+
* Append data to a buffer.
|
| 450 |
+
*
|
| 451 |
+
* If `len` is -1, `str` is expected to be zero-terminated.
|
| 452 |
+
*
|
| 453 |
+
* @param buf the buffer
|
| 454 |
+
* @param str bytes to add
|
| 455 |
+
* @param len number of bytes
|
| 456 |
+
* @returns 0 if successful, -1 in case of error.
|
| 457 |
+
*/
|
| 458 |
+
int
|
| 459 |
+
xmlBufAdd(xmlBuf *buf, const xmlChar *str, size_t len) {
|
| 460 |
+
if ((buf == NULL) || (BUF_ERROR(buf)) || (BUF_STATIC(buf)))
|
| 461 |
+
return(-1);
|
| 462 |
+
if (len == 0)
|
| 463 |
+
return(0);
|
| 464 |
+
if (str == NULL)
|
| 465 |
+
return(-1);
|
| 466 |
+
|
| 467 |
+
if (len > buf->size - buf->use) {
|
| 468 |
+
if (xmlBufGrowInternal(buf, len) < 0)
|
| 469 |
+
return(-1);
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
memmove(&buf->content[buf->use], str, len);
|
| 473 |
+
buf->use += len;
|
| 474 |
+
buf->content[buf->use] = 0;
|
| 475 |
+
|
| 476 |
+
return(0);
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
/**
|
| 480 |
+
* Append a zero-terminated string to a buffer.
|
| 481 |
+
*
|
| 482 |
+
* @param buf the buffer
|
| 483 |
+
* @param str string (optional)
|
| 484 |
+
* @returns 0 if successful, -1 in case of error.
|
| 485 |
+
*/
|
| 486 |
+
int
|
| 487 |
+
xmlBufCat(xmlBuf *buf, const xmlChar *str) {
|
| 488 |
+
if (str == NULL)
|
| 489 |
+
return(0);
|
| 490 |
+
return(xmlBufAdd(buf, str, strlen((const char *) str)));
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
/**
|
| 494 |
+
* Helper routine to switch from the old buffer structures in use
|
| 495 |
+
* in various APIs. It creates a wrapper xmlBuf which will be
|
| 496 |
+
* used for internal processing until xmlBufBackToBuffer is
|
| 497 |
+
* issued.
|
| 498 |
+
*
|
| 499 |
+
* @param buffer incoming old buffer to convert to a new one
|
| 500 |
+
* @returns a new xmlBuf unless the call failed and NULL is returned
|
| 501 |
+
*/
|
| 502 |
+
xmlBuf *
|
| 503 |
+
xmlBufFromBuffer(xmlBuffer *buffer) {
|
| 504 |
+
xmlBufPtr ret;
|
| 505 |
+
|
| 506 |
+
if (buffer == NULL)
|
| 507 |
+
return(NULL);
|
| 508 |
+
|
| 509 |
+
ret = xmlMalloc(sizeof(xmlBuf));
|
| 510 |
+
if (ret == NULL)
|
| 511 |
+
return(NULL);
|
| 512 |
+
|
| 513 |
+
ret->use = buffer->use;
|
| 514 |
+
ret->flags = 0;
|
| 515 |
+
ret->maxSize = SIZE_MAX - 1;
|
| 516 |
+
|
| 517 |
+
if (buffer->content == NULL) {
|
| 518 |
+
ret->size = 50;
|
| 519 |
+
ret->mem = xmlMalloc(ret->size + 1);
|
| 520 |
+
ret->content = ret->mem;
|
| 521 |
+
if (ret->mem == NULL)
|
| 522 |
+
xmlBufMemoryError(ret);
|
| 523 |
+
else
|
| 524 |
+
ret->content[0] = 0;
|
| 525 |
+
} else {
|
| 526 |
+
ret->size = buffer->size - 1;
|
| 527 |
+
ret->content = buffer->content;
|
| 528 |
+
if (buffer->alloc == XML_BUFFER_ALLOC_IO)
|
| 529 |
+
ret->mem = buffer->contentIO;
|
| 530 |
+
else
|
| 531 |
+
ret->mem = buffer->content;
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
return(ret);
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
/**
|
| 538 |
+
* Function to be called once internal processing had been done to
|
| 539 |
+
* update back the buffer provided by the user. This can lead to
|
| 540 |
+
* a failure in case the size accumulated in the xmlBuf is larger
|
| 541 |
+
* than what an xmlBuffer can support on 64 bits (INT_MAX)
|
| 542 |
+
* The xmlBuf `buf` wrapper is deallocated by this call in any case.
|
| 543 |
+
*
|
| 544 |
+
* @param buf new buffer wrapping the old one
|
| 545 |
+
* @param ret old buffer
|
| 546 |
+
* @returns 0 on success, -1 on error.
|
| 547 |
+
*/
|
| 548 |
+
int
|
| 549 |
+
xmlBufBackToBuffer(xmlBuf *buf, xmlBuffer *ret) {
|
| 550 |
+
if ((buf == NULL) || (ret == NULL))
|
| 551 |
+
return(-1);
|
| 552 |
+
|
| 553 |
+
if ((BUF_ERROR(buf)) || (BUF_STATIC(buf)) ||
|
| 554 |
+
(buf->use >= INT_MAX)) {
|
| 555 |
+
xmlBufFree(buf);
|
| 556 |
+
ret->content = NULL;
|
| 557 |
+
ret->contentIO = NULL;
|
| 558 |
+
ret->use = 0;
|
| 559 |
+
ret->size = 0;
|
| 560 |
+
return(-1);
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
ret->use = buf->use;
|
| 564 |
+
if (buf->size >= INT_MAX) {
|
| 565 |
+
/* Keep the buffer but provide a truncated size value. */
|
| 566 |
+
ret->size = INT_MAX;
|
| 567 |
+
} else {
|
| 568 |
+
ret->size = buf->size + 1;
|
| 569 |
+
}
|
| 570 |
+
ret->alloc = XML_BUFFER_ALLOC_IO;
|
| 571 |
+
ret->content = buf->content;
|
| 572 |
+
ret->contentIO = buf->mem;
|
| 573 |
+
xmlFree(buf);
|
| 574 |
+
return(0);
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
/**
|
| 578 |
+
* Update pointers in the parser input struct.
|
| 579 |
+
*
|
| 580 |
+
* Update `base`, `cur` and `end` to point into the buffer.
|
| 581 |
+
* This is required after the content array was reallocated.
|
| 582 |
+
*
|
| 583 |
+
* @param buf a buffer
|
| 584 |
+
* @param input a parser input
|
| 585 |
+
* @returns 0 on success, -1 in case of error.
|
| 586 |
+
*/
|
| 587 |
+
int
|
| 588 |
+
xmlBufResetInput(xmlBuf *buf, xmlParserInput *input) {
|
| 589 |
+
return(xmlBufUpdateInput(buf, input, 0));
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
/**
|
| 593 |
+
* Update pointers in the parser input struct.
|
| 594 |
+
*
|
| 595 |
+
* Update `base`, `cur` and `end` to point into the buffer.
|
| 596 |
+
* This is required after the content array was reallocated.
|
| 597 |
+
*
|
| 598 |
+
* @param buf a buffer
|
| 599 |
+
* @param input a parser input
|
| 600 |
+
* @param pos the `cur` position relative to the start of the
|
| 601 |
+
* buffer
|
| 602 |
+
* @returns 0 on success, -1 in case of error.
|
| 603 |
+
*/
|
| 604 |
+
int
|
| 605 |
+
xmlBufUpdateInput(xmlBuf *buf, xmlParserInput *input, size_t pos) {
|
| 606 |
+
if ((buf == NULL) || (input == NULL))
|
| 607 |
+
return(-1);
|
| 608 |
+
input->base = buf->content;
|
| 609 |
+
input->cur = input->base + pos;
|
| 610 |
+
input->end = &buf->content[buf->use];
|
| 611 |
+
return(0);
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
/************************************************************************
|
| 615 |
+
* *
|
| 616 |
+
* Old buffer implementation *
|
| 617 |
+
* *
|
| 618 |
+
************************************************************************/
|
| 619 |
+
|
| 620 |
+
/**
|
| 621 |
+
* Set the buffer allocation scheme.
|
| 622 |
+
*
|
| 623 |
+
* @deprecated No-op, allocation schemes were removed.
|
| 624 |
+
*
|
| 625 |
+
* @param scheme allocation method to use
|
| 626 |
+
*/
|
| 627 |
+
void
|
| 628 |
+
xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme ATTRIBUTE_UNUSED) {
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
/**
|
| 632 |
+
* Get the buffer allocation scheme.
|
| 633 |
+
*
|
| 634 |
+
* @deprecated Allocation schemes were removed.
|
| 635 |
+
*
|
| 636 |
+
* @returns the current allocation scheme
|
| 637 |
+
*/
|
| 638 |
+
xmlBufferAllocationScheme
|
| 639 |
+
xmlGetBufferAllocationScheme(void) {
|
| 640 |
+
return(XML_BUFFER_ALLOC_EXACT);
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
/**
|
| 644 |
+
* Create a buffer.
|
| 645 |
+
*
|
| 646 |
+
* The default initial size is 256.
|
| 647 |
+
*
|
| 648 |
+
* @returns the new structure.
|
| 649 |
+
*/
|
| 650 |
+
xmlBuffer *
|
| 651 |
+
xmlBufferCreate(void) {
|
| 652 |
+
xmlBufferPtr ret;
|
| 653 |
+
|
| 654 |
+
ret = xmlMalloc(sizeof(*ret));
|
| 655 |
+
if (ret == NULL)
|
| 656 |
+
return(NULL);
|
| 657 |
+
|
| 658 |
+
ret->use = 0;
|
| 659 |
+
ret->size = 256;
|
| 660 |
+
ret->alloc = XML_BUFFER_ALLOC_IO;
|
| 661 |
+
ret->contentIO = xmlMalloc(ret->size);
|
| 662 |
+
if (ret->contentIO == NULL) {
|
| 663 |
+
xmlFree(ret);
|
| 664 |
+
return(NULL);
|
| 665 |
+
}
|
| 666 |
+
ret->content = ret->contentIO;
|
| 667 |
+
ret->content[0] = 0;
|
| 668 |
+
|
| 669 |
+
return(ret);
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
/**
|
| 673 |
+
* Create a buffer with an initial size.
|
| 674 |
+
*
|
| 675 |
+
* @param size initial size of buffer
|
| 676 |
+
* @returns the new structure.
|
| 677 |
+
*/
|
| 678 |
+
xmlBuffer *
|
| 679 |
+
xmlBufferCreateSize(size_t size) {
|
| 680 |
+
xmlBufferPtr ret;
|
| 681 |
+
|
| 682 |
+
if (size >= INT_MAX)
|
| 683 |
+
return(NULL);
|
| 684 |
+
|
| 685 |
+
ret = xmlMalloc(sizeof(*ret));
|
| 686 |
+
if (ret == NULL)
|
| 687 |
+
return(NULL);
|
| 688 |
+
|
| 689 |
+
ret->use = 0;
|
| 690 |
+
ret->alloc = XML_BUFFER_ALLOC_IO;
|
| 691 |
+
ret->size = (size ? size + 1 : 0); /* +1 for ending null */
|
| 692 |
+
|
| 693 |
+
if (ret->size) {
|
| 694 |
+
ret->contentIO = xmlMalloc(ret->size);
|
| 695 |
+
if (ret->contentIO == NULL) {
|
| 696 |
+
xmlFree(ret);
|
| 697 |
+
return(NULL);
|
| 698 |
+
}
|
| 699 |
+
ret->content = ret->contentIO;
|
| 700 |
+
ret->content[0] = 0;
|
| 701 |
+
} else {
|
| 702 |
+
ret->contentIO = NULL;
|
| 703 |
+
ret->content = NULL;
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
return(ret);
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
/**
|
| 710 |
+
* Extract buffer content.
|
| 711 |
+
*
|
| 712 |
+
* Return the contents of the buffer as an `xmlChar` string,
|
| 713 |
+
* clearing the buffer.
|
| 714 |
+
*
|
| 715 |
+
* This doesn't work with static buffers as they can't be reset.
|
| 716 |
+
*
|
| 717 |
+
* @param buf the buffer
|
| 718 |
+
* @returns the buffer content
|
| 719 |
+
*/
|
| 720 |
+
xmlChar *
|
| 721 |
+
xmlBufferDetach(xmlBuffer *buf) {
|
| 722 |
+
xmlChar *ret;
|
| 723 |
+
|
| 724 |
+
if (buf == NULL)
|
| 725 |
+
return(NULL);
|
| 726 |
+
|
| 727 |
+
if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
|
| 728 |
+
(buf->content != buf->contentIO)) {
|
| 729 |
+
ret = xmlStrndup(buf->content, buf->use);
|
| 730 |
+
xmlFree(buf->contentIO);
|
| 731 |
+
} else {
|
| 732 |
+
ret = buf->content;
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
buf->contentIO = NULL;
|
| 736 |
+
buf->content = NULL;
|
| 737 |
+
buf->size = 0;
|
| 738 |
+
buf->use = 0;
|
| 739 |
+
|
| 740 |
+
return ret;
|
| 741 |
+
}
|
| 742 |
+
|
| 743 |
+
/**
|
| 744 |
+
* Create a static buffer.
|
| 745 |
+
*
|
| 746 |
+
* The memory must be zero-terminated and not be modified for the
|
| 747 |
+
* lifetime of the buffer. A static buffer can't be grown, modified or
|
| 748 |
+
* detached, but it can be shrunk.
|
| 749 |
+
*
|
| 750 |
+
* @param mem the memory area
|
| 751 |
+
* @param size the size in bytes
|
| 752 |
+
* @returns a new buffer
|
| 753 |
+
*/
|
| 754 |
+
xmlBuffer *
|
| 755 |
+
xmlBufferCreateStatic(void *mem, size_t size) {
|
| 756 |
+
xmlBufferPtr buf = xmlBufferCreateSize(size);
|
| 757 |
+
|
| 758 |
+
xmlBufferAdd(buf, mem, size);
|
| 759 |
+
return(buf);
|
| 760 |
+
}
|
| 761 |
+
|
| 762 |
+
/**
|
| 763 |
+
* Set the allocation scheme of a buffer.
|
| 764 |
+
*
|
| 765 |
+
* For libxml2 before 2.14, it is recommended to set this to
|
| 766 |
+
* XML_BUFFER_ALLOC_DOUBLE_IT. Has no effect on 2.14 or later.
|
| 767 |
+
*
|
| 768 |
+
* @param buf the buffer to tune
|
| 769 |
+
* @param scheme allocation scheme to use
|
| 770 |
+
*/
|
| 771 |
+
void
|
| 772 |
+
xmlBufferSetAllocationScheme(xmlBuffer *buf ATTRIBUTE_UNUSED,
|
| 773 |
+
xmlBufferAllocationScheme scheme ATTRIBUTE_UNUSED) {
|
| 774 |
+
}
|
| 775 |
+
|
| 776 |
+
/**
|
| 777 |
+
* Free a buffer.
|
| 778 |
+
*
|
| 779 |
+
* @param buf the buffer to free
|
| 780 |
+
*/
|
| 781 |
+
void
|
| 782 |
+
xmlBufferFree(xmlBuffer *buf) {
|
| 783 |
+
if (buf == NULL)
|
| 784 |
+
return;
|
| 785 |
+
|
| 786 |
+
if (buf->alloc == XML_BUFFER_ALLOC_IO)
|
| 787 |
+
xmlFree(buf->contentIO);
|
| 788 |
+
else
|
| 789 |
+
xmlFree(buf->content);
|
| 790 |
+
|
| 791 |
+
xmlFree(buf);
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
/**
|
| 795 |
+
* Empty a buffer.
|
| 796 |
+
*
|
| 797 |
+
* @param buf the buffer
|
| 798 |
+
*/
|
| 799 |
+
void
|
| 800 |
+
xmlBufferEmpty(xmlBuffer *buf) {
|
| 801 |
+
if (buf == NULL)
|
| 802 |
+
return;
|
| 803 |
+
if (buf->content == NULL)
|
| 804 |
+
return;
|
| 805 |
+
|
| 806 |
+
buf->use = 0;
|
| 807 |
+
|
| 808 |
+
if (buf->alloc == XML_BUFFER_ALLOC_IO) {
|
| 809 |
+
buf->size += buf->content - buf->contentIO;
|
| 810 |
+
buf->content = buf->contentIO;
|
| 811 |
+
buf->content[0] = 0;
|
| 812 |
+
} else {
|
| 813 |
+
buf->content[0] = 0;
|
| 814 |
+
}
|
| 815 |
+
}
|
| 816 |
+
|
| 817 |
+
/**
|
| 818 |
+
* Discard bytes at the start of a buffer.
|
| 819 |
+
*
|
| 820 |
+
* @deprecated Internal function, don't use.
|
| 821 |
+
*
|
| 822 |
+
* @param buf the buffer
|
| 823 |
+
* @param len the number of bytes to remove
|
| 824 |
+
* @returns the number of bytes removed, or -1 in case of failure.
|
| 825 |
+
*/
|
| 826 |
+
int
|
| 827 |
+
xmlBufferShrink(xmlBuffer *buf, unsigned int len) {
|
| 828 |
+
if (buf == NULL)
|
| 829 |
+
return(-1);
|
| 830 |
+
if (len == 0)
|
| 831 |
+
return(0);
|
| 832 |
+
if (len > buf->use)
|
| 833 |
+
return(-1);
|
| 834 |
+
|
| 835 |
+
buf->use -= len;
|
| 836 |
+
|
| 837 |
+
if (buf->alloc == XML_BUFFER_ALLOC_IO) {
|
| 838 |
+
buf->content += len;
|
| 839 |
+
buf->size -= len;
|
| 840 |
+
} else {
|
| 841 |
+
memmove(buf->content, &buf->content[len], buf->use + 1);
|
| 842 |
+
}
|
| 843 |
+
|
| 844 |
+
return(len);
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
/**
|
| 848 |
+
* Grow a buffer.
|
| 849 |
+
*
|
| 850 |
+
* @deprecated Internal function, don't use.
|
| 851 |
+
*
|
| 852 |
+
* @param buf the buffer
|
| 853 |
+
* @param len number of extra bytes to allocate
|
| 854 |
+
* @returns the new available space or -1 in case of error
|
| 855 |
+
*/
|
| 856 |
+
int
|
| 857 |
+
xmlBufferGrow(xmlBuffer *buf, unsigned int len) {
|
| 858 |
+
unsigned int size;
|
| 859 |
+
xmlChar *newbuf;
|
| 860 |
+
|
| 861 |
+
if (buf == NULL)
|
| 862 |
+
return(-1);
|
| 863 |
+
|
| 864 |
+
if (len < buf->size - buf->use)
|
| 865 |
+
return(0);
|
| 866 |
+
if (len >= INT_MAX - buf->use)
|
| 867 |
+
return(-1);
|
| 868 |
+
|
| 869 |
+
if (buf->size > (size_t) len) {
|
| 870 |
+
if (buf->size <= INT_MAX / 2)
|
| 871 |
+
size = buf->size * 2;
|
| 872 |
+
else
|
| 873 |
+
size = INT_MAX;
|
| 874 |
+
} else {
|
| 875 |
+
size = buf->use + len + 1;
|
| 876 |
+
if (size <= INT_MAX - 100)
|
| 877 |
+
size += 100;
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
|
| 881 |
+
(buf->content != buf->contentIO)) {
|
| 882 |
+
newbuf = xmlMalloc(size);
|
| 883 |
+
if (newbuf == NULL)
|
| 884 |
+
return(-1);
|
| 885 |
+
if (buf->content != NULL)
|
| 886 |
+
memcpy(newbuf, buf->content, buf->use + 1);
|
| 887 |
+
xmlFree(buf->contentIO);
|
| 888 |
+
} else {
|
| 889 |
+
newbuf = xmlRealloc(buf->content, size);
|
| 890 |
+
if (newbuf == NULL)
|
| 891 |
+
return(-1);
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
+
if (buf->alloc == XML_BUFFER_ALLOC_IO)
|
| 895 |
+
buf->contentIO = newbuf;
|
| 896 |
+
buf->content = newbuf;
|
| 897 |
+
buf->size = size;
|
| 898 |
+
|
| 899 |
+
return(buf->size - buf->use - 1);
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
/**
|
| 903 |
+
* Dump a buffer to a `FILE`.
|
| 904 |
+
*
|
| 905 |
+
* @param file the output file
|
| 906 |
+
* @param buf the buffer
|
| 907 |
+
* @returns the number of bytes written
|
| 908 |
+
*/
|
| 909 |
+
int
|
| 910 |
+
xmlBufferDump(FILE *file, xmlBuffer *buf) {
|
| 911 |
+
size_t ret;
|
| 912 |
+
|
| 913 |
+
if (buf == NULL)
|
| 914 |
+
return(0);
|
| 915 |
+
if (buf->content == NULL)
|
| 916 |
+
return(0);
|
| 917 |
+
if (file == NULL)
|
| 918 |
+
file = stdout;
|
| 919 |
+
ret = fwrite(buf->content, 1, buf->use, file);
|
| 920 |
+
return(ret > INT_MAX ? INT_MAX : ret);
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
+
/**
|
| 924 |
+
* Get pointer into buffer content.
|
| 925 |
+
*
|
| 926 |
+
* @param buf the buffer
|
| 927 |
+
* @returns the internal content
|
| 928 |
+
*/
|
| 929 |
+
const xmlChar *
|
| 930 |
+
xmlBufferContent(const xmlBuffer *buf)
|
| 931 |
+
{
|
| 932 |
+
if(!buf)
|
| 933 |
+
return NULL;
|
| 934 |
+
|
| 935 |
+
return buf->content;
|
| 936 |
+
}
|
| 937 |
+
|
| 938 |
+
/**
|
| 939 |
+
* Get the size of the buffer content.
|
| 940 |
+
*
|
| 941 |
+
* @param buf the buffer
|
| 942 |
+
* @returns the size of the buffer content in bytes
|
| 943 |
+
*/
|
| 944 |
+
int
|
| 945 |
+
xmlBufferLength(const xmlBuffer *buf)
|
| 946 |
+
{
|
| 947 |
+
if(!buf)
|
| 948 |
+
return 0;
|
| 949 |
+
|
| 950 |
+
return buf->use;
|
| 951 |
+
}
|
| 952 |
+
|
| 953 |
+
/**
|
| 954 |
+
* Resize a buffer to a minimum size.
|
| 955 |
+
*
|
| 956 |
+
* @deprecated Internal function, don't use.
|
| 957 |
+
*
|
| 958 |
+
* @param buf the buffer to resize
|
| 959 |
+
* @param size the desired size
|
| 960 |
+
* @returns 1 on succes, 0 in case of error
|
| 961 |
+
*/
|
| 962 |
+
int
|
| 963 |
+
xmlBufferResize(xmlBuffer *buf, unsigned int size)
|
| 964 |
+
{
|
| 965 |
+
int res;
|
| 966 |
+
|
| 967 |
+
if (buf == NULL)
|
| 968 |
+
return(0);
|
| 969 |
+
if (size < buf->size)
|
| 970 |
+
return(1);
|
| 971 |
+
res = xmlBufferGrow(buf, size - buf->use);
|
| 972 |
+
|
| 973 |
+
return(res < 0 ? 0 : 1);
|
| 974 |
+
}
|
| 975 |
+
|
| 976 |
+
/**
|
| 977 |
+
* Append bytes to a buffer.
|
| 978 |
+
*
|
| 979 |
+
* If `len` is -1, `str` is assumed to be zero-terminated.
|
| 980 |
+
*
|
| 981 |
+
* @param buf the buffer
|
| 982 |
+
* @param str bytes to add
|
| 983 |
+
* @param len number of bytes
|
| 984 |
+
* @returns an xmlParserErrors code.
|
| 985 |
+
*/
|
| 986 |
+
int
|
| 987 |
+
xmlBufferAdd(xmlBuffer *buf, const xmlChar *str, int len) {
|
| 988 |
+
if ((buf == NULL) || (str == NULL))
|
| 989 |
+
return(XML_ERR_ARGUMENT);
|
| 990 |
+
if (len < 0)
|
| 991 |
+
len = xmlStrlen(str);
|
| 992 |
+
if (len == 0)
|
| 993 |
+
return(XML_ERR_OK);
|
| 994 |
+
|
| 995 |
+
/* Note that both buf->size and buf->use can be zero here. */
|
| 996 |
+
if ((unsigned) len >= buf->size - buf->use) {
|
| 997 |
+
if (xmlBufferGrow(buf, len) < 0)
|
| 998 |
+
return(XML_ERR_NO_MEMORY);
|
| 999 |
+
}
|
| 1000 |
+
|
| 1001 |
+
memmove(&buf->content[buf->use], str, len);
|
| 1002 |
+
buf->use += len;
|
| 1003 |
+
buf->content[buf->use] = 0;
|
| 1004 |
+
return(XML_ERR_OK);
|
| 1005 |
+
}
|
| 1006 |
+
|
| 1007 |
+
/**
|
| 1008 |
+
* Prepend bytes to a buffer.
|
| 1009 |
+
*
|
| 1010 |
+
* If `len` is -1, `str` is assumed to be zero-terminated.
|
| 1011 |
+
*
|
| 1012 |
+
* @param buf the buffer
|
| 1013 |
+
* @param str bytes to prepend
|
| 1014 |
+
* @param len number of bytes
|
| 1015 |
+
* @returns an xmlParserErrors code.
|
| 1016 |
+
*/
|
| 1017 |
+
int
|
| 1018 |
+
xmlBufferAddHead(xmlBuffer *buf, const xmlChar *str, int len) {
|
| 1019 |
+
unsigned start = 0;
|
| 1020 |
+
|
| 1021 |
+
if ((buf == NULL) || (str == NULL))
|
| 1022 |
+
return(XML_ERR_ARGUMENT);
|
| 1023 |
+
if (len < 0)
|
| 1024 |
+
len = xmlStrlen(str);
|
| 1025 |
+
if (len == 0)
|
| 1026 |
+
return(XML_ERR_OK);
|
| 1027 |
+
|
| 1028 |
+
if (buf->alloc == XML_BUFFER_ALLOC_IO) {
|
| 1029 |
+
start = buf->content - buf->contentIO;
|
| 1030 |
+
|
| 1031 |
+
/*
|
| 1032 |
+
* We can add it in the space previously shrunk
|
| 1033 |
+
*/
|
| 1034 |
+
if ((unsigned) len <= start) {
|
| 1035 |
+
buf->content -= len;
|
| 1036 |
+
memmove(&buf->content[0], str, len);
|
| 1037 |
+
buf->use += len;
|
| 1038 |
+
buf->size += len;
|
| 1039 |
+
return(0);
|
| 1040 |
+
}
|
| 1041 |
+
if ((unsigned) len < buf->size + start - buf->use) {
|
| 1042 |
+
memmove(&buf->contentIO[len], buf->content, buf->use + 1);
|
| 1043 |
+
memmove(buf->contentIO, str, len);
|
| 1044 |
+
buf->content = buf->contentIO;
|
| 1045 |
+
buf->use += len;
|
| 1046 |
+
buf->size += start;
|
| 1047 |
+
return(0);
|
| 1048 |
+
}
|
| 1049 |
+
}
|
| 1050 |
+
|
| 1051 |
+
if ((unsigned) len >= buf->size - buf->use) {
|
| 1052 |
+
if (xmlBufferGrow(buf, len) < 0)
|
| 1053 |
+
return(-1);
|
| 1054 |
+
}
|
| 1055 |
+
|
| 1056 |
+
memmove(&buf->content[len], buf->content, buf->use + 1);
|
| 1057 |
+
memmove(buf->content, str, len);
|
| 1058 |
+
buf->use += len;
|
| 1059 |
+
return (0);
|
| 1060 |
+
}
|
| 1061 |
+
|
| 1062 |
+
/**
|
| 1063 |
+
* Append a zero-terminated string to a buffer.
|
| 1064 |
+
*
|
| 1065 |
+
* @param buf the buffer
|
| 1066 |
+
* @param str string to add
|
| 1067 |
+
* @returns an xmlParserErrors code.
|
| 1068 |
+
*/
|
| 1069 |
+
int
|
| 1070 |
+
xmlBufferCat(xmlBuffer *buf, const xmlChar *str) {
|
| 1071 |
+
return(xmlBufferAdd(buf, str, -1));
|
| 1072 |
+
}
|
| 1073 |
+
|
| 1074 |
+
/**
|
| 1075 |
+
* Append a zero-terminated C string to a buffer.
|
| 1076 |
+
*
|
| 1077 |
+
* @param buf the buffer
|
| 1078 |
+
* @param str string to add
|
| 1079 |
+
* @returns an xmlParserErrors code.
|
| 1080 |
+
*/
|
| 1081 |
+
int
|
| 1082 |
+
xmlBufferCCat(xmlBuffer *buf, const char *str) {
|
| 1083 |
+
return(xmlBufferAdd(buf, (const xmlChar *) str, -1));
|
| 1084 |
+
}
|
| 1085 |
+
|
| 1086 |
+
/**
|
| 1087 |
+
* Append a zero-terminated `xmlChar` string to a buffer.
|
| 1088 |
+
*
|
| 1089 |
+
* @param buf the XML buffer
|
| 1090 |
+
* @param string the string to add
|
| 1091 |
+
*/
|
| 1092 |
+
void
|
| 1093 |
+
xmlBufferWriteCHAR(xmlBuffer *buf, const xmlChar *string) {
|
| 1094 |
+
xmlBufferAdd(buf, string, -1);
|
| 1095 |
+
}
|
| 1096 |
+
|
| 1097 |
+
/**
|
| 1098 |
+
* Append a zero-terminated C string to a buffer.
|
| 1099 |
+
*
|
| 1100 |
+
* Same as #xmlBufferCCat.
|
| 1101 |
+
*
|
| 1102 |
+
* @param buf the buffer
|
| 1103 |
+
* @param string the string to add
|
| 1104 |
+
*/
|
| 1105 |
+
void
|
| 1106 |
+
xmlBufferWriteChar(xmlBuffer *buf, const char *string) {
|
| 1107 |
+
xmlBufferAdd(buf, (const xmlChar *) string, -1);
|
| 1108 |
+
}
|
| 1109 |
+
|
| 1110 |
+
/**
|
| 1111 |
+
* Append a quoted string to a buffer.
|
| 1112 |
+
*
|
| 1113 |
+
* Append a string quoted with single or double quotes. If the
|
| 1114 |
+
* string contains both single and double quotes, double quotes
|
| 1115 |
+
* are escaped with `"`.
|
| 1116 |
+
*
|
| 1117 |
+
* @param buf the buffer
|
| 1118 |
+
* @param string the string to add
|
| 1119 |
+
*/
|
| 1120 |
+
void
|
| 1121 |
+
xmlBufferWriteQuotedString(xmlBuffer *buf, const xmlChar *string) {
|
| 1122 |
+
const xmlChar *cur, *base;
|
| 1123 |
+
if (buf == NULL)
|
| 1124 |
+
return;
|
| 1125 |
+
if (xmlStrchr(string, '\"')) {
|
| 1126 |
+
if (xmlStrchr(string, '\'')) {
|
| 1127 |
+
xmlBufferCCat(buf, "\"");
|
| 1128 |
+
base = cur = string;
|
| 1129 |
+
while(*cur != 0){
|
| 1130 |
+
if(*cur == '"'){
|
| 1131 |
+
if (base != cur)
|
| 1132 |
+
xmlBufferAdd(buf, base, cur - base);
|
| 1133 |
+
xmlBufferAdd(buf, BAD_CAST """, 6);
|
| 1134 |
+
cur++;
|
| 1135 |
+
base = cur;
|
| 1136 |
+
}
|
| 1137 |
+
else {
|
| 1138 |
+
cur++;
|
| 1139 |
+
}
|
| 1140 |
+
}
|
| 1141 |
+
if (base != cur)
|
| 1142 |
+
xmlBufferAdd(buf, base, cur - base);
|
| 1143 |
+
xmlBufferCCat(buf, "\"");
|
| 1144 |
+
}
|
| 1145 |
+
else{
|
| 1146 |
+
xmlBufferCCat(buf, "\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 |
+
* http://www.w3.org/TR/xml-c14n
|
| 4 |
+
*
|
| 5 |
+
* "Exclusive XML Canonicalization" implementation
|
| 6 |
+
* http://www.w3.org/TR/xml-exc-c14n
|
| 7 |
+
*
|
| 8 |
+
* See Copyright for the status of this software.
|
| 9 |
+
*
|
| 10 |
+
* Author: Aleksey Sanin
|
| 11 |
+
*/
|
| 12 |
+
#define IN_LIBXML
|
| 13 |
+
#include "libxml.h"
|
| 14 |
+
#ifdef LIBXML_C14N_ENABLED
|
| 15 |
+
|
| 16 |
+
#include <stdlib.h>
|
| 17 |
+
#include <string.h>
|
| 18 |
+
|
| 19 |
+
#include <libxml/tree.h>
|
| 20 |
+
#include <libxml/parser.h>
|
| 21 |
+
#include <libxml/uri.h>
|
| 22 |
+
#include <libxml/xmlerror.h>
|
| 23 |
+
#include <libxml/xpathInternals.h>
|
| 24 |
+
#include <libxml/c14n.h>
|
| 25 |
+
|
| 26 |
+
#include "private/error.h"
|
| 27 |
+
#include "private/io.h"
|
| 28 |
+
#include "private/memory.h"
|
| 29 |
+
|
| 30 |
+
/************************************************************************
|
| 31 |
+
* *
|
| 32 |
+
* Some declaration better left private ATM *
|
| 33 |
+
* *
|
| 34 |
+
************************************************************************/
|
| 35 |
+
|
| 36 |
+
typedef enum {
|
| 37 |
+
XMLC14N_BEFORE_DOCUMENT_ELEMENT = 0,
|
| 38 |
+
XMLC14N_INSIDE_DOCUMENT_ELEMENT = 1,
|
| 39 |
+
XMLC14N_AFTER_DOCUMENT_ELEMENT = 2
|
| 40 |
+
} xmlC14NPosition;
|
| 41 |
+
|
| 42 |
+
typedef struct _xmlC14NVisibleNsStack {
|
| 43 |
+
int nsCurEnd; /* number of nodes in the set */
|
| 44 |
+
int nsPrevStart; /* the beginning of the stack for previous visible node */
|
| 45 |
+
int nsPrevEnd; /* the end of the stack for previous visible node */
|
| 46 |
+
int nsMax; /* size of the array as allocated */
|
| 47 |
+
xmlNsPtr *nsTab; /* array of ns in no particular order */
|
| 48 |
+
xmlNodePtr *nodeTab; /* array of nodes in no particular order */
|
| 49 |
+
} xmlC14NVisibleNsStack, *xmlC14NVisibleNsStackPtr;
|
| 50 |
+
|
| 51 |
+
typedef struct _xmlC14NCtx {
|
| 52 |
+
/* input parameters */
|
| 53 |
+
xmlDocPtr doc;
|
| 54 |
+
xmlC14NIsVisibleCallback is_visible_callback;
|
| 55 |
+
void* user_data;
|
| 56 |
+
int with_comments;
|
| 57 |
+
xmlOutputBufferPtr buf;
|
| 58 |
+
|
| 59 |
+
/* position in the XML document */
|
| 60 |
+
xmlC14NPosition pos;
|
| 61 |
+
int parent_is_doc;
|
| 62 |
+
xmlC14NVisibleNsStackPtr ns_rendered;
|
| 63 |
+
|
| 64 |
+
/* C14N mode */
|
| 65 |
+
xmlC14NMode mode;
|
| 66 |
+
|
| 67 |
+
/* exclusive canonicalization */
|
| 68 |
+
xmlChar **inclusive_ns_prefixes;
|
| 69 |
+
|
| 70 |
+
/* error number */
|
| 71 |
+
int error;
|
| 72 |
+
} xmlC14NCtx, *xmlC14NCtxPtr;
|
| 73 |
+
|
| 74 |
+
static xmlC14NVisibleNsStackPtr xmlC14NVisibleNsStackCreate (void);
|
| 75 |
+
static void xmlC14NVisibleNsStackDestroy (xmlC14NVisibleNsStackPtr cur);
|
| 76 |
+
static int xmlC14NVisibleNsStackAdd (xmlC14NVisibleNsStackPtr cur,
|
| 77 |
+
xmlNsPtr ns,
|
| 78 |
+
xmlNodePtr node);
|
| 79 |
+
static void xmlC14NVisibleNsStackSave (xmlC14NVisibleNsStackPtr cur,
|
| 80 |
+
xmlC14NVisibleNsStackPtr state);
|
| 81 |
+
static void xmlC14NVisibleNsStackRestore (xmlC14NVisibleNsStackPtr cur,
|
| 82 |
+
xmlC14NVisibleNsStackPtr state);
|
| 83 |
+
static void xmlC14NVisibleNsStackShift (xmlC14NVisibleNsStackPtr cur);
|
| 84 |
+
static int xmlC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur,
|
| 85 |
+
xmlNsPtr ns);
|
| 86 |
+
static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur,
|
| 87 |
+
xmlNsPtr ns,
|
| 88 |
+
xmlC14NCtxPtr ctx);
|
| 89 |
+
|
| 90 |
+
static int xmlC14NIsNodeInNodeset (void *user_data,
|
| 91 |
+
xmlNodePtr node,
|
| 92 |
+
xmlNodePtr parent);
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
static int xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur);
|
| 97 |
+
static int xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur);
|
| 98 |
+
typedef enum {
|
| 99 |
+
XMLC14N_NORMALIZE_ATTR = 0,
|
| 100 |
+
XMLC14N_NORMALIZE_COMMENT = 1,
|
| 101 |
+
XMLC14N_NORMALIZE_PI = 2,
|
| 102 |
+
XMLC14N_NORMALIZE_TEXT = 3
|
| 103 |
+
} xmlC14NNormalizationMode;
|
| 104 |
+
|
| 105 |
+
static xmlChar *xmlC11NNormalizeString(const xmlChar * input,
|
| 106 |
+
xmlC14NNormalizationMode mode);
|
| 107 |
+
|
| 108 |
+
#define xmlC11NNormalizeAttr( a ) \
|
| 109 |
+
xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_ATTR)
|
| 110 |
+
#define xmlC11NNormalizeComment( a ) \
|
| 111 |
+
xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_COMMENT)
|
| 112 |
+
#define xmlC11NNormalizePI( a ) \
|
| 113 |
+
xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_PI)
|
| 114 |
+
#define xmlC11NNormalizeText( a ) \
|
| 115 |
+
xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_TEXT)
|
| 116 |
+
|
| 117 |
+
#define xmlC14NIsVisible( ctx, node, parent ) \
|
| 118 |
+
(((ctx)->is_visible_callback != NULL) ? \
|
| 119 |
+
(ctx)->is_visible_callback((ctx)->user_data, \
|
| 120 |
+
(xmlNodePtr)(node), (xmlNodePtr)(parent)) : 1)
|
| 121 |
+
|
| 122 |
+
#define xmlC14NIsExclusive( ctx ) \
|
| 123 |
+
( (ctx)->mode == XML_C14N_EXCLUSIVE_1_0 )
|
| 124 |
+
|
| 125 |
+
/************************************************************************
|
| 126 |
+
* *
|
| 127 |
+
* Some factorized error routines *
|
| 128 |
+
* *
|
| 129 |
+
************************************************************************/
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* Handle a redefinition of memory error
|
| 133 |
+
*
|
| 134 |
+
* @param ctxt a C14N evaluation context
|
| 135 |
+
*/
|
| 136 |
+
static void
|
| 137 |
+
xmlC14NErrMemory(xmlC14NCtxPtr ctxt)
|
| 138 |
+
{
|
| 139 |
+
if (ctxt != NULL)
|
| 140 |
+
ctxt->error = XML_ERR_NO_MEMORY;
|
| 141 |
+
|
| 142 |
+
xmlRaiseMemoryError(NULL, NULL, NULL, XML_FROM_C14N, NULL);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
static void
|
| 146 |
+
xmlC14NErrFull(xmlC14NCtxPtr ctxt, xmlNodePtr node, int code, const char *str1,
|
| 147 |
+
const char *msg, ...)
|
| 148 |
+
{
|
| 149 |
+
va_list ap;
|
| 150 |
+
int res;
|
| 151 |
+
|
| 152 |
+
if (ctxt != NULL)
|
| 153 |
+
ctxt->error = code;
|
| 154 |
+
|
| 155 |
+
va_start(ap, msg);
|
| 156 |
+
res = xmlVRaiseError(NULL, NULL, NULL, ctxt, node,
|
| 157 |
+
XML_FROM_C14N, code, XML_ERR_ERROR, NULL, 0,
|
| 158 |
+
str1, NULL, NULL, 0, 0,
|
| 159 |
+
msg, ap);
|
| 160 |
+
va_end(ap);
|
| 161 |
+
if (res < 0)
|
| 162 |
+
xmlC14NErrMemory(ctxt);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Handle a param error
|
| 167 |
+
*
|
| 168 |
+
* @param ctxt a C14N evaluation context
|
| 169 |
+
*/
|
| 170 |
+
static void
|
| 171 |
+
xmlC14NErrParam(xmlC14NCtxPtr ctxt)
|
| 172 |
+
{
|
| 173 |
+
xmlC14NErrFull(ctxt, NULL, XML_ERR_ARGUMENT, NULL,
|
| 174 |
+
"Invalid argument\n", NULL);
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/**
|
| 178 |
+
* Handle an invalid node error
|
| 179 |
+
*
|
| 180 |
+
* @param ctxt a C14N evaluation context
|
| 181 |
+
* @param node_type node type
|
| 182 |
+
* @param extra extra information
|
| 183 |
+
*/
|
| 184 |
+
static void
|
| 185 |
+
xmlC14NErrInvalidNode(xmlC14NCtxPtr ctxt, const char *node_type,
|
| 186 |
+
const char *extra)
|
| 187 |
+
{
|
| 188 |
+
xmlC14NErrFull(ctxt, NULL, XML_C14N_INVALID_NODE, extra,
|
| 189 |
+
"Node %s is invalid here : %s\n", node_type, extra);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
/**
|
| 193 |
+
* Handle an unknown node error
|
| 194 |
+
*
|
| 195 |
+
* @param ctxt a C14N evaluation context
|
| 196 |
+
* @param node_type node type
|
| 197 |
+
* @param extra extra information
|
| 198 |
+
*/
|
| 199 |
+
static void
|
| 200 |
+
xmlC14NErrUnknownNode(xmlC14NCtxPtr ctxt, int node_type, const char *extra)
|
| 201 |
+
{
|
| 202 |
+
xmlC14NErrFull(ctxt, NULL, XML_C14N_UNKNOW_NODE, extra,
|
| 203 |
+
"Unknown node type %d found : %s\n", node_type, extra);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
/**
|
| 207 |
+
* Handle a relative namespace error
|
| 208 |
+
*
|
| 209 |
+
* @param ctxt a C14N evaluation context
|
| 210 |
+
* @param ns_uri namespace URI
|
| 211 |
+
*/
|
| 212 |
+
static void
|
| 213 |
+
xmlC14NErrRelativeNamespace(xmlC14NCtxPtr ctxt, const char *ns_uri)
|
| 214 |
+
{
|
| 215 |
+
xmlC14NErrFull(ctxt, NULL, XML_C14N_RELATIVE_NAMESPACE, ns_uri,
|
| 216 |
+
"Relative namespace UR is invalid here : %s\n", ns_uri);
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
/**
|
| 222 |
+
* Handle an error
|
| 223 |
+
*
|
| 224 |
+
* @param ctxt a C14N evaluation context
|
| 225 |
+
* @param node the context node
|
| 226 |
+
* @param error the error code
|
| 227 |
+
* @param msg the message
|
| 228 |
+
*/
|
| 229 |
+
static void
|
| 230 |
+
xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error,
|
| 231 |
+
const char * msg)
|
| 232 |
+
{
|
| 233 |
+
xmlC14NErrFull(ctxt, node, error, NULL, "%s", msg);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/************************************************************************
|
| 237 |
+
* *
|
| 238 |
+
* The implementation internals *
|
| 239 |
+
* *
|
| 240 |
+
************************************************************************/
|
| 241 |
+
#define XML_NAMESPACES_DEFAULT 16
|
| 242 |
+
|
| 243 |
+
static int
|
| 244 |
+
xmlC14NIsNodeInNodeset(void *user_data, xmlNodePtr node, xmlNodePtr parent) {
|
| 245 |
+
xmlNodeSetPtr nodes = (xmlNodeSetPtr) user_data;
|
| 246 |
+
if((nodes != NULL) && (node != NULL)) {
|
| 247 |
+
if(node->type != XML_NAMESPACE_DECL) {
|
| 248 |
+
return(xmlXPathNodeSetContains(nodes, node));
|
| 249 |
+
} else {
|
| 250 |
+
xmlNs ns;
|
| 251 |
+
|
| 252 |
+
memcpy(&ns, node, sizeof(ns));
|
| 253 |
+
|
| 254 |
+
/* this is a libxml hack! check xpath.c for details */
|
| 255 |
+
if((parent != NULL) && (parent->type == XML_ATTRIBUTE_NODE)) {
|
| 256 |
+
ns.next = (xmlNsPtr)parent->parent;
|
| 257 |
+
} else {
|
| 258 |
+
ns.next = (xmlNsPtr)parent;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
/*
|
| 262 |
+
* If the input is an XPath node-set, then the node-set must explicitly
|
| 263 |
+
* contain every node to be rendered to the canonical form.
|
| 264 |
+
*/
|
| 265 |
+
return(xmlXPathNodeSetContains(nodes, (xmlNodePtr)&ns));
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
return(1);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
static xmlC14NVisibleNsStackPtr
|
| 272 |
+
xmlC14NVisibleNsStackCreate(void) {
|
| 273 |
+
xmlC14NVisibleNsStackPtr ret;
|
| 274 |
+
|
| 275 |
+
ret = (xmlC14NVisibleNsStackPtr) xmlMalloc(sizeof(xmlC14NVisibleNsStack));
|
| 276 |
+
if (ret == NULL)
|
| 277 |
+
return(NULL);
|
| 278 |
+
memset(ret, 0, sizeof(xmlC14NVisibleNsStack));
|
| 279 |
+
return(ret);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
static void
|
| 283 |
+
xmlC14NVisibleNsStackDestroy(xmlC14NVisibleNsStackPtr cur) {
|
| 284 |
+
if(cur == NULL) {
|
| 285 |
+
xmlC14NErrParam(NULL);
|
| 286 |
+
return;
|
| 287 |
+
}
|
| 288 |
+
if(cur->nsTab != NULL) {
|
| 289 |
+
memset(cur->nsTab, 0, cur->nsMax * sizeof(xmlNsPtr));
|
| 290 |
+
xmlFree(cur->nsTab);
|
| 291 |
+
}
|
| 292 |
+
if(cur->nodeTab != NULL) {
|
| 293 |
+
memset(cur->nodeTab, 0, cur->nsMax * sizeof(xmlNodePtr));
|
| 294 |
+
xmlFree(cur->nodeTab);
|
| 295 |
+
}
|
| 296 |
+
memset(cur, 0, sizeof(xmlC14NVisibleNsStack));
|
| 297 |
+
xmlFree(cur);
|
| 298 |
+
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
static int
|
| 302 |
+
xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr node) {
|
| 303 |
+
if((cur == NULL) ||
|
| 304 |
+
((cur->nsTab == NULL) && (cur->nodeTab != NULL)) ||
|
| 305 |
+
((cur->nsTab != NULL) && (cur->nodeTab == NULL)))
|
| 306 |
+
return (1);
|
| 307 |
+
|
| 308 |
+
if (cur->nsMax <= cur->nsCurEnd) {
|
| 309 |
+
xmlNsPtr *tmp1;
|
| 310 |
+
xmlNodePtr *tmp2;
|
| 311 |
+
int newSize;
|
| 312 |
+
|
| 313 |
+
newSize = xmlGrowCapacity(cur->nsMax,
|
| 314 |
+
sizeof(tmp1[0]) + sizeof(tmp2[0]),
|
| 315 |
+
XML_NAMESPACES_DEFAULT, XML_MAX_ITEMS);
|
| 316 |
+
|
| 317 |
+
tmp1 = xmlRealloc(cur->nsTab, newSize * sizeof(tmp1[0]));
|
| 318 |
+
if (tmp1 == NULL)
|
| 319 |
+
return (-1);
|
| 320 |
+
cur->nsTab = tmp1;
|
| 321 |
+
|
| 322 |
+
tmp2 = xmlRealloc(cur->nodeTab, newSize * sizeof(tmp2[0]));
|
| 323 |
+
if (tmp2 == NULL)
|
| 324 |
+
return (-1);
|
| 325 |
+
cur->nodeTab = tmp2;
|
| 326 |
+
|
| 327 |
+
cur->nsMax = newSize;
|
| 328 |
+
}
|
| 329 |
+
cur->nsTab[cur->nsCurEnd] = ns;
|
| 330 |
+
cur->nodeTab[cur->nsCurEnd] = node;
|
| 331 |
+
|
| 332 |
+
++cur->nsCurEnd;
|
| 333 |
+
|
| 334 |
+
return (0);
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
static void
|
| 338 |
+
xmlC14NVisibleNsStackSave(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) {
|
| 339 |
+
if((cur == NULL) || (state == NULL)) {
|
| 340 |
+
xmlC14NErrParam(NULL);
|
| 341 |
+
return;
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
state->nsCurEnd = cur->nsCurEnd;
|
| 345 |
+
state->nsPrevStart = cur->nsPrevStart;
|
| 346 |
+
state->nsPrevEnd = cur->nsPrevEnd;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
static void
|
| 350 |
+
xmlC14NVisibleNsStackRestore(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) {
|
| 351 |
+
if((cur == NULL) || (state == NULL)) {
|
| 352 |
+
xmlC14NErrParam(NULL);
|
| 353 |
+
return;
|
| 354 |
+
}
|
| 355 |
+
cur->nsCurEnd = state->nsCurEnd;
|
| 356 |
+
cur->nsPrevStart = state->nsPrevStart;
|
| 357 |
+
cur->nsPrevEnd = state->nsPrevEnd;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
static void
|
| 361 |
+
xmlC14NVisibleNsStackShift(xmlC14NVisibleNsStackPtr cur) {
|
| 362 |
+
if(cur == NULL) {
|
| 363 |
+
xmlC14NErrParam(NULL);
|
| 364 |
+
return;
|
| 365 |
+
}
|
| 366 |
+
cur->nsPrevStart = cur->nsPrevEnd;
|
| 367 |
+
cur->nsPrevEnd = cur->nsCurEnd;
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
static int
|
| 371 |
+
xmlC14NStrEqual(const xmlChar *str1, const xmlChar *str2) {
|
| 372 |
+
if (str1 == str2) return(1);
|
| 373 |
+
if (str1 == NULL) return((*str2) == '\0');
|
| 374 |
+
if (str2 == NULL) return((*str1) == '\0');
|
| 375 |
+
do {
|
| 376 |
+
if (*str1++ != *str2) return(0);
|
| 377 |
+
} while (*str2++);
|
| 378 |
+
return(1);
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
/**
|
| 382 |
+
* Checks whether the given namespace was already rendered or not
|
| 383 |
+
*
|
| 384 |
+
* @param cur the visible stack
|
| 385 |
+
* @param ns the namespace to check
|
| 386 |
+
* @returns 1 if we already wrote this namespace or 0 otherwise
|
| 387 |
+
*/
|
| 388 |
+
static int
|
| 389 |
+
xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns)
|
| 390 |
+
{
|
| 391 |
+
int i;
|
| 392 |
+
const xmlChar *prefix;
|
| 393 |
+
const xmlChar *href;
|
| 394 |
+
int has_empty_ns;
|
| 395 |
+
|
| 396 |
+
if(cur == NULL) {
|
| 397 |
+
xmlC14NErrParam(NULL);
|
| 398 |
+
return (0);
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
/*
|
| 402 |
+
* if the default namespace xmlns="" is not defined yet then
|
| 403 |
+
* we do not want to print it out
|
| 404 |
+
*/
|
| 405 |
+
prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix;
|
| 406 |
+
href = ((ns == NULL) || (ns->href == NULL)) ? BAD_CAST "" : ns->href;
|
| 407 |
+
has_empty_ns = (xmlC14NStrEqual(prefix, NULL) && xmlC14NStrEqual(href, NULL));
|
| 408 |
+
|
| 409 |
+
if (cur->nsTab != NULL) {
|
| 410 |
+
int start = (has_empty_ns) ? 0 : cur->nsPrevStart;
|
| 411 |
+
for (i = cur->nsCurEnd - 1; i >= start; --i) {
|
| 412 |
+
xmlNsPtr ns1 = cur->nsTab[i];
|
| 413 |
+
|
| 414 |
+
if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) {
|
| 415 |
+
return(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL));
|
| 416 |
+
}
|
| 417 |
+
}
|
| 418 |
+
}
|
| 419 |
+
return(has_empty_ns);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
static int
|
| 423 |
+
xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx) {
|
| 424 |
+
int i;
|
| 425 |
+
const xmlChar *prefix;
|
| 426 |
+
const xmlChar *href;
|
| 427 |
+
int has_empty_ns;
|
| 428 |
+
|
| 429 |
+
if(cur == NULL) {
|
| 430 |
+
xmlC14NErrParam(ctx);
|
| 431 |
+
return (0);
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
/*
|
| 435 |
+
* if the default namespace xmlns="" is not defined yet then
|
| 436 |
+
* we do not want to print it out
|
| 437 |
+
*/
|
| 438 |
+
prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix;
|
| 439 |
+
href = ((ns == NULL) || (ns->href == NULL)) ? BAD_CAST "" : ns->href;
|
| 440 |
+
has_empty_ns = (xmlC14NStrEqual(prefix, NULL) && xmlC14NStrEqual(href, NULL));
|
| 441 |
+
|
| 442 |
+
if (cur->nsTab != NULL) {
|
| 443 |
+
int start = 0;
|
| 444 |
+
for (i = cur->nsCurEnd - 1; i >= start; --i) {
|
| 445 |
+
xmlNsPtr ns1 = cur->nsTab[i];
|
| 446 |
+
|
| 447 |
+
if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) {
|
| 448 |
+
if(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL)) {
|
| 449 |
+
return(xmlC14NIsVisible(ctx, ns1, cur->nodeTab[i]));
|
| 450 |
+
} else {
|
| 451 |
+
return(0);
|
| 452 |
+
}
|
| 453 |
+
}
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
+
return(has_empty_ns);
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
/**
|
| 463 |
+
* Checks whether the given namespace is a default "xml:" namespace
|
| 464 |
+
* with href="http://www.w3.org/XML/1998/namespace"
|
| 465 |
+
*
|
| 466 |
+
* @param ns the namespace to check
|
| 467 |
+
* @returns 1 if the node is default or 0 otherwise
|
| 468 |
+
*/
|
| 469 |
+
|
| 470 |
+
/* todo: make it a define? */
|
| 471 |
+
static int
|
| 472 |
+
xmlC14NIsXmlNs(xmlNsPtr ns)
|
| 473 |
+
{
|
| 474 |
+
return ((ns != NULL) &&
|
| 475 |
+
(xmlStrEqual(ns->prefix, BAD_CAST "xml")) &&
|
| 476 |
+
(xmlStrEqual(ns->href, XML_XML_NAMESPACE)));
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
/**
|
| 481 |
+
* Compares the namespaces by names (prefixes).
|
| 482 |
+
*
|
| 483 |
+
* @param data1 the pointer to first namespace
|
| 484 |
+
* @param data2 the pointer to second namespace
|
| 485 |
+
* @returns -1 if ns1 < ns2, 0 if ns1 == ns2 or 1 if ns1 > ns2.
|
| 486 |
+
*/
|
| 487 |
+
static int
|
| 488 |
+
xmlC14NNsCompare(const void *data1, const void *data2)
|
| 489 |
+
{
|
| 490 |
+
const xmlNs *ns1 = data1;
|
| 491 |
+
const xmlNs *ns2 = data2;
|
| 492 |
+
if (ns1 == ns2)
|
| 493 |
+
return (0);
|
| 494 |
+
if (ns1 == NULL)
|
| 495 |
+
return (-1);
|
| 496 |
+
if (ns2 == NULL)
|
| 497 |
+
return (1);
|
| 498 |
+
|
| 499 |
+
return (xmlStrcmp(ns1->prefix, ns2->prefix));
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
/**
|
| 504 |
+
* Prints the given namespace to the output buffer from C14N context.
|
| 505 |
+
*
|
| 506 |
+
* @param ns the pointer to namespace
|
| 507 |
+
* @param ctx the C14N context
|
| 508 |
+
* @returns 1 on success or 0 on fail.
|
| 509 |
+
*/
|
| 510 |
+
static int
|
| 511 |
+
xmlC14NPrintNamespaces(const xmlNs *ns, xmlC14NCtxPtr ctx)
|
| 512 |
+
{
|
| 513 |
+
|
| 514 |
+
if ((ns == NULL) || (ctx == NULL)) {
|
| 515 |
+
xmlC14NErrParam(ctx);
|
| 516 |
+
return 0;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
if (ns->prefix != NULL) {
|
| 520 |
+
xmlOutputBufferWriteString(ctx->buf, " xmlns:");
|
| 521 |
+
xmlOutputBufferWriteString(ctx->buf, (const char *) ns->prefix);
|
| 522 |
+
xmlOutputBufferWriteString(ctx->buf, "=");
|
| 523 |
+
} else {
|
| 524 |
+
xmlOutputBufferWriteString(ctx->buf, " xmlns=");
|
| 525 |
+
}
|
| 526 |
+
if(ns->href != NULL) {
|
| 527 |
+
xmlOutputBufferWriteQuotedString(ctx->buf, ns->href);
|
| 528 |
+
} else {
|
| 529 |
+
xmlOutputBufferWriteString(ctx->buf, "\"\"");
|
| 530 |
+
}
|
| 531 |
+
return (1);
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
static int
|
| 535 |
+
xmlC14NPrintNamespacesWalker(const void *ns, void *ctx) {
|
| 536 |
+
return xmlC14NPrintNamespaces(ns, ctx);
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
/**
|
| 540 |
+
* Prints out canonical namespace axis of the current node to the
|
| 541 |
+
* buffer from C14N context as follows
|
| 542 |
+
*
|
| 543 |
+
* Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
|
| 544 |
+
*
|
| 545 |
+
* Namespace Axis
|
| 546 |
+
* Consider a list L containing only namespace nodes in the
|
| 547 |
+
* axis and in the node-set in lexicographic order (ascending). To begin
|
| 548 |
+
* processing L, if the first node is not the default namespace node (a node
|
| 549 |
+
* with no namespace URI and no local name), then generate a space followed
|
| 550 |
+
* by xmlns="" if and only if the following conditions are met:
|
| 551 |
+
* - the element E that owns the axis is in the node-set
|
| 552 |
+
* - The nearest ancestor element of E in the node-set has a default
|
| 553 |
+
* namespace node in the node-set (default namespace nodes always
|
| 554 |
+
* have non-empty values in XPath)
|
| 555 |
+
* The latter condition eliminates unnecessary occurrences of xmlns="" in
|
| 556 |
+
* the canonical form since an element only receives an xmlns="" if its
|
| 557 |
+
* default namespace is empty and if it has an immediate parent in the
|
| 558 |
+
* canonical form that has a non-empty default namespace. To finish
|
| 559 |
+
* processing L, simply process every namespace node in L, except omit
|
| 560 |
+
* namespace node with local name xml, which defines the xml prefix,
|
| 561 |
+
* if its string value is http://www.w3.org/XML/1998/namespace.
|
| 562 |
+
*
|
| 563 |
+
* Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n)
|
| 564 |
+
* Canonical XML applied to a document subset requires the search of the
|
| 565 |
+
* ancestor nodes of each orphan element node for attributes in the xml
|
| 566 |
+
* namespace, such as xml:lang and xml:space. These are copied into the
|
| 567 |
+
* element node except if a declaration of the same attribute is already
|
| 568 |
+
* in the attribute axis of the element (whether or not it is included in
|
| 569 |
+
* the document subset). This search and copying are omitted from the
|
| 570 |
+
* Exclusive XML Canonicalization method.
|
| 571 |
+
*
|
| 572 |
+
* @param ctx the C14N context
|
| 573 |
+
* @param cur the current node
|
| 574 |
+
* @param visible the visibility of node
|
| 575 |
+
* @returns 0 on success or -1 on fail.
|
| 576 |
+
*/
|
| 577 |
+
static int
|
| 578 |
+
xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
|
| 579 |
+
{
|
| 580 |
+
xmlNodePtr n;
|
| 581 |
+
xmlNsPtr ns, tmp;
|
| 582 |
+
xmlListPtr list;
|
| 583 |
+
int already_rendered;
|
| 584 |
+
int has_empty_ns = 0;
|
| 585 |
+
|
| 586 |
+
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
|
| 587 |
+
xmlC14NErrParam(ctx);
|
| 588 |
+
return (-1);
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
/*
|
| 592 |
+
* Create a sorted list to store element namespaces
|
| 593 |
+
*/
|
| 594 |
+
list = xmlListCreate(NULL, xmlC14NNsCompare);
|
| 595 |
+
if (list == NULL) {
|
| 596 |
+
xmlC14NErrMemory(ctx);
|
| 597 |
+
return (-1);
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
/* check all namespaces */
|
| 601 |
+
for(n = cur; n != NULL; n = n->parent) {
|
| 602 |
+
for(ns = n->nsDef; ns != NULL; ns = ns->next) {
|
| 603 |
+
tmp = xmlSearchNs(cur->doc, cur, ns->prefix);
|
| 604 |
+
|
| 605 |
+
if((tmp == ns) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) {
|
| 606 |
+
already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns);
|
| 607 |
+
if(visible) {
|
| 608 |
+
if (xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur) < 0) {
|
| 609 |
+
xmlC14NErrMemory(ctx);
|
| 610 |
+
goto error;
|
| 611 |
+
}
|
| 612 |
+
}
|
| 613 |
+
if(!already_rendered) {
|
| 614 |
+
xmlListInsert(list, ns);
|
| 615 |
+
}
|
| 616 |
+
if(xmlStrlen(ns->prefix) == 0) {
|
| 617 |
+
has_empty_ns = 1;
|
| 618 |
+
}
|
| 619 |
+
}
|
| 620 |
+
}
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
/**
|
| 624 |
+
* if the first node is not the default namespace node (a node with no
|
| 625 |
+
* namespace URI and no local name), then generate a space followed by
|
| 626 |
+
* xmlns="" if and only if the following conditions are met:
|
| 627 |
+
* - the element E that owns the axis is in the node-set
|
| 628 |
+
* - the nearest ancestor element of E in the node-set has a default
|
| 629 |
+
* namespace node in the node-set (default namespace nodes always
|
| 630 |
+
* have non-empty values in XPath)
|
| 631 |
+
*/
|
| 632 |
+
if(visible && !has_empty_ns) {
|
| 633 |
+
xmlNs ns_default;
|
| 634 |
+
|
| 635 |
+
memset(&ns_default, 0, sizeof(ns_default));
|
| 636 |
+
if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) {
|
| 637 |
+
xmlC14NPrintNamespaces(&ns_default, ctx);
|
| 638 |
+
}
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
|
| 642 |
+
/*
|
| 643 |
+
* print out all elements from list
|
| 644 |
+
*/
|
| 645 |
+
xmlListWalk(list, xmlC14NPrintNamespacesWalker, (void *) ctx);
|
| 646 |
+
|
| 647 |
+
/*
|
| 648 |
+
* Cleanup
|
| 649 |
+
*/
|
| 650 |
+
error:
|
| 651 |
+
xmlListDelete(list);
|
| 652 |
+
return (0);
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
|
| 656 |
+
/**
|
| 657 |
+
* Prints out exclusive canonical namespace axis of the current node to the
|
| 658 |
+
* buffer from C14N context as follows
|
| 659 |
+
*
|
| 660 |
+
* Exclusive XML Canonicalization
|
| 661 |
+
* http://www.w3.org/TR/xml-exc-c14n
|
| 662 |
+
*
|
| 663 |
+
* If the element node is in the XPath subset then output the node in
|
| 664 |
+
* accordance with Canonical XML except for namespace nodes which are
|
| 665 |
+
* rendered as follows:
|
| 666 |
+
*
|
| 667 |
+
* 1. Render each namespace node iff:
|
| 668 |
+
* * it is visibly utilized by the immediate parent element or one of
|
| 669 |
+
* its attributes, or is present in InclusiveNamespaces PrefixList, and
|
| 670 |
+
* * its prefix and value do not appear in ns_rendered. ns_rendered is
|
| 671 |
+
* obtained by popping the state stack in order to obtain a list of
|
| 672 |
+
* prefixes and their values which have already been rendered by
|
| 673 |
+
* an output ancestor of the namespace node's parent element.
|
| 674 |
+
* 2. Append the rendered namespace node to the list ns_rendered of namespace
|
| 675 |
+
* nodes rendered by output ancestors. Push ns_rendered on state stack and
|
| 676 |
+
* recurse.
|
| 677 |
+
* 3. After the recursion returns, pop thestate stack.
|
| 678 |
+
*
|
| 679 |
+
*
|
| 680 |
+
* @param ctx the C14N context
|
| 681 |
+
* @param cur the current node
|
| 682 |
+
* @param visible the visibility of node
|
| 683 |
+
* @returns 0 on success or -1 on fail.
|
| 684 |
+
*/
|
| 685 |
+
static int
|
| 686 |
+
xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
|
| 687 |
+
{
|
| 688 |
+
xmlNsPtr ns;
|
| 689 |
+
xmlListPtr list;
|
| 690 |
+
xmlAttrPtr attr;
|
| 691 |
+
int already_rendered;
|
| 692 |
+
int has_empty_ns = 0;
|
| 693 |
+
int has_visibly_utilized_empty_ns = 0;
|
| 694 |
+
int has_empty_ns_in_inclusive_list = 0;
|
| 695 |
+
|
| 696 |
+
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
|
| 697 |
+
xmlC14NErrParam(ctx);
|
| 698 |
+
return (-1);
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
if(!xmlC14NIsExclusive(ctx)) {
|
| 702 |
+
xmlC14NErrParam(ctx);
|
| 703 |
+
return (-1);
|
| 704 |
+
|
| 705 |
+
}
|
| 706 |
+
|
| 707 |
+
/*
|
| 708 |
+
* Create a sorted list to store element namespaces
|
| 709 |
+
*/
|
| 710 |
+
list = xmlListCreate(NULL, xmlC14NNsCompare);
|
| 711 |
+
if (list == NULL) {
|
| 712 |
+
xmlC14NErrMemory(ctx);
|
| 713 |
+
return (-1);
|
| 714 |
+
}
|
| 715 |
+
|
| 716 |
+
/*
|
| 717 |
+
* process inclusive namespaces:
|
| 718 |
+
* All namespace nodes appearing on inclusive ns list are
|
| 719 |
+
* handled as provided in Canonical XML
|
| 720 |
+
*/
|
| 721 |
+
if(ctx->inclusive_ns_prefixes != NULL) {
|
| 722 |
+
xmlChar *prefix;
|
| 723 |
+
int i;
|
| 724 |
+
|
| 725 |
+
for (i = 0; ctx->inclusive_ns_prefixes[i] != NULL; ++i) {
|
| 726 |
+
prefix = ctx->inclusive_ns_prefixes[i];
|
| 727 |
+
/*
|
| 728 |
+
* Special values for namespace with empty prefix
|
| 729 |
+
*/
|
| 730 |
+
if (xmlStrEqual(prefix, BAD_CAST "#default")
|
| 731 |
+
|| xmlStrEqual(prefix, BAD_CAST "")) {
|
| 732 |
+
prefix = NULL;
|
| 733 |
+
has_empty_ns_in_inclusive_list = 1;
|
| 734 |
+
}
|
| 735 |
+
|
| 736 |
+
ns = xmlSearchNs(cur->doc, cur, prefix);
|
| 737 |
+
if((ns != NULL) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) {
|
| 738 |
+
already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns);
|
| 739 |
+
if(visible) {
|
| 740 |
+
if (xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur) < 0) {
|
| 741 |
+
xmlC14NErrMemory(ctx);
|
| 742 |
+
goto error;
|
| 743 |
+
}
|
| 744 |
+
}
|
| 745 |
+
if(!already_rendered) {
|
| 746 |
+
xmlListInsert(list, ns);
|
| 747 |
+
}
|
| 748 |
+
if(xmlStrlen(ns->prefix) == 0) {
|
| 749 |
+
has_empty_ns = 1;
|
| 750 |
+
}
|
| 751 |
+
}
|
| 752 |
+
}
|
| 753 |
+
}
|
| 754 |
+
|
| 755 |
+
/* add node namespace */
|
| 756 |
+
if(cur->ns != NULL) {
|
| 757 |
+
ns = cur->ns;
|
| 758 |
+
} else {
|
| 759 |
+
ns = xmlSearchNs(cur->doc, cur, NULL);
|
| 760 |
+
has_visibly_utilized_empty_ns = 1;
|
| 761 |
+
}
|
| 762 |
+
if((ns != NULL) && !xmlC14NIsXmlNs(ns)) {
|
| 763 |
+
if(visible && xmlC14NIsVisible(ctx, ns, cur)) {
|
| 764 |
+
if(!xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, ns, ctx)) {
|
| 765 |
+
xmlListInsert(list, ns);
|
| 766 |
+
}
|
| 767 |
+
}
|
| 768 |
+
if(visible) {
|
| 769 |
+
if (xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur) < 0) {
|
| 770 |
+
xmlC14NErrMemory(ctx);
|
| 771 |
+
goto error;
|
| 772 |
+
}
|
| 773 |
+
}
|
| 774 |
+
if(xmlStrlen(ns->prefix) == 0) {
|
| 775 |
+
has_empty_ns = 1;
|
| 776 |
+
}
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
|
| 780 |
+
/* add attributes */
|
| 781 |
+
for(attr = cur->properties; attr != NULL; attr = attr->next) {
|
| 782 |
+
/*
|
| 783 |
+
* we need to check that attribute is visible and has non
|
| 784 |
+
* default namespace (XML Namespaces: "default namespaces
|
| 785 |
+
* do not apply directly to attributes")
|
| 786 |
+
*/
|
| 787 |
+
if((attr->ns != NULL) && !xmlC14NIsXmlNs(attr->ns) && xmlC14NIsVisible(ctx, attr, cur)) {
|
| 788 |
+
already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, attr->ns, ctx);
|
| 789 |
+
if (xmlC14NVisibleNsStackAdd(ctx->ns_rendered, attr->ns, cur) < 0) {
|
| 790 |
+
xmlC14NErrMemory(ctx);
|
| 791 |
+
goto error;
|
| 792 |
+
}
|
| 793 |
+
if(!already_rendered && visible) {
|
| 794 |
+
xmlListInsert(list, attr->ns);
|
| 795 |
+
}
|
| 796 |
+
if(xmlStrlen(attr->ns->prefix) == 0) {
|
| 797 |
+
has_empty_ns = 1;
|
| 798 |
+
}
|
| 799 |
+
} else if((attr->ns != NULL) && (xmlStrlen(attr->ns->prefix) == 0) && (xmlStrlen(attr->ns->href) == 0)) {
|
| 800 |
+
has_visibly_utilized_empty_ns = 1;
|
| 801 |
+
}
|
| 802 |
+
}
|
| 803 |
+
|
| 804 |
+
/*
|
| 805 |
+
* Process xmlns=""
|
| 806 |
+
*/
|
| 807 |
+
if(visible && has_visibly_utilized_empty_ns &&
|
| 808 |
+
!has_empty_ns && !has_empty_ns_in_inclusive_list) {
|
| 809 |
+
xmlNs ns_default;
|
| 810 |
+
|
| 811 |
+
memset(&ns_default, 0, sizeof(ns_default));
|
| 812 |
+
|
| 813 |
+
already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default, ctx);
|
| 814 |
+
if(!already_rendered) {
|
| 815 |
+
xmlC14NPrintNamespaces(&ns_default, ctx);
|
| 816 |
+
}
|
| 817 |
+
} else if(visible && !has_empty_ns && has_empty_ns_in_inclusive_list) {
|
| 818 |
+
xmlNs ns_default;
|
| 819 |
+
|
| 820 |
+
memset(&ns_default, 0, sizeof(ns_default));
|
| 821 |
+
if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) {
|
| 822 |
+
xmlC14NPrintNamespaces(&ns_default, ctx);
|
| 823 |
+
}
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
|
| 827 |
+
|
| 828 |
+
/*
|
| 829 |
+
* print out all elements from list
|
| 830 |
+
*/
|
| 831 |
+
xmlListWalk(list, xmlC14NPrintNamespacesWalker, (void *) ctx);
|
| 832 |
+
|
| 833 |
+
/*
|
| 834 |
+
* Cleanup
|
| 835 |
+
*/
|
| 836 |
+
error:
|
| 837 |
+
xmlListDelete(list);
|
| 838 |
+
return (0);
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
|
| 842 |
+
/**
|
| 843 |
+
* Checks whether the given attribute is a default "xml:" namespace
|
| 844 |
+
* with href="http://www.w3.org/XML/1998/namespace"
|
| 845 |
+
*
|
| 846 |
+
* @param attr the attr to check
|
| 847 |
+
* @returns 1 if the node is default or 0 otherwise
|
| 848 |
+
*/
|
| 849 |
+
|
| 850 |
+
/* todo: make it a define? */
|
| 851 |
+
static int
|
| 852 |
+
xmlC14NIsXmlAttr(xmlAttrPtr attr)
|
| 853 |
+
{
|
| 854 |
+
return ((attr->ns != NULL) &&
|
| 855 |
+
(xmlC14NIsXmlNs(attr->ns) != 0));
|
| 856 |
+
}
|
| 857 |
+
|
| 858 |
+
|
| 859 |
+
/**
|
| 860 |
+
* Prints the given attribute to the output buffer from C14N context.
|
| 861 |
+
*
|
| 862 |
+
* @param data1 the pointer tls o first attr
|
| 863 |
+
* @param data2 the pointer to second attr
|
| 864 |
+
* @returns -1 if attr1 < attr2, 0 if attr1 == attr2 or 1 if attr1 > attr2.
|
| 865 |
+
*/
|
| 866 |
+
static int
|
| 867 |
+
xmlC14NAttrsCompare(const void *data1, const void *data2)
|
| 868 |
+
{
|
| 869 |
+
const xmlAttr *attr1 = data1;
|
| 870 |
+
const xmlAttr *attr2 = data2;
|
| 871 |
+
int ret = 0;
|
| 872 |
+
|
| 873 |
+
/*
|
| 874 |
+
* Simple cases
|
| 875 |
+
*/
|
| 876 |
+
if (attr1 == attr2)
|
| 877 |
+
return (0);
|
| 878 |
+
if (attr1 == NULL)
|
| 879 |
+
return (-1);
|
| 880 |
+
if (attr2 == NULL)
|
| 881 |
+
return (1);
|
| 882 |
+
if (attr1->ns == attr2->ns) {
|
| 883 |
+
return (xmlStrcmp(attr1->name, attr2->name));
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
/*
|
| 887 |
+
* Attributes in the default namespace are first
|
| 888 |
+
* because the default namespace is not applied to
|
| 889 |
+
* unqualified attributes
|
| 890 |
+
*/
|
| 891 |
+
if (attr1->ns == NULL)
|
| 892 |
+
return (-1);
|
| 893 |
+
if (attr2->ns == NULL)
|
| 894 |
+
return (1);
|
| 895 |
+
if (attr1->ns->prefix == NULL)
|
| 896 |
+
return (-1);
|
| 897 |
+
if (attr2->ns->prefix == NULL)
|
| 898 |
+
return (1);
|
| 899 |
+
|
| 900 |
+
ret = xmlStrcmp(attr1->ns->href, attr2->ns->href);
|
| 901 |
+
if (ret == 0) {
|
| 902 |
+
ret = xmlStrcmp(attr1->name, attr2->name);
|
| 903 |
+
}
|
| 904 |
+
return (ret);
|
| 905 |
+
}
|
| 906 |
+
|
| 907 |
+
|
| 908 |
+
/**
|
| 909 |
+
* Prints out canonical attribute urrent node to the
|
| 910 |
+
* buffer from C14N context as follows
|
| 911 |
+
*
|
| 912 |
+
* Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
|
| 913 |
+
*
|
| 914 |
+
* @param data the pointer to attr
|
| 915 |
+
* @param user the C14N context
|
| 916 |
+
* @returns 1 on success or 0 on fail.
|
| 917 |
+
*/
|
| 918 |
+
static int
|
| 919 |
+
xmlC14NPrintAttrs(const void *data, void *user)
|
| 920 |
+
{
|
| 921 |
+
const xmlAttr *attr = data;
|
| 922 |
+
xmlC14NCtxPtr ctx = (xmlC14NCtxPtr) user;
|
| 923 |
+
xmlChar *value;
|
| 924 |
+
xmlChar *buffer;
|
| 925 |
+
|
| 926 |
+
if ((attr == NULL) || (ctx == NULL)) {
|
| 927 |
+
xmlC14NErrParam(ctx);
|
| 928 |
+
return (0);
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
xmlOutputBufferWriteString(ctx->buf, " ");
|
| 932 |
+
if (attr->ns != NULL && xmlStrlen(attr->ns->prefix) > 0) {
|
| 933 |
+
xmlOutputBufferWriteString(ctx->buf,
|
| 934 |
+
(const char *) attr->ns->prefix);
|
| 935 |
+
xmlOutputBufferWriteString(ctx->buf, ":");
|
| 936 |
+
}
|
| 937 |
+
xmlOutputBufferWriteString(ctx->buf, (const char *) attr->name);
|
| 938 |
+
xmlOutputBufferWriteString(ctx->buf, "=\"");
|
| 939 |
+
|
| 940 |
+
value = xmlNodeListGetString(ctx->doc, attr->children, 1);
|
| 941 |
+
/* todo: should we log an error if value==NULL ? */
|
| 942 |
+
if (value != NULL) {
|
| 943 |
+
buffer = xmlC11NNormalizeAttr(value);
|
| 944 |
+
xmlFree(value);
|
| 945 |
+
if (buffer != NULL) {
|
| 946 |
+
xmlOutputBufferWriteString(ctx->buf, (const char *) buffer);
|
| 947 |
+
xmlFree(buffer);
|
| 948 |
+
} else {
|
| 949 |
+
xmlC14NErrMemory(ctx);
|
| 950 |
+
return (0);
|
| 951 |
+
}
|
| 952 |
+
}
|
| 953 |
+
xmlOutputBufferWriteString(ctx->buf, "\"");
|
| 954 |
+
return (1);
|
| 955 |
+
}
|
| 956 |
+
|
| 957 |
+
/**
|
| 958 |
+
* Finds an attribute in a hidden parent node.
|
| 959 |
+
*
|
| 960 |
+
* @returns a pointer to the attribute node (if found) or NULL otherwise.
|
| 961 |
+
*/
|
| 962 |
+
static xmlAttrPtr
|
| 963 |
+
xmlC14NFindHiddenParentAttr(xmlC14NCtxPtr ctx, xmlNodePtr cur, const xmlChar * name, const xmlChar * ns)
|
| 964 |
+
{
|
| 965 |
+
xmlAttrPtr res;
|
| 966 |
+
while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) {
|
| 967 |
+
res = xmlHasNsProp(cur, name, ns);
|
| 968 |
+
if(res != NULL) {
|
| 969 |
+
return res;
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
cur = cur->parent;
|
| 973 |
+
}
|
| 974 |
+
|
| 975 |
+
return NULL;
|
| 976 |
+
}
|
| 977 |
+
|
| 978 |
+
/**
|
| 979 |
+
* Fixes up the xml:base attribute
|
| 980 |
+
*
|
| 981 |
+
* @returns the newly created attribute or NULL
|
| 982 |
+
*/
|
| 983 |
+
static xmlAttrPtr
|
| 984 |
+
xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr)
|
| 985 |
+
{
|
| 986 |
+
xmlChar * res = NULL;
|
| 987 |
+
xmlNodePtr cur;
|
| 988 |
+
xmlAttrPtr attr;
|
| 989 |
+
xmlChar * tmp_str;
|
| 990 |
+
xmlChar * tmp_str2;
|
| 991 |
+
int tmp_str_len;
|
| 992 |
+
|
| 993 |
+
if ((ctx == NULL) || (xml_base_attr == NULL) || (xml_base_attr->parent == NULL)) {
|
| 994 |
+
xmlC14NErrParam(ctx);
|
| 995 |
+
return (NULL);
|
| 996 |
+
}
|
| 997 |
+
|
| 998 |
+
/* start from current value */
|
| 999 |
+
res = xmlNodeListGetString(ctx->doc, xml_base_attr->children, 1);
|
| 1000 |
+
if(res == NULL) {
|
| 1001 |
+
xmlC14NErrMemory(ctx);
|
| 1002 |
+
return (NULL);
|
| 1003 |
+
}
|
| 1004 |
+
|
| 1005 |
+
/* go up the stack until we find a node that we rendered already */
|
| 1006 |
+
cur = xml_base_attr->parent->parent;
|
| 1007 |
+
while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) {
|
| 1008 |
+
int code;
|
| 1009 |
+
|
| 1010 |
+
attr = xmlHasNsProp(cur, BAD_CAST "base", XML_XML_NAMESPACE);
|
| 1011 |
+
if(attr != NULL) {
|
| 1012 |
+
/* get attr value */
|
| 1013 |
+
tmp_str = xmlNodeListGetString(ctx->doc, attr->children, 1);
|
| 1014 |
+
if(tmp_str == NULL) {
|
| 1015 |
+
xmlFree(res);
|
| 1016 |
+
|
| 1017 |
+
xmlC14NErrMemory(ctx);
|
| 1018 |
+
return (NULL);
|
| 1019 |
+
}
|
| 1020 |
+
|
| 1021 |
+
/* we need to add '/' if our current base uri ends with '..' or '.'
|
| 1022 |
+
to ensure that we are forced to go "up" all the time */
|
| 1023 |
+
tmp_str_len = xmlStrlen(tmp_str);
|
| 1024 |
+
if(tmp_str_len > 1 && tmp_str[tmp_str_len - 2] == '.') {
|
| 1025 |
+
tmp_str2 = xmlStrcat(tmp_str, BAD_CAST "/");
|
| 1026 |
+
if(tmp_str2 == NULL) {
|
| 1027 |
+
xmlFree(tmp_str);
|
| 1028 |
+
xmlFree(res);
|
| 1029 |
+
|
| 1030 |
+
xmlC14NErrMemory(ctx);
|
| 1031 |
+
return (NULL);
|
| 1032 |
+
}
|
| 1033 |
+
|
| 1034 |
+
tmp_str = tmp_str2;
|
| 1035 |
+
}
|
| 1036 |
+
|
| 1037 |
+
/* build uri */
|
| 1038 |
+
code = xmlBuildURISafe(res, tmp_str, &tmp_str2);
|
| 1039 |
+
if (code != 0) {
|
| 1040 |
+
xmlFree(tmp_str);
|
| 1041 |
+
xmlFree(res);
|
| 1042 |
+
|
| 1043 |
+
if (code < 0)
|
| 1044 |
+
xmlC14NErrMemory(ctx);
|
| 1045 |
+
else
|
| 1046 |
+
xmlC14NErr(ctx, cur, XML_ERR_INVALID_URI,
|
| 1047 |
+
"processing xml:base attribute - "
|
| 1048 |
+
"can't construct uri");
|
| 1049 |
+
return (NULL);
|
| 1050 |
+
}
|
| 1051 |
+
|
| 1052 |
+
/* cleanup and set the new res */
|
| 1053 |
+
xmlFree(tmp_str);
|
| 1054 |
+
xmlFree(res);
|
| 1055 |
+
res = tmp_str2;
|
| 1056 |
+
}
|
| 1057 |
+
|
| 1058 |
+
/* next */
|
| 1059 |
+
cur = cur->parent;
|
| 1060 |
+
}
|
| 1061 |
+
|
| 1062 |
+
/* check if result uri is empty or not */
|
| 1063 |
+
if((res == NULL) || xmlStrEqual(res, BAD_CAST "")) {
|
| 1064 |
+
xmlFree(res);
|
| 1065 |
+
return (NULL);
|
| 1066 |
+
}
|
| 1067 |
+
|
| 1068 |
+
/* create and return the new attribute node */
|
| 1069 |
+
attr = xmlNewNsProp(NULL, xml_base_attr->ns, BAD_CAST "base", res);
|
| 1070 |
+
if(attr == NULL) {
|
| 1071 |
+
xmlFree(res);
|
| 1072 |
+
|
| 1073 |
+
xmlC14NErrMemory(ctx);
|
| 1074 |
+
return (NULL);
|
| 1075 |
+
}
|
| 1076 |
+
|
| 1077 |
+
/* done */
|
| 1078 |
+
xmlFree(res);
|
| 1079 |
+
return (attr);
|
| 1080 |
+
}
|
| 1081 |
+
|
| 1082 |
+
/**
|
| 1083 |
+
* Prints out canonical attribute axis of the current node to the
|
| 1084 |
+
* buffer from C14N context as follows
|
| 1085 |
+
*
|
| 1086 |
+
* Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
|
| 1087 |
+
*
|
| 1088 |
+
* Attribute Axis
|
| 1089 |
+
* In lexicographic order (ascending), process each node that
|
| 1090 |
+
* is in the element's attribute axis and in the node-set.
|
| 1091 |
+
*
|
| 1092 |
+
* The processing of an element node E MUST be modified slightly
|
| 1093 |
+
* when an XPath node-set is given as input and the element's
|
| 1094 |
+
* parent is omitted from the node-set.
|
| 1095 |
+
*
|
| 1096 |
+
*
|
| 1097 |
+
* Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n)
|
| 1098 |
+
*
|
| 1099 |
+
* Canonical XML applied to a document subset requires the search of the
|
| 1100 |
+
* ancestor nodes of each orphan element node for attributes in the xml
|
| 1101 |
+
* namespace, such as xml:lang and xml:space. These are copied into the
|
| 1102 |
+
* element node except if a declaration of the same attribute is already
|
| 1103 |
+
* in the attribute axis of the element (whether or not it is included in
|
| 1104 |
+
* the document subset). This search and copying are omitted from the
|
| 1105 |
+
* Exclusive XML Canonicalization method.
|
| 1106 |
+
*
|
| 1107 |
+
* @param ctx the C14N context
|
| 1108 |
+
* @param cur the current node
|
| 1109 |
+
* @param parent_visible the visibility of the parent node
|
| 1110 |
+
* @returns 0 on success or -1 on fail.
|
| 1111 |
+
*/
|
| 1112 |
+
static int
|
| 1113 |
+
xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
|
| 1114 |
+
{
|
| 1115 |
+
xmlAttrPtr attr;
|
| 1116 |
+
xmlListPtr list;
|
| 1117 |
+
xmlAttrPtr attrs_to_delete = NULL;
|
| 1118 |
+
|
| 1119 |
+
/* special processing for 1.1 spec */
|
| 1120 |
+
xmlAttrPtr xml_base_attr = NULL;
|
| 1121 |
+
xmlAttrPtr xml_lang_attr = NULL;
|
| 1122 |
+
xmlAttrPtr xml_space_attr = NULL;
|
| 1123 |
+
|
| 1124 |
+
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
|
| 1125 |
+
xmlC14NErrParam(ctx);
|
| 1126 |
+
return (-1);
|
| 1127 |
+
}
|
| 1128 |
+
|
| 1129 |
+
/*
|
| 1130 |
+
* Create a sorted list to store element attributes
|
| 1131 |
+
*/
|
| 1132 |
+
list = xmlListCreate(NULL, xmlC14NAttrsCompare);
|
| 1133 |
+
if (list == NULL) {
|
| 1134 |
+
xmlC14NErrMemory(ctx);
|
| 1135 |
+
return (-1);
|
| 1136 |
+
}
|
| 1137 |
+
|
| 1138 |
+
switch(ctx->mode) {
|
| 1139 |
+
case XML_C14N_1_0:
|
| 1140 |
+
/* The processing of an element node E MUST be modified slightly when an XPath node-set is
|
| 1141 |
+
* given as input and the element's parent is omitted from the node-set. The method for processing
|
| 1142 |
+
* the attribute axis of an element E in the node-set is enhanced. All element nodes along E's
|
| 1143 |
+
* ancestor axis are examined for nearest occurrences of attributes in the xml namespace, such
|
| 1144 |
+
* as xml:lang and xml:space (whether or not they are in the node-set). From this list of attributes,
|
| 1145 |
+
* remove any that are in E's attribute axis (whether or not they are in the node-set). Then,
|
| 1146 |
+
* lexicographically merge this attribute list with the nodes of E's attribute axis that are in
|
| 1147 |
+
* the node-set. The result of visiting the attribute axis is computed by processing the attribute
|
| 1148 |
+
* nodes in this merged attribute list.
|
| 1149 |
+
*/
|
| 1150 |
+
|
| 1151 |
+
/*
|
| 1152 |
+
* Add all visible attributes from current node.
|
| 1153 |
+
*/
|
| 1154 |
+
attr = cur->properties;
|
| 1155 |
+
while (attr != NULL) {
|
| 1156 |
+
/* check that attribute is visible */
|
| 1157 |
+
if (xmlC14NIsVisible(ctx, attr, cur)) {
|
| 1158 |
+
xmlListInsert(list, attr);
|
| 1159 |
+
}
|
| 1160 |
+
attr = attr->next;
|
| 1161 |
+
}
|
| 1162 |
+
|
| 1163 |
+
/*
|
| 1164 |
+
* Handle xml attributes
|
| 1165 |
+
*/
|
| 1166 |
+
if (parent_visible && (cur->parent != NULL) &&
|
| 1167 |
+
(!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent)))
|
| 1168 |
+
{
|
| 1169 |
+
xmlNodePtr tmp;
|
| 1170 |
+
|
| 1171 |
+
/*
|
| 1172 |
+
* If XPath node-set is not specified then the parent is always
|
| 1173 |
+
* visible!
|
| 1174 |
+
*/
|
| 1175 |
+
tmp = cur->parent;
|
| 1176 |
+
while (tmp != NULL) {
|
| 1177 |
+
attr = tmp->properties;
|
| 1178 |
+
while (attr != NULL) {
|
| 1179 |
+
if (xmlC14NIsXmlAttr(attr) != 0) {
|
| 1180 |
+
if (xmlListSearch(list, attr) == NULL) {
|
| 1181 |
+
xmlListInsert(list, attr);
|
| 1182 |
+
}
|
| 1183 |
+
}
|
| 1184 |
+
attr = attr->next;
|
| 1185 |
+
}
|
| 1186 |
+
tmp = tmp->parent;
|
| 1187 |
+
}
|
| 1188 |
+
}
|
| 1189 |
+
|
| 1190 |
+
/* done */
|
| 1191 |
+
break;
|
| 1192 |
+
case XML_C14N_EXCLUSIVE_1_0:
|
| 1193 |
+
/* attributes in the XML namespace, such as xml:lang and xml:space
|
| 1194 |
+
* are not imported into orphan nodes of the document subset
|
| 1195 |
+
*/
|
| 1196 |
+
|
| 1197 |
+
/*
|
| 1198 |
+
* Add all visible attributes from current node.
|
| 1199 |
+
*/
|
| 1200 |
+
attr = cur->properties;
|
| 1201 |
+
while (attr != NULL) {
|
| 1202 |
+
/* check that attribute is visible */
|
| 1203 |
+
if (xmlC14NIsVisible(ctx, attr, cur)) {
|
| 1204 |
+
xmlListInsert(list, attr);
|
| 1205 |
+
}
|
| 1206 |
+
attr = attr->next;
|
| 1207 |
+
}
|
| 1208 |
+
|
| 1209 |
+
/* do nothing special for xml attributes */
|
| 1210 |
+
break;
|
| 1211 |
+
case XML_C14N_1_1:
|
| 1212 |
+
/* The processing of an element node E MUST be modified slightly when an XPath node-set is
|
| 1213 |
+
* given as input and some of the element's ancestors are omitted from the node-set.
|
| 1214 |
+
*
|
| 1215 |
+
* Simple inheritable attributes are attributes that have a value that requires at most a simple
|
| 1216 |
+
* redeclaration. This redeclaration is done by supplying a new value in the child axis. The
|
| 1217 |
+
* redeclaration of a simple inheritable attribute A contained in one of E's ancestors is done
|
| 1218 |
+
* by supplying a value to an attribute Ae inside E with the same name. Simple inheritable attributes
|
| 1219 |
+
* are xml:lang and xml:space.
|
| 1220 |
+
*
|
| 1221 |
+
* The method for processing the attribute axis of an element E in the node-set is hence enhanced.
|
| 1222 |
+
* All element nodes along E's ancestor axis are examined for the nearest occurrences of simple
|
| 1223 |
+
* inheritable attributes in the xml namespace, such as xml:lang and xml:space (whether or not they
|
| 1224 |
+
* are in the node-set). From this list of attributes, any simple inheritable attributes that are
|
| 1225 |
+
* already in E's attribute axis (whether or not they are in the node-set) are removed. Then,
|
| 1226 |
+
* lexicographically merge this attribute list with the nodes of E's attribute axis that are in
|
| 1227 |
+
* the node-set. The result of visiting the attribute axis is computed by processing the attribute
|
| 1228 |
+
* nodes in this merged attribute list.
|
| 1229 |
+
*
|
| 1230 |
+
* The xml:id attribute is not a simple inheritable attribute and no processing of these attributes is
|
| 1231 |
+
* performed.
|
| 1232 |
+
*
|
| 1233 |
+
* The xml:base attribute is not a simple inheritable attribute and requires special processing beyond
|
| 1234 |
+
* a simple redeclaration.
|
| 1235 |
+
*
|
| 1236 |
+
* Attributes in the XML namespace other than xml:base, xml:id, xml:lang, and xml:space MUST be processed
|
| 1237 |
+
* as ordinary attributes.
|
| 1238 |
+
*/
|
| 1239 |
+
|
| 1240 |
+
/*
|
| 1241 |
+
* Add all visible attributes from current node.
|
| 1242 |
+
*/
|
| 1243 |
+
attr = cur->properties;
|
| 1244 |
+
while (attr != NULL) {
|
| 1245 |
+
/* special processing for XML attribute kiks in only when we have invisible parents */
|
| 1246 |
+
if ((!parent_visible) || (xmlC14NIsXmlAttr(attr) == 0)) {
|
| 1247 |
+
/* check that attribute is visible */
|
| 1248 |
+
if (xmlC14NIsVisible(ctx, attr, cur)) {
|
| 1249 |
+
xmlListInsert(list, attr);
|
| 1250 |
+
}
|
| 1251 |
+
} else {
|
| 1252 |
+
int matched = 0;
|
| 1253 |
+
|
| 1254 |
+
/* check for simple inheritance attributes */
|
| 1255 |
+
if((!matched) && (xml_lang_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "lang")) {
|
| 1256 |
+
xml_lang_attr = attr;
|
| 1257 |
+
matched = 1;
|
| 1258 |
+
}
|
| 1259 |
+
if((!matched) && (xml_space_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "space")) {
|
| 1260 |
+
xml_space_attr = attr;
|
| 1261 |
+
matched = 1;
|
| 1262 |
+
}
|
| 1263 |
+
|
| 1264 |
+
/* check for base attr */
|
| 1265 |
+
if((!matched) && (xml_base_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "base")) {
|
| 1266 |
+
xml_base_attr = attr;
|
| 1267 |
+
matched = 1;
|
| 1268 |
+
}
|
| 1269 |
+
|
| 1270 |
+
/* otherwise, it is a normal attribute, so just check if it is visible */
|
| 1271 |
+
if((!matched) && xmlC14NIsVisible(ctx, attr, cur)) {
|
| 1272 |
+
xmlListInsert(list, attr);
|
| 1273 |
+
}
|
| 1274 |
+
}
|
| 1275 |
+
|
| 1276 |
+
/* move to the next one */
|
| 1277 |
+
attr = attr->next;
|
| 1278 |
+
}
|
| 1279 |
+
|
| 1280 |
+
/* special processing for XML attribute kiks in only when we have invisible parents */
|
| 1281 |
+
if ((parent_visible)) {
|
| 1282 |
+
|
| 1283 |
+
/* simple inheritance attributes - copy */
|
| 1284 |
+
if(xml_lang_attr == NULL) {
|
| 1285 |
+
xml_lang_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "lang", XML_XML_NAMESPACE);
|
| 1286 |
+
}
|
| 1287 |
+
if(xml_lang_attr != NULL) {
|
| 1288 |
+
xmlListInsert(list, xml_lang_attr);
|
| 1289 |
+
}
|
| 1290 |
+
if(xml_space_attr == NULL) {
|
| 1291 |
+
xml_space_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "space", XML_XML_NAMESPACE);
|
| 1292 |
+
}
|
| 1293 |
+
if(xml_space_attr != NULL) {
|
| 1294 |
+
xmlListInsert(list, xml_space_attr);
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
/* base uri attribute - fix up */
|
| 1298 |
+
if(xml_base_attr == NULL) {
|
| 1299 |
+
/* if we don't have base uri attribute, check if we have a "hidden" one above */
|
| 1300 |
+
xml_base_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "base", XML_XML_NAMESPACE);
|
| 1301 |
+
}
|
| 1302 |
+
if(xml_base_attr != NULL) {
|
| 1303 |
+
xml_base_attr = xmlC14NFixupBaseAttr(ctx, xml_base_attr);
|
| 1304 |
+
if(xml_base_attr != NULL) {
|
| 1305 |
+
xmlListInsert(list, xml_base_attr);
|
| 1306 |
+
|
| 1307 |
+
/* note that we MUST delete returned attr node ourselves! */
|
| 1308 |
+
xml_base_attr->next = attrs_to_delete;
|
| 1309 |
+
attrs_to_delete = xml_base_attr;
|
| 1310 |
+
}
|
| 1311 |
+
}
|
| 1312 |
+
}
|
| 1313 |
+
|
| 1314 |
+
/* done */
|
| 1315 |
+
break;
|
| 1316 |
+
}
|
| 1317 |
+
|
| 1318 |
+
/*
|
| 1319 |
+
* print out all elements from list
|
| 1320 |
+
*/
|
| 1321 |
+
xmlListWalk(list, xmlC14NPrintAttrs, (void *) ctx);
|
| 1322 |
+
|
| 1323 |
+
/*
|
| 1324 |
+
* Cleanup
|
| 1325 |
+
*/
|
| 1326 |
+
xmlFreePropList(attrs_to_delete);
|
| 1327 |
+
xmlListDelete(list);
|
| 1328 |
+
return (0);
|
| 1329 |
+
}
|
| 1330 |
+
|
| 1331 |
+
/**
|
| 1332 |
+
* Checks that current element node has no relative namespaces defined
|
| 1333 |
+
*
|
| 1334 |
+
* @param ctx the C14N context
|
| 1335 |
+
* @param cur the current element node
|
| 1336 |
+
* @returns 0 if the node has no relative namespaces or -1 otherwise.
|
| 1337 |
+
*/
|
| 1338 |
+
static int
|
| 1339 |
+
xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur)
|
| 1340 |
+
{
|
| 1341 |
+
xmlNsPtr ns;
|
| 1342 |
+
|
| 1343 |
+
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
|
| 1344 |
+
xmlC14NErrParam(ctx);
|
| 1345 |
+
return (-1);
|
| 1346 |
+
}
|
| 1347 |
+
|
| 1348 |
+
ns = cur->nsDef;
|
| 1349 |
+
while (ns != NULL) {
|
| 1350 |
+
if (xmlStrlen(ns->href) > 0) {
|
| 1351 |
+
xmlURIPtr uri;
|
| 1352 |
+
int code;
|
| 1353 |
+
|
| 1354 |
+
code = xmlParseURISafe((const char *) ns->href, &uri);
|
| 1355 |
+
if (uri == NULL) {
|
| 1356 |
+
if (code < 0)
|
| 1357 |
+
xmlC14NErrMemory(ctx);
|
| 1358 |
+
else
|
| 1359 |
+
xmlC14NErr(ctx, cur, XML_ERR_INVALID_URI,
|
| 1360 |
+
"parsing namespace uri");
|
| 1361 |
+
return (-1);
|
| 1362 |
+
}
|
| 1363 |
+
if (xmlStrlen((const xmlChar *) uri->scheme) == 0) {
|
| 1364 |
+
xmlC14NErrRelativeNamespace(ctx, uri->scheme);
|
| 1365 |
+
xmlFreeURI(uri);
|
| 1366 |
+
return (-1);
|
| 1367 |
+
}
|
| 1368 |
+
xmlFreeURI(uri);
|
| 1369 |
+
}
|
| 1370 |
+
ns = ns->next;
|
| 1371 |
+
}
|
| 1372 |
+
return (0);
|
| 1373 |
+
}
|
| 1374 |
+
|
| 1375 |
+
/**
|
| 1376 |
+
* Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
|
| 1377 |
+
*
|
| 1378 |
+
* Element Nodes
|
| 1379 |
+
* If the element is not in the node-set, then the result is obtained
|
| 1380 |
+
* by processing the namespace axis, then the attribute axis, then
|
| 1381 |
+
* processing the child nodes of the element that are in the node-set
|
| 1382 |
+
* (in document order). If the element is in the node-set, then the result
|
| 1383 |
+
* is an open angle bracket (<), the element QName, the result of
|
| 1384 |
+
* processing the namespace axis, the result of processing the attribute
|
| 1385 |
+
* axis, a close angle bracket (>), the result of processing the child
|
| 1386 |
+
* nodes of the element that are in the node-set (in document order), an
|
| 1387 |
+
* open angle bracket, a forward slash (/), the element QName, and a close
|
| 1388 |
+
* angle bracket.
|
| 1389 |
+
*
|
| 1390 |
+
* @param ctx the pointer to C14N context object
|
| 1391 |
+
* @param cur the node to process
|
| 1392 |
+
* @param visible this node is visible
|
| 1393 |
+
* @returns non-negative value on success or negative value on fail
|
| 1394 |
+
*/
|
| 1395 |
+
static int
|
| 1396 |
+
xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
|
| 1397 |
+
{
|
| 1398 |
+
int ret;
|
| 1399 |
+
xmlC14NVisibleNsStack state;
|
| 1400 |
+
int parent_is_doc = 0;
|
| 1401 |
+
|
| 1402 |
+
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
|
| 1403 |
+
xmlC14NErrParam(ctx);
|
| 1404 |
+
return (-1);
|
| 1405 |
+
}
|
| 1406 |
+
|
| 1407 |
+
/*
|
| 1408 |
+
* Check relative relative namespaces:
|
| 1409 |
+
* implementations of XML canonicalization MUST report an operation
|
| 1410 |
+
* failure on documents containing relative namespace URIs.
|
| 1411 |
+
*/
|
| 1412 |
+
if (xmlC14NCheckForRelativeNamespaces(ctx, cur) < 0)
|
| 1413 |
+
return (-1);
|
| 1414 |
+
|
| 1415 |
+
/*
|
| 1416 |
+
* Save ns_rendered stack position
|
| 1417 |
+
*/
|
| 1418 |
+
memset(&state, 0, sizeof(state));
|
| 1419 |
+
xmlC14NVisibleNsStackSave(ctx->ns_rendered, &state);
|
| 1420 |
+
|
| 1421 |
+
if (visible) {
|
| 1422 |
+
if (ctx->parent_is_doc) {
|
| 1423 |
+
/* save this flag into the stack */
|
| 1424 |
+
parent_is_doc = ctx->parent_is_doc;
|
| 1425 |
+
ctx->parent_is_doc = 0;
|
| 1426 |
+
ctx->pos = XMLC14N_INSIDE_DOCUMENT_ELEMENT;
|
| 1427 |
+
}
|
| 1428 |
+
xmlOutputBufferWriteString(ctx->buf, "<");
|
| 1429 |
+
|
| 1430 |
+
if ((cur->ns != NULL) && (xmlStrlen(cur->ns->prefix) > 0)) {
|
| 1431 |
+
xmlOutputBufferWriteString(ctx->buf,
|
| 1432 |
+
(const char *) cur->ns->prefix);
|
| 1433 |
+
xmlOutputBufferWriteString(ctx->buf, ":");
|
| 1434 |
+
}
|
| 1435 |
+
xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name);
|
| 1436 |
+
}
|
| 1437 |
+
|
| 1438 |
+
if (!xmlC14NIsExclusive(ctx)) {
|
| 1439 |
+
ret = xmlC14NProcessNamespacesAxis(ctx, cur, visible);
|
| 1440 |
+
} else {
|
| 1441 |
+
ret = xmlExcC14NProcessNamespacesAxis(ctx, cur, visible);
|
| 1442 |
+
}
|
| 1443 |
+
if (ret < 0)
|
| 1444 |
+
return (-1);
|
| 1445 |
+
/* todo: shouldn't this go to "visible only"? */
|
| 1446 |
+
if(visible) {
|
| 1447 |
+
xmlC14NVisibleNsStackShift(ctx->ns_rendered);
|
| 1448 |
+
}
|
| 1449 |
+
|
| 1450 |
+
ret = xmlC14NProcessAttrsAxis(ctx, cur, visible);
|
| 1451 |
+
if (ret < 0)
|
| 1452 |
+
return (-1);
|
| 1453 |
+
|
| 1454 |
+
if (visible) {
|
| 1455 |
+
xmlOutputBufferWriteString(ctx->buf, ">");
|
| 1456 |
+
}
|
| 1457 |
+
if (cur->children != NULL) {
|
| 1458 |
+
ret = xmlC14NProcessNodeList(ctx, cur->children);
|
| 1459 |
+
if (ret < 0)
|
| 1460 |
+
return (-1);
|
| 1461 |
+
}
|
| 1462 |
+
if (visible) {
|
| 1463 |
+
xmlOutputBufferWriteString(ctx->buf, "</");
|
| 1464 |
+
if ((cur->ns != NULL) && (xmlStrlen(cur->ns->prefix) > 0)) {
|
| 1465 |
+
xmlOutputBufferWriteString(ctx->buf,
|
| 1466 |
+
(const char *) cur->ns->prefix);
|
| 1467 |
+
xmlOutputBufferWriteString(ctx->buf, ":");
|
| 1468 |
+
}
|
| 1469 |
+
xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name);
|
| 1470 |
+
xmlOutputBufferWriteString(ctx->buf, ">");
|
| 1471 |
+
if (parent_is_doc) {
|
| 1472 |
+
/* restore this flag from the stack for next node */
|
| 1473 |
+
ctx->parent_is_doc = parent_is_doc;
|
| 1474 |
+
ctx->pos = XMLC14N_AFTER_DOCUMENT_ELEMENT;
|
| 1475 |
+
}
|
| 1476 |
+
}
|
| 1477 |
+
|
| 1478 |
+
/*
|
| 1479 |
+
* Restore ns_rendered stack position
|
| 1480 |
+
*/
|
| 1481 |
+
xmlC14NVisibleNsStackRestore(ctx->ns_rendered, &state);
|
| 1482 |
+
return (0);
|
| 1483 |
+
}
|
| 1484 |
+
|
| 1485 |
+
/**
|
| 1486 |
+
* Processes the given node
|
| 1487 |
+
*
|
| 1488 |
+
* @param ctx the pointer to C14N context object
|
| 1489 |
+
* @param cur the node to process
|
| 1490 |
+
* @returns non-negative value on success or negative value on fail
|
| 1491 |
+
*/
|
| 1492 |
+
static int
|
| 1493 |
+
xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur)
|
| 1494 |
+
{
|
| 1495 |
+
int ret = 0;
|
| 1496 |
+
int visible;
|
| 1497 |
+
|
| 1498 |
+
if ((ctx == NULL) || (cur == NULL)) {
|
| 1499 |
+
xmlC14NErrParam(ctx);
|
| 1500 |
+
return (-1);
|
| 1501 |
+
}
|
| 1502 |
+
|
| 1503 |
+
visible = xmlC14NIsVisible(ctx, cur, cur->parent);
|
| 1504 |
+
switch (cur->type) {
|
| 1505 |
+
case XML_ELEMENT_NODE:
|
| 1506 |
+
ret = xmlC14NProcessElementNode(ctx, cur, visible);
|
| 1507 |
+
break;
|
| 1508 |
+
case XML_CDATA_SECTION_NODE:
|
| 1509 |
+
case XML_TEXT_NODE:
|
| 1510 |
+
/*
|
| 1511 |
+
* Text Nodes
|
| 1512 |
+
* the string value, except all ampersands are replaced
|
| 1513 |
+
* by &, all open angle brackets (<) are replaced by <, all closing
|
| 1514 |
+
* angle brackets (>) are replaced by >, and all #xD characters are
|
| 1515 |
+
* replaced by 
.
|
| 1516 |
+
*/
|
| 1517 |
+
/* cdata sections are processed as text nodes */
|
| 1518 |
+
/* todo: verify that cdata sections are included in XPath nodes set */
|
| 1519 |
+
if ((visible) && (cur->content != NULL)) {
|
| 1520 |
+
xmlChar *buffer;
|
| 1521 |
+
|
| 1522 |
+
buffer = xmlC11NNormalizeText(cur->content);
|
| 1523 |
+
if (buffer != NULL) {
|
| 1524 |
+
xmlOutputBufferWriteString(ctx->buf,
|
| 1525 |
+
(const char *) buffer);
|
| 1526 |
+
xmlFree(buffer);
|
| 1527 |
+
} else {
|
| 1528 |
+
xmlC14NErrMemory(ctx);
|
| 1529 |
+
return (-1);
|
| 1530 |
+
}
|
| 1531 |
+
}
|
| 1532 |
+
break;
|
| 1533 |
+
case XML_PI_NODE:
|
| 1534 |
+
/*
|
| 1535 |
+
* Processing Instruction (PI) Nodes-
|
| 1536 |
+
* The opening PI symbol (<?), the PI target name of the node,
|
| 1537 |
+
* a leading space and the string value if it is not empty, and
|
| 1538 |
+
* the closing PI symbol (?>). If the string value is empty,
|
| 1539 |
+
* then the leading space is not added. Also, a trailing #xA is
|
| 1540 |
+
* rendered after the closing PI symbol for PI children of the
|
| 1541 |
+
* root node with a lesser document order than the document
|
| 1542 |
+
* element, and a leading #xA is rendered before the opening PI
|
| 1543 |
+
* symbol of PI children of the root node with a greater document
|
| 1544 |
+
* order than the document element.
|
| 1545 |
+
*/
|
| 1546 |
+
if (visible) {
|
| 1547 |
+
if (ctx->pos == XMLC14N_AFTER_DOCUMENT_ELEMENT) {
|
| 1548 |
+
xmlOutputBufferWriteString(ctx->buf, "\x0A<?");
|
| 1549 |
+
} else {
|
| 1550 |
+
xmlOutputBufferWriteString(ctx->buf, "<?");
|
| 1551 |
+
}
|
| 1552 |
+
|
| 1553 |
+
xmlOutputBufferWriteString(ctx->buf,
|
| 1554 |
+
(const char *) cur->name);
|
| 1555 |
+
if ((cur->content != NULL) && (*(cur->content) != '\0')) {
|
| 1556 |
+
xmlChar *buffer;
|
| 1557 |
+
|
| 1558 |
+
xmlOutputBufferWriteString(ctx->buf, " ");
|
| 1559 |
+
|
| 1560 |
+
/* todo: do we need to normalize pi? */
|
| 1561 |
+
buffer = xmlC11NNormalizePI(cur->content);
|
| 1562 |
+
if (buffer != NULL) {
|
| 1563 |
+
xmlOutputBufferWriteString(ctx->buf,
|
| 1564 |
+
(const char *) buffer);
|
| 1565 |
+
xmlFree(buffer);
|
| 1566 |
+
} else {
|
| 1567 |
+
xmlC14NErrMemory(ctx);
|
| 1568 |
+
return (-1);
|
| 1569 |
+
}
|
| 1570 |
+
}
|
| 1571 |
+
|
| 1572 |
+
if (ctx->pos == XMLC14N_BEFORE_DOCUMENT_ELEMENT) {
|
| 1573 |
+
xmlOutputBufferWriteString(ctx->buf, "?>\x0A");
|
| 1574 |
+
} else {
|
| 1575 |
+
xmlOutputBufferWriteString(ctx->buf, "?>");
|
| 1576 |
+
}
|
| 1577 |
+
}
|
| 1578 |
+
break;
|
| 1579 |
+
case XML_COMMENT_NODE:
|
| 1580 |
+
/*
|
| 1581 |
+
* Comment Nodes
|
| 1582 |
+
* Nothing if generating canonical XML without comments. For
|
| 1583 |
+
* canonical XML with comments, generate the opening comment
|
| 1584 |
+
* symbol (<!--), the string value of the node, and the
|
| 1585 |
+
* closing comment symbol (-->). Also, a trailing #xA is rendered
|
| 1586 |
+
* after the closing comment symbol for comment children of the
|
| 1587 |
+
* root node with a lesser document order than the document
|
| 1588 |
+
* element, and a leading #xA is rendered before the opening
|
| 1589 |
+
* comment symbol of comment children of the root node with a
|
| 1590 |
+
* greater document order than the document element. (Comment
|
| 1591 |
+
* children of the root node represent comments outside of the
|
| 1592 |
+
* top-level document element and outside of the document type
|
| 1593 |
+
* declaration).
|
| 1594 |
+
*/
|
| 1595 |
+
if (visible && ctx->with_comments) {
|
| 1596 |
+
if (ctx->pos == XMLC14N_AFTER_DOCUMENT_ELEMENT) {
|
| 1597 |
+
xmlOutputBufferWriteString(ctx->buf, "\x0A<!--");
|
| 1598 |
+
} else {
|
| 1599 |
+
xmlOutputBufferWriteString(ctx->buf, "<!--");
|
| 1600 |
+
}
|
| 1601 |
+
|
| 1602 |
+
if (cur->content != NULL) {
|
| 1603 |
+
xmlChar *buffer;
|
| 1604 |
+
|
| 1605 |
+
/* todo: do we need to normalize comment? */
|
| 1606 |
+
buffer = xmlC11NNormalizeComment(cur->content);
|
| 1607 |
+
if (buffer != NULL) {
|
| 1608 |
+
xmlOutputBufferWriteString(ctx->buf,
|
| 1609 |
+
(const char *) buffer);
|
| 1610 |
+
xmlFree(buffer);
|
| 1611 |
+
} else {
|
| 1612 |
+
xmlC14NErrMemory(ctx);
|
| 1613 |
+
return (-1);
|
| 1614 |
+
}
|
| 1615 |
+
}
|
| 1616 |
+
|
| 1617 |
+
if (ctx->pos == XMLC14N_BEFORE_DOCUMENT_ELEMENT) {
|
| 1618 |
+
xmlOutputBufferWriteString(ctx->buf, "-->\x0A");
|
| 1619 |
+
} else {
|
| 1620 |
+
xmlOutputBufferWriteString(ctx->buf, "-->");
|
| 1621 |
+
}
|
| 1622 |
+
}
|
| 1623 |
+
break;
|
| 1624 |
+
case XML_DOCUMENT_NODE:
|
| 1625 |
+
case XML_DOCUMENT_FRAG_NODE: /* should be processed as document? */
|
| 1626 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 1627 |
+
case XML_HTML_DOCUMENT_NODE: /* should be processed as document? */
|
| 1628 |
+
#endif
|
| 1629 |
+
if (cur->children != NULL) {
|
| 1630 |
+
ctx->pos = XMLC14N_BEFORE_DOCUMENT_ELEMENT;
|
| 1631 |
+
ctx->parent_is_doc = 1;
|
| 1632 |
+
ret = xmlC14NProcessNodeList(ctx, cur->children);
|
| 1633 |
+
}
|
| 1634 |
+
break;
|
| 1635 |
+
|
| 1636 |
+
case XML_ATTRIBUTE_NODE:
|
| 1637 |
+
xmlC14NErrInvalidNode(ctx, "XML_ATTRIBUTE_NODE", "processing node");
|
| 1638 |
+
return (-1);
|
| 1639 |
+
case XML_NAMESPACE_DECL:
|
| 1640 |
+
xmlC14NErrInvalidNode(ctx, "XML_NAMESPACE_DECL", "processing node");
|
| 1641 |
+
return (-1);
|
| 1642 |
+
case XML_ENTITY_REF_NODE:
|
| 1643 |
+
xmlC14NErrInvalidNode(ctx, "XML_ENTITY_REF_NODE", "processing node");
|
| 1644 |
+
return (-1);
|
| 1645 |
+
case XML_ENTITY_NODE:
|
| 1646 |
+
xmlC14NErrInvalidNode(ctx, "XML_ENTITY_NODE", "processing node");
|
| 1647 |
+
return (-1);
|
| 1648 |
+
|
| 1649 |
+
case XML_DOCUMENT_TYPE_NODE:
|
| 1650 |
+
case XML_NOTATION_NODE:
|
| 1651 |
+
case XML_DTD_NODE:
|
| 1652 |
+
case XML_ELEMENT_DECL:
|
| 1653 |
+
case XML_ATTRIBUTE_DECL:
|
| 1654 |
+
case XML_ENTITY_DECL:
|
| 1655 |
+
#ifdef LIBXML_XINCLUDE_ENABLED
|
| 1656 |
+
case XML_XINCLUDE_START:
|
| 1657 |
+
case XML_XINCLUDE_END:
|
| 1658 |
+
#endif
|
| 1659 |
+
/*
|
| 1660 |
+
* should be ignored according to "W3C Canonical XML"
|
| 1661 |
+
*/
|
| 1662 |
+
break;
|
| 1663 |
+
default:
|
| 1664 |
+
xmlC14NErrUnknownNode(ctx, cur->type, "processing node");
|
| 1665 |
+
return (-1);
|
| 1666 |
+
}
|
| 1667 |
+
|
| 1668 |
+
return (ret);
|
| 1669 |
+
}
|
| 1670 |
+
|
| 1671 |
+
/**
|
| 1672 |
+
* Processes all nodes in the row starting from cur.
|
| 1673 |
+
*
|
| 1674 |
+
* @param ctx the pointer to C14N context object
|
| 1675 |
+
* @param cur the node to start from
|
| 1676 |
+
* @returns non-negative value on success or negative value on fail
|
| 1677 |
+
*/
|
| 1678 |
+
static int
|
| 1679 |
+
xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur)
|
| 1680 |
+
{
|
| 1681 |
+
int ret;
|
| 1682 |
+
|
| 1683 |
+
if (ctx == NULL) {
|
| 1684 |
+
xmlC14NErrParam(ctx);
|
| 1685 |
+
return (-1);
|
| 1686 |
+
}
|
| 1687 |
+
|
| 1688 |
+
for (ret = 0; cur != NULL && ret >= 0; cur = cur->next) {
|
| 1689 |
+
ret = xmlC14NProcessNode(ctx, cur);
|
| 1690 |
+
}
|
| 1691 |
+
return (ret);
|
| 1692 |
+
}
|
| 1693 |
+
|
| 1694 |
+
|
| 1695 |
+
/**
|
| 1696 |
+
* Cleanups the C14N context object.
|
| 1697 |
+
*
|
| 1698 |
+
* @param ctx the pointer to C14N context object
|
| 1699 |
+
*/
|
| 1700 |
+
|
| 1701 |
+
static void
|
| 1702 |
+
xmlC14NFreeCtx(xmlC14NCtxPtr ctx)
|
| 1703 |
+
{
|
| 1704 |
+
if (ctx == NULL) {
|
| 1705 |
+
xmlC14NErrParam(ctx);
|
| 1706 |
+
return;
|
| 1707 |
+
}
|
| 1708 |
+
|
| 1709 |
+
if (ctx->ns_rendered != NULL) {
|
| 1710 |
+
xmlC14NVisibleNsStackDestroy(ctx->ns_rendered);
|
| 1711 |
+
}
|
| 1712 |
+
xmlFree(ctx);
|
| 1713 |
+
}
|
| 1714 |
+
|
| 1715 |
+
/**
|
| 1716 |
+
* Creates new C14N context object to store C14N parameters.
|
| 1717 |
+
*
|
| 1718 |
+
* @param doc the XML document for canonization
|
| 1719 |
+
* @param is_visible_callback the function to use to determine is node visible
|
| 1720 |
+
* or not
|
| 1721 |
+
* @param user_data the first parameter for `is_visible_callback` function
|
| 1722 |
+
* (in most cases, it is nodes set)
|
| 1723 |
+
* @param mode the c14n mode (see `xmlC14NMode`)
|
| 1724 |
+
* @param inclusive_ns_prefixes the list of inclusive namespace prefixes
|
| 1725 |
+
* ended with a NULL or NULL if there is no
|
| 1726 |
+
* inclusive namespaces (only for `
|
| 1727 |
+
* canonicalization)
|
| 1728 |
+
* @param with_comments include comments in the result (!=0) or not (==0)
|
| 1729 |
+
* @param buf the output buffer to store canonical XML; this
|
| 1730 |
+
* buffer MUST have encoder==NULL because C14N requires
|
| 1731 |
+
* UTF-8 output
|
| 1732 |
+
* @returns pointer to newly created object (success) or NULL (fail)
|
| 1733 |
+
*/
|
| 1734 |
+
static xmlC14NCtxPtr
|
| 1735 |
+
xmlC14NNewCtx(xmlDocPtr doc,
|
| 1736 |
+
xmlC14NIsVisibleCallback is_visible_callback, void* user_data,
|
| 1737 |
+
xmlC14NMode mode, xmlChar ** inclusive_ns_prefixes,
|
| 1738 |
+
int with_comments, xmlOutputBufferPtr buf)
|
| 1739 |
+
{
|
| 1740 |
+
xmlC14NCtxPtr ctx = NULL;
|
| 1741 |
+
|
| 1742 |
+
if ((doc == NULL) || (buf == NULL)) {
|
| 1743 |
+
xmlC14NErrParam(ctx);
|
| 1744 |
+
return (NULL);
|
| 1745 |
+
}
|
| 1746 |
+
|
| 1747 |
+
/*
|
| 1748 |
+
* Validate the encoding output buffer encoding
|
| 1749 |
+
*/
|
| 1750 |
+
if (buf->encoder != NULL) {
|
| 1751 |
+
xmlC14NErr(ctx, (xmlNodePtr) doc, XML_C14N_REQUIRES_UTF8,
|
| 1752 |
+
"xmlC14NNewCtx: output buffer encoder != NULL but C14N requires UTF8 output\n");
|
| 1753 |
+
return (NULL);
|
| 1754 |
+
}
|
| 1755 |
+
|
| 1756 |
+
/*
|
| 1757 |
+
* Allocate a new xmlC14NCtx and fill the fields.
|
| 1758 |
+
*/
|
| 1759 |
+
ctx = (xmlC14NCtxPtr) xmlMalloc(sizeof(xmlC14NCtx));
|
| 1760 |
+
if (ctx == NULL) {
|
| 1761 |
+
xmlC14NErrMemory(ctx);
|
| 1762 |
+
return (NULL);
|
| 1763 |
+
}
|
| 1764 |
+
memset(ctx, 0, sizeof(xmlC14NCtx));
|
| 1765 |
+
|
| 1766 |
+
/*
|
| 1767 |
+
* initialize C14N context
|
| 1768 |
+
*/
|
| 1769 |
+
ctx->doc = doc;
|
| 1770 |
+
ctx->with_comments = with_comments;
|
| 1771 |
+
ctx->is_visible_callback = is_visible_callback;
|
| 1772 |
+
ctx->user_data = user_data;
|
| 1773 |
+
ctx->buf = buf;
|
| 1774 |
+
ctx->parent_is_doc = 1;
|
| 1775 |
+
ctx->pos = XMLC14N_BEFORE_DOCUMENT_ELEMENT;
|
| 1776 |
+
ctx->ns_rendered = xmlC14NVisibleNsStackCreate();
|
| 1777 |
+
|
| 1778 |
+
if(ctx->ns_rendered == NULL) {
|
| 1779 |
+
xmlC14NErrMemory(ctx);
|
| 1780 |
+
xmlC14NFreeCtx(ctx);
|
| 1781 |
+
return (NULL);
|
| 1782 |
+
}
|
| 1783 |
+
|
| 1784 |
+
/*
|
| 1785 |
+
* Set "mode" flag and remember list of inclusive prefixes
|
| 1786 |
+
* for exclusive c14n
|
| 1787 |
+
*/
|
| 1788 |
+
ctx->mode = mode;
|
| 1789 |
+
if(xmlC14NIsExclusive(ctx)) {
|
| 1790 |
+
ctx->inclusive_ns_prefixes = inclusive_ns_prefixes;
|
| 1791 |
+
}
|
| 1792 |
+
|
| 1793 |
+
return (ctx);
|
| 1794 |
+
}
|
| 1795 |
+
|
| 1796 |
+
/**
|
| 1797 |
+
* Dumps the canonized image of given XML document into the provided buffer.
|
| 1798 |
+
* For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
|
| 1799 |
+
* "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
|
| 1800 |
+
*
|
| 1801 |
+
* @param doc the XML document for canonization
|
| 1802 |
+
* @param is_visible_callback the function to use to determine is node visible
|
| 1803 |
+
* or not
|
| 1804 |
+
* @param user_data the first parameter for `is_visible_callback` function
|
| 1805 |
+
* (in most cases, it is nodes set)
|
| 1806 |
+
* @param mode the c14n mode (see `xmlC14NMode`)
|
| 1807 |
+
* @param inclusive_ns_prefixes the list of inclusive namespace prefixes
|
| 1808 |
+
* ended with a NULL or NULL if there is no
|
| 1809 |
+
* inclusive namespaces (only for exclusive
|
| 1810 |
+
* canonicalization, ignored otherwise)
|
| 1811 |
+
* @param with_comments include comments in the result (!=0) or not (==0)
|
| 1812 |
+
* @param buf the output buffer to store canonical XML; this
|
| 1813 |
+
* buffer MUST have encoder==NULL because C14N requires
|
| 1814 |
+
* UTF-8 output
|
| 1815 |
+
* @returns non-negative value on success or a negative value on fail
|
| 1816 |
+
*/
|
| 1817 |
+
int
|
| 1818 |
+
xmlC14NExecute(xmlDoc *doc, xmlC14NIsVisibleCallback is_visible_callback,
|
| 1819 |
+
void* user_data, int mode, xmlChar **inclusive_ns_prefixes,
|
| 1820 |
+
int with_comments, xmlOutputBuffer *buf) {
|
| 1821 |
+
|
| 1822 |
+
xmlC14NCtxPtr ctx;
|
| 1823 |
+
xmlC14NMode c14n_mode = XML_C14N_1_0;
|
| 1824 |
+
int ret;
|
| 1825 |
+
|
| 1826 |
+
if ((buf == NULL) || (doc == NULL)) {
|
| 1827 |
+
xmlC14NErrParam(NULL);
|
| 1828 |
+
return (-1);
|
| 1829 |
+
}
|
| 1830 |
+
|
| 1831 |
+
/* for backward compatibility, we have to have "mode" as "int"
|
| 1832 |
+
and here we check that user gives valid value */
|
| 1833 |
+
switch(mode) {
|
| 1834 |
+
case XML_C14N_1_0:
|
| 1835 |
+
case XML_C14N_EXCLUSIVE_1_0:
|
| 1836 |
+
case XML_C14N_1_1:
|
| 1837 |
+
c14n_mode = (xmlC14NMode)mode;
|
| 1838 |
+
break;
|
| 1839 |
+
default:
|
| 1840 |
+
xmlC14NErrParam(NULL);
|
| 1841 |
+
return (-1);
|
| 1842 |
+
}
|
| 1843 |
+
|
| 1844 |
+
/*
|
| 1845 |
+
* Validate the encoding output buffer encoding
|
| 1846 |
+
*/
|
| 1847 |
+
if (buf->encoder != NULL) {
|
| 1848 |
+
xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_REQUIRES_UTF8,
|
| 1849 |
+
"xmlC14NExecute: output buffer encoder != NULL but C14N requires UTF8 output\n");
|
| 1850 |
+
return (-1);
|
| 1851 |
+
}
|
| 1852 |
+
|
| 1853 |
+
ctx = xmlC14NNewCtx(doc, is_visible_callback, user_data,
|
| 1854 |
+
c14n_mode, inclusive_ns_prefixes,
|
| 1855 |
+
with_comments, buf);
|
| 1856 |
+
if (ctx == NULL) {
|
| 1857 |
+
xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_CREATE_CTXT,
|
| 1858 |
+
"xmlC14NExecute: unable to create C14N context\n");
|
| 1859 |
+
return (-1);
|
| 1860 |
+
}
|
| 1861 |
+
|
| 1862 |
+
|
| 1863 |
+
|
| 1864 |
+
/*
|
| 1865 |
+
* Root Node
|
| 1866 |
+
* The root node is the parent of the top-level document element. The
|
| 1867 |
+
* result of processing each of its child nodes that is in the node-set
|
| 1868 |
+
* in document order. The root node does not generate a byte order mark,
|
| 1869 |
+
* XML declaration, nor anything from within the document type
|
| 1870 |
+
* declaration.
|
| 1871 |
+
*/
|
| 1872 |
+
if (doc->children != NULL) {
|
| 1873 |
+
ret = xmlC14NProcessNodeList(ctx, doc->children);
|
| 1874 |
+
if (ret < 0) {
|
| 1875 |
+
xmlC14NFreeCtx(ctx);
|
| 1876 |
+
return (-1);
|
| 1877 |
+
}
|
| 1878 |
+
}
|
| 1879 |
+
|
| 1880 |
+
/*
|
| 1881 |
+
* Flush buffer to get number of bytes written
|
| 1882 |
+
*/
|
| 1883 |
+
ret = xmlOutputBufferFlush(buf);
|
| 1884 |
+
if (ret < 0) {
|
| 1885 |
+
xmlC14NErr(ctx, NULL, buf->error, "flushing output buffer");
|
| 1886 |
+
xmlC14NFreeCtx(ctx);
|
| 1887 |
+
return (-1);
|
| 1888 |
+
}
|
| 1889 |
+
|
| 1890 |
+
/*
|
| 1891 |
+
* Cleanup
|
| 1892 |
+
*/
|
| 1893 |
+
xmlC14NFreeCtx(ctx);
|
| 1894 |
+
return (ret);
|
| 1895 |
+
}
|
| 1896 |
+
|
| 1897 |
+
/**
|
| 1898 |
+
* Dumps the canonized image of given XML document into the provided buffer.
|
| 1899 |
+
* For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
|
| 1900 |
+
* "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
|
| 1901 |
+
*
|
| 1902 |
+
* @param doc the XML document for canonization
|
| 1903 |
+
* @param nodes the nodes set to be included in the canonized image
|
| 1904 |
+
* or NULL if all document nodes should be included
|
| 1905 |
+
* @param mode the c14n mode (see `xmlC14NMode`)
|
| 1906 |
+
* @param inclusive_ns_prefixes the list of inclusive namespace prefixes
|
| 1907 |
+
* ended with a NULL or NULL if there is no
|
| 1908 |
+
* inclusive namespaces (only for exclusive
|
| 1909 |
+
* canonicalization, ignored otherwise)
|
| 1910 |
+
* @param with_comments include comments in the result (!=0) or not (==0)
|
| 1911 |
+
* @param buf the output buffer to store canonical XML; this
|
| 1912 |
+
* buffer MUST have encoder==NULL because C14N requires
|
| 1913 |
+
* UTF-8 output
|
| 1914 |
+
* @returns non-negative value on success or a negative value on fail
|
| 1915 |
+
*/
|
| 1916 |
+
int
|
| 1917 |
+
xmlC14NDocSaveTo(xmlDoc *doc, xmlNodeSet *nodes,
|
| 1918 |
+
int mode, xmlChar ** inclusive_ns_prefixes,
|
| 1919 |
+
int with_comments, xmlOutputBuffer *buf) {
|
| 1920 |
+
return(xmlC14NExecute(doc,
|
| 1921 |
+
xmlC14NIsNodeInNodeset,
|
| 1922 |
+
nodes,
|
| 1923 |
+
mode,
|
| 1924 |
+
inclusive_ns_prefixes,
|
| 1925 |
+
with_comments,
|
| 1926 |
+
buf));
|
| 1927 |
+
}
|
| 1928 |
+
|
| 1929 |
+
|
| 1930 |
+
/**
|
| 1931 |
+
* Dumps the canonized image of given XML document into memory.
|
| 1932 |
+
* For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
|
| 1933 |
+
* "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
|
| 1934 |
+
*
|
| 1935 |
+
* @param doc the XML document for canonization
|
| 1936 |
+
* @param nodes the nodes set to be included in the canonized image
|
| 1937 |
+
* or NULL if all document nodes should be included
|
| 1938 |
+
* @param mode the c14n mode (see `xmlC14NMode`)
|
| 1939 |
+
* @param inclusive_ns_prefixes the list of inclusive namespace prefixes
|
| 1940 |
+
* ended with a NULL or NULL if there is no
|
| 1941 |
+
* inclusive namespaces (only for exclusive
|
| 1942 |
+
* canonicalization, ignored otherwise)
|
| 1943 |
+
* @param with_comments include comments in the result (!=0) or not (==0)
|
| 1944 |
+
* @param doc_txt_ptr the memory pointer for allocated canonical XML text;
|
| 1945 |
+
* the caller of this functions is responsible for calling
|
| 1946 |
+
* xmlFree() to free allocated memory
|
| 1947 |
+
* @returns the number of bytes written on success or a negative value on fail
|
| 1948 |
+
*/
|
| 1949 |
+
int
|
| 1950 |
+
xmlC14NDocDumpMemory(xmlDoc *doc, xmlNodeSet *nodes,
|
| 1951 |
+
int mode, xmlChar ** inclusive_ns_prefixes,
|
| 1952 |
+
int with_comments, xmlChar ** doc_txt_ptr)
|
| 1953 |
+
{
|
| 1954 |
+
int ret;
|
| 1955 |
+
xmlOutputBufferPtr buf;
|
| 1956 |
+
|
| 1957 |
+
if (doc_txt_ptr == NULL) {
|
| 1958 |
+
xmlC14NErrParam(NULL);
|
| 1959 |
+
return (-1);
|
| 1960 |
+
}
|
| 1961 |
+
|
| 1962 |
+
*doc_txt_ptr = NULL;
|
| 1963 |
+
|
| 1964 |
+
/*
|
| 1965 |
+
* create memory buffer with UTF8 (default) encoding
|
| 1966 |
+
*/
|
| 1967 |
+
buf = xmlAllocOutputBuffer(NULL);
|
| 1968 |
+
if (buf == NULL) {
|
| 1969 |
+
xmlC14NErrMemory(NULL);
|
| 1970 |
+
return (-1);
|
| 1971 |
+
}
|
| 1972 |
+
|
| 1973 |
+
/*
|
| 1974 |
+
* canonize document and write to buffer
|
| 1975 |
+
*/
|
| 1976 |
+
ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes,
|
| 1977 |
+
with_comments, buf);
|
| 1978 |
+
if (ret < 0) {
|
| 1979 |
+
(void) xmlOutputBufferClose(buf);
|
| 1980 |
+
return (-1);
|
| 1981 |
+
}
|
| 1982 |
+
|
| 1983 |
+
ret = xmlBufUse(buf->buffer);
|
| 1984 |
+
if (ret >= 0) {
|
| 1985 |
+
*doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), ret);
|
| 1986 |
+
}
|
| 1987 |
+
(void) xmlOutputBufferClose(buf);
|
| 1988 |
+
|
| 1989 |
+
if ((*doc_txt_ptr == NULL) && (ret >= 0)) {
|
| 1990 |
+
xmlC14NErrMemory(NULL);
|
| 1991 |
+
return (-1);
|
| 1992 |
+
}
|
| 1993 |
+
return (ret);
|
| 1994 |
+
}
|
| 1995 |
+
|
| 1996 |
+
/**
|
| 1997 |
+
* Dumps the canonized image of given XML document into the file.
|
| 1998 |
+
* For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
|
| 1999 |
+
* "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
|
| 2000 |
+
*
|
| 2001 |
+
* @param doc the XML document for canonization
|
| 2002 |
+
* @param nodes the nodes set to be included in the canonized image
|
| 2003 |
+
* or NULL if all document nodes should be included
|
| 2004 |
+
* @param mode the c14n mode (see `xmlC14NMode`)
|
| 2005 |
+
* @param inclusive_ns_prefixes the list of inclusive namespace prefixes
|
| 2006 |
+
* ended with a NULL or NULL if there is no
|
| 2007 |
+
* inclusive namespaces (only for exclusive
|
| 2008 |
+
* canonicalization, ignored otherwise)
|
| 2009 |
+
* @param with_comments include comments in the result (!=0) or not (==0)
|
| 2010 |
+
* @param filename the filename to store canonical XML image
|
| 2011 |
+
* @param compression the compression level (zlib required):
|
| 2012 |
+
* -1 - libxml default,
|
| 2013 |
+
* 0 - uncompressed,
|
| 2014 |
+
* >0 - compression level
|
| 2015 |
+
* @returns the number of bytes written success or a negative value on fail
|
| 2016 |
+
*/
|
| 2017 |
+
int
|
| 2018 |
+
xmlC14NDocSave(xmlDoc *doc, xmlNodeSet *nodes,
|
| 2019 |
+
int mode, xmlChar ** inclusive_ns_prefixes,
|
| 2020 |
+
int with_comments, const char *filename, int compression)
|
| 2021 |
+
{
|
| 2022 |
+
xmlOutputBufferPtr buf;
|
| 2023 |
+
int ret;
|
| 2024 |
+
|
| 2025 |
+
if (filename == NULL) {
|
| 2026 |
+
xmlC14NErrParam(NULL);
|
| 2027 |
+
return (-1);
|
| 2028 |
+
}
|
| 2029 |
+
#ifdef LIBXML_ZLIB_ENABLED
|
| 2030 |
+
if (compression < 0)
|
| 2031 |
+
compression = xmlGetCompressMode();
|
| 2032 |
+
#endif
|
| 2033 |
+
|
| 2034 |
+
/*
|
| 2035 |
+
* save the content to a temp buffer, use default UTF8 encoding.
|
| 2036 |
+
*/
|
| 2037 |
+
buf = xmlOutputBufferCreateFilename(filename, NULL, compression);
|
| 2038 |
+
if (buf == NULL) {
|
| 2039 |
+
xmlC14NErr(NULL, NULL, XML_IO_UNKNOWN, "creating temporary filename");
|
| 2040 |
+
return (-1);
|
| 2041 |
+
}
|
| 2042 |
+
|
| 2043 |
+
/*
|
| 2044 |
+
* canonize document and write to buffer
|
| 2045 |
+
*/
|
| 2046 |
+
ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes,
|
| 2047 |
+
with_comments, buf);
|
| 2048 |
+
if (ret < 0) {
|
| 2049 |
+
(void) xmlOutputBufferClose(buf);
|
| 2050 |
+
return (-1);
|
| 2051 |
+
}
|
| 2052 |
+
|
| 2053 |
+
/*
|
| 2054 |
+
* get the numbers of bytes written
|
| 2055 |
+
*/
|
| 2056 |
+
ret = xmlOutputBufferClose(buf);
|
| 2057 |
+
return (ret);
|
| 2058 |
+
}
|
| 2059 |
+
|
| 2060 |
+
/**
|
| 2061 |
+
* Converts a string to a canonical (normalized) format. The code is stolen
|
| 2062 |
+
* from xmlEscapeText. Added normalization of `\x09`, `\x0a`,
|
| 2063 |
+
* `\x0A` and the `mode` parameter.
|
| 2064 |
+
*
|
| 2065 |
+
* @param input the input string
|
| 2066 |
+
* @param mode the normalization mode (attribute, comment, PI or text)
|
| 2067 |
+
* @returns a normalized string (caller is responsible for calling #xmlFree)
|
| 2068 |
+
* or NULL if an error occurs
|
| 2069 |
+
*/
|
| 2070 |
+
static xmlChar *
|
| 2071 |
+
xmlC11NNormalizeString(const xmlChar * input,
|
| 2072 |
+
xmlC14NNormalizationMode mode)
|
| 2073 |
+
{
|
| 2074 |
+
const xmlChar *cur = input;
|
| 2075 |
+
xmlChar *buffer = NULL;
|
| 2076 |
+
xmlChar *out = NULL;
|
| 2077 |
+
int buffer_size = 0;
|
| 2078 |
+
|
| 2079 |
+
if (input == NULL)
|
| 2080 |
+
return (NULL);
|
| 2081 |
+
|
| 2082 |
+
/*
|
| 2083 |
+
* allocate an translation buffer.
|
| 2084 |
+
*/
|
| 2085 |
+
buffer_size = 1000;
|
| 2086 |
+
buffer = xmlMalloc(buffer_size);
|
| 2087 |
+
if (buffer == NULL)
|
| 2088 |
+
return (NULL);
|
| 2089 |
+
out = buffer;
|
| 2090 |
+
|
| 2091 |
+
while (*cur != '\0') {
|
| 2092 |
+
if ((out - buffer) > (buffer_size - 10)) {
|
| 2093 |
+
xmlChar *tmp;
|
| 2094 |
+
int indx = out - buffer;
|
| 2095 |
+
int newSize;
|
| 2096 |
+
|
| 2097 |
+
newSize = xmlGrowCapacity(buffer_size, 1, 1, XML_MAX_ITEMS);
|
| 2098 |
+
if (newSize < 0) {
|
| 2099 |
+
xmlFree(buffer);
|
| 2100 |
+
return(NULL);
|
| 2101 |
+
}
|
| 2102 |
+
tmp = xmlRealloc(buffer, newSize);
|
| 2103 |
+
if (tmp == NULL) {
|
| 2104 |
+
xmlFree(buffer);
|
| 2105 |
+
return(NULL);
|
| 2106 |
+
}
|
| 2107 |
+
buffer = tmp;
|
| 2108 |
+
buffer_size = newSize;
|
| 2109 |
+
out = &buffer[indx];
|
| 2110 |
+
}
|
| 2111 |
+
|
| 2112 |
+
if ((*cur == '<') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
|
| 2113 |
+
(mode == XMLC14N_NORMALIZE_TEXT))) {
|
| 2114 |
+
*out++ = '&';
|
| 2115 |
+
*out++ = 'l';
|
| 2116 |
+
*out++ = 't';
|
| 2117 |
+
*out++ = ';';
|
| 2118 |
+
} else if ((*cur == '>') && (mode == XMLC14N_NORMALIZE_TEXT)) {
|
| 2119 |
+
*out++ = '&';
|
| 2120 |
+
*out++ = 'g';
|
| 2121 |
+
*out++ = 't';
|
| 2122 |
+
*out++ = ';';
|
| 2123 |
+
} else if ((*cur == '&') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
|
| 2124 |
+
(mode == XMLC14N_NORMALIZE_TEXT))) {
|
| 2125 |
+
*out++ = '&';
|
| 2126 |
+
*out++ = 'a';
|
| 2127 |
+
*out++ = 'm';
|
| 2128 |
+
*out++ = 'p';
|
| 2129 |
+
*out++ = ';';
|
| 2130 |
+
} else if ((*cur == '"') && (mode == XMLC14N_NORMALIZE_ATTR)) {
|
| 2131 |
+
*out++ = '&';
|
| 2132 |
+
*out++ = 'q';
|
| 2133 |
+
*out++ = 'u';
|
| 2134 |
+
*out++ = 'o';
|
| 2135 |
+
*out++ = 't';
|
| 2136 |
+
*out++ = ';';
|
| 2137 |
+
} else if ((*cur == '\x09') && (mode == XMLC14N_NORMALIZE_ATTR)) {
|
| 2138 |
+
*out++ = '&';
|
| 2139 |
+
*out++ = '#';
|
| 2140 |
+
*out++ = 'x';
|
| 2141 |
+
*out++ = '9';
|
| 2142 |
+
*out++ = ';';
|
| 2143 |
+
} else if ((*cur == '\x0A') && (mode == XMLC14N_NORMALIZE_ATTR)) {
|
| 2144 |
+
*out++ = '&';
|
| 2145 |
+
*out++ = '#';
|
| 2146 |
+
*out++ = 'x';
|
| 2147 |
+
*out++ = 'A';
|
| 2148 |
+
*out++ = ';';
|
| 2149 |
+
} else if ((*cur == '\x0D') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
|
| 2150 |
+
(mode == XMLC14N_NORMALIZE_TEXT) ||
|
| 2151 |
+
(mode == XMLC14N_NORMALIZE_COMMENT) ||
|
| 2152 |
+
(mode == XMLC14N_NORMALIZE_PI))) {
|
| 2153 |
+
*out++ = '&';
|
| 2154 |
+
*out++ = '#';
|
| 2155 |
+
*out++ = 'x';
|
| 2156 |
+
*out++ = 'D';
|
| 2157 |
+
*out++ = ';';
|
| 2158 |
+
} else {
|
| 2159 |
+
/*
|
| 2160 |
+
* Works because on UTF-8, all extended sequences cannot
|
| 2161 |
+
* result in bytes in the ASCII range.
|
| 2162 |
+
*/
|
| 2163 |
+
*out++ = *cur;
|
| 2164 |
+
}
|
| 2165 |
+
cur++;
|
| 2166 |
+
}
|
| 2167 |
+
*out = 0;
|
| 2168 |
+
return (buffer);
|
| 2169 |
+
}
|
| 2170 |
+
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* chvalid.c: this module implements the character range
|
| 3 |
+
* validation APIs
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
#define IN_LIBXML
|
| 7 |
+
#include "libxml.h"
|
| 8 |
+
#include <libxml/chvalid.h>
|
| 9 |
+
|
| 10 |
+
#include <stddef.h>
|
| 11 |
+
|
| 12 |
+
/*
|
| 13 |
+
* The initial tables ({func_name}_tab) are used to validate whether a
|
| 14 |
+
* single-byte character is within the specified group. Each table
|
| 15 |
+
* contains 256 bytes, with each byte representing one of the 256
|
| 16 |
+
* possible characters. If the table byte is set, the character is
|
| 17 |
+
* allowed.
|
| 18 |
+
*
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
#include "codegen/ranges.inc"
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Does a binary search of the range table to determine if char
|
| 25 |
+
* is valid
|
| 26 |
+
*
|
| 27 |
+
* @param val character to be validated
|
| 28 |
+
* @param rptr pointer to range to be used to validate
|
| 29 |
+
* @returns true if character valid, false otherwise
|
| 30 |
+
*/
|
| 31 |
+
int
|
| 32 |
+
xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
| 33 |
+
int low, high, mid;
|
| 34 |
+
const xmlChSRange *sptr;
|
| 35 |
+
const xmlChLRange *lptr;
|
| 36 |
+
|
| 37 |
+
if (rptr == NULL) return(0);
|
| 38 |
+
if (val < 0x10000) { /* is val in 'short' or 'long' array? */
|
| 39 |
+
if (rptr->nbShortRange == 0)
|
| 40 |
+
return 0;
|
| 41 |
+
low = 0;
|
| 42 |
+
high = rptr->nbShortRange - 1;
|
| 43 |
+
sptr = rptr->shortRange;
|
| 44 |
+
while (low <= high) {
|
| 45 |
+
mid = (low + high) / 2;
|
| 46 |
+
if ((unsigned short) val < sptr[mid].low) {
|
| 47 |
+
high = mid - 1;
|
| 48 |
+
} else {
|
| 49 |
+
if ((unsigned short) val > sptr[mid].high) {
|
| 50 |
+
low = mid + 1;
|
| 51 |
+
} else {
|
| 52 |
+
return 1;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
} else {
|
| 57 |
+
if (rptr->nbLongRange == 0) {
|
| 58 |
+
return 0;
|
| 59 |
+
}
|
| 60 |
+
low = 0;
|
| 61 |
+
high = rptr->nbLongRange - 1;
|
| 62 |
+
lptr = rptr->longRange;
|
| 63 |
+
while (low <= high) {
|
| 64 |
+
mid = (low + high) / 2;
|
| 65 |
+
if (val < lptr[mid].low) {
|
| 66 |
+
high = mid - 1;
|
| 67 |
+
} else {
|
| 68 |
+
if (val > lptr[mid].high) {
|
| 69 |
+
low = mid + 1;
|
| 70 |
+
} else {
|
| 71 |
+
return 1;
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
return 0;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* @deprecated Use #xmlIsBaseChar_ch or #xmlIsBaseCharQ.
|
| 82 |
+
*
|
| 83 |
+
* @param ch character to validate
|
| 84 |
+
* @returns true if argument valid, false otherwise
|
| 85 |
+
*/
|
| 86 |
+
int
|
| 87 |
+
xmlIsBaseChar(unsigned int ch) {
|
| 88 |
+
return(xmlIsBaseCharQ(ch));
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* @deprecated Use #xmlIsBlank_ch or #xmlIsBlankQ.
|
| 94 |
+
*
|
| 95 |
+
* @param ch character to validate
|
| 96 |
+
* @returns true if argument valid, false otherwise
|
| 97 |
+
*/
|
| 98 |
+
int
|
| 99 |
+
xmlIsBlank(unsigned int ch) {
|
| 100 |
+
return(xmlIsBlankQ(ch));
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* @deprecated Use #xmlIsChar_ch or #xmlIsCharQ.
|
| 106 |
+
*
|
| 107 |
+
* @param ch character to validate
|
| 108 |
+
* @returns true if argument valid, false otherwise
|
| 109 |
+
*/
|
| 110 |
+
int
|
| 111 |
+
xmlIsChar(unsigned int ch) {
|
| 112 |
+
return(xmlIsCharQ(ch));
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* @deprecated Use #xmlIsCombiningQ.
|
| 118 |
+
*
|
| 119 |
+
* @param ch character to validate
|
| 120 |
+
* @returns true if argument valid, false otherwise
|
| 121 |
+
*/
|
| 122 |
+
int
|
| 123 |
+
xmlIsCombining(unsigned int ch) {
|
| 124 |
+
return(xmlIsCombiningQ(ch));
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
/**
|
| 129 |
+
* @deprecated Use #xmlIsDigit_ch or #xmlIsDigitQ.
|
| 130 |
+
*
|
| 131 |
+
* @param ch character to validate
|
| 132 |
+
* @returns true if argument valid, false otherwise
|
| 133 |
+
*/
|
| 134 |
+
int
|
| 135 |
+
xmlIsDigit(unsigned int ch) {
|
| 136 |
+
return(xmlIsDigitQ(ch));
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
/**
|
| 141 |
+
* @deprecated Use #xmlIsExtender_ch or #xmlIsExtenderQ.
|
| 142 |
+
*
|
| 143 |
+
* @param ch character to validate
|
| 144 |
+
* @returns true if argument valid, false otherwise
|
| 145 |
+
*/
|
| 146 |
+
int
|
| 147 |
+
xmlIsExtender(unsigned int ch) {
|
| 148 |
+
return(xmlIsExtenderQ(ch));
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
/**
|
| 153 |
+
* @deprecated Use #xmlIsIdeographicQ.
|
| 154 |
+
*
|
| 155 |
+
* @param ch character to validate
|
| 156 |
+
* @returns true if argument valid, false otherwise
|
| 157 |
+
*/
|
| 158 |
+
int
|
| 159 |
+
xmlIsIdeographic(unsigned int ch) {
|
| 160 |
+
return(xmlIsIdeographicQ(ch));
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
/**
|
| 165 |
+
* @deprecated Use #xmlIsPubidChar_ch or #xmlIsPubidCharQ.
|
| 166 |
+
*
|
| 167 |
+
* @param ch character to validate
|
| 168 |
+
* @returns true if argument valid, false otherwise
|
| 169 |
+
*/
|
| 170 |
+
int
|
| 171 |
+
xmlIsPubidChar(unsigned int ch) {
|
| 172 |
+
return(xmlIsPubidCharQ(ch));
|
| 173 |
+
}
|
| 174 |
+
|
codegen/charset.inc
ADDED
|
@@ -0,0 +1,1223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Lookup tables for transcoding of 8-bit character sets.
|
| 3 |
+
*
|
| 4 |
+
* Generated with tools/genTranscode.py.
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
static const unsigned short xmlunicodetable_windows_1252 [128] = {
|
| 8 |
+
0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
|
| 9 |
+
0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f,
|
| 10 |
+
0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
|
| 11 |
+
0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178,
|
| 12 |
+
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
| 13 |
+
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 14 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
| 15 |
+
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
|
| 16 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 17 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 18 |
+
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 19 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
| 20 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 21 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 22 |
+
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 23 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
static const unsigned char xmltranscodetable_windows_1252 [48 + 10 * 64] = {
|
| 27 |
+
0x00, 0x00, 0x03, 0x09, 0x00, 0x07, 0x05, 0x00,
|
| 28 |
+
0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
|
| 29 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 30 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 31 |
+
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 32 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 33 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 34 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 35 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 36 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 37 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 38 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 39 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 40 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 41 |
+
0x04, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00,
|
| 42 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 43 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 44 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 45 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 46 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 47 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 48 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 49 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 50 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 51 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 52 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 53 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 54 |
+
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
| 55 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 56 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 57 |
+
0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 58 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x8f,
|
| 59 |
+
0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 60 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00,
|
| 61 |
+
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
| 62 |
+
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
| 63 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
| 64 |
+
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
| 65 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 66 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 67 |
+
0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00,
|
| 68 |
+
0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00,
|
| 69 |
+
0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00,
|
| 70 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 71 |
+
0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 72 |
+
0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 73 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 74 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 75 |
+
0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 76 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 77 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 78 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 79 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 80 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 81 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00,
|
| 82 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 83 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 84 |
+
0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
|
| 85 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 86 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 87 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 88 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 89 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 90 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 91 |
+
0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00,
|
| 92 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 93 |
+
0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 94 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 95 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 96 |
+
0x9f, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x9e, 0x00,
|
| 97 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 98 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 99 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 100 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 101 |
+
0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 102 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 103 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 104 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 105 |
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 106 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 107 |
+
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 108 |
+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
| 109 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 110 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 111 |
+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 112 |
+
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
| 113 |
+
};
|
| 114 |
+
|
| 115 |
+
#if !defined(LIBXML_ICONV_ENABLED) && \
|
| 116 |
+
!defined(LIBXML_ICU_ENABLED) && \
|
| 117 |
+
defined(LIBXML_ISO8859X_ENABLED)
|
| 118 |
+
|
| 119 |
+
static const unsigned short xmlunicodetable_ISO8859_2 [128] = {
|
| 120 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 121 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 122 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 123 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 124 |
+
0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7,
|
| 125 |
+
0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b,
|
| 126 |
+
0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7,
|
| 127 |
+
0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c,
|
| 128 |
+
0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7,
|
| 129 |
+
0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e,
|
| 130 |
+
0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7,
|
| 131 |
+
0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df,
|
| 132 |
+
0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7,
|
| 133 |
+
0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f,
|
| 134 |
+
0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7,
|
| 135 |
+
0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9,
|
| 136 |
+
};
|
| 137 |
+
|
| 138 |
+
static const unsigned char xmltranscodetable_ISO8859_2 [48 + 6 * 64] = {
|
| 139 |
+
0x00, 0x00, 0x01, 0x05, 0x02, 0x04, 0x00, 0x00,
|
| 140 |
+
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
|
| 141 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 142 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 143 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 144 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 145 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 146 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 147 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 148 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 149 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 150 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 151 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 152 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 153 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 154 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 155 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 156 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 157 |
+
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7,
|
| 158 |
+
0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
|
| 159 |
+
0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
|
| 160 |
+
0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 161 |
+
0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6,
|
| 162 |
+
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef,
|
| 163 |
+
0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 164 |
+
0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00,
|
| 165 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 166 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 167 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 168 |
+
0x00, 0xc5, 0xe5, 0x00, 0x00, 0xa5, 0xb5, 0x00,
|
| 169 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7,
|
| 170 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 171 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 172 |
+
0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00,
|
| 173 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 174 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 175 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 176 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 177 |
+
0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2,
|
| 178 |
+
0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 179 |
+
0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00,
|
| 180 |
+
0xd8, 0xf8, 0xa6, 0xb6, 0x00, 0x00, 0xaa, 0xba,
|
| 181 |
+
0xa9, 0xb9, 0xde, 0xfe, 0xab, 0xbb, 0x00, 0x00,
|
| 182 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9,
|
| 183 |
+
0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 184 |
+
0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00,
|
| 185 |
+
0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7,
|
| 186 |
+
0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00,
|
| 187 |
+
0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
|
| 188 |
+
0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf,
|
| 189 |
+
0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7,
|
| 190 |
+
0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00,
|
| 191 |
+
0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
|
| 192 |
+
0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00,
|
| 193 |
+
};
|
| 194 |
+
|
| 195 |
+
static const unsigned short xmlunicodetable_ISO8859_3 [128] = {
|
| 196 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 197 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 198 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 199 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 200 |
+
0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7,
|
| 201 |
+
0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b,
|
| 202 |
+
0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7,
|
| 203 |
+
0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c,
|
| 204 |
+
0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7,
|
| 205 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 206 |
+
0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7,
|
| 207 |
+
0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df,
|
| 208 |
+
0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7,
|
| 209 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 210 |
+
0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7,
|
| 211 |
+
0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9,
|
| 212 |
+
};
|
| 213 |
+
|
| 214 |
+
static const unsigned char xmltranscodetable_ISO8859_3 [48 + 6 * 64] = {
|
| 215 |
+
0x00, 0x00, 0x01, 0x05, 0x02, 0x04, 0x00, 0x00,
|
| 216 |
+
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
|
| 217 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 218 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 219 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 220 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 221 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 222 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 223 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 224 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 225 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 226 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 227 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 228 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 229 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 230 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 231 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 232 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 233 |
+
0xa0, 0x00, 0x00, 0xa3, 0xa4, 0x00, 0x00, 0xa7,
|
| 234 |
+
0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
|
| 235 |
+
0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7,
|
| 236 |
+
0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
|
| 237 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 238 |
+
0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00,
|
| 239 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 240 |
+
0x00, 0x00, 0x00, 0x00, 0xd8, 0xf8, 0xab, 0xbb,
|
| 241 |
+
0xd5, 0xf5, 0x00, 0x00, 0xa6, 0xb6, 0xa1, 0xb1,
|
| 242 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 243 |
+
0xa9, 0xb9, 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00,
|
| 244 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 245 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 246 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 247 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 248 |
+
0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 249 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 250 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 251 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 252 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 253 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 254 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 255 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 256 |
+
0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, 0xaa, 0xba,
|
| 257 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 258 |
+
0x00, 0x00, 0x00, 0x00, 0xdd, 0xfd, 0x00, 0x00,
|
| 259 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 260 |
+
0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00,
|
| 261 |
+
0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7,
|
| 262 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 263 |
+
0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
|
| 264 |
+
0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
|
| 265 |
+
0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7,
|
| 266 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 267 |
+
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
|
| 268 |
+
0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00,
|
| 269 |
+
};
|
| 270 |
+
|
| 271 |
+
static const unsigned short xmlunicodetable_ISO8859_4 [128] = {
|
| 272 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 273 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 274 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 275 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 276 |
+
0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7,
|
| 277 |
+
0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af,
|
| 278 |
+
0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7,
|
| 279 |
+
0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b,
|
| 280 |
+
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
|
| 281 |
+
0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a,
|
| 282 |
+
0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 283 |
+
0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df,
|
| 284 |
+
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
|
| 285 |
+
0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b,
|
| 286 |
+
0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 287 |
+
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9,
|
| 288 |
+
};
|
| 289 |
+
|
| 290 |
+
static const unsigned char xmltranscodetable_ISO8859_4 [48 + 6 * 64] = {
|
| 291 |
+
0x00, 0x00, 0x01, 0x05, 0x02, 0x03, 0x00, 0x00,
|
| 292 |
+
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
|
| 293 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 294 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 295 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 296 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 297 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 298 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 299 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 300 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 301 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 302 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 303 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 304 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 305 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 306 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 307 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 308 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 309 |
+
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7,
|
| 310 |
+
0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0xaf,
|
| 311 |
+
0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
|
| 312 |
+
0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 313 |
+
0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00,
|
| 314 |
+
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00,
|
| 315 |
+
0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec,
|
| 316 |
+
0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 317 |
+
0x00, 0x00, 0xab, 0xbb, 0x00, 0x00, 0x00, 0x00,
|
| 318 |
+
0xa5, 0xb5, 0xcf, 0xef, 0x00, 0x00, 0xc7, 0xe7,
|
| 319 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0xf3,
|
| 320 |
+
0xa2, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, 0x00,
|
| 321 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00,
|
| 322 |
+
0x00, 0x00, 0xbd, 0xbf, 0xd2, 0xf2, 0x00, 0x00,
|
| 323 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xb3,
|
| 324 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 325 |
+
0xa9, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc,
|
| 326 |
+
0xdd, 0xfd, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
| 327 |
+
0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00,
|
| 328 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00,
|
| 329 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7,
|
| 330 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 331 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 332 |
+
0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00,
|
| 333 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 334 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 335 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 336 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 337 |
+
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00,
|
| 338 |
+
0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00,
|
| 339 |
+
0x00, 0x00, 0x00, 0x00, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 340 |
+
0xd8, 0x00, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
|
| 341 |
+
0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00,
|
| 342 |
+
0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00,
|
| 343 |
+
0x00, 0x00, 0x00, 0x00, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 344 |
+
0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00,
|
| 345 |
+
};
|
| 346 |
+
|
| 347 |
+
static const unsigned short xmlunicodetable_ISO8859_5 [128] = {
|
| 348 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 349 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 350 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 351 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 352 |
+
0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
|
| 353 |
+
0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f,
|
| 354 |
+
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
| 355 |
+
0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
|
| 356 |
+
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
| 357 |
+
0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
|
| 358 |
+
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
| 359 |
+
0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
|
| 360 |
+
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
| 361 |
+
0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f,
|
| 362 |
+
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
|
| 363 |
+
0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f,
|
| 364 |
+
};
|
| 365 |
+
|
| 366 |
+
static const unsigned char xmltranscodetable_ISO8859_5 [48 + 6 * 64] = {
|
| 367 |
+
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 368 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 369 |
+
0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 370 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 371 |
+
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 372 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 373 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 374 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 375 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 376 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 377 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 378 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 379 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 380 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 381 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 382 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 383 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 384 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 385 |
+
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd,
|
| 386 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
|
| 387 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 388 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 389 |
+
0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
| 390 |
+
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf,
|
| 391 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
| 392 |
+
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
| 393 |
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 394 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 395 |
+
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 396 |
+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
| 397 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 398 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 399 |
+
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 400 |
+
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff,
|
| 401 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 402 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 403 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 404 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 405 |
+
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
|
| 406 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 407 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 408 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 409 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 410 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 411 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 412 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 413 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 414 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 415 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00,
|
| 416 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 417 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 418 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 419 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 420 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 421 |
+
};
|
| 422 |
+
|
| 423 |
+
static const unsigned short xmlunicodetable_ISO8859_6 [128] = {
|
| 424 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 425 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 426 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 427 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 428 |
+
0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000,
|
| 429 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000,
|
| 430 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 431 |
+
0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f,
|
| 432 |
+
0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
| 433 |
+
0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
|
| 434 |
+
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
|
| 435 |
+
0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 436 |
+
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
|
| 437 |
+
0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
|
| 438 |
+
0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 439 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 440 |
+
};
|
| 441 |
+
|
| 442 |
+
static const unsigned char xmltranscodetable_ISO8859_6 [48 + 4 * 64] = {
|
| 443 |
+
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 444 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 445 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 446 |
+
0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 447 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 448 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 449 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 450 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 451 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 452 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 453 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 454 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 455 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 456 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 457 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 458 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 459 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 460 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 461 |
+
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00,
|
| 462 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
|
| 463 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 464 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 465 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 466 |
+
0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00,
|
| 467 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 468 |
+
0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf,
|
| 469 |
+
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 470 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 471 |
+
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 472 |
+
0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 473 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 474 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 475 |
+
0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 476 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 477 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 478 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 479 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 480 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 481 |
+
};
|
| 482 |
+
|
| 483 |
+
static const unsigned short xmlunicodetable_ISO8859_7 [128] = {
|
| 484 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 485 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 486 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 487 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 488 |
+
0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7,
|
| 489 |
+
0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015,
|
| 490 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7,
|
| 491 |
+
0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f,
|
| 492 |
+
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
| 493 |
+
0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f,
|
| 494 |
+
0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7,
|
| 495 |
+
0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af,
|
| 496 |
+
0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
|
| 497 |
+
0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
|
| 498 |
+
0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7,
|
| 499 |
+
0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000,
|
| 500 |
+
};
|
| 501 |
+
|
| 502 |
+
static const unsigned char xmltranscodetable_ISO8859_7 [48 + 6 * 64] = {
|
| 503 |
+
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 504 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05,
|
| 505 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 506 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 507 |
+
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 508 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 509 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 510 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 511 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 512 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 513 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 514 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 515 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 516 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 517 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 518 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 519 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 520 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 521 |
+
0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7,
|
| 522 |
+
0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0x00,
|
| 523 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0xb7,
|
| 524 |
+
0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00,
|
| 525 |
+
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 526 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 527 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 528 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 529 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 530 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 531 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 532 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 533 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 534 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 535 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00,
|
| 536 |
+
0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 537 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 538 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 539 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 540 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 541 |
+
0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0x00,
|
| 542 |
+
0xb8, 0xb9, 0xba, 0x00, 0xbc, 0x00, 0xbe, 0xbf,
|
| 543 |
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 544 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 545 |
+
0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 546 |
+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
| 547 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 548 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 549 |
+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 550 |
+
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00,
|
| 551 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 552 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 553 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 554 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 555 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 556 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 557 |
+
};
|
| 558 |
+
|
| 559 |
+
static const unsigned short xmlunicodetable_ISO8859_8 [128] = {
|
| 560 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 561 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 562 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 563 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 564 |
+
0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
| 565 |
+
0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 566 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
| 567 |
+
0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000,
|
| 568 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 569 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 570 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 571 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017,
|
| 572 |
+
0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7,
|
| 573 |
+
0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df,
|
| 574 |
+
0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7,
|
| 575 |
+
0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000,
|
| 576 |
+
};
|
| 577 |
+
|
| 578 |
+
static const unsigned char xmltranscodetable_ISO8859_8 [48 + 6 * 64] = {
|
| 579 |
+
0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
|
| 580 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 581 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
|
| 582 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 583 |
+
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 584 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 585 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 586 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 587 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 588 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 589 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 590 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 591 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 592 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 593 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 594 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 595 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 596 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 597 |
+
0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
| 598 |
+
0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
| 599 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
| 600 |
+
0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00,
|
| 601 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 602 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 603 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa,
|
| 604 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 605 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 606 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 607 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba,
|
| 608 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 609 |
+
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 610 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 611 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 612 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 613 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 614 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 615 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 616 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 617 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 618 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe,
|
| 619 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf,
|
| 620 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 621 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 622 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 623 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 624 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 625 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 626 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 627 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 628 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 629 |
+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 630 |
+
0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 631 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 632 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 633 |
+
};
|
| 634 |
+
|
| 635 |
+
static const unsigned short xmlunicodetable_ISO8859_9 [128] = {
|
| 636 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 637 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 638 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 639 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 640 |
+
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
| 641 |
+
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 642 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
| 643 |
+
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
|
| 644 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 645 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 646 |
+
0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 647 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df,
|
| 648 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 649 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 650 |
+
0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 651 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff,
|
| 652 |
+
};
|
| 653 |
+
|
| 654 |
+
static const unsigned char xmltranscodetable_ISO8859_9 [48 + 5 * 64] = {
|
| 655 |
+
0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00,
|
| 656 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 657 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 658 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 659 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 660 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 661 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 662 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 663 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 664 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 665 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 666 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 667 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 668 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 669 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 670 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 671 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 672 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 673 |
+
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
| 674 |
+
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
| 675 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
| 676 |
+
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
| 677 |
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 678 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 679 |
+
0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 680 |
+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
|
| 681 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 682 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 683 |
+
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 684 |
+
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
|
| 685 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 686 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 687 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 688 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0,
|
| 689 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 690 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 691 |
+
0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 692 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 693 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 694 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 695 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 696 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe,
|
| 697 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 698 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 699 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 700 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 701 |
+
};
|
| 702 |
+
|
| 703 |
+
static const unsigned short xmlunicodetable_ISO8859_10 [128] = {
|
| 704 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 705 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 706 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 707 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 708 |
+
0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7,
|
| 709 |
+
0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a,
|
| 710 |
+
0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7,
|
| 711 |
+
0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b,
|
| 712 |
+
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
|
| 713 |
+
0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf,
|
| 714 |
+
0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168,
|
| 715 |
+
0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
| 716 |
+
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
|
| 717 |
+
0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef,
|
| 718 |
+
0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169,
|
| 719 |
+
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138,
|
| 720 |
+
};
|
| 721 |
+
|
| 722 |
+
static const unsigned char xmltranscodetable_ISO8859_10 [48 + 7 * 64] = {
|
| 723 |
+
0x00, 0x00, 0x01, 0x06, 0x02, 0x03, 0x00, 0x00,
|
| 724 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 725 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 726 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 727 |
+
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 728 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 729 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 730 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 731 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 732 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 733 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 734 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 735 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 736 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 737 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 738 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 739 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 740 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 741 |
+
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7,
|
| 742 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
|
| 743 |
+
0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7,
|
| 744 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 745 |
+
0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00,
|
| 746 |
+
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00,
|
| 747 |
+
0xa9, 0xb9, 0xa2, 0xb2, 0x00, 0x00, 0xcc, 0xec,
|
| 748 |
+
0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 749 |
+
0x00, 0x00, 0xa3, 0xb3, 0x00, 0x00, 0x00, 0x00,
|
| 750 |
+
0xa5, 0xb5, 0xa4, 0xb4, 0x00, 0x00, 0xc7, 0xe7,
|
| 751 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6,
|
| 752 |
+
0xff, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, 0x00,
|
| 753 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00,
|
| 754 |
+
0x00, 0x00, 0xaf, 0xbf, 0xd2, 0xf2, 0x00, 0x00,
|
| 755 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 756 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 757 |
+
0xaa, 0xba, 0x00, 0x00, 0x00, 0x00, 0xab, 0xbb,
|
| 758 |
+
0xd7, 0xf7, 0xae, 0xbe, 0x00, 0x00, 0x00, 0x00,
|
| 759 |
+
0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00,
|
| 760 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, 0x00,
|
| 761 |
+
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 762 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 763 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 764 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 765 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 766 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 767 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 768 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 769 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 770 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 771 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
|
| 772 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 773 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 774 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 775 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 776 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 777 |
+
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00,
|
| 778 |
+
0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
|
| 779 |
+
0xd0, 0x00, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0x00,
|
| 780 |
+
0xd8, 0x00, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
| 781 |
+
0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00,
|
| 782 |
+
0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0xef,
|
| 783 |
+
0xf0, 0x00, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0x00,
|
| 784 |
+
0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00,
|
| 785 |
+
};
|
| 786 |
+
|
| 787 |
+
static const unsigned short xmlunicodetable_ISO8859_11 [128] = {
|
| 788 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 789 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 790 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 791 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 792 |
+
0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07,
|
| 793 |
+
0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f,
|
| 794 |
+
0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17,
|
| 795 |
+
0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f,
|
| 796 |
+
0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27,
|
| 797 |
+
0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f,
|
| 798 |
+
0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37,
|
| 799 |
+
0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f,
|
| 800 |
+
0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47,
|
| 801 |
+
0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f,
|
| 802 |
+
0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57,
|
| 803 |
+
0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 804 |
+
};
|
| 805 |
+
|
| 806 |
+
static const unsigned char xmltranscodetable_ISO8859_11 [48 + 5 * 64] = {
|
| 807 |
+
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 808 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 809 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 810 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 811 |
+
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 812 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 813 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 814 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 815 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 816 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 817 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 818 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 819 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 820 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 821 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 822 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 823 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 824 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 825 |
+
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 826 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 827 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 828 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 829 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 830 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 831 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 832 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 833 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 834 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 835 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 836 |
+
0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 837 |
+
0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
| 838 |
+
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
| 839 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
| 840 |
+
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
| 841 |
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 842 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 843 |
+
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 844 |
+
0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf,
|
| 845 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 846 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 847 |
+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 848 |
+
0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00,
|
| 849 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 850 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 851 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 852 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 853 |
+
};
|
| 854 |
+
|
| 855 |
+
static const unsigned short xmlunicodetable_ISO8859_13 [128] = {
|
| 856 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 857 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 858 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 859 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 860 |
+
0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7,
|
| 861 |
+
0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6,
|
| 862 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7,
|
| 863 |
+
0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6,
|
| 864 |
+
0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112,
|
| 865 |
+
0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b,
|
| 866 |
+
0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7,
|
| 867 |
+
0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df,
|
| 868 |
+
0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113,
|
| 869 |
+
0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c,
|
| 870 |
+
0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7,
|
| 871 |
+
0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019,
|
| 872 |
+
};
|
| 873 |
+
|
| 874 |
+
static const unsigned char xmltranscodetable_ISO8859_13 [48 + 7 * 64] = {
|
| 875 |
+
0x00, 0x00, 0x01, 0x04, 0x06, 0x05, 0x00, 0x00,
|
| 876 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 877 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 878 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 879 |
+
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 880 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 881 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 882 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 883 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 884 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 885 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 886 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 887 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 888 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 889 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 890 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 891 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 892 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 893 |
+
0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0x00, 0xa6, 0xa7,
|
| 894 |
+
0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00,
|
| 895 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7,
|
| 896 |
+
0x00, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00,
|
| 897 |
+
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 898 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 899 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 900 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 901 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 902 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 903 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 904 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 905 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 906 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 907 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 908 |
+
0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00,
|
| 909 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 910 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 911 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 912 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 913 |
+
0x00, 0x00, 0x00, 0x00, 0xc4, 0xc5, 0xaf, 0x00,
|
| 914 |
+
0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 915 |
+
0x00, 0x00, 0x00, 0xd3, 0x00, 0xd5, 0xd6, 0xd7,
|
| 916 |
+
0xa8, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0xdf,
|
| 917 |
+
0x00, 0x00, 0x00, 0x00, 0xe4, 0xe5, 0xbf, 0x00,
|
| 918 |
+
0x00, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 919 |
+
0x00, 0x00, 0x00, 0xf3, 0x00, 0xf5, 0xf6, 0xf7,
|
| 920 |
+
0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00,
|
| 921 |
+
0x00, 0xd9, 0xf9, 0xd1, 0xf1, 0xd2, 0xf2, 0x00,
|
| 922 |
+
0x00, 0x00, 0x00, 0x00, 0xd4, 0xf4, 0x00, 0x00,
|
| 923 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba,
|
| 924 |
+
0x00, 0x00, 0xda, 0xfa, 0x00, 0x00, 0x00, 0x00,
|
| 925 |
+
0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 926 |
+
0x00, 0x00, 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00,
|
| 927 |
+
0x00, 0x00, 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
| 928 |
+
0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00,
|
| 929 |
+
0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3,
|
| 930 |
+
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00,
|
| 931 |
+
0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb,
|
| 932 |
+
0xc6, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 933 |
+
0x00, 0x00, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00,
|
| 934 |
+
0x00, 0x00, 0xce, 0xee, 0x00, 0x00, 0xc1, 0xe1,
|
| 935 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xed,
|
| 936 |
+
0x00, 0x00, 0x00, 0xcf, 0xef, 0x00, 0x00, 0x00,
|
| 937 |
+
};
|
| 938 |
+
|
| 939 |
+
static const unsigned short xmlunicodetable_ISO8859_14 [128] = {
|
| 940 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 941 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 942 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 943 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 944 |
+
0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7,
|
| 945 |
+
0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178,
|
| 946 |
+
0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56,
|
| 947 |
+
0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61,
|
| 948 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 949 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 950 |
+
0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a,
|
| 951 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df,
|
| 952 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 953 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 954 |
+
0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b,
|
| 955 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff,
|
| 956 |
+
};
|
| 957 |
+
|
| 958 |
+
static const unsigned char xmltranscodetable_ISO8859_14 [48 + 10 * 64] = {
|
| 959 |
+
0x00, 0x00, 0x01, 0x09, 0x04, 0x07, 0x00, 0x00,
|
| 960 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 961 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 962 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 963 |
+
0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 964 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 965 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 966 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 967 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 968 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 969 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 970 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 971 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 972 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 973 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 974 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 975 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 976 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 977 |
+
0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0xa7,
|
| 978 |
+
0x00, 0xa9, 0x00, 0x00, 0x00, 0xad, 0xae, 0x00,
|
| 979 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00,
|
| 980 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 981 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 982 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 983 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 984 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 985 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 986 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 987 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 988 |
+
0x03, 0x08, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00,
|
| 989 |
+
0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00,
|
| 990 |
+
0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00,
|
| 991 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 992 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xb1,
|
| 993 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 994 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 995 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 996 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 997 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 998 |
+
0x00, 0x00, 0xa4, 0xa5, 0x00, 0x00, 0x00, 0x00,
|
| 999 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1000 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1001 |
+
0xb2, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1002 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1003 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1004 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1005 |
+
0xa8, 0xb8, 0xaa, 0xba, 0xbd, 0xbe, 0x00, 0x00,
|
| 1006 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1007 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1008 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1009 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1010 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1011 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1012 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1013 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1014 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1015 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1016 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1017 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1018 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1019 |
+
0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00,
|
| 1020 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1021 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1022 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1023 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1024 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1025 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1026 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1027 |
+
0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, 0xde, 0xfe,
|
| 1028 |
+
0xaf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1029 |
+
0xb4, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1030 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1031 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0xb9,
|
| 1032 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1033 |
+
0xbb, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1034 |
+
0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00,
|
| 1035 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1036 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1037 |
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 1038 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 1039 |
+
0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00,
|
| 1040 |
+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf,
|
| 1041 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 1042 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 1043 |
+
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00,
|
| 1044 |
+
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff,
|
| 1045 |
+
};
|
| 1046 |
+
|
| 1047 |
+
static const unsigned short xmlunicodetable_ISO8859_15 [128] = {
|
| 1048 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 1049 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 1050 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 1051 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 1052 |
+
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7,
|
| 1053 |
+
0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 1054 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7,
|
| 1055 |
+
0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf,
|
| 1056 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 1057 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 1058 |
+
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 1059 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
| 1060 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 1061 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 1062 |
+
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 1063 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
|
| 1064 |
+
};
|
| 1065 |
+
|
| 1066 |
+
static const unsigned char xmltranscodetable_ISO8859_15 [48 + 6 * 64] = {
|
| 1067 |
+
0x00, 0x00, 0x01, 0x05, 0x00, 0x04, 0x00, 0x00,
|
| 1068 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1069 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1070 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1071 |
+
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1072 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1073 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1074 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1075 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1076 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1077 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1078 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1079 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1080 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1081 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 1082 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 1083 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 1084 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 1085 |
+
0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7,
|
| 1086 |
+
0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
| 1087 |
+
0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7,
|
| 1088 |
+
0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf,
|
| 1089 |
+
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1090 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1091 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1092 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1093 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1094 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1095 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1096 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1097 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1098 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1099 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1100 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1101 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1102 |
+
0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00,
|
| 1103 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1104 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1105 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1106 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1107 |
+
0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00,
|
| 1108 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1109 |
+
0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1110 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1111 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1112 |
+
0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00,
|
| 1113 |
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
| 1114 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 1115 |
+
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
| 1116 |
+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
| 1117 |
+
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
| 1118 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 1119 |
+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
| 1120 |
+
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
| 1121 |
+
};
|
| 1122 |
+
|
| 1123 |
+
static const unsigned short xmlunicodetable_ISO8859_16 [128] = {
|
| 1124 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 1125 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 1126 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 1127 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 1128 |
+
0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7,
|
| 1129 |
+
0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b,
|
| 1130 |
+
0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7,
|
| 1131 |
+
0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c,
|
| 1132 |
+
0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7,
|
| 1133 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 1134 |
+
0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a,
|
| 1135 |
+
0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df,
|
| 1136 |
+
0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7,
|
| 1137 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 1138 |
+
0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b,
|
| 1139 |
+
0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff,
|
| 1140 |
+
};
|
| 1141 |
+
|
| 1142 |
+
static const unsigned char xmltranscodetable_ISO8859_16 [48 + 9 * 64] = {
|
| 1143 |
+
0x00, 0x00, 0x01, 0x08, 0x02, 0x03, 0x00, 0x00,
|
| 1144 |
+
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1145 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1146 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1147 |
+
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1148 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1149 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1150 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1151 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1152 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1153 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1154 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1155 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1156 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1157 |
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
| 1158 |
+
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
| 1159 |
+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
| 1160 |
+
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
| 1161 |
+
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7,
|
| 1162 |
+
0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0x00,
|
| 1163 |
+
0xb0, 0xb1, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xb7,
|
| 1164 |
+
0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00,
|
| 1165 |
+
0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xa2, 0xc5, 0xe5,
|
| 1166 |
+
0x00, 0x00, 0x00, 0x00, 0xb2, 0xb9, 0x00, 0x00,
|
| 1167 |
+
0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1168 |
+
0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1169 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1170 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1171 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1172 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1173 |
+
0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0x00,
|
| 1174 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1175 |
+
0xd5, 0xf5, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00,
|
| 1176 |
+
0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00,
|
| 1177 |
+
0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1178 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1179 |
+
0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1180 |
+
0xbe, 0xac, 0xae, 0xaf, 0xbf, 0xb4, 0xb8, 0x00,
|
| 1181 |
+
0x06, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1182 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1183 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1184 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1185 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1186 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1187 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1188 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1189 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1190 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1191 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1192 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1193 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1194 |
+
0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00,
|
| 1195 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1196 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1197 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1198 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1199 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1200 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xa5, 0x00,
|
| 1201 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1202 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1203 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1204 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1205 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1206 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1207 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1208 |
+
0xaa, 0xba, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
| 1209 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1210 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1211 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1212 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 1213 |
+
0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0xc7,
|
| 1214 |
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
| 1215 |
+
0x00, 0x00, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0x00,
|
| 1216 |
+
0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
|
| 1217 |
+
0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0xe7,
|
| 1218 |
+
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
| 1219 |
+
0x00, 0x00, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0x00,
|
| 1220 |
+
0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
|
| 1221 |
+
};
|
| 1222 |
+
|
| 1223 |
+
#endif /* LIBXML_ISO8859X_ENABLED */
|
codegen/escape.inc
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
static const char xmlEscapeContent[] = {
|
| 2 |
+
8, '&', '#', 'x', 'F', 'F', 'F', 'D', ';', 4, '&', '#',
|
| 3 |
+
'9', ';', 5, '&', '#', '1', '0', ';', 5, '&', '#', '1',
|
| 4 |
+
'3', ';', 6, '&', 'q', 'u', 'o', 't', ';', 5, '&', 'a',
|
| 5 |
+
'm', 'p', ';', 4, '&', 'l', 't', ';', 4, '&', 'g', 't',
|
| 6 |
+
';',
|
| 7 |
+
};
|
| 8 |
+
|
| 9 |
+
static const signed char xmlEscapeTab[128] = {
|
| 10 |
+
0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 20, 0, 0,
|
| 11 |
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| 12 |
+
-1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 13 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
| 14 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 15 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 16 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 17 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
static const signed char xmlEscapeTabQuot[128] = {
|
| 21 |
+
0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 20, 0, 0,
|
| 22 |
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| 23 |
+
-1, -1, 26, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 24 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
| 25 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 26 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 27 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 28 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 29 |
+
};
|
| 30 |
+
|
| 31 |
+
static const signed char xmlEscapeTabAttr[128] = {
|
| 32 |
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 14, 0, 0, 20, 0, 0,
|
| 33 |
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| 34 |
+
-1, -1, 26, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 35 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
| 36 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 37 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 38 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 39 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 40 |
+
};
|
| 41 |
+
|
| 42 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 43 |
+
|
| 44 |
+
static const signed char htmlEscapeTab[128] = {
|
| 45 |
+
0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 46 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 47 |
+
-1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 48 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
| 49 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 50 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 51 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 52 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 53 |
+
};
|
| 54 |
+
|
| 55 |
+
static const signed char htmlEscapeTabAttr[128] = {
|
| 56 |
+
0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 57 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 58 |
+
-1, -1, 26, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 59 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
| 60 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 61 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 62 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| 63 |
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
def printHexTable(out, width, data):
|
| 4 |
+
s = ''
|
| 5 |
+
|
| 6 |
+
for i in range(len(data)):
|
| 7 |
+
if i % 8 == 0:
|
| 8 |
+
s += ' '
|
| 9 |
+
else:
|
| 10 |
+
s += ' '
|
| 11 |
+
|
| 12 |
+
s += f'0x{data[i]:{f"0{width}x"}},'
|
| 13 |
+
|
| 14 |
+
if i % 8 == 7:
|
| 15 |
+
out.write(s + '\n')
|
| 16 |
+
s = ''
|
| 17 |
+
|
| 18 |
+
def genTranscodeTable(out, name, chars):
|
| 19 |
+
# For two-byte sequences, we look up a row with 64 entries.
|
| 20 |
+
row_ids = [ 0 ] * 32
|
| 21 |
+
# For three-byte sequences, we look up a plane with 64 entries,
|
| 22 |
+
# indexing into rows.
|
| 23 |
+
plane_ids = [ 0 ] * 16
|
| 24 |
+
data = [ 0 ] * 64
|
| 25 |
+
|
| 26 |
+
o = 0x80
|
| 27 |
+
for cp in chars:
|
| 28 |
+
if cp != 0:
|
| 29 |
+
if cp < 0x0800:
|
| 30 |
+
# The lower five bits of the first byte in a
|
| 31 |
+
# two-byte sequence are used to find the row.
|
| 32 |
+
i = cp // 64
|
| 33 |
+
index = row_ids[i]
|
| 34 |
+
if index == 0:
|
| 35 |
+
index = len(data) // 64
|
| 36 |
+
data += [ 0 ] * 64
|
| 37 |
+
row_ids[i] = index
|
| 38 |
+
else:
|
| 39 |
+
# The lower four bits of the first byte in a
|
| 40 |
+
# three-byte sequence are used to find the plane.
|
| 41 |
+
i = cp // (64 * 64)
|
| 42 |
+
index2 = plane_ids[i]
|
| 43 |
+
if index2 == 0:
|
| 44 |
+
index2 = len(data) // 64
|
| 45 |
+
data += [ 0 ] * 64
|
| 46 |
+
plane_ids[i] = index2
|
| 47 |
+
|
| 48 |
+
# The lower six bits of the second byte in a
|
| 49 |
+
# three-byte sequence are used to find the row.
|
| 50 |
+
i = index2 * 64 + cp // 64 % 64
|
| 51 |
+
index = data[i]
|
| 52 |
+
if index == 0:
|
| 53 |
+
index = len(data) // 64
|
| 54 |
+
data += [ 0 ] * 64
|
| 55 |
+
data[i] = index
|
| 56 |
+
|
| 57 |
+
# The lower six bits in the last byte are
|
| 58 |
+
# used to lookup the codepoint.
|
| 59 |
+
data[index * 64 + cp % 64] = o
|
| 60 |
+
|
| 61 |
+
o += 1
|
| 62 |
+
|
| 63 |
+
out.write('static const unsigned short ')
|
| 64 |
+
out.write(f'xmlunicodetable_{name} [128] = {{\n')
|
| 65 |
+
printHexTable(out, 4, chars)
|
| 66 |
+
out.write('};\n\n')
|
| 67 |
+
|
| 68 |
+
num_chunks = len(data) // 64
|
| 69 |
+
out.write('static const unsigned char ')
|
| 70 |
+
out.write(f'xmltranscodetable_{name} [48 + {num_chunks} * 64] = {{\n')
|
| 71 |
+
printHexTable(out, 2, row_ids)
|
| 72 |
+
printHexTable(out, 2, plane_ids)
|
| 73 |
+
printHexTable(out, 2, data)
|
| 74 |
+
out.write('};\n\n')
|
| 75 |
+
|
| 76 |
+
out = open(f'codegen/charset.inc', 'w')
|
| 77 |
+
|
| 78 |
+
out.write('''/*
|
| 79 |
+
* Lookup tables for transcoding of 8-bit character sets.
|
| 80 |
+
*
|
| 81 |
+
* Generated with tools/genTranscode.py.
|
| 82 |
+
*/
|
| 83 |
+
|
| 84 |
+
''')
|
| 85 |
+
|
| 86 |
+
genTranscodeTable(out, 'windows_1252', [
|
| 87 |
+
0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
|
| 88 |
+
0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f,
|
| 89 |
+
0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
|
| 90 |
+
0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178,
|
| 91 |
+
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
| 92 |
+
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 93 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
| 94 |
+
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
|
| 95 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 96 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 97 |
+
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 98 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
| 99 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 100 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 101 |
+
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 102 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
|
| 103 |
+
])
|
| 104 |
+
|
| 105 |
+
out.write(r'''#if !defined(LIBXML_ICONV_ENABLED) && \
|
| 106 |
+
!defined(LIBXML_ICU_ENABLED) && \
|
| 107 |
+
defined(LIBXML_ISO8859X_ENABLED)
|
| 108 |
+
|
| 109 |
+
''')
|
| 110 |
+
|
| 111 |
+
genTranscodeTable(out, 'ISO8859_2', [
|
| 112 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 113 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 114 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 115 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 116 |
+
0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7,
|
| 117 |
+
0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b,
|
| 118 |
+
0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7,
|
| 119 |
+
0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c,
|
| 120 |
+
0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7,
|
| 121 |
+
0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e,
|
| 122 |
+
0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7,
|
| 123 |
+
0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df,
|
| 124 |
+
0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7,
|
| 125 |
+
0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f,
|
| 126 |
+
0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7,
|
| 127 |
+
0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9,
|
| 128 |
+
])
|
| 129 |
+
|
| 130 |
+
genTranscodeTable(out, 'ISO8859_3', [
|
| 131 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 132 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 133 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 134 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 135 |
+
0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7,
|
| 136 |
+
0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b,
|
| 137 |
+
0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7,
|
| 138 |
+
0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c,
|
| 139 |
+
0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7,
|
| 140 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 141 |
+
0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7,
|
| 142 |
+
0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df,
|
| 143 |
+
0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7,
|
| 144 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 145 |
+
0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7,
|
| 146 |
+
0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9,
|
| 147 |
+
])
|
| 148 |
+
|
| 149 |
+
genTranscodeTable(out, 'ISO8859_4', [
|
| 150 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 151 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 152 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 153 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 154 |
+
0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7,
|
| 155 |
+
0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af,
|
| 156 |
+
0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7,
|
| 157 |
+
0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b,
|
| 158 |
+
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
|
| 159 |
+
0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a,
|
| 160 |
+
0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 161 |
+
0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df,
|
| 162 |
+
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
|
| 163 |
+
0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b,
|
| 164 |
+
0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 165 |
+
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9,
|
| 166 |
+
])
|
| 167 |
+
|
| 168 |
+
genTranscodeTable(out, 'ISO8859_5', [
|
| 169 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 170 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 171 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 172 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 173 |
+
0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
|
| 174 |
+
0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f,
|
| 175 |
+
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
| 176 |
+
0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
|
| 177 |
+
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
| 178 |
+
0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
|
| 179 |
+
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
| 180 |
+
0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
|
| 181 |
+
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
| 182 |
+
0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f,
|
| 183 |
+
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
|
| 184 |
+
0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f,
|
| 185 |
+
])
|
| 186 |
+
|
| 187 |
+
genTranscodeTable(out, 'ISO8859_6', [
|
| 188 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 189 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 190 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 191 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 192 |
+
0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000,
|
| 193 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000,
|
| 194 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 195 |
+
0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f,
|
| 196 |
+
0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
| 197 |
+
0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
|
| 198 |
+
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
|
| 199 |
+
0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 200 |
+
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
|
| 201 |
+
0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
|
| 202 |
+
0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 203 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 204 |
+
])
|
| 205 |
+
|
| 206 |
+
genTranscodeTable(out, 'ISO8859_7', [
|
| 207 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 208 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 209 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 210 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 211 |
+
0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7,
|
| 212 |
+
0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015,
|
| 213 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7,
|
| 214 |
+
0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f,
|
| 215 |
+
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
| 216 |
+
0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f,
|
| 217 |
+
0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7,
|
| 218 |
+
0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af,
|
| 219 |
+
0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
|
| 220 |
+
0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
|
| 221 |
+
0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7,
|
| 222 |
+
0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000,
|
| 223 |
+
])
|
| 224 |
+
|
| 225 |
+
genTranscodeTable(out, 'ISO8859_8', [
|
| 226 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 227 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 228 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 229 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 230 |
+
0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
| 231 |
+
0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 232 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
| 233 |
+
0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000,
|
| 234 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 235 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 236 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 237 |
+
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017,
|
| 238 |
+
0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7,
|
| 239 |
+
0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df,
|
| 240 |
+
0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7,
|
| 241 |
+
0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000,
|
| 242 |
+
])
|
| 243 |
+
|
| 244 |
+
genTranscodeTable(out, 'ISO8859_9', [
|
| 245 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 246 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 247 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 248 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 249 |
+
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
| 250 |
+
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 251 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
| 252 |
+
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
|
| 253 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 254 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 255 |
+
0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 256 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df,
|
| 257 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 258 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 259 |
+
0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 260 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff,
|
| 261 |
+
])
|
| 262 |
+
|
| 263 |
+
genTranscodeTable(out, 'ISO8859_10', [
|
| 264 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 265 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 266 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 267 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 268 |
+
0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7,
|
| 269 |
+
0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a,
|
| 270 |
+
0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7,
|
| 271 |
+
0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b,
|
| 272 |
+
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
|
| 273 |
+
0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf,
|
| 274 |
+
0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168,
|
| 275 |
+
0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
| 276 |
+
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
|
| 277 |
+
0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef,
|
| 278 |
+
0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169,
|
| 279 |
+
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138,
|
| 280 |
+
])
|
| 281 |
+
|
| 282 |
+
genTranscodeTable(out, 'ISO8859_11', [
|
| 283 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 284 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 285 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 286 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 287 |
+
0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07,
|
| 288 |
+
0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f,
|
| 289 |
+
0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17,
|
| 290 |
+
0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f,
|
| 291 |
+
0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27,
|
| 292 |
+
0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f,
|
| 293 |
+
0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37,
|
| 294 |
+
0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f,
|
| 295 |
+
0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47,
|
| 296 |
+
0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f,
|
| 297 |
+
0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57,
|
| 298 |
+
0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000,
|
| 299 |
+
])
|
| 300 |
+
|
| 301 |
+
genTranscodeTable(out, 'ISO8859_13', [
|
| 302 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 303 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 304 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 305 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 306 |
+
0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7,
|
| 307 |
+
0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6,
|
| 308 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7,
|
| 309 |
+
0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6,
|
| 310 |
+
0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112,
|
| 311 |
+
0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b,
|
| 312 |
+
0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7,
|
| 313 |
+
0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df,
|
| 314 |
+
0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113,
|
| 315 |
+
0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c,
|
| 316 |
+
0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7,
|
| 317 |
+
0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019,
|
| 318 |
+
])
|
| 319 |
+
|
| 320 |
+
genTranscodeTable(out, 'ISO8859_14', [
|
| 321 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 322 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 323 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 324 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 325 |
+
0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7,
|
| 326 |
+
0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178,
|
| 327 |
+
0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56,
|
| 328 |
+
0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61,
|
| 329 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 330 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 331 |
+
0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a,
|
| 332 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df,
|
| 333 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 334 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 335 |
+
0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b,
|
| 336 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff,
|
| 337 |
+
])
|
| 338 |
+
|
| 339 |
+
genTranscodeTable(out, 'ISO8859_15', [
|
| 340 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 341 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 342 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 343 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 344 |
+
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7,
|
| 345 |
+
0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
| 346 |
+
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7,
|
| 347 |
+
0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf,
|
| 348 |
+
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
| 349 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 350 |
+
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
| 351 |
+
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
| 352 |
+
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
| 353 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 354 |
+
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
| 355 |
+
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
|
| 356 |
+
])
|
| 357 |
+
|
| 358 |
+
genTranscodeTable(out, 'ISO8859_16', [
|
| 359 |
+
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
| 360 |
+
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
| 361 |
+
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
| 362 |
+
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
| 363 |
+
0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7,
|
| 364 |
+
0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b,
|
| 365 |
+
0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7,
|
| 366 |
+
0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c,
|
| 367 |
+
0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7,
|
| 368 |
+
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
| 369 |
+
0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a,
|
| 370 |
+
0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df,
|
| 371 |
+
0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7,
|
| 372 |
+
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
| 373 |
+
0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b,
|
| 374 |
+
0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff,
|
| 375 |
+
])
|
| 376 |
+
|
| 377 |
+
out.write('#endif /* LIBXML_ISO8859X_ENABLED */\n')
|
| 378 |
+
|
| 379 |
+
out.close()
|
codegen/genEscape.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
entities = [
|
| 4 |
+
[ '', '�' ],
|
| 5 |
+
[ '\t', '	' ],
|
| 6 |
+
[ '\n', ' ' ],
|
| 7 |
+
[ '\r', ' ' ],
|
| 8 |
+
[ '"', '"' ],
|
| 9 |
+
[ '&', '&' ],
|
| 10 |
+
[ '<', '<' ],
|
| 11 |
+
[ '>', '>' ],
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
offset = [ None ] * 128
|
| 15 |
+
|
| 16 |
+
def gen_content(out):
|
| 17 |
+
pos = 0
|
| 18 |
+
r = ''
|
| 19 |
+
|
| 20 |
+
for rec in entities:
|
| 21 |
+
char, repl = rec
|
| 22 |
+
|
| 23 |
+
if char:
|
| 24 |
+
offset[ord(char)] = pos
|
| 25 |
+
|
| 26 |
+
if pos % 12 == 0: r += '\n '
|
| 27 |
+
else: r += ' '
|
| 28 |
+
r += '%3d,' % len(repl)
|
| 29 |
+
pos += 1
|
| 30 |
+
|
| 31 |
+
for c in repl:
|
| 32 |
+
if pos % 12 == 0: r += '\n '
|
| 33 |
+
else: r += ' '
|
| 34 |
+
r += "'%s'," % c
|
| 35 |
+
pos += 1
|
| 36 |
+
|
| 37 |
+
out.write('static const char xmlEscapeContent[] = {%s\n};\n\n' % r)
|
| 38 |
+
|
| 39 |
+
def gen_tab(out, name, escape, is_xml):
|
| 40 |
+
r = ''
|
| 41 |
+
|
| 42 |
+
for i in range(0x80):
|
| 43 |
+
|
| 44 |
+
if chr(i) in escape:
|
| 45 |
+
v = offset[i]
|
| 46 |
+
elif i == 0:
|
| 47 |
+
v = 0
|
| 48 |
+
elif is_xml and i < 32 and i != 9 and i != 10:
|
| 49 |
+
v = 0
|
| 50 |
+
else:
|
| 51 |
+
v = -1
|
| 52 |
+
|
| 53 |
+
if i % 16 == 0: r += '\n '
|
| 54 |
+
else: r += ' '
|
| 55 |
+
r += '%2d,' % v
|
| 56 |
+
|
| 57 |
+
out.write('static const signed char %s[128] = {%s\n};\n\n' % (name, r))
|
| 58 |
+
|
| 59 |
+
with open('codegen/escape.inc', 'w') as out:
|
| 60 |
+
gen_content(out)
|
| 61 |
+
|
| 62 |
+
gen_tab(out, 'xmlEscapeTab', '\r&<>', True)
|
| 63 |
+
gen_tab(out, 'xmlEscapeTabQuot', '\r"&<>', True)
|
| 64 |
+
gen_tab(out, 'xmlEscapeTabAttr', '\t\n\r"&<>', True)
|
| 65 |
+
|
| 66 |
+
out.write('#ifdef LIBXML_HTML_ENABLED\n\n')
|
| 67 |
+
gen_tab(out, 'htmlEscapeTab', '&<>', False)
|
| 68 |
+
gen_tab(out, 'htmlEscapeTabAttr', '"&<>', False)
|
| 69 |
+
out.write('#endif /* LIBXML_HTML_ENABLED */\n')
|
codegen/genHtml5Ent.py
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
|
| 7 |
+
# The basic idea is to find named character references using binary
|
| 8 |
+
# search. Since entity strings may not have a terminator, this doesn't
|
| 9 |
+
# work if one entity string is a prefix of another. In this case,
|
| 10 |
+
# we branch to a subtable after matching the prefix.
|
| 11 |
+
#
|
| 12 |
+
# We create separate initial tables based on the first character
|
| 13 |
+
# of the entity name.
|
| 14 |
+
#
|
| 15 |
+
# The following tables are generated:
|
| 16 |
+
#
|
| 17 |
+
# htmlEntAlpha: start and end of initial tables, indexing into
|
| 18 |
+
# htmlEntValues
|
| 19 |
+
# htmlEntValues: concatenation of all table values, which index into
|
| 20 |
+
# htmlEntStrings
|
| 21 |
+
# htmlEntStrings: variable sized records containing entity name,
|
| 22 |
+
# replacement and optionally the position of a
|
| 23 |
+
# subtable
|
| 24 |
+
|
| 25 |
+
try:
|
| 26 |
+
with open('entities.json') as json_data:
|
| 27 |
+
ents = json.load(json_data)
|
| 28 |
+
except FileNotFoundError:
|
| 29 |
+
print('entities.json not found, try curl -LJO',
|
| 30 |
+
'https://html.spec.whatwg.org/entities.json')
|
| 31 |
+
sys.exit(1)
|
| 32 |
+
|
| 33 |
+
def to_cchars(s):
|
| 34 |
+
r = []
|
| 35 |
+
|
| 36 |
+
for c in s.encode():
|
| 37 |
+
if c >= 0x20 and c <= 0x7E and c != ord("'") and c != ord('\\'):
|
| 38 |
+
v = f"'{chr(c)}'"
|
| 39 |
+
else:
|
| 40 |
+
v = c
|
| 41 |
+
r += [ v ]
|
| 42 |
+
|
| 43 |
+
return r
|
| 44 |
+
|
| 45 |
+
@dataclass
|
| 46 |
+
class PrefixStackEntry:
|
| 47 |
+
prefix: str
|
| 48 |
+
table_id: int
|
| 49 |
+
|
| 50 |
+
@dataclass
|
| 51 |
+
class AlphaFixup:
|
| 52 |
+
table_id: int
|
| 53 |
+
char: int
|
| 54 |
+
|
| 55 |
+
@dataclass
|
| 56 |
+
class StringFixup:
|
| 57 |
+
table_id: int
|
| 58 |
+
string_index: int
|
| 59 |
+
super_table_id: int
|
| 60 |
+
super_offset: int
|
| 61 |
+
|
| 62 |
+
# Remove entity strings without trailing semicolon
|
| 63 |
+
keys = (key for key in ents.keys() if key.endswith(';'))
|
| 64 |
+
|
| 65 |
+
# Sort entity strings
|
| 66 |
+
keys = sorted(keys, key=lambda k: k[1:-1])
|
| 67 |
+
|
| 68 |
+
strings = []
|
| 69 |
+
tables = []
|
| 70 |
+
prefix_stack = []
|
| 71 |
+
alpha_fixups = []
|
| 72 |
+
string_fixups = []
|
| 73 |
+
for i in range(64):
|
| 74 |
+
tables.append([])
|
| 75 |
+
|
| 76 |
+
for i, key in enumerate(keys):
|
| 77 |
+
name = key[1:-1]
|
| 78 |
+
|
| 79 |
+
next_name = None
|
| 80 |
+
if i + 1 < len(keys):
|
| 81 |
+
next_name = keys[i+1][1:-1]
|
| 82 |
+
|
| 83 |
+
while prefix_stack and not name.startswith(prefix_stack[-1].prefix):
|
| 84 |
+
prefix_stack.pop()
|
| 85 |
+
|
| 86 |
+
# First character is initial prefix
|
| 87 |
+
if not prefix_stack:
|
| 88 |
+
table_id = len(tables)
|
| 89 |
+
tables.append([])
|
| 90 |
+
|
| 91 |
+
prefix_stack.append(PrefixStackEntry(name[0], table_id))
|
| 92 |
+
alpha_fixups.append(AlphaFixup(table_id, ord(name[0]) % 64))
|
| 93 |
+
|
| 94 |
+
string_index = len(strings)
|
| 95 |
+
table = tables[prefix_stack[-1].table_id]
|
| 96 |
+
table_index = len(table)
|
| 97 |
+
table.append(string_index)
|
| 98 |
+
|
| 99 |
+
name_offset = len(prefix_stack[-1].prefix)
|
| 100 |
+
name_chars = to_cchars(name[name_offset:])
|
| 101 |
+
repl_chars = to_cchars(ents[key]['characters'])
|
| 102 |
+
semicolon_flag = 0
|
| 103 |
+
if key[:-1] in ents:
|
| 104 |
+
semicolon_flag = 0x80
|
| 105 |
+
|
| 106 |
+
if next_name and next_name.startswith(name):
|
| 107 |
+
# Create subtable
|
| 108 |
+
|
| 109 |
+
strings += [
|
| 110 |
+
len(name_chars) | semicolon_flag | 0x40, *name_chars,
|
| 111 |
+
0, 0, # subtable position, to be fixed up
|
| 112 |
+
len(repl_chars), *repl_chars,
|
| 113 |
+
]
|
| 114 |
+
|
| 115 |
+
table_id = len(tables)
|
| 116 |
+
tables.append([])
|
| 117 |
+
|
| 118 |
+
fixup_index = string_index + 1 + len(name_chars)
|
| 119 |
+
string_fixups.append(StringFixup(
|
| 120 |
+
table_id, fixup_index, prefix_stack[-1].table_id, table_index,
|
| 121 |
+
))
|
| 122 |
+
|
| 123 |
+
prefix_stack.append(PrefixStackEntry(name, table_id))
|
| 124 |
+
else:
|
| 125 |
+
strings += [
|
| 126 |
+
len(name_chars) | semicolon_flag, *name_chars,
|
| 127 |
+
len(repl_chars), *repl_chars,
|
| 128 |
+
]
|
| 129 |
+
|
| 130 |
+
# Concat tables and record ranges
|
| 131 |
+
ranges = [ 0 ]
|
| 132 |
+
values = []
|
| 133 |
+
for table in tables:
|
| 134 |
+
values += table
|
| 135 |
+
ranges.append(len(values))
|
| 136 |
+
|
| 137 |
+
# Create alpha table
|
| 138 |
+
alpha = [ 0 ] * (59 * 3)
|
| 139 |
+
for fixup in alpha_fixups:
|
| 140 |
+
table_id, c = fixup.table_id, fixup.char
|
| 141 |
+
start = ranges[table_id]
|
| 142 |
+
end = ranges[table_id+1]
|
| 143 |
+
alpha[c*3:c*3+3] = [ start & 0xFF, start >> 8, end - start ]
|
| 144 |
+
|
| 145 |
+
# Fix up subtable positions
|
| 146 |
+
for fixup in string_fixups:
|
| 147 |
+
table_id, i = fixup.table_id, fixup.string_index
|
| 148 |
+
start = ranges[table_id]
|
| 149 |
+
end = ranges[table_id+1]
|
| 150 |
+
super_index = ranges[fixup.super_table_id] + fixup.super_offset
|
| 151 |
+
strings[i:i+2] = [ start - super_index, end - start ]
|
| 152 |
+
|
| 153 |
+
# Print tables
|
| 154 |
+
|
| 155 |
+
def gen_table(ctype, cname, values, fmt, elems_per_line):
|
| 156 |
+
count = len(values)
|
| 157 |
+
r = ''
|
| 158 |
+
|
| 159 |
+
for i in range(count):
|
| 160 |
+
if i != 0: r += ','
|
| 161 |
+
if i % elems_per_line == 0: r += '\n '
|
| 162 |
+
else: r += ' '
|
| 163 |
+
r += fmt % values[i]
|
| 164 |
+
|
| 165 |
+
return f'static const {ctype} {cname}[{count}] = {{{r}\n}};\n\n'
|
| 166 |
+
|
| 167 |
+
with open('codegen/html5ent.inc', 'w') as out:
|
| 168 |
+
out.write(gen_table('unsigned char', 'htmlEntAlpha', alpha, '%3d', 15))
|
| 169 |
+
out.write(gen_table('unsigned short', 'htmlEntValues', values, '%5d', 10))
|
| 170 |
+
out.write(gen_table('unsigned char', 'htmlEntStrings', strings, '%3s', 15))
|
codegen/genHtml5LibTests.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
import glob
|
| 4 |
+
import json
|
| 5 |
+
import re
|
| 6 |
+
|
| 7 |
+
state_map = {
|
| 8 |
+
'Data state': 0,
|
| 9 |
+
'RCDATA state': 1,
|
| 10 |
+
'RAWTEXT state': 2,
|
| 11 |
+
'PLAINTEXT state': 3,
|
| 12 |
+
'Script data state': 4,
|
| 13 |
+
'CDATA section state': 5,
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
for filename in sorted(glob.glob('../html5lib-tests/tokenizer/*.test')):
|
| 17 |
+
match = re.search('/([^/]*).test$', filename)
|
| 18 |
+
if match is None:
|
| 19 |
+
continue
|
| 20 |
+
testname = match[1]
|
| 21 |
+
if testname == 'xmlViolation':
|
| 22 |
+
continue
|
| 23 |
+
|
| 24 |
+
with open(filename) as json_data:
|
| 25 |
+
root = json.load(json_data)
|
| 26 |
+
|
| 27 |
+
test_out = open(f'test/html-tokenizer/{testname}.test', 'w')
|
| 28 |
+
result_out = open(f'result/html-tokenizer/{testname}.test', 'w')
|
| 29 |
+
|
| 30 |
+
counter = 0
|
| 31 |
+
|
| 32 |
+
for tests in root.values():
|
| 33 |
+
for test in tests:
|
| 34 |
+
input = test['input']
|
| 35 |
+
|
| 36 |
+
# Skip surrogate tests
|
| 37 |
+
if re.search(r'\\uD[89A-F]', input, re.I):
|
| 38 |
+
continue
|
| 39 |
+
|
| 40 |
+
input = re.sub(r'\\u([A-Fa-f0-9]{4})',
|
| 41 |
+
lambda m: chr(int(m[1], 16)),
|
| 42 |
+
input)
|
| 43 |
+
|
| 44 |
+
output = ''
|
| 45 |
+
for token in test['output']:
|
| 46 |
+
if token[1] == '\0':
|
| 47 |
+
continue
|
| 48 |
+
|
| 49 |
+
output += token[0] + '\n'
|
| 50 |
+
|
| 51 |
+
if token[0] == 'DOCTYPE':
|
| 52 |
+
for i in range(1, 4):
|
| 53 |
+
if token[i] is None:
|
| 54 |
+
output += '<none>\n'
|
| 55 |
+
else:
|
| 56 |
+
output += token[i] + '\n'
|
| 57 |
+
else:
|
| 58 |
+
output += token[1]
|
| 59 |
+
if token[0] == 'StartTag':
|
| 60 |
+
for name, value in token[2].items():
|
| 61 |
+
output += f' {name}={value}'
|
| 62 |
+
output += '\n'
|
| 63 |
+
|
| 64 |
+
output = re.sub(r'\\u([A-Fa-f0-9]{4})',
|
| 65 |
+
lambda m: chr(int(m[1], 16)),
|
| 66 |
+
output)
|
| 67 |
+
|
| 68 |
+
# The HTML5 spec splits handling of U+0000 across
|
| 69 |
+
# tokenizer and tree builder. We already ignore
|
| 70 |
+
# U+0000 in body text when tokenizing.
|
| 71 |
+
output = re.sub(r'\x00', '', output)
|
| 72 |
+
|
| 73 |
+
for state in test.get('initialStates', ['Data state']):
|
| 74 |
+
state_no = state_map.get(state)
|
| 75 |
+
if state_no is None:
|
| 76 |
+
raise Exception(f'{filename}: unknown state: {state}')
|
| 77 |
+
if state_no == 5:
|
| 78 |
+
continue
|
| 79 |
+
|
| 80 |
+
start_tag = test.get('lastStartTag', '-')
|
| 81 |
+
|
| 82 |
+
test_out.write(f'{counter} {start_tag} {state_no} '
|
| 83 |
+
f'{len(input.encode())}\n')
|
| 84 |
+
test_out.write(input)
|
| 85 |
+
test_out.write('\n')
|
| 86 |
+
|
| 87 |
+
result_out.write(f'{counter}\n')
|
| 88 |
+
result_out.write(output)
|
| 89 |
+
|
| 90 |
+
counter += 1
|
| 91 |
+
|
| 92 |
+
test_out.close()
|
| 93 |
+
result_out.close()
|
codegen/genRanges.py
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
#
|
| 3 |
+
# Portions of this script have been (shamelessly) stolen from the
|
| 4 |
+
# prior work of Daniel Veillard (genUnicode.py)
|
| 5 |
+
#
|
| 6 |
+
# I, however, take full credit for any bugs, errors or difficulties :-)
|
| 7 |
+
#
|
| 8 |
+
# William Brack
|
| 9 |
+
# October 2003
|
| 10 |
+
#
|
| 11 |
+
# 18 October 2003
|
| 12 |
+
# Modified to maintain binary compatibility with previous library versions
|
| 13 |
+
# by adding a suffix 'Q' ('quick') to the macro generated for the original,
|
| 14 |
+
# function, and adding generation of a function (with the original name) which
|
| 15 |
+
# instantiates the macro.
|
| 16 |
+
#
|
| 17 |
+
|
| 18 |
+
import sys
|
| 19 |
+
import rangetab
|
| 20 |
+
|
| 21 |
+
#
|
| 22 |
+
# A routine to take a list of yes/no (1, 0) values and turn it
|
| 23 |
+
# into a list of ranges. This will later be used to determine whether
|
| 24 |
+
# to generate single-byte lookup tables, or inline comparisons
|
| 25 |
+
#
|
| 26 |
+
def makeRange(lst):
|
| 27 |
+
ret = []
|
| 28 |
+
pos = 0
|
| 29 |
+
while pos < len(lst):
|
| 30 |
+
try: # index generates exception if not present
|
| 31 |
+
s = lst[pos:].index(1) # look for start of next range
|
| 32 |
+
except:
|
| 33 |
+
break # if no more, finished
|
| 34 |
+
pos += s # pointer to start of possible range
|
| 35 |
+
try:
|
| 36 |
+
e = lst[pos:].index(0) # look for end of range
|
| 37 |
+
e += pos
|
| 38 |
+
except: # if no end, set to end of list
|
| 39 |
+
e = len(lst)
|
| 40 |
+
ret.append((pos, e-1)) # append range tuple to list
|
| 41 |
+
pos = e + 1 # ready to check for next range
|
| 42 |
+
return ret
|
| 43 |
+
|
| 44 |
+
# minTableSize gives the minimum number of ranges which must be present
|
| 45 |
+
# before a 256-byte lookup table is produced. If there are less than this
|
| 46 |
+
# number, a macro with inline comparisons is generated
|
| 47 |
+
minTableSize = 6
|
| 48 |
+
|
| 49 |
+
# dictionary of functions, key=name, element contains char-map and range-list
|
| 50 |
+
Functs = {}
|
| 51 |
+
|
| 52 |
+
state = 0
|
| 53 |
+
|
| 54 |
+
try:
|
| 55 |
+
defines = open("codegen/ranges.def", "r")
|
| 56 |
+
except:
|
| 57 |
+
print("Missing codegen/ranges.def, aborting ...")
|
| 58 |
+
sys.exit(1)
|
| 59 |
+
|
| 60 |
+
#
|
| 61 |
+
# The lines in the .def file have three types:-
|
| 62 |
+
# name: Defines a new function block
|
| 63 |
+
# ur: Defines individual or ranges of unicode values
|
| 64 |
+
# end: Indicates the end of the function block
|
| 65 |
+
#
|
| 66 |
+
# These lines are processed below.
|
| 67 |
+
#
|
| 68 |
+
for line in defines.readlines():
|
| 69 |
+
# ignore blank lines, or lines beginning with '#'
|
| 70 |
+
if line[0] == '#':
|
| 71 |
+
continue
|
| 72 |
+
line = line.strip()
|
| 73 |
+
if line == '':
|
| 74 |
+
continue
|
| 75 |
+
# split line into space-separated fields, then split on type
|
| 76 |
+
try:
|
| 77 |
+
fields = line.split(' ')
|
| 78 |
+
#
|
| 79 |
+
# name line:
|
| 80 |
+
# validate any previous function block already ended
|
| 81 |
+
# validate this function not already defined
|
| 82 |
+
# initialize an entry in the function dicitonary
|
| 83 |
+
# including a mask table with no values yet defined
|
| 84 |
+
#
|
| 85 |
+
if fields[0] == 'name':
|
| 86 |
+
name = fields[1]
|
| 87 |
+
if state != 0:
|
| 88 |
+
print("'name' %s found before previous name" \
|
| 89 |
+
"completed" % (fields[1]))
|
| 90 |
+
continue
|
| 91 |
+
state = 1
|
| 92 |
+
if name in Functs:
|
| 93 |
+
print("name '%s' already present - may give" \
|
| 94 |
+
" wrong results" % (name))
|
| 95 |
+
else:
|
| 96 |
+
# dict entry with two list elements (chdata, rangedata)
|
| 97 |
+
Functs[name] = [ [], [] ]
|
| 98 |
+
for v in range(256):
|
| 99 |
+
Functs[name][0].append(0)
|
| 100 |
+
#
|
| 101 |
+
# end line:
|
| 102 |
+
# validate there was a preceding function name line
|
| 103 |
+
# set state to show no current function active
|
| 104 |
+
#
|
| 105 |
+
elif fields[0] == 'end':
|
| 106 |
+
if state == 0:
|
| 107 |
+
print("'end' found outside of function block")
|
| 108 |
+
continue
|
| 109 |
+
state = 0
|
| 110 |
+
|
| 111 |
+
#
|
| 112 |
+
# ur line:
|
| 113 |
+
# validate function has been defined
|
| 114 |
+
# process remaining fields on the line, which may be either
|
| 115 |
+
# individual unicode values or ranges of values
|
| 116 |
+
#
|
| 117 |
+
elif fields[0] == 'ur':
|
| 118 |
+
if state != 1:
|
| 119 |
+
raise Exception("'ur' found outside of 'name' block")
|
| 120 |
+
for el in fields[1:]:
|
| 121 |
+
pos = el.find('..')
|
| 122 |
+
# pos <=0 means not a range, so must be individual value
|
| 123 |
+
if pos <= 0:
|
| 124 |
+
# cheap handling of hex or decimal values
|
| 125 |
+
if el[0:2] == '0x':
|
| 126 |
+
value = int(el[2:],16)
|
| 127 |
+
elif el[0] == "'":
|
| 128 |
+
value = ord(el[1])
|
| 129 |
+
else:
|
| 130 |
+
value = int(el)
|
| 131 |
+
if ((value < 0) | (value > 0x1fffff)):
|
| 132 |
+
raise Exception('Illegal value (%s) in ch for'\
|
| 133 |
+
' name %s' % (el,name))
|
| 134 |
+
# for ur we have only ranges (makes things simpler),
|
| 135 |
+
# so convert val to range
|
| 136 |
+
currange = (value, value)
|
| 137 |
+
# pos > 0 means this is a range, so isolate/validate
|
| 138 |
+
# the interval
|
| 139 |
+
else:
|
| 140 |
+
# split the range into it's first-val, last-val
|
| 141 |
+
(first, last) = el.split("..")
|
| 142 |
+
# convert values from text into binary
|
| 143 |
+
if first[0:2] == '0x':
|
| 144 |
+
start = int(first[2:],16)
|
| 145 |
+
elif first[0] == "'":
|
| 146 |
+
start = ord(first[1])
|
| 147 |
+
else:
|
| 148 |
+
start = int(first)
|
| 149 |
+
if last[0:2] == '0x':
|
| 150 |
+
end = int(last[2:],16)
|
| 151 |
+
elif last[0] == "'":
|
| 152 |
+
end = ord(last[1])
|
| 153 |
+
else:
|
| 154 |
+
end = int(last)
|
| 155 |
+
if (start < 0) | (end > 0x1fffff) | (start > end):
|
| 156 |
+
raise Exception("Invalid range '%s'" % el)
|
| 157 |
+
currange = (start, end)
|
| 158 |
+
# common path - 'currange' has the range, now take care of it
|
| 159 |
+
# We split on single-byte values vs. multibyte
|
| 160 |
+
if currange[1] < 0x100: # single-byte
|
| 161 |
+
for ch in range(currange[0],currange[1]+1):
|
| 162 |
+
# validate that value not previously defined
|
| 163 |
+
if Functs[name][0][ch]:
|
| 164 |
+
msg = "Duplicate ch value '%s' for name '%s'" % (el, name)
|
| 165 |
+
raise Exception(msg)
|
| 166 |
+
Functs[name][0][ch] = 1
|
| 167 |
+
else: # multi-byte
|
| 168 |
+
if currange in Functs[name][1]:
|
| 169 |
+
raise Exception("range already defined in" \
|
| 170 |
+
" function")
|
| 171 |
+
else:
|
| 172 |
+
Functs[name][1].append(currange)
|
| 173 |
+
|
| 174 |
+
except:
|
| 175 |
+
print("Failed to process line: %s" % (line))
|
| 176 |
+
raise
|
| 177 |
+
|
| 178 |
+
try:
|
| 179 |
+
output = open("codegen/ranges.inc", "w")
|
| 180 |
+
except:
|
| 181 |
+
print("Failed to open codegen/ranges.inc")
|
| 182 |
+
sys.exit(1)
|
| 183 |
+
|
| 184 |
+
#
|
| 185 |
+
# Now output the generated data.
|
| 186 |
+
#
|
| 187 |
+
|
| 188 |
+
fkeys = sorted(Functs.keys())
|
| 189 |
+
|
| 190 |
+
for f in fkeys:
|
| 191 |
+
|
| 192 |
+
# First we convert the specified single-byte values into a group of ranges.
|
| 193 |
+
if max(Functs[f][0]) > 0: # only check if at least one entry
|
| 194 |
+
rangeTable = makeRange(Functs[f][0])
|
| 195 |
+
numRanges = len(rangeTable)
|
| 196 |
+
if numRanges >= minTableSize: # table is worthwhile
|
| 197 |
+
# write the constant data to the code file
|
| 198 |
+
output.write("const unsigned char %s_tab[256] = {\n" % f)
|
| 199 |
+
pline = " "
|
| 200 |
+
for n in range(255):
|
| 201 |
+
pline += " 0x%02x," % Functs[f][0][n]
|
| 202 |
+
if len(pline) > 72:
|
| 203 |
+
output.write(pline + "\n")
|
| 204 |
+
pline = " "
|
| 205 |
+
output.write(pline + " 0x%02x };\n\n" % Functs[f][0][255])
|
| 206 |
+
|
| 207 |
+
#
|
| 208 |
+
# Next we do the unicode ranges
|
| 209 |
+
#
|
| 210 |
+
|
| 211 |
+
for f in fkeys:
|
| 212 |
+
if len(Functs[f][1]) > 0: # only generate if unicode ranges present
|
| 213 |
+
rangeTable = Functs[f][1]
|
| 214 |
+
rangeTable.sort() # ascending tuple sequence
|
| 215 |
+
group = rangetab.gen_range_tables(output, f, '_srng', '_lrng',
|
| 216 |
+
rangeTable)
|
| 217 |
+
|
| 218 |
+
output.write("const xmlChRangeGroup %sGroup =\n\t%s;\n\n" %
|
| 219 |
+
(f, group))
|
| 220 |
+
|
| 221 |
+
output.close()
|
| 222 |
+
|
codegen/genTestApi.py
ADDED
|
@@ -0,0 +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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
#
|
| 3 |
+
# generate a test program for the API
|
| 4 |
+
#
|
| 5 |
+
|
| 6 |
+
import xml.etree.ElementTree as etree
|
| 7 |
+
import os
|
| 8 |
+
import re
|
| 9 |
+
import sys
|
| 10 |
+
|
| 11 |
+
import xmlmod
|
| 12 |
+
|
| 13 |
+
# Globals
|
| 14 |
+
|
| 15 |
+
dtors = {
|
| 16 |
+
'htmlDoc *': 'xmlFreeDoc',
|
| 17 |
+
'htmlParserCtxt *': 'htmlFreeParserCtxt',
|
| 18 |
+
'xmlAutomata *': 'xmlFreeAutomata',
|
| 19 |
+
'xmlBuffer *': 'xmlBufferFree',
|
| 20 |
+
'xmlCatalog *': 'xmlFreeCatalog',
|
| 21 |
+
'xmlChar *': 'xmlFree',
|
| 22 |
+
'xmlDOMWrapCtxt *': 'xmlDOMWrapFreeCtxt',
|
| 23 |
+
'xmlDict *': 'xmlDictFree',
|
| 24 |
+
'xmlDoc *': 'xmlFreeDoc',
|
| 25 |
+
'xmlDtd *': 'xmlFreeDtd',
|
| 26 |
+
'xmlEntitiesTable *': 'xmlFreeEntitiesTable',
|
| 27 |
+
'xmlElementContent *': 'xmlFreeElementContent',
|
| 28 |
+
'xmlEnumeration *': 'xmlFreeEnumeration',
|
| 29 |
+
'xmlList *': 'xmlListDelete',
|
| 30 |
+
'xmlModule *': 'xmlModuleFree',
|
| 31 |
+
'xmlMutex *': 'xmlFreeMutex',
|
| 32 |
+
'xmlNode *': 'xmlFreeNode',
|
| 33 |
+
'xmlNodeSet *': 'xmlXPathFreeNodeSet',
|
| 34 |
+
'xmlNs *': 'xmlFreeNs',
|
| 35 |
+
'xmlOutputBuffer *': 'xmlOutputBufferClose',
|
| 36 |
+
'xmlParserCtxt *': 'xmlFreeParserCtxt',
|
| 37 |
+
'xmlParserInputBuffer *': 'xmlFreeParserInputBuffer',
|
| 38 |
+
'xmlParserInput *': 'xmlFreeInputStream',
|
| 39 |
+
'xmlRMutex *': 'xmlFreeRMutex',
|
| 40 |
+
'xmlRelaxNGValidCtxt *': 'xmlRelaxNGFreeValidCtxt',
|
| 41 |
+
'xmlSaveCtxt *': 'xmlSaveClose',
|
| 42 |
+
'xmlSchemaFacet *': 'xmlSchemaFreeFacet',
|
| 43 |
+
'xmlSchemaVal *': 'xmlSchemaFreeValue',
|
| 44 |
+
'xmlSchemaValidCtxt *': 'xmlSchemaFreeValidCtxt',
|
| 45 |
+
'xmlTextWriter *': 'xmlFreeTextWriter',
|
| 46 |
+
'xmlURI *': 'xmlFreeURI',
|
| 47 |
+
'xmlValidCtxt *': 'xmlFreeValidCtxt',
|
| 48 |
+
'xmlXPathContext *': 'xmlXPathFreeContext',
|
| 49 |
+
'xmlXPathParserContext *': 'xmlXPathFreeParserContext',
|
| 50 |
+
'xmlXPathObject *': 'xmlXPathFreeObject',
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
blockList = {
|
| 54 |
+
# init/cleanup
|
| 55 |
+
'xmlCleanupParser': True,
|
| 56 |
+
'xmlInitParser': True,
|
| 57 |
+
|
| 58 |
+
# arg must be non-NULL
|
| 59 |
+
'xmlMemStrdupLoc': True,
|
| 60 |
+
'xmlMemoryStrdup': True,
|
| 61 |
+
|
| 62 |
+
# Returns void pointer which must be freed
|
| 63 |
+
'xmlMallocAtomicLoc': True,
|
| 64 |
+
'xmlMallocLoc': True,
|
| 65 |
+
'xmlMemMalloc': True,
|
| 66 |
+
'xmlMemRealloc': True,
|
| 67 |
+
'xmlReallocLoc': True,
|
| 68 |
+
|
| 69 |
+
# Would reset the error handler
|
| 70 |
+
'xmlSetStructuredErrorFunc': True,
|
| 71 |
+
|
| 72 |
+
# Prints errors
|
| 73 |
+
'xmlCatalogGetPublic': True,
|
| 74 |
+
'xmlCatalogGetSystem': True,
|
| 75 |
+
'xmlDebugDumpDTD': True,
|
| 76 |
+
'xmlDebugDumpDocument': True,
|
| 77 |
+
'xmlDebugDumpNode': True,
|
| 78 |
+
'xmlDebugDumpString': True,
|
| 79 |
+
'xmlParserError': True,
|
| 80 |
+
'xmlParserWarning': True,
|
| 81 |
+
'xmlParserValidityError': True,
|
| 82 |
+
'xmlParserValidityWarning': True,
|
| 83 |
+
|
| 84 |
+
# Internal parser unctions, ctxt must be non-NULL
|
| 85 |
+
'xmlParseAttribute': True,
|
| 86 |
+
'xmlParseAttributeListDecl': True,
|
| 87 |
+
'xmlParseAttributeType': True,
|
| 88 |
+
'xmlParseCDSect': True,
|
| 89 |
+
'xmlParseCharData': True,
|
| 90 |
+
'xmlParseCharRef': True,
|
| 91 |
+
'xmlParseComment': True,
|
| 92 |
+
'xmlParseDefaultDecl': True,
|
| 93 |
+
'xmlParseDocTypeDecl': True,
|
| 94 |
+
'xmlParseEndTag': True,
|
| 95 |
+
'xmlParseElement': True,
|
| 96 |
+
'xmlParseElementChildrenContentDecl': True,
|
| 97 |
+
'xmlParseElementContentDecl': True,
|
| 98 |
+
'xmlParseElementDecl': True,
|
| 99 |
+
'xmlParseElementMixedContentDecl': True,
|
| 100 |
+
'xmlParseEncName': True,
|
| 101 |
+
'xmlParseEncodingDecl': True,
|
| 102 |
+
'xmlParseEntityDecl': True,
|
| 103 |
+
'xmlParseEntityValue': True,
|
| 104 |
+
'xmlParseEnumeratedType': True,
|
| 105 |
+
'xmlParseEnumerationType': True,
|
| 106 |
+
'xmlParseExternalID': True,
|
| 107 |
+
'xmlParseExternalSubset': True,
|
| 108 |
+
'xmlParseMarkupDecl': True,
|
| 109 |
+
'xmlParseMisc': True,
|
| 110 |
+
'xmlParseName': True,
|
| 111 |
+
'xmlParseNmtoken': True,
|
| 112 |
+
'xmlParseNotationDecl': True,
|
| 113 |
+
'xmlParseNotationType': True,
|
| 114 |
+
'xmlParsePEReference': True,
|
| 115 |
+
'xmlParsePI': True,
|
| 116 |
+
'xmlParsePITarget': True,
|
| 117 |
+
'xmlParsePubidLiteral': True,
|
| 118 |
+
'xmlParseReference': True,
|
| 119 |
+
'xmlParseSDDecl': True,
|
| 120 |
+
'xmlParseStartTag': True,
|
| 121 |
+
'xmlParseSystemLiteral': True,
|
| 122 |
+
'xmlParseTextDecl': True,
|
| 123 |
+
'xmlParseVersionInfo': True,
|
| 124 |
+
'xmlParseVersionNum': True,
|
| 125 |
+
'xmlParseXMLDecl': True,
|
| 126 |
+
'xmlParserHandlePEReference': True,
|
| 127 |
+
'xmlSkipBlankChars': True,
|
| 128 |
+
|
| 129 |
+
# reads from stdin
|
| 130 |
+
'htmlReadFd': True,
|
| 131 |
+
'xmlReadFd': True,
|
| 132 |
+
'xmlReaderForFd': True,
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
# Parse document
|
| 136 |
+
|
| 137 |
+
if len(sys.argv) > 1:
|
| 138 |
+
buildDir = sys.argv[1]
|
| 139 |
+
else:
|
| 140 |
+
buildDir = '.'
|
| 141 |
+
|
| 142 |
+
xmlDocDir = buildDir + '/doc/xml'
|
| 143 |
+
|
| 144 |
+
filenames = {}
|
| 145 |
+
functions = {}
|
| 146 |
+
|
| 147 |
+
for file in os.listdir(xmlDocDir):
|
| 148 |
+
if not file.endswith('_8h.xml'):
|
| 149 |
+
continue
|
| 150 |
+
|
| 151 |
+
doc = etree.parse(xmlDocDir + '/' + file)
|
| 152 |
+
|
| 153 |
+
compound = doc.find('compounddef')
|
| 154 |
+
module = compound.find('compoundname').text
|
| 155 |
+
if not module.endswith('.h'):
|
| 156 |
+
continue
|
| 157 |
+
module = module[:-2]
|
| 158 |
+
|
| 159 |
+
for section in compound.findall('sectiondef'):
|
| 160 |
+
if section.get('kind') != 'func':
|
| 161 |
+
continue
|
| 162 |
+
|
| 163 |
+
for func in section.findall('memberdef'):
|
| 164 |
+
name = func.find('name').text
|
| 165 |
+
if name in blockList:
|
| 166 |
+
continue
|
| 167 |
+
|
| 168 |
+
module1, module2 = xmlmod.findModules(module, name)
|
| 169 |
+
|
| 170 |
+
cargs = []
|
| 171 |
+
skip = False
|
| 172 |
+
for arg in func.findall('param'):
|
| 173 |
+
atype = etree.tostring(arg.find('type'),
|
| 174 |
+
method='text', encoding='unicode').rstrip()
|
| 175 |
+
if atype == 'void':
|
| 176 |
+
continue
|
| 177 |
+
if atype == 'va_list':
|
| 178 |
+
skip = True
|
| 179 |
+
break
|
| 180 |
+
if re.search(r'(Ptr|\*)$', atype):
|
| 181 |
+
cargs.append('NULL')
|
| 182 |
+
else:
|
| 183 |
+
cargs.append('0')
|
| 184 |
+
|
| 185 |
+
if skip:
|
| 186 |
+
continue
|
| 187 |
+
|
| 188 |
+
mfunc = functions.get(module1)
|
| 189 |
+
if mfunc is None:
|
| 190 |
+
mfunc = {}
|
| 191 |
+
functions[module1] = mfunc
|
| 192 |
+
|
| 193 |
+
mmfunc = mfunc.get(module2)
|
| 194 |
+
if mmfunc is None:
|
| 195 |
+
mmfunc = {}
|
| 196 |
+
mfunc[module2] = mmfunc
|
| 197 |
+
|
| 198 |
+
code = f'{name}({', '.join(cargs)})'
|
| 199 |
+
|
| 200 |
+
rtype = etree.tostring(func.find('type'),
|
| 201 |
+
method='text', encoding='unicode').rstrip()
|
| 202 |
+
dtor = dtors.get(rtype)
|
| 203 |
+
if dtor is not None:
|
| 204 |
+
code = f'{dtor}({code})'
|
| 205 |
+
elif rtype == 'xmlHashTable *':
|
| 206 |
+
code = f'xmlHashFree({code}, NULL)'
|
| 207 |
+
|
| 208 |
+
mmfunc[name] = f' {code};\n'
|
| 209 |
+
|
| 210 |
+
# Write output
|
| 211 |
+
|
| 212 |
+
test = open('testapi.c', 'w')
|
| 213 |
+
|
| 214 |
+
test.write("""/*
|
| 215 |
+
* testapi.c: libxml2 API tester program.
|
| 216 |
+
*
|
| 217 |
+
* Automatically generated by gentest.py
|
| 218 |
+
*
|
| 219 |
+
* See Copyright for the status of this software.
|
| 220 |
+
*/
|
| 221 |
+
|
| 222 |
+
/* Disable deprecation warnings */
|
| 223 |
+
#define XML_DEPRECATED
|
| 224 |
+
|
| 225 |
+
#include "libxml.h"
|
| 226 |
+
#include <libxml/HTMLparser.h>
|
| 227 |
+
#include <libxml/HTMLtree.h>
|
| 228 |
+
#include <libxml/c14n.h>
|
| 229 |
+
#include <libxml/catalog.h>
|
| 230 |
+
#include <libxml/debugXML.h>
|
| 231 |
+
#include <libxml/parserInternals.h>
|
| 232 |
+
#include <libxml/pattern.h>
|
| 233 |
+
#include <libxml/relaxng.h>
|
| 234 |
+
#include <libxml/schematron.h>
|
| 235 |
+
#include <libxml/uri.h>
|
| 236 |
+
#include <libxml/xinclude.h>
|
| 237 |
+
#include <libxml/xlink.h>
|
| 238 |
+
#include <libxml/xmlmodule.h>
|
| 239 |
+
#include <libxml/xmlreader.h>
|
| 240 |
+
#include <libxml/xmlsave.h>
|
| 241 |
+
#include <libxml/xmlschemas.h>
|
| 242 |
+
#include <libxml/xmlschemastypes.h>
|
| 243 |
+
#include <libxml/xmlwriter.h>
|
| 244 |
+
#include <libxml/xpathInternals.h>
|
| 245 |
+
#include <libxml/xpointer.h>
|
| 246 |
+
|
| 247 |
+
static void
|
| 248 |
+
ignoreError(void *userData ATTRIBUTE_UNUSED,
|
| 249 |
+
const xmlError *error ATTRIBUTE_UNUSED) {
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
int
|
| 253 |
+
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
| 254 |
+
xmlInitParser();
|
| 255 |
+
xmlSetStructuredErrorFunc(NULL, ignoreError);
|
| 256 |
+
|
| 257 |
+
""")
|
| 258 |
+
|
| 259 |
+
for module1 in sorted(functions.keys()):
|
| 260 |
+
mfunc = functions[module1]
|
| 261 |
+
|
| 262 |
+
if module1 != '':
|
| 263 |
+
test.write(f'#ifdef LIBXML_{module1}_ENABLED\n')
|
| 264 |
+
|
| 265 |
+
for module2 in sorted(mfunc.keys()):
|
| 266 |
+
mmfunc = mfunc[module2]
|
| 267 |
+
|
| 268 |
+
if module2 != '':
|
| 269 |
+
test.write(f'#ifdef LIBXML_{module2}_ENABLED\n')
|
| 270 |
+
|
| 271 |
+
for name in sorted(mmfunc.keys()):
|
| 272 |
+
test.write(mmfunc[name])
|
| 273 |
+
|
| 274 |
+
if module2 != '':
|
| 275 |
+
test.write(f'#endif /* LIBXML_{module2}_ENABLED */\n')
|
| 276 |
+
|
| 277 |
+
if module1 != '':
|
| 278 |
+
test.write(f'#endif /* LIBXML_{module1}_ENABLED */\n')
|
| 279 |
+
|
| 280 |
+
test.write('\n')
|
| 281 |
+
|
| 282 |
+
test.write(""" xmlCleanupParser();
|
| 283 |
+
return 0;
|
| 284 |
+
}
|
| 285 |
+
""")
|
codegen/genUnicode.py
ADDED
|
@@ -0,0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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
#
|
| 3 |
+
# Original script modified in November 2003 to take advantage of
|
| 4 |
+
# the character-validation range routines, and updated to the
|
| 5 |
+
# current Unicode information (Version 4.0.1)
|
| 6 |
+
#
|
| 7 |
+
# NOTE: there is an 'alias' facility for blocks which are not present in
|
| 8 |
+
# the current release, but are needed for ABI compatibility. This
|
| 9 |
+
# must be accomplished MANUALLY! Please see the comments below under
|
| 10 |
+
# 'blockAliases'
|
| 11 |
+
#
|
| 12 |
+
import sys
|
| 13 |
+
import string
|
| 14 |
+
import rangetab
|
| 15 |
+
|
| 16 |
+
#
|
| 17 |
+
# blockAliases is a small hack - it is used for mapping block names which
|
| 18 |
+
# were were used in the 3.1 release, but are missing or changed in the current
|
| 19 |
+
# release. The format is "OldBlockName:NewBlockName1[,NewBlockName2[,...]]"
|
| 20 |
+
blockAliases = []
|
| 21 |
+
blockAliases.append("CombiningMarksforSymbols:CombiningDiacriticalMarksforSymbols")
|
| 22 |
+
blockAliases.append("Greek:GreekandCoptic")
|
| 23 |
+
blockAliases.append("PrivateUse:PrivateUseArea,SupplementaryPrivateUseArea-A," +
|
| 24 |
+
"SupplementaryPrivateUseArea-B")
|
| 25 |
+
|
| 26 |
+
# minTableSize gives the minimum number of ranges which must be present
|
| 27 |
+
# before a range table is produced. If there are less than this
|
| 28 |
+
# number, inline comparisons are generated
|
| 29 |
+
minTableSize = 8
|
| 30 |
+
|
| 31 |
+
blockfile = "Blocks-4.0.1.txt"
|
| 32 |
+
catfile = "UnicodeData-4.0.1.txt"
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
#
|
| 36 |
+
# Now process the "blocks" file, reducing it to a dictionary
|
| 37 |
+
# indexed by blockname, containing a tuple with the applicable
|
| 38 |
+
# block range
|
| 39 |
+
#
|
| 40 |
+
BlockNames = {}
|
| 41 |
+
try:
|
| 42 |
+
blocks = open(blockfile, "r")
|
| 43 |
+
except:
|
| 44 |
+
print("Missing %s, aborting ..." % blockfile)
|
| 45 |
+
sys.exit(1)
|
| 46 |
+
|
| 47 |
+
for line in blocks.readlines():
|
| 48 |
+
if line[0] == '#':
|
| 49 |
+
continue
|
| 50 |
+
line = line.strip()
|
| 51 |
+
if line == '':
|
| 52 |
+
continue
|
| 53 |
+
try:
|
| 54 |
+
fields = line.split(';')
|
| 55 |
+
range = fields[0].strip()
|
| 56 |
+
(start, end) = range.split("..")
|
| 57 |
+
name = fields[1].strip()
|
| 58 |
+
name = name.replace(' ', '')
|
| 59 |
+
except:
|
| 60 |
+
print("Failed to process line: %s" % (line))
|
| 61 |
+
continue
|
| 62 |
+
start = int(start, 16)
|
| 63 |
+
end = int(end, 16)
|
| 64 |
+
try:
|
| 65 |
+
BlockNames[name].append((start, end))
|
| 66 |
+
except:
|
| 67 |
+
BlockNames[name] = [(start, end)]
|
| 68 |
+
blocks.close()
|
| 69 |
+
print("Parsed %d blocks descriptions" % (len(BlockNames.keys())))
|
| 70 |
+
|
| 71 |
+
for block in blockAliases:
|
| 72 |
+
alias = block.split(':')
|
| 73 |
+
alist = alias[1].split(',')
|
| 74 |
+
for comp in alist:
|
| 75 |
+
if comp in BlockNames:
|
| 76 |
+
if alias[0] not in BlockNames:
|
| 77 |
+
BlockNames[alias[0]] = []
|
| 78 |
+
for r in BlockNames[comp]:
|
| 79 |
+
BlockNames[alias[0]].append(r)
|
| 80 |
+
else:
|
| 81 |
+
print("Alias %s: %s not in Blocks" % (alias[0], comp))
|
| 82 |
+
continue
|
| 83 |
+
|
| 84 |
+
#
|
| 85 |
+
# Next process the Categories file. This is more complex, since
|
| 86 |
+
# the file is in code sequence, and we need to invert it. We use
|
| 87 |
+
# a dictionary with index category-name, with each entry containing
|
| 88 |
+
# all the ranges (codepoints) of that category. Note that category
|
| 89 |
+
# names comprise two parts - the general category, and the "subclass"
|
| 90 |
+
# within that category. Therefore, both "general category" (which is
|
| 91 |
+
# the first character of the 2-character category-name) and the full
|
| 92 |
+
# (2-character) name are entered into this dictionary.
|
| 93 |
+
#
|
| 94 |
+
try:
|
| 95 |
+
data = open(catfile, "r")
|
| 96 |
+
except:
|
| 97 |
+
print("Missing %s, aborting ..." % catfile)
|
| 98 |
+
sys.exit(1)
|
| 99 |
+
|
| 100 |
+
nbchar = 0;
|
| 101 |
+
Categories = {}
|
| 102 |
+
for line in data.readlines():
|
| 103 |
+
if line[0] == '#':
|
| 104 |
+
continue
|
| 105 |
+
line = line.strip()
|
| 106 |
+
if line == '':
|
| 107 |
+
continue
|
| 108 |
+
try:
|
| 109 |
+
fields = line.split(';')
|
| 110 |
+
point = fields[0].strip()
|
| 111 |
+
value = 0
|
| 112 |
+
while point != '':
|
| 113 |
+
value = value * 16
|
| 114 |
+
if point[0] >= '0' and point[0] <= '9':
|
| 115 |
+
value = value + ord(point[0]) - ord('0')
|
| 116 |
+
elif point[0] >= 'A' and point[0] <= 'F':
|
| 117 |
+
value = value + 10 + ord(point[0]) - ord('A')
|
| 118 |
+
elif point[0] >= 'a' and point[0] <= 'f':
|
| 119 |
+
value = value + 10 + ord(point[0]) - ord('a')
|
| 120 |
+
point = point[1:]
|
| 121 |
+
name = fields[2]
|
| 122 |
+
except:
|
| 123 |
+
print("Failed to process line: %s" % (line))
|
| 124 |
+
continue
|
| 125 |
+
|
| 126 |
+
nbchar = nbchar + 1
|
| 127 |
+
# update entry for "full name"
|
| 128 |
+
try:
|
| 129 |
+
Categories[name].append(value)
|
| 130 |
+
except:
|
| 131 |
+
try:
|
| 132 |
+
Categories[name] = [value]
|
| 133 |
+
except:
|
| 134 |
+
print("Failed to process line: %s" % (line))
|
| 135 |
+
# update "general category" name
|
| 136 |
+
try:
|
| 137 |
+
Categories[name[0]].append(value)
|
| 138 |
+
except:
|
| 139 |
+
try:
|
| 140 |
+
Categories[name[0]] = [value]
|
| 141 |
+
except:
|
| 142 |
+
print("Failed to process line: %s" % (line))
|
| 143 |
+
|
| 144 |
+
data.close()
|
| 145 |
+
print("Parsed %d char generating %d categories" % (nbchar, len(Categories.keys())))
|
| 146 |
+
|
| 147 |
+
#
|
| 148 |
+
# The data is now all read. Time to process it into a more useful form.
|
| 149 |
+
#
|
| 150 |
+
# reduce the number list into ranges
|
| 151 |
+
for cat in Categories.keys():
|
| 152 |
+
list = Categories[cat]
|
| 153 |
+
start = -1
|
| 154 |
+
prev = -1
|
| 155 |
+
end = -1
|
| 156 |
+
ranges = []
|
| 157 |
+
for val in list:
|
| 158 |
+
if start == -1:
|
| 159 |
+
start = val
|
| 160 |
+
prev = val
|
| 161 |
+
continue
|
| 162 |
+
elif val == prev + 1:
|
| 163 |
+
prev = val
|
| 164 |
+
continue
|
| 165 |
+
elif prev == start:
|
| 166 |
+
ranges.append((prev, prev))
|
| 167 |
+
start = val
|
| 168 |
+
prev = val
|
| 169 |
+
continue
|
| 170 |
+
else:
|
| 171 |
+
ranges.append((start, prev))
|
| 172 |
+
start = val
|
| 173 |
+
prev = val
|
| 174 |
+
continue
|
| 175 |
+
if prev == start:
|
| 176 |
+
ranges.append((prev, prev))
|
| 177 |
+
else:
|
| 178 |
+
ranges.append((start, prev))
|
| 179 |
+
Categories[cat] = ranges
|
| 180 |
+
|
| 181 |
+
#
|
| 182 |
+
# Assure all data is in alphabetic order, since we will be doing binary
|
| 183 |
+
# searches on the tables.
|
| 184 |
+
#
|
| 185 |
+
bkeys = sorted(BlockNames.keys())
|
| 186 |
+
|
| 187 |
+
ckeys = sorted(Categories.keys())
|
| 188 |
+
|
| 189 |
+
#
|
| 190 |
+
# Generate the resulting files
|
| 191 |
+
#
|
| 192 |
+
try:
|
| 193 |
+
output = open("codegen/unicode.inc", "w")
|
| 194 |
+
except:
|
| 195 |
+
print("Failed to open codegen/unicode.inc")
|
| 196 |
+
sys.exit(1)
|
| 197 |
+
|
| 198 |
+
#
|
| 199 |
+
# For any categories with more than minTableSize ranges we generate
|
| 200 |
+
# a range table suitable for xmlCharInRange
|
| 201 |
+
#
|
| 202 |
+
for name in ckeys:
|
| 203 |
+
if len(Categories[name]) <= minTableSize or name == 'Cs':
|
| 204 |
+
continue
|
| 205 |
+
ranges = Categories[name]
|
| 206 |
+
group = rangetab.gen_range_tables(output, 'xml' + name, 'S', 'L', ranges)
|
| 207 |
+
output.write("static const xmlChRangeGroup xml%sG = %s;\n\n" %
|
| 208 |
+
(name, group))
|
| 209 |
+
|
| 210 |
+
for name in ckeys:
|
| 211 |
+
if name == 'Cs':
|
| 212 |
+
continue
|
| 213 |
+
ranges = Categories[name]
|
| 214 |
+
output.write("static int\nxmlUCSIsCat%s(int code) {\n" % name)
|
| 215 |
+
if len(Categories[name]) > minTableSize:
|
| 216 |
+
output.write(" return(xmlCharInRange((unsigned int)code, &xml%sG)"
|
| 217 |
+
% name)
|
| 218 |
+
else:
|
| 219 |
+
start = 1
|
| 220 |
+
for range in ranges:
|
| 221 |
+
(begin, end) = range;
|
| 222 |
+
if start:
|
| 223 |
+
output.write(" return(");
|
| 224 |
+
start = 0
|
| 225 |
+
else:
|
| 226 |
+
output.write(" ||\n ");
|
| 227 |
+
if (begin == end):
|
| 228 |
+
output.write("(code == %s)" % (hex(begin)))
|
| 229 |
+
else:
|
| 230 |
+
output.write("((code >= %s) && (code <= %s))" % (
|
| 231 |
+
hex(begin), hex(end)))
|
| 232 |
+
output.write(");\n}\n\n")
|
| 233 |
+
|
| 234 |
+
#
|
| 235 |
+
# Range tables for blocks
|
| 236 |
+
#
|
| 237 |
+
|
| 238 |
+
blockGroups = ''
|
| 239 |
+
for block in bkeys:
|
| 240 |
+
name = block.replace('-', '')
|
| 241 |
+
ranges = BlockNames[block]
|
| 242 |
+
group = rangetab.gen_range_tables(output, 'xml' + name, 'S', 'L', ranges)
|
| 243 |
+
output.write("\n")
|
| 244 |
+
if blockGroups != '':
|
| 245 |
+
blockGroups += ",\n"
|
| 246 |
+
blockGroups += ' {"%s",\n %s}' % (block, group)
|
| 247 |
+
|
| 248 |
+
output.write("static const xmlUnicodeRange xmlUnicodeBlocks[] = {\n")
|
| 249 |
+
output.write(blockGroups)
|
| 250 |
+
output.write("\n};\n\n")
|
| 251 |
+
|
| 252 |
+
output.close()
|
codegen/html5ent.inc
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
codegen/ranges.def
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ur '-' 0x27 '(' ')' '+' ',' '.' '/'
|
| 14 |
+
ur ':' '=' '?' ';' '!' '*' '#' '@'
|
| 15 |
+
ur '$' '_' '%'
|
| 16 |
+
end
|
| 17 |
+
|
| 18 |
+
name xmlIsBlank
|
| 19 |
+
ur 0x09 0x0a 0x0d 0x20
|
| 20 |
+
end xmlIsBlank
|
| 21 |
+
|
| 22 |
+
name xmlIsBaseChar
|
| 23 |
+
ur 0x0041..0x005A
|
| 24 |
+
ur 0x0061..0x007A
|
| 25 |
+
ur 0x00C0..0x00D6
|
| 26 |
+
ur 0x00D8..0x00F6
|
| 27 |
+
ur 0x00F8..0x00FF
|
| 28 |
+
ur 0x0100..0x0131
|
| 29 |
+
ur 0x0134..0x013E
|
| 30 |
+
ur 0x0141..0x0148
|
| 31 |
+
ur 0x014A..0x017E
|
| 32 |
+
ur 0x0180..0x01C3
|
| 33 |
+
ur 0x01CD..0x01F0
|
| 34 |
+
ur 0x01F4..0x01F5
|
| 35 |
+
ur 0x01FA..0x0217
|
| 36 |
+
ur 0x0250..0x02A8
|
| 37 |
+
ur 0x02BB..0x02C1
|
| 38 |
+
ur 0x0386
|
| 39 |
+
ur 0x0388..0x038A
|
| 40 |
+
ur 0x038C
|
| 41 |
+
ur 0x038E..0x03A1
|
| 42 |
+
ur 0x03A3..0x03CE
|
| 43 |
+
ur 0x03D0..0x03D6
|
| 44 |
+
ur 0x03DA
|
| 45 |
+
ur 0x03DC
|
| 46 |
+
ur 0x03DE
|
| 47 |
+
ur 0x03E0
|
| 48 |
+
ur 0x03E2..0x03F3
|
| 49 |
+
ur 0x0401..0x040C
|
| 50 |
+
ur 0x040E..0x044F
|
| 51 |
+
ur 0x0451..0x045C
|
| 52 |
+
ur 0x045E..0x0481
|
| 53 |
+
ur 0x0490..0x04C4
|
| 54 |
+
ur 0x04C7..0x04C8
|
| 55 |
+
ur 0x04CB..0x04CC
|
| 56 |
+
ur 0x04D0..0x04EB
|
| 57 |
+
ur 0x04EE..0x04F5
|
| 58 |
+
ur 0x04F8..0x04F9
|
| 59 |
+
ur 0x0531..0x0556
|
| 60 |
+
ur 0x0559
|
| 61 |
+
ur 0x0561..0x0586
|
| 62 |
+
ur 0x05D0..0x05EA
|
| 63 |
+
ur 0x05F0..0x05F2
|
| 64 |
+
ur 0x0621..0x063A
|
| 65 |
+
ur 0x0641..0x064A
|
| 66 |
+
ur 0x0671..0x06B7
|
| 67 |
+
ur 0x06BA..0x06BE
|
| 68 |
+
ur 0x06C0..0x06CE
|
| 69 |
+
ur 0x06D0..0x06D3
|
| 70 |
+
ur 0x06D5
|
| 71 |
+
ur 0x06E5..0x06E6
|
| 72 |
+
ur 0x0905..0x0939
|
| 73 |
+
ur 0x093D
|
| 74 |
+
ur 0x0958..0x0961
|
| 75 |
+
ur 0x0985..0x098C
|
| 76 |
+
ur 0x098F..0x0990
|
| 77 |
+
ur 0x0993..0x09A8
|
| 78 |
+
ur 0x09AA..0x09B0
|
| 79 |
+
ur 0x09B2
|
| 80 |
+
ur 0x09B6..0x09B9
|
| 81 |
+
ur 0x09DC..0x09DD
|
| 82 |
+
ur 0x09DF..0x09E1
|
| 83 |
+
ur 0x09F0..0x09F1
|
| 84 |
+
ur 0x0A05..0x0A0A
|
| 85 |
+
ur 0x0A0F..0x0A10
|
| 86 |
+
ur 0x0A13..0x0A28
|
| 87 |
+
ur 0x0A2A..0x0A30
|
| 88 |
+
ur 0x0A32..0x0A33
|
| 89 |
+
ur 0x0A35..0x0A36
|
| 90 |
+
ur 0x0A38..0x0A39
|
| 91 |
+
ur 0x0A59..0x0A5C
|
| 92 |
+
ur 0x0A5E
|
| 93 |
+
ur 0x0A72..0x0A74
|
| 94 |
+
ur 0x0A85..0x0A8B
|
| 95 |
+
ur 0x0A8D
|
| 96 |
+
ur 0x0A8F..0x0A91
|
| 97 |
+
ur 0x0A93..0x0AA8
|
| 98 |
+
ur 0x0AAA..0x0AB0
|
| 99 |
+
ur 0x0AB2..0x0AB3
|
| 100 |
+
ur 0x0AB5..0x0AB9
|
| 101 |
+
ur 0x0ABD
|
| 102 |
+
ur 0x0AE0
|
| 103 |
+
ur 0x0B05..0x0B0C
|
| 104 |
+
ur 0x0B0F..0x0B10
|
| 105 |
+
ur 0x0B13..0x0B28
|
| 106 |
+
ur 0x0B2A..0x0B30
|
| 107 |
+
ur 0x0B32..0x0B33
|
| 108 |
+
ur 0x0B36..0x0B39
|
| 109 |
+
ur 0x0B3D
|
| 110 |
+
ur 0x0B5C..0x0B5D
|
| 111 |
+
ur 0x0B5F..0x0B61
|
| 112 |
+
ur 0x0B85..0x0B8A
|
| 113 |
+
ur 0x0B8E..0x0B90
|
| 114 |
+
ur 0x0B92..0x0B95
|
| 115 |
+
ur 0x0B99..0x0B9A
|
| 116 |
+
ur 0x0B9C
|
| 117 |
+
ur 0x0B9E..0x0B9F
|
| 118 |
+
ur 0x0BA3..0x0BA4
|
| 119 |
+
ur 0x0BA8..0x0BAA
|
| 120 |
+
ur 0x0BAE..0x0BB5
|
| 121 |
+
ur 0x0BB7..0x0BB9
|
| 122 |
+
ur 0x0C05..0x0C0C
|
| 123 |
+
ur 0x0C0E..0x0C10
|
| 124 |
+
ur 0x0C12..0x0C28
|
| 125 |
+
ur 0x0C2A..0x0C33
|
| 126 |
+
ur 0x0C35..0x0C39
|
| 127 |
+
ur 0x0C60..0x0C61
|
| 128 |
+
ur 0x0C85..0x0C8C
|
| 129 |
+
ur 0x0C8E..0x0C90
|
| 130 |
+
ur 0x0C92..0x0CA8
|
| 131 |
+
ur 0x0CAA..0x0CB3
|
| 132 |
+
ur 0x0CB5..0x0CB9
|
| 133 |
+
ur 0x0CDE
|
| 134 |
+
ur 0x0CE0..0x0CE1
|
| 135 |
+
ur 0x0D05..0x0D0C
|
| 136 |
+
ur 0x0D0E..0x0D10
|
| 137 |
+
ur 0x0D12..0x0D28
|
| 138 |
+
ur 0x0D2A..0x0D39
|
| 139 |
+
ur 0x0D60..0x0D61
|
| 140 |
+
ur 0x0E01..0x0E2E
|
| 141 |
+
ur 0x0E30
|
| 142 |
+
ur 0x0E32..0x0E33
|
| 143 |
+
ur 0x0E40..0x0E45
|
| 144 |
+
ur 0x0E81..0x0E82
|
| 145 |
+
ur 0x0E84
|
| 146 |
+
ur 0x0E87..0x0E88
|
| 147 |
+
ur 0x0E8A
|
| 148 |
+
ur 0x0E8D
|
| 149 |
+
ur 0x0E94..0x0E97
|
| 150 |
+
ur 0x0E99..0x0E9F
|
| 151 |
+
ur 0x0EA1..0x0EA3
|
| 152 |
+
ur 0x0EA5
|
| 153 |
+
ur 0x0EA7
|
| 154 |
+
ur 0x0EAA..0x0EAB
|
| 155 |
+
ur 0x0EAD..0x0EAE
|
| 156 |
+
ur 0x0EB0
|
| 157 |
+
ur 0x0EB2..0x0EB3
|
| 158 |
+
ur 0x0EBD
|
| 159 |
+
ur 0x0EC0..0x0EC4
|
| 160 |
+
ur 0x0F40..0x0F47
|
| 161 |
+
ur 0x0F49..0x0F69
|
| 162 |
+
ur 0x10A0..0x10C5
|
| 163 |
+
ur 0x10D0..0x10F6
|
| 164 |
+
ur 0x1100
|
| 165 |
+
ur 0x1102..0x1103
|
| 166 |
+
ur 0x1105..0x1107
|
| 167 |
+
ur 0x1109
|
| 168 |
+
ur 0x110B..0x110C
|
| 169 |
+
ur 0x110E..0x1112
|
| 170 |
+
ur 0x113C
|
| 171 |
+
ur 0x113E
|
| 172 |
+
ur 0x1140
|
| 173 |
+
ur 0x114C
|
| 174 |
+
ur 0x114E
|
| 175 |
+
ur 0x1150
|
| 176 |
+
ur 0x1154..0x1155
|
| 177 |
+
ur 0x1159
|
| 178 |
+
ur 0x115F..0x1161
|
| 179 |
+
ur 0x1163
|
| 180 |
+
ur 0x1165
|
| 181 |
+
ur 0x1167
|
| 182 |
+
ur 0x1169
|
| 183 |
+
ur 0x116D..0x116E
|
| 184 |
+
ur 0x1172..0x1173
|
| 185 |
+
ur 0x1175
|
| 186 |
+
ur 0x119E
|
| 187 |
+
ur 0x11A8
|
| 188 |
+
ur 0x11AB
|
| 189 |
+
ur 0x11AE..0x11AF
|
| 190 |
+
ur 0x11B7..0x11B8
|
| 191 |
+
ur 0x11BA
|
| 192 |
+
ur 0x11BC..0x11C2
|
| 193 |
+
ur 0x11EB
|
| 194 |
+
ur 0x11F0
|
| 195 |
+
ur 0x11F9
|
| 196 |
+
ur 0x1E00..0x1E9B
|
| 197 |
+
ur 0x1EA0..0x1EF9
|
| 198 |
+
ur 0x1F00..0x1F15
|
| 199 |
+
ur 0x1F18..0x1F1D
|
| 200 |
+
ur 0x1F20..0x1F45
|
| 201 |
+
ur 0x1F48..0x1F4D
|
| 202 |
+
ur 0x1F50..0x1F57
|
| 203 |
+
ur 0x1F59
|
| 204 |
+
ur 0x1F5B
|
| 205 |
+
ur 0x1F5D
|
| 206 |
+
ur 0x1F5F..0x1F7D
|
| 207 |
+
ur 0x1F80..0x1FB4
|
| 208 |
+
ur 0x1FB6..0x1FBC
|
| 209 |
+
ur 0x1FBE
|
| 210 |
+
ur 0x1FC2..0x1FC4
|
| 211 |
+
ur 0x1FC6..0x1FCC
|
| 212 |
+
ur 0x1FD0..0x1FD3
|
| 213 |
+
ur 0x1FD6..0x1FDB
|
| 214 |
+
ur 0x1FE0..0x1FEC
|
| 215 |
+
ur 0x1FF2..0x1FF4
|
| 216 |
+
ur 0x1FF6..0x1FFC
|
| 217 |
+
ur 0x2126
|
| 218 |
+
ur 0x212A..0x212B
|
| 219 |
+
ur 0x212E
|
| 220 |
+
ur 0x2180..0x2182
|
| 221 |
+
ur 0x3041..0x3094
|
| 222 |
+
ur 0x30A1..0x30FA
|
| 223 |
+
ur 0x3105..0x312C
|
| 224 |
+
ur 0xAC00..0xD7A3
|
| 225 |
+
end xmlIsBaseChar
|
| 226 |
+
|
| 227 |
+
name xmlIsIdeographic
|
| 228 |
+
ur 0x4E00..0x9FA5
|
| 229 |
+
ur 0x3007
|
| 230 |
+
ur 0x3021..0x3029
|
| 231 |
+
end xmlIsIdeographic
|
| 232 |
+
|
| 233 |
+
name xmlIsCombining
|
| 234 |
+
ur 0x0300..0x0345
|
| 235 |
+
ur 0x0360..0x0361
|
| 236 |
+
ur 0x0483..0x0486
|
| 237 |
+
ur 0x0591..0x05A1
|
| 238 |
+
ur 0x05A3..0x05B9
|
| 239 |
+
ur 0x05BB..0x05BD
|
| 240 |
+
ur 0x05BF
|
| 241 |
+
ur 0x05C1..0x05C2
|
| 242 |
+
ur 0x05C4
|
| 243 |
+
ur 0x064B..0x0652
|
| 244 |
+
ur 0x0670
|
| 245 |
+
ur 0x06D6..0x06DC
|
| 246 |
+
ur 0x06DD..0x06DF
|
| 247 |
+
ur 0x06E0..0x06E4
|
| 248 |
+
ur 0x06E7..0x06E8
|
| 249 |
+
ur 0x06EA..0x06ED
|
| 250 |
+
ur 0x0901..0x0903
|
| 251 |
+
ur 0x093C
|
| 252 |
+
ur 0x093E..0x094C
|
| 253 |
+
ur 0x094D
|
| 254 |
+
ur 0x0951..0x0954
|
| 255 |
+
ur 0x0962..0x0963
|
| 256 |
+
ur 0x0981..0x0983
|
| 257 |
+
ur 0x09BC
|
| 258 |
+
ur 0x09BE
|
| 259 |
+
ur 0x09BF
|
| 260 |
+
ur 0x09C0..0x09C4
|
| 261 |
+
ur 0x09C7..0x09C8
|
| 262 |
+
ur 0x09CB..0x09CD
|
| 263 |
+
ur 0x09D7
|
| 264 |
+
ur 0x09E2..0x09E3
|
| 265 |
+
ur 0x0A02
|
| 266 |
+
ur 0x0A3C
|
| 267 |
+
ur 0x0A3E
|
| 268 |
+
ur 0x0A3F
|
| 269 |
+
ur 0x0A40..0x0A42
|
| 270 |
+
ur 0x0A47..0x0A48
|
| 271 |
+
ur 0x0A4B..0x0A4D
|
| 272 |
+
ur 0x0A70..0x0A71
|
| 273 |
+
ur 0x0A81..0x0A83
|
| 274 |
+
ur 0x0ABC
|
| 275 |
+
ur 0x0ABE..0x0AC5
|
| 276 |
+
ur 0x0AC7..0x0AC9
|
| 277 |
+
ur 0x0ACB..0x0ACD
|
| 278 |
+
ur 0x0B01..0x0B03
|
| 279 |
+
ur 0x0B3C
|
| 280 |
+
ur 0x0B3E..0x0B43
|
| 281 |
+
ur 0x0B47..0x0B48
|
| 282 |
+
ur 0x0B4B..0x0B4D
|
| 283 |
+
ur 0x0B56..0x0B57
|
| 284 |
+
ur 0x0B82..0x0B83
|
| 285 |
+
ur 0x0BBE..0x0BC2
|
| 286 |
+
ur 0x0BC6..0x0BC8
|
| 287 |
+
ur 0x0BCA..0x0BCD
|
| 288 |
+
ur 0x0BD7
|
| 289 |
+
ur 0x0C01..0x0C03
|
| 290 |
+
ur 0x0C3E..0x0C44
|
| 291 |
+
ur 0x0C46..0x0C48
|
| 292 |
+
ur 0x0C4A..0x0C4D
|
| 293 |
+
ur 0x0C55..0x0C56
|
| 294 |
+
ur 0x0C82..0x0C83
|
| 295 |
+
ur 0x0CBE..0x0CC4
|
| 296 |
+
ur 0x0CC6..0x0CC8
|
| 297 |
+
ur 0x0CCA..0x0CCD
|
| 298 |
+
ur 0x0CD5..0x0CD6
|
| 299 |
+
ur 0x0D02..0x0D03
|
| 300 |
+
ur 0x0D3E..0x0D43
|
| 301 |
+
ur 0x0D46..0x0D48
|
| 302 |
+
ur 0x0D4A..0x0D4D
|
| 303 |
+
ur 0x0D57
|
| 304 |
+
ur 0x0E31
|
| 305 |
+
ur 0x0E34..0x0E3A
|
| 306 |
+
ur 0x0E47..0x0E4E
|
| 307 |
+
ur 0x0EB1
|
| 308 |
+
ur 0x0EB4..0x0EB9
|
| 309 |
+
ur 0x0EBB..0x0EBC
|
| 310 |
+
ur 0x0EC8..0x0ECD
|
| 311 |
+
ur 0x0F18..0x0F19
|
| 312 |
+
ur 0x0F35
|
| 313 |
+
ur 0x0F37
|
| 314 |
+
ur 0x0F39
|
| 315 |
+
ur 0x0F3E
|
| 316 |
+
ur 0x0F3F
|
| 317 |
+
ur 0x0F71..0x0F84
|
| 318 |
+
ur 0x0F86..0x0F8B
|
| 319 |
+
ur 0x0F90..0x0F95
|
| 320 |
+
ur 0x0F97
|
| 321 |
+
ur 0x0F99..0x0FAD
|
| 322 |
+
ur 0x0FB1..0x0FB7
|
| 323 |
+
ur 0x0FB9
|
| 324 |
+
ur 0x20D0..0x20DC
|
| 325 |
+
ur 0x20E1
|
| 326 |
+
ur 0x302A..0x302F
|
| 327 |
+
ur 0x3099
|
| 328 |
+
ur 0x309A
|
| 329 |
+
end xmlIsCombining
|
| 330 |
+
|
| 331 |
+
name xmlIsDigit
|
| 332 |
+
ur 0x0030..0x0039
|
| 333 |
+
ur 0x0660..0x0669
|
| 334 |
+
ur 0x06F0..0x06F9
|
| 335 |
+
ur 0x0966..0x096F
|
| 336 |
+
ur 0x09E6..0x09EF
|
| 337 |
+
ur 0x0A66..0x0A6F
|
| 338 |
+
ur 0x0AE6..0x0AEF
|
| 339 |
+
ur 0x0B66..0x0B6F
|
| 340 |
+
ur 0x0BE7..0x0BEF
|
| 341 |
+
ur 0x0C66..0x0C6F
|
| 342 |
+
ur 0x0CE6..0x0CEF
|
| 343 |
+
ur 0x0D66..0x0D6F
|
| 344 |
+
ur 0x0E50..0x0E59
|
| 345 |
+
ur 0x0ED0..0x0ED9
|
| 346 |
+
ur 0x0F20..0x0F29
|
| 347 |
+
end xmlIsDigit
|
| 348 |
+
|
| 349 |
+
name xmlIsExtender
|
| 350 |
+
ur 0x00B7
|
| 351 |
+
ur 0x02D0
|
| 352 |
+
ur 0x02D1
|
| 353 |
+
ur 0x0387
|
| 354 |
+
ur 0x0640
|
| 355 |
+
ur 0x0E46
|
| 356 |
+
ur 0x0EC6
|
| 357 |
+
ur 0x3005
|
| 358 |
+
ur 0x3031..0x3035
|
| 359 |
+
ur 0x309D..0x309E
|
| 360 |
+
ur 0x30FC..0x30FE
|
| 361 |
+
end xmlIsExtender
|
codegen/ranges.inc
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 0x01, 0x01,
|
| 6 |
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
| 7 |
+
0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
| 8 |
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
| 9 |
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
|
| 10 |
+
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
| 11 |
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
| 12 |
+
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 13 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 14 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 15 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 16 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 17 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 18 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 19 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 20 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 21 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 22 |
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| 23 |
+
0x00, 0x00, 0x00, 0x00 };
|
| 24 |
+
|
| 25 |
+
static const xmlChSRange xmlIsBaseChar_srng[] = {{0x100, 0x131},
|
| 26 |
+
{0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3},
|
| 27 |
+
{0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8},
|
| 28 |
+
{0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c},
|
| 29 |
+
{0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da},
|
| 30 |
+
{0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3},
|
| 31 |
+
{0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481},
|
| 32 |
+
{0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb},
|
| 33 |
+
{0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559},
|
| 34 |
+
{0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a},
|
| 35 |
+
{0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce},
|
| 36 |
+
{0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939},
|
| 37 |
+
{0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990},
|
| 38 |
+
{0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9},
|
| 39 |
+
{0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a},
|
| 40 |
+
{0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33},
|
| 41 |
+
{0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e},
|
| 42 |
+
{0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91},
|
| 43 |
+
{0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9},
|
| 44 |
+
{0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10},
|
| 45 |
+
{0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39},
|
| 46 |
+
{0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a},
|
| 47 |
+
{0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c},
|
| 48 |
+
{0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5},
|
| 49 |
+
{0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
|
| 50 |
+
{0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c},
|
| 51 |
+
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
| 52 |
+
{0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
|
| 53 |
+
{0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e},
|
| 54 |
+
{0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82},
|
| 55 |
+
{0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d},
|
| 56 |
+
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5},
|
| 57 |
+
{0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0},
|
| 58 |
+
{0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47},
|
| 59 |
+
{0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100},
|
| 60 |
+
{0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c},
|
| 61 |
+
{0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140},
|
| 62 |
+
{0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155},
|
| 63 |
+
{0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165},
|
| 64 |
+
{0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173},
|
| 65 |
+
{0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab},
|
| 66 |
+
{0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2},
|
| 67 |
+
{0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b},
|
| 68 |
+
{0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
|
| 69 |
+
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b},
|
| 70 |
+
{0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
|
| 71 |
+
{0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
|
| 72 |
+
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
|
| 73 |
+
{0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
|
| 74 |
+
{0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
|
| 75 |
+
const xmlChRangeGroup xmlIsBaseCharGroup =
|
| 76 |
+
{197,0,xmlIsBaseChar_srng,NULL};
|
| 77 |
+
|
| 78 |
+
static const xmlChSRange xmlIsChar_srng[] = {{0x100, 0xd7ff},
|
| 79 |
+
{0xe000, 0xfffd}};
|
| 80 |
+
static const xmlChLRange xmlIsChar_lrng[] = {{0x10000, 0x10ffff}};
|
| 81 |
+
const xmlChRangeGroup xmlIsCharGroup =
|
| 82 |
+
{2,1,xmlIsChar_srng,xmlIsChar_lrng};
|
| 83 |
+
|
| 84 |
+
static const xmlChSRange xmlIsCombining_srng[] = {{0x300, 0x345},
|
| 85 |
+
{0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
|
| 86 |
+
{0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4},
|
| 87 |
+
{0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df},
|
| 88 |
+
{0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903},
|
| 89 |
+
{0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954},
|
| 90 |
+
{0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be},
|
| 91 |
+
{0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd},
|
| 92 |
+
{0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c},
|
| 93 |
+
{0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48},
|
| 94 |
+
{0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc},
|
| 95 |
+
{0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03},
|
| 96 |
+
{0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d},
|
| 97 |
+
{0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
|
| 98 |
+
{0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44},
|
| 99 |
+
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83},
|
| 100 |
+
{0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6},
|
| 101 |
+
{0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d},
|
| 102 |
+
{0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e},
|
| 103 |
+
{0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd},
|
| 104 |
+
{0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39},
|
| 105 |
+
{0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b},
|
| 106 |
+
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
|
| 107 |
+
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
|
| 108 |
+
{0x3099, 0x3099}, {0x309a, 0x309a}};
|
| 109 |
+
const xmlChRangeGroup xmlIsCombiningGroup =
|
| 110 |
+
{95,0,xmlIsCombining_srng,NULL};
|
| 111 |
+
|
| 112 |
+
static const xmlChSRange xmlIsDigit_srng[] = {{0x660, 0x669},
|
| 113 |
+
{0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
|
| 114 |
+
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
|
| 115 |
+
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
| 116 |
+
{0xf20, 0xf29}};
|
| 117 |
+
const xmlChRangeGroup xmlIsDigitGroup =
|
| 118 |
+
{14,0,xmlIsDigit_srng,NULL};
|
| 119 |
+
|
| 120 |
+
static const xmlChSRange xmlIsExtender_srng[] = {{0x2d0, 0x2d0},
|
| 121 |
+
{0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
|
| 122 |
+
{0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
|
| 123 |
+
{0x30fc, 0x30fe}};
|
| 124 |
+
const xmlChRangeGroup xmlIsExtenderGroup =
|
| 125 |
+
{10,0,xmlIsExtender_srng,NULL};
|
| 126 |
+
|
| 127 |
+
static const xmlChSRange xmlIsIdeographic_srng[] = {{0x3007, 0x3007},
|
| 128 |
+
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
|
| 129 |
+
const xmlChRangeGroup xmlIsIdeographicGroup =
|
| 130 |
+
{3,0,xmlIsIdeographic_srng,NULL};
|
| 131 |
+
|
codegen/rangetab.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def gen_range_tables(out, name, s_suffix, l_suffix, ranges):
|
| 2 |
+
numshort = 0
|
| 3 |
+
numlong = 0
|
| 4 |
+
sptr = "NULL"
|
| 5 |
+
lptr = "NULL"
|
| 6 |
+
|
| 7 |
+
for range in ranges:
|
| 8 |
+
(low, high) = range
|
| 9 |
+
if high < 0x10000:
|
| 10 |
+
if numshort == 0:
|
| 11 |
+
sptr = name + s_suffix
|
| 12 |
+
pline = "static const xmlChSRange %s[] = {" % sptr
|
| 13 |
+
else:
|
| 14 |
+
pline += ","
|
| 15 |
+
numshort += 1
|
| 16 |
+
else:
|
| 17 |
+
if numlong == 0:
|
| 18 |
+
if numshort > 0:
|
| 19 |
+
out.write(pline + "};\n")
|
| 20 |
+
lptr = name + l_suffix
|
| 21 |
+
pline = "static const xmlChLRange %s[] = {" % lptr
|
| 22 |
+
else:
|
| 23 |
+
pline += ","
|
| 24 |
+
numlong += 1
|
| 25 |
+
if len(pline) > 60:
|
| 26 |
+
out.write(pline + "\n")
|
| 27 |
+
pline = " "
|
| 28 |
+
elif pline[-1:] == ",":
|
| 29 |
+
pline += " "
|
| 30 |
+
pline += "{%s, %s}" % (hex(low), hex(high))
|
| 31 |
+
|
| 32 |
+
out.write(pline + "};\n")
|
| 33 |
+
|
| 34 |
+
return "{%s,%s,%s,%s}" % (numshort, numlong, sptr, lptr)
|
codegen/unicode.inc
ADDED
|
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d17a}, {0xe0001, 0xe0001},
|
| 7 |
+
{0xe0020, 0xe007f}, {0xf0000, 0xf0000}, {0xffffd, 0xffffd},
|
| 8 |
+
{0x100000, 0x100000}, {0x10fffd, 0x10fffd}};
|
| 9 |
+
static const xmlChRangeGroup xmlCG = {18,7,xmlCS,xmlCL};
|
| 10 |
+
|
| 11 |
+
static const xmlChSRange xmlCfS[] = {{0xad, 0xad}, {0x600, 0x603},
|
| 12 |
+
{0x6dd, 0x6dd}, {0x70f, 0x70f}, {0x17b4, 0x17b5}, {0x200b, 0x200f},
|
| 13 |
+
{0x202a, 0x202e}, {0x2060, 0x2063}, {0x206a, 0x206f}, {0xfeff, 0xfeff},
|
| 14 |
+
{0xfff9, 0xfffb}};
|
| 15 |
+
static const xmlChLRange xmlCfL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001},
|
| 16 |
+
{0xe0020, 0xe007f}};
|
| 17 |
+
static const xmlChRangeGroup xmlCfG = {11,3,xmlCfS,xmlCfL};
|
| 18 |
+
|
| 19 |
+
static const xmlChSRange xmlLS[] = {{0x41, 0x5a}, {0x61, 0x7a},
|
| 20 |
+
{0xaa, 0xaa}, {0xb5, 0xb5}, {0xba, 0xba}, {0xc0, 0xd6}, {0xd8, 0xf6},
|
| 21 |
+
{0xf8, 0x236}, {0x250, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4},
|
| 22 |
+
{0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x386, 0x386}, {0x388, 0x38a},
|
| 23 |
+
{0x38c, 0x38c}, {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3f5},
|
| 24 |
+
{0x3f7, 0x3fb}, {0x400, 0x481}, {0x48a, 0x4ce}, {0x4d0, 0x4f5},
|
| 25 |
+
{0x4f8, 0x4f9}, {0x500, 0x50f}, {0x531, 0x556}, {0x559, 0x559},
|
| 26 |
+
{0x561, 0x587}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a},
|
| 27 |
+
{0x640, 0x64a}, {0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5},
|
| 28 |
+
{0x6e5, 0x6e6}, {0x6ee, 0x6ef}, {0x6fa, 0x6fc}, {0x6ff, 0x6ff},
|
| 29 |
+
{0x710, 0x710}, {0x712, 0x72f}, {0x74d, 0x74f}, {0x780, 0x7a5},
|
| 30 |
+
{0x7b1, 0x7b1}, {0x904, 0x939}, {0x93d, 0x93d}, {0x950, 0x950},
|
| 31 |
+
{0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, {0x993, 0x9a8},
|
| 32 |
+
{0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, {0x9bd, 0x9bd},
|
| 33 |
+
{0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a},
|
| 34 |
+
{0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33},
|
| 35 |
+
{0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e},
|
| 36 |
+
{0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8},
|
| 37 |
+
{0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, {0xabd, 0xabd},
|
| 38 |
+
{0xad0, 0xad0}, {0xae0, 0xae1}, {0xb05, 0xb0c}, {0xb0f, 0xb10},
|
| 39 |
+
{0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb35, 0xb39},
|
| 40 |
+
{0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb71, 0xb71},
|
| 41 |
+
{0xb83, 0xb83}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95},
|
| 42 |
+
{0xb99, 0xb9a}, {0xb9c, 0xb9c}, {0xb9e, 0xb9f}, {0xba3, 0xba4},
|
| 43 |
+
{0xba8, 0xbaa}, {0xbae, 0xbb5}, {0xbb7, 0xbb9}, {0xc05, 0xc0c},
|
| 44 |
+
{0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc33}, {0xc35, 0xc39},
|
| 45 |
+
{0xc60, 0xc61}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8},
|
| 46 |
+
{0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbd, 0xcbd}, {0xcde, 0xcde},
|
| 47 |
+
{0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd28},
|
| 48 |
+
{0xd2a, 0xd39}, {0xd60, 0xd61}, {0xd85, 0xd96}, {0xd9a, 0xdb1},
|
| 49 |
+
{0xdb3, 0xdbb}, {0xdbd, 0xdbd}, {0xdc0, 0xdc6}, {0xe01, 0xe30},
|
| 50 |
+
{0xe32, 0xe33}, {0xe40, 0xe46}, {0xe81, 0xe82}, {0xe84, 0xe84},
|
| 51 |
+
{0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, {0xe94, 0xe97},
|
| 52 |
+
{0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, {0xea7, 0xea7},
|
| 53 |
+
{0xeaa, 0xeab}, {0xead, 0xeb0}, {0xeb2, 0xeb3}, {0xebd, 0xebd},
|
| 54 |
+
{0xec0, 0xec4}, {0xec6, 0xec6}, {0xedc, 0xedd}, {0xf00, 0xf00},
|
| 55 |
+
{0xf40, 0xf47}, {0xf49, 0xf6a}, {0xf88, 0xf8b}, {0x1000, 0x1021},
|
| 56 |
+
{0x1023, 0x1027}, {0x1029, 0x102a}, {0x1050, 0x1055}, {0x10a0, 0x10c5},
|
| 57 |
+
{0x10d0, 0x10f8}, {0x1100, 0x1159}, {0x115f, 0x11a2}, {0x11a8, 0x11f9},
|
| 58 |
+
{0x1200, 0x1206}, {0x1208, 0x1246}, {0x1248, 0x1248}, {0x124a, 0x124d},
|
| 59 |
+
{0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1286},
|
| 60 |
+
{0x1288, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12ae}, {0x12b0, 0x12b0},
|
| 61 |
+
{0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5},
|
| 62 |
+
{0x12c8, 0x12ce}, {0x12d0, 0x12d6}, {0x12d8, 0x12ee}, {0x12f0, 0x130e},
|
| 63 |
+
{0x1310, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x131e}, {0x1320, 0x1346},
|
| 64 |
+
{0x1348, 0x135a}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x1676},
|
| 65 |
+
{0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x1700, 0x170c}, {0x170e, 0x1711},
|
| 66 |
+
{0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770},
|
| 67 |
+
{0x1780, 0x17b3}, {0x17d7, 0x17d7}, {0x17dc, 0x17dc}, {0x1820, 0x1877},
|
| 68 |
+
{0x1880, 0x18a8}, {0x1900, 0x191c}, {0x1950, 0x196d}, {0x1970, 0x1974},
|
| 69 |
+
{0x1d00, 0x1d6b}, {0x1e00, 0x1e9b}, {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15},
|
| 70 |
+
{0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57},
|
| 71 |
+
{0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d},
|
| 72 |
+
{0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4},
|
| 73 |
+
{0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec},
|
| 74 |
+
{0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2071, 0x2071}, {0x207f, 0x207f},
|
| 75 |
+
{0x2102, 0x2102}, {0x2107, 0x2107}, {0x210a, 0x2113}, {0x2115, 0x2115},
|
| 76 |
+
{0x2119, 0x211d}, {0x2124, 0x2124}, {0x2126, 0x2126}, {0x2128, 0x2128},
|
| 77 |
+
{0x212a, 0x212d}, {0x212f, 0x2131}, {0x2133, 0x2139}, {0x213d, 0x213f},
|
| 78 |
+
{0x2145, 0x2149}, {0x3005, 0x3006}, {0x3031, 0x3035}, {0x303b, 0x303c},
|
| 79 |
+
{0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff},
|
| 80 |
+
{0x3105, 0x312c}, {0x3131, 0x318e}, {0x31a0, 0x31b7}, {0x31f0, 0x31ff},
|
| 81 |
+
{0x3400, 0x3400}, {0x4db5, 0x4db5}, {0x4e00, 0x4e00}, {0x9fa5, 0x9fa5},
|
| 82 |
+
{0xa000, 0xa48c}, {0xac00, 0xac00}, {0xd7a3, 0xd7a3}, {0xf900, 0xfa2d},
|
| 83 |
+
{0xfa30, 0xfa6a}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb1d},
|
| 84 |
+
{0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb3e, 0xfb3e},
|
| 85 |
+
{0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d},
|
| 86 |
+
{0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74},
|
| 87 |
+
{0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe},
|
| 88 |
+
{0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}};
|
| 89 |
+
static const xmlChLRange xmlLL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026},
|
| 90 |
+
{0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d},
|
| 91 |
+
{0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10300, 0x1031e},
|
| 92 |
+
{0x10330, 0x10349}, {0x10380, 0x1039d}, {0x10400, 0x1049d},
|
| 93 |
+
{0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835},
|
| 94 |
+
{0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f},
|
| 95 |
+
{0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d49e, 0x1d49f},
|
| 96 |
+
{0x1d4a2, 0x1d4a2}, {0x1d4a5, 0x1d4a6}, {0x1d4a9, 0x1d4ac},
|
| 97 |
+
{0x1d4ae, 0x1d4b9}, {0x1d4bb, 0x1d4bb}, {0x1d4bd, 0x1d4c3},
|
| 98 |
+
{0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
|
| 99 |
+
{0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e},
|
| 100 |
+
{0x1d540, 0x1d544}, {0x1d546, 0x1d546}, {0x1d54a, 0x1d550},
|
| 101 |
+
{0x1d552, 0x1d6a3}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da},
|
| 102 |
+
{0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734},
|
| 103 |
+
{0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788},
|
| 104 |
+
{0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9},
|
| 105 |
+
{0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d}};
|
| 106 |
+
static const xmlChRangeGroup xmlLG = {279,50,xmlLS,xmlLL};
|
| 107 |
+
|
| 108 |
+
static const xmlChSRange xmlLlS[] = {{0x61, 0x7a}, {0xaa, 0xaa},
|
| 109 |
+
{0xb5, 0xb5}, {0xba, 0xba}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x101, 0x101},
|
| 110 |
+
{0x103, 0x103}, {0x105, 0x105}, {0x107, 0x107}, {0x109, 0x109},
|
| 111 |
+
{0x10b, 0x10b}, {0x10d, 0x10d}, {0x10f, 0x10f}, {0x111, 0x111},
|
| 112 |
+
{0x113, 0x113}, {0x115, 0x115}, {0x117, 0x117}, {0x119, 0x119},
|
| 113 |
+
{0x11b, 0x11b}, {0x11d, 0x11d}, {0x11f, 0x11f}, {0x121, 0x121},
|
| 114 |
+
{0x123, 0x123}, {0x125, 0x125}, {0x127, 0x127}, {0x129, 0x129},
|
| 115 |
+
{0x12b, 0x12b}, {0x12d, 0x12d}, {0x12f, 0x12f}, {0x131, 0x131},
|
| 116 |
+
{0x133, 0x133}, {0x135, 0x135}, {0x137, 0x138}, {0x13a, 0x13a},
|
| 117 |
+
{0x13c, 0x13c}, {0x13e, 0x13e}, {0x140, 0x140}, {0x142, 0x142},
|
| 118 |
+
{0x144, 0x144}, {0x146, 0x146}, {0x148, 0x149}, {0x14b, 0x14b},
|
| 119 |
+
{0x14d, 0x14d}, {0x14f, 0x14f}, {0x151, 0x151}, {0x153, 0x153},
|
| 120 |
+
{0x155, 0x155}, {0x157, 0x157}, {0x159, 0x159}, {0x15b, 0x15b},
|
| 121 |
+
{0x15d, 0x15d}, {0x15f, 0x15f}, {0x161, 0x161}, {0x163, 0x163},
|
| 122 |
+
{0x165, 0x165}, {0x167, 0x167}, {0x169, 0x169}, {0x16b, 0x16b},
|
| 123 |
+
{0x16d, 0x16d}, {0x16f, 0x16f}, {0x171, 0x171}, {0x173, 0x173},
|
| 124 |
+
{0x175, 0x175}, {0x177, 0x177}, {0x17a, 0x17a}, {0x17c, 0x17c},
|
| 125 |
+
{0x17e, 0x180}, {0x183, 0x183}, {0x185, 0x185}, {0x188, 0x188},
|
| 126 |
+
{0x18c, 0x18d}, {0x192, 0x192}, {0x195, 0x195}, {0x199, 0x19b},
|
| 127 |
+
{0x19e, 0x19e}, {0x1a1, 0x1a1}, {0x1a3, 0x1a3}, {0x1a5, 0x1a5},
|
| 128 |
+
{0x1a8, 0x1a8}, {0x1aa, 0x1ab}, {0x1ad, 0x1ad}, {0x1b0, 0x1b0},
|
| 129 |
+
{0x1b4, 0x1b4}, {0x1b6, 0x1b6}, {0x1b9, 0x1ba}, {0x1bd, 0x1bf},
|
| 130 |
+
{0x1c6, 0x1c6}, {0x1c9, 0x1c9}, {0x1cc, 0x1cc}, {0x1ce, 0x1ce},
|
| 131 |
+
{0x1d0, 0x1d0}, {0x1d2, 0x1d2}, {0x1d4, 0x1d4}, {0x1d6, 0x1d6},
|
| 132 |
+
{0x1d8, 0x1d8}, {0x1da, 0x1da}, {0x1dc, 0x1dd}, {0x1df, 0x1df},
|
| 133 |
+
{0x1e1, 0x1e1}, {0x1e3, 0x1e3}, {0x1e5, 0x1e5}, {0x1e7, 0x1e7},
|
| 134 |
+
{0x1e9, 0x1e9}, {0x1eb, 0x1eb}, {0x1ed, 0x1ed}, {0x1ef, 0x1f0},
|
| 135 |
+
{0x1f3, 0x1f3}, {0x1f5, 0x1f5}, {0x1f9, 0x1f9}, {0x1fb, 0x1fb},
|
| 136 |
+
{0x1fd, 0x1fd}, {0x1ff, 0x1ff}, {0x201, 0x201}, {0x203, 0x203},
|
| 137 |
+
{0x205, 0x205}, {0x207, 0x207}, {0x209, 0x209}, {0x20b, 0x20b},
|
| 138 |
+
{0x20d, 0x20d}, {0x20f, 0x20f}, {0x211, 0x211}, {0x213, 0x213},
|
| 139 |
+
{0x215, 0x215}, {0x217, 0x217}, {0x219, 0x219}, {0x21b, 0x21b},
|
| 140 |
+
{0x21d, 0x21d}, {0x21f, 0x21f}, {0x221, 0x221}, {0x223, 0x223},
|
| 141 |
+
{0x225, 0x225}, {0x227, 0x227}, {0x229, 0x229}, {0x22b, 0x22b},
|
| 142 |
+
{0x22d, 0x22d}, {0x22f, 0x22f}, {0x231, 0x231}, {0x233, 0x236},
|
| 143 |
+
{0x250, 0x2af}, {0x390, 0x390}, {0x3ac, 0x3ce}, {0x3d0, 0x3d1},
|
| 144 |
+
{0x3d5, 0x3d7}, {0x3d9, 0x3d9}, {0x3db, 0x3db}, {0x3dd, 0x3dd},
|
| 145 |
+
{0x3df, 0x3df}, {0x3e1, 0x3e1}, {0x3e3, 0x3e3}, {0x3e5, 0x3e5},
|
| 146 |
+
{0x3e7, 0x3e7}, {0x3e9, 0x3e9}, {0x3eb, 0x3eb}, {0x3ed, 0x3ed},
|
| 147 |
+
{0x3ef, 0x3f3}, {0x3f5, 0x3f5}, {0x3f8, 0x3f8}, {0x3fb, 0x3fb},
|
| 148 |
+
{0x430, 0x45f}, {0x461, 0x461}, {0x463, 0x463}, {0x465, 0x465},
|
| 149 |
+
{0x467, 0x467}, {0x469, 0x469}, {0x46b, 0x46b}, {0x46d, 0x46d},
|
| 150 |
+
{0x46f, 0x46f}, {0x471, 0x471}, {0x473, 0x473}, {0x475, 0x475},
|
| 151 |
+
{0x477, 0x477}, {0x479, 0x479}, {0x47b, 0x47b}, {0x47d, 0x47d},
|
| 152 |
+
{0x47f, 0x47f}, {0x481, 0x481}, {0x48b, 0x48b}, {0x48d, 0x48d},
|
| 153 |
+
{0x48f, 0x48f}, {0x491, 0x491}, {0x493, 0x493}, {0x495, 0x495},
|
| 154 |
+
{0x497, 0x497}, {0x499, 0x499}, {0x49b, 0x49b}, {0x49d, 0x49d},
|
| 155 |
+
{0x49f, 0x49f}, {0x4a1, 0x4a1}, {0x4a3, 0x4a3}, {0x4a5, 0x4a5},
|
| 156 |
+
{0x4a7, 0x4a7}, {0x4a9, 0x4a9}, {0x4ab, 0x4ab}, {0x4ad, 0x4ad},
|
| 157 |
+
{0x4af, 0x4af}, {0x4b1, 0x4b1}, {0x4b3, 0x4b3}, {0x4b5, 0x4b5},
|
| 158 |
+
{0x4b7, 0x4b7}, {0x4b9, 0x4b9}, {0x4bb, 0x4bb}, {0x4bd, 0x4bd},
|
| 159 |
+
{0x4bf, 0x4bf}, {0x4c2, 0x4c2}, {0x4c4, 0x4c4}, {0x4c6, 0x4c6},
|
| 160 |
+
{0x4c8, 0x4c8}, {0x4ca, 0x4ca}, {0x4cc, 0x4cc}, {0x4ce, 0x4ce},
|
| 161 |
+
{0x4d1, 0x4d1}, {0x4d3, 0x4d3}, {0x4d5, 0x4d5}, {0x4d7, 0x4d7},
|
| 162 |
+
{0x4d9, 0x4d9}, {0x4db, 0x4db}, {0x4dd, 0x4dd}, {0x4df, 0x4df},
|
| 163 |
+
{0x4e1, 0x4e1}, {0x4e3, 0x4e3}, {0x4e5, 0x4e5}, {0x4e7, 0x4e7},
|
| 164 |
+
{0x4e9, 0x4e9}, {0x4eb, 0x4eb}, {0x4ed, 0x4ed}, {0x4ef, 0x4ef},
|
| 165 |
+
{0x4f1, 0x4f1}, {0x4f3, 0x4f3}, {0x4f5, 0x4f5}, {0x4f9, 0x4f9},
|
| 166 |
+
{0x501, 0x501}, {0x503, 0x503}, {0x505, 0x505}, {0x507, 0x507},
|
| 167 |
+
{0x509, 0x509}, {0x50b, 0x50b}, {0x50d, 0x50d}, {0x50f, 0x50f},
|
| 168 |
+
{0x561, 0x587}, {0x1d00, 0x1d2b}, {0x1d62, 0x1d6b}, {0x1e01, 0x1e01},
|
| 169 |
+
{0x1e03, 0x1e03}, {0x1e05, 0x1e05}, {0x1e07, 0x1e07}, {0x1e09, 0x1e09},
|
| 170 |
+
{0x1e0b, 0x1e0b}, {0x1e0d, 0x1e0d}, {0x1e0f, 0x1e0f}, {0x1e11, 0x1e11},
|
| 171 |
+
{0x1e13, 0x1e13}, {0x1e15, 0x1e15}, {0x1e17, 0x1e17}, {0x1e19, 0x1e19},
|
| 172 |
+
{0x1e1b, 0x1e1b}, {0x1e1d, 0x1e1d}, {0x1e1f, 0x1e1f}, {0x1e21, 0x1e21},
|
| 173 |
+
{0x1e23, 0x1e23}, {0x1e25, 0x1e25}, {0x1e27, 0x1e27}, {0x1e29, 0x1e29},
|
| 174 |
+
{0x1e2b, 0x1e2b}, {0x1e2d, 0x1e2d}, {0x1e2f, 0x1e2f}, {0x1e31, 0x1e31},
|
| 175 |
+
{0x1e33, 0x1e33}, {0x1e35, 0x1e35}, {0x1e37, 0x1e37}, {0x1e39, 0x1e39},
|
| 176 |
+
{0x1e3b, 0x1e3b}, {0x1e3d, 0x1e3d}, {0x1e3f, 0x1e3f}, {0x1e41, 0x1e41},
|
| 177 |
+
{0x1e43, 0x1e43}, {0x1e45, 0x1e45}, {0x1e47, 0x1e47}, {0x1e49, 0x1e49},
|
| 178 |
+
{0x1e4b, 0x1e4b}, {0x1e4d, 0x1e4d}, {0x1e4f, 0x1e4f}, {0x1e51, 0x1e51},
|
| 179 |
+
{0x1e53, 0x1e53}, {0x1e55, 0x1e55}, {0x1e57, 0x1e57}, {0x1e59, 0x1e59},
|
| 180 |
+
{0x1e5b, 0x1e5b}, {0x1e5d, 0x1e5d}, {0x1e5f, 0x1e5f}, {0x1e61, 0x1e61},
|
| 181 |
+
{0x1e63, 0x1e63}, {0x1e65, 0x1e65}, {0x1e67, 0x1e67}, {0x1e69, 0x1e69},
|
| 182 |
+
{0x1e6b, 0x1e6b}, {0x1e6d, 0x1e6d}, {0x1e6f, 0x1e6f}, {0x1e71, 0x1e71},
|
| 183 |
+
{0x1e73, 0x1e73}, {0x1e75, 0x1e75}, {0x1e77, 0x1e77}, {0x1e79, 0x1e79},
|
| 184 |
+
{0x1e7b, 0x1e7b}, {0x1e7d, 0x1e7d}, {0x1e7f, 0x1e7f}, {0x1e81, 0x1e81},
|
| 185 |
+
{0x1e83, 0x1e83}, {0x1e85, 0x1e85}, {0x1e87, 0x1e87}, {0x1e89, 0x1e89},
|
| 186 |
+
{0x1e8b, 0x1e8b}, {0x1e8d, 0x1e8d}, {0x1e8f, 0x1e8f}, {0x1e91, 0x1e91},
|
| 187 |
+
{0x1e93, 0x1e93}, {0x1e95, 0x1e9b}, {0x1ea1, 0x1ea1}, {0x1ea3, 0x1ea3},
|
| 188 |
+
{0x1ea5, 0x1ea5}, {0x1ea7, 0x1ea7}, {0x1ea9, 0x1ea9}, {0x1eab, 0x1eab},
|
| 189 |
+
{0x1ead, 0x1ead}, {0x1eaf, 0x1eaf}, {0x1eb1, 0x1eb1}, {0x1eb3, 0x1eb3},
|
| 190 |
+
{0x1eb5, 0x1eb5}, {0x1eb7, 0x1eb7}, {0x1eb9, 0x1eb9}, {0x1ebb, 0x1ebb},
|
| 191 |
+
{0x1ebd, 0x1ebd}, {0x1ebf, 0x1ebf}, {0x1ec1, 0x1ec1}, {0x1ec3, 0x1ec3},
|
| 192 |
+
{0x1ec5, 0x1ec5}, {0x1ec7, 0x1ec7}, {0x1ec9, 0x1ec9}, {0x1ecb, 0x1ecb},
|
| 193 |
+
{0x1ecd, 0x1ecd}, {0x1ecf, 0x1ecf}, {0x1ed1, 0x1ed1}, {0x1ed3, 0x1ed3},
|
| 194 |
+
{0x1ed5, 0x1ed5}, {0x1ed7, 0x1ed7}, {0x1ed9, 0x1ed9}, {0x1edb, 0x1edb},
|
| 195 |
+
{0x1edd, 0x1edd}, {0x1edf, 0x1edf}, {0x1ee1, 0x1ee1}, {0x1ee3, 0x1ee3},
|
| 196 |
+
{0x1ee5, 0x1ee5}, {0x1ee7, 0x1ee7}, {0x1ee9, 0x1ee9}, {0x1eeb, 0x1eeb},
|
| 197 |
+
{0x1eed, 0x1eed}, {0x1eef, 0x1eef}, {0x1ef1, 0x1ef1}, {0x1ef3, 0x1ef3},
|
| 198 |
+
{0x1ef5, 0x1ef5}, {0x1ef7, 0x1ef7}, {0x1ef9, 0x1ef9}, {0x1f00, 0x1f07},
|
| 199 |
+
{0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37}, {0x1f40, 0x1f45},
|
| 200 |
+
{0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d}, {0x1f80, 0x1f87},
|
| 201 |
+
{0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4}, {0x1fb6, 0x1fb7},
|
| 202 |
+
{0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fc7}, {0x1fd0, 0x1fd3},
|
| 203 |
+
{0x1fd6, 0x1fd7}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ff7},
|
| 204 |
+
{0x2071, 0x2071}, {0x207f, 0x207f}, {0x210a, 0x210a}, {0x210e, 0x210f},
|
| 205 |
+
{0x2113, 0x2113}, {0x212f, 0x212f}, {0x2134, 0x2134}, {0x2139, 0x2139},
|
| 206 |
+
{0x213d, 0x213d}, {0x2146, 0x2149}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
|
| 207 |
+
{0xff41, 0xff5a}};
|
| 208 |
+
static const xmlChLRange xmlLlL[] = {{0x10428, 0x1044f}, {0x1d41a, 0x1d433},
|
| 209 |
+
{0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b},
|
| 210 |
+
{0x1d4b6, 0x1d4b9}, {0x1d4bb, 0x1d4bb}, {0x1d4bd, 0x1d4c3},
|
| 211 |
+
{0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537},
|
| 212 |
+
{0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3},
|
| 213 |
+
{0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f},
|
| 214 |
+
{0x1d68a, 0x1d6a3}, {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1},
|
| 215 |
+
{0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e},
|
| 216 |
+
{0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f},
|
| 217 |
+
{0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}};
|
| 218 |
+
static const xmlChRangeGroup xmlLlG = {396,28,xmlLlS,xmlLlL};
|
| 219 |
+
|
| 220 |
+
static const xmlChSRange xmlLmS[] = {{0x2b0, 0x2c1}, {0x2c6, 0x2d1},
|
| 221 |
+
{0x2e0, 0x2e4}, {0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x559, 0x559},
|
| 222 |
+
{0x640, 0x640}, {0x6e5, 0x6e6}, {0xe46, 0xe46}, {0xec6, 0xec6},
|
| 223 |
+
{0x17d7, 0x17d7}, {0x1843, 0x1843}, {0x1d2c, 0x1d61}, {0x3005, 0x3005},
|
| 224 |
+
{0x3031, 0x3035}, {0x303b, 0x303b}, {0x309d, 0x309e}, {0x30fc, 0x30fe},
|
| 225 |
+
{0xff70, 0xff70}, {0xff9e, 0xff9f}};
|
| 226 |
+
static const xmlChRangeGroup xmlLmG = {20,0,xmlLmS,NULL};
|
| 227 |
+
|
| 228 |
+
static const xmlChSRange xmlLoS[] = {{0x1bb, 0x1bb}, {0x1c0, 0x1c3},
|
| 229 |
+
{0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, {0x641, 0x64a},
|
| 230 |
+
{0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5}, {0x6ee, 0x6ef},
|
| 231 |
+
{0x6fa, 0x6fc}, {0x6ff, 0x6ff}, {0x710, 0x710}, {0x712, 0x72f},
|
| 232 |
+
{0x74d, 0x74f}, {0x780, 0x7a5}, {0x7b1, 0x7b1}, {0x904, 0x939},
|
| 233 |
+
{0x93d, 0x93d}, {0x950, 0x950}, {0x958, 0x961}, {0x985, 0x98c},
|
| 234 |
+
{0x98f, 0x990}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2},
|
| 235 |
+
{0x9b6, 0x9b9}, {0x9bd, 0x9bd}, {0x9dc, 0x9dd}, {0x9df, 0x9e1},
|
| 236 |
+
{0x9f0, 0x9f1}, {0xa05, 0xa0a}, {0xa0f, 0xa10}, {0xa13, 0xa28},
|
| 237 |
+
{0xa2a, 0xa30}, {0xa32, 0xa33}, {0xa35, 0xa36}, {0xa38, 0xa39},
|
| 238 |
+
{0xa59, 0xa5c}, {0xa5e, 0xa5e}, {0xa72, 0xa74}, {0xa85, 0xa8d},
|
| 239 |
+
{0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3},
|
| 240 |
+
{0xab5, 0xab9}, {0xabd, 0xabd}, {0xad0, 0xad0}, {0xae0, 0xae1},
|
| 241 |
+
{0xb05, 0xb0c}, {0xb0f, 0xb10}, {0xb13, 0xb28}, {0xb2a, 0xb30},
|
| 242 |
+
{0xb32, 0xb33}, {0xb35, 0xb39}, {0xb3d, 0xb3d}, {0xb5c, 0xb5d},
|
| 243 |
+
{0xb5f, 0xb61}, {0xb71, 0xb71}, {0xb83, 0xb83}, {0xb85, 0xb8a},
|
| 244 |
+
{0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c},
|
| 245 |
+
{0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5},
|
| 246 |
+
{0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
|
| 247 |
+
{0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c},
|
| 248 |
+
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
| 249 |
+
{0xcbd, 0xcbd}, {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c},
|
| 250 |
+
{0xd0e, 0xd10}, {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61},
|
| 251 |
+
{0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdbd, 0xdbd},
|
| 252 |
+
{0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45},
|
| 253 |
+
{0xe81, 0xe82}, {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a},
|
| 254 |
+
{0xe8d, 0xe8d}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3},
|
| 255 |
+
{0xea5, 0xea5}, {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeb0},
|
| 256 |
+
{0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xedc, 0xedd},
|
| 257 |
+
{0xf00, 0xf00}, {0xf40, 0xf47}, {0xf49, 0xf6a}, {0xf88, 0xf8b},
|
| 258 |
+
{0x1000, 0x1021}, {0x1023, 0x1027}, {0x1029, 0x102a}, {0x1050, 0x1055},
|
| 259 |
+
{0x10d0, 0x10f8}, {0x1100, 0x1159}, {0x115f, 0x11a2}, {0x11a8, 0x11f9},
|
| 260 |
+
{0x1200, 0x1206}, {0x1208, 0x1246}, {0x1248, 0x1248}, {0x124a, 0x124d},
|
| 261 |
+
{0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1286},
|
| 262 |
+
{0x1288, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12ae}, {0x12b0, 0x12b0},
|
| 263 |
+
{0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5},
|
| 264 |
+
{0x12c8, 0x12ce}, {0x12d0, 0x12d6}, {0x12d8, 0x12ee}, {0x12f0, 0x130e},
|
| 265 |
+
{0x1310, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x131e}, {0x1320, 0x1346},
|
| 266 |
+
{0x1348, 0x135a}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x1676},
|
| 267 |
+
{0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x1700, 0x170c}, {0x170e, 0x1711},
|
| 268 |
+
{0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770},
|
| 269 |
+
{0x1780, 0x17b3}, {0x17dc, 0x17dc}, {0x1820, 0x1842}, {0x1844, 0x1877},
|
| 270 |
+
{0x1880, 0x18a8}, {0x1900, 0x191c}, {0x1950, 0x196d}, {0x1970, 0x1974},
|
| 271 |
+
{0x2135, 0x2138}, {0x3006, 0x3006}, {0x303c, 0x303c}, {0x3041, 0x3096},
|
| 272 |
+
{0x309f, 0x309f}, {0x30a1, 0x30fa}, {0x30ff, 0x30ff}, {0x3105, 0x312c},
|
| 273 |
+
{0x3131, 0x318e}, {0x31a0, 0x31b7}, {0x31f0, 0x31ff}, {0x3400, 0x3400},
|
| 274 |
+
{0x4db5, 0x4db5}, {0x4e00, 0x4e00}, {0x9fa5, 0x9fa5}, {0xa000, 0xa48c},
|
| 275 |
+
{0xac00, 0xac00}, {0xd7a3, 0xd7a3}, {0xf900, 0xfa2d}, {0xfa30, 0xfa6a},
|
| 276 |
+
{0xfb1d, 0xfb1d}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c},
|
| 277 |
+
{0xfb3e, 0xfb3e}, {0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1},
|
| 278 |
+
{0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb},
|
| 279 |
+
{0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff66, 0xff6f}, {0xff71, 0xff9d},
|
| 280 |
+
{0xffa0, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7},
|
| 281 |
+
{0xffda, 0xffdc}};
|
| 282 |
+
static const xmlChLRange xmlLoL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026},
|
| 283 |
+
{0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d},
|
| 284 |
+
{0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10300, 0x1031e},
|
| 285 |
+
{0x10330, 0x10349}, {0x10380, 0x1039d}, {0x10450, 0x1049d},
|
| 286 |
+
{0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835},
|
| 287 |
+
{0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f},
|
| 288 |
+
{0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d}};
|
| 289 |
+
static const xmlChRangeGroup xmlLoG = {211,20,xmlLoS,xmlLoL};
|
| 290 |
+
|
| 291 |
+
static const xmlChSRange xmlLtS[] = {{0x1c5, 0x1c5}, {0x1c8, 0x1c8},
|
| 292 |
+
{0x1cb, 0x1cb}, {0x1f2, 0x1f2}, {0x1f88, 0x1f8f}, {0x1f98, 0x1f9f},
|
| 293 |
+
{0x1fa8, 0x1faf}, {0x1fbc, 0x1fbc}, {0x1fcc, 0x1fcc}, {0x1ffc, 0x1ffc}};
|
| 294 |
+
static const xmlChRangeGroup xmlLtG = {10,0,xmlLtS,NULL};
|
| 295 |
+
|
| 296 |
+
static const xmlChSRange xmlLuS[] = {{0x41, 0x5a}, {0xc0, 0xd6},
|
| 297 |
+
{0xd8, 0xde}, {0x100, 0x100}, {0x102, 0x102}, {0x104, 0x104},
|
| 298 |
+
{0x106, 0x106}, {0x108, 0x108}, {0x10a, 0x10a}, {0x10c, 0x10c},
|
| 299 |
+
{0x10e, 0x10e}, {0x110, 0x110}, {0x112, 0x112}, {0x114, 0x114},
|
| 300 |
+
{0x116, 0x116}, {0x118, 0x118}, {0x11a, 0x11a}, {0x11c, 0x11c},
|
| 301 |
+
{0x11e, 0x11e}, {0x120, 0x120}, {0x122, 0x122}, {0x124, 0x124},
|
| 302 |
+
{0x126, 0x126}, {0x128, 0x128}, {0x12a, 0x12a}, {0x12c, 0x12c},
|
| 303 |
+
{0x12e, 0x12e}, {0x130, 0x130}, {0x132, 0x132}, {0x134, 0x134},
|
| 304 |
+
{0x136, 0x136}, {0x139, 0x139}, {0x13b, 0x13b}, {0x13d, 0x13d},
|
| 305 |
+
{0x13f, 0x13f}, {0x141, 0x141}, {0x143, 0x143}, {0x145, 0x145},
|
| 306 |
+
{0x147, 0x147}, {0x14a, 0x14a}, {0x14c, 0x14c}, {0x14e, 0x14e},
|
| 307 |
+
{0x150, 0x150}, {0x152, 0x152}, {0x154, 0x154}, {0x156, 0x156},
|
| 308 |
+
{0x158, 0x158}, {0x15a, 0x15a}, {0x15c, 0x15c}, {0x15e, 0x15e},
|
| 309 |
+
{0x160, 0x160}, {0x162, 0x162}, {0x164, 0x164}, {0x166, 0x166},
|
| 310 |
+
{0x168, 0x168}, {0x16a, 0x16a}, {0x16c, 0x16c}, {0x16e, 0x16e},
|
| 311 |
+
{0x170, 0x170}, {0x172, 0x172}, {0x174, 0x174}, {0x176, 0x176},
|
| 312 |
+
{0x178, 0x179}, {0x17b, 0x17b}, {0x17d, 0x17d}, {0x181, 0x182},
|
| 313 |
+
{0x184, 0x184}, {0x186, 0x187}, {0x189, 0x18b}, {0x18e, 0x191},
|
| 314 |
+
{0x193, 0x194}, {0x196, 0x198}, {0x19c, 0x19d}, {0x19f, 0x1a0},
|
| 315 |
+
{0x1a2, 0x1a2}, {0x1a4, 0x1a4}, {0x1a6, 0x1a7}, {0x1a9, 0x1a9},
|
| 316 |
+
{0x1ac, 0x1ac}, {0x1ae, 0x1af}, {0x1b1, 0x1b3}, {0x1b5, 0x1b5},
|
| 317 |
+
{0x1b7, 0x1b8}, {0x1bc, 0x1bc}, {0x1c4, 0x1c4}, {0x1c7, 0x1c7},
|
| 318 |
+
{0x1ca, 0x1ca}, {0x1cd, 0x1cd}, {0x1cf, 0x1cf}, {0x1d1, 0x1d1},
|
| 319 |
+
{0x1d3, 0x1d3}, {0x1d5, 0x1d5}, {0x1d7, 0x1d7}, {0x1d9, 0x1d9},
|
| 320 |
+
{0x1db, 0x1db}, {0x1de, 0x1de}, {0x1e0, 0x1e0}, {0x1e2, 0x1e2},
|
| 321 |
+
{0x1e4, 0x1e4}, {0x1e6, 0x1e6}, {0x1e8, 0x1e8}, {0x1ea, 0x1ea},
|
| 322 |
+
{0x1ec, 0x1ec}, {0x1ee, 0x1ee}, {0x1f1, 0x1f1}, {0x1f4, 0x1f4},
|
| 323 |
+
{0x1f6, 0x1f8}, {0x1fa, 0x1fa}, {0x1fc, 0x1fc}, {0x1fe, 0x1fe},
|
| 324 |
+
{0x200, 0x200}, {0x202, 0x202}, {0x204, 0x204}, {0x206, 0x206},
|
| 325 |
+
{0x208, 0x208}, {0x20a, 0x20a}, {0x20c, 0x20c}, {0x20e, 0x20e},
|
| 326 |
+
{0x210, 0x210}, {0x212, 0x212}, {0x214, 0x214}, {0x216, 0x216},
|
| 327 |
+
{0x218, 0x218}, {0x21a, 0x21a}, {0x21c, 0x21c}, {0x21e, 0x21e},
|
| 328 |
+
{0x220, 0x220}, {0x222, 0x222}, {0x224, 0x224}, {0x226, 0x226},
|
| 329 |
+
{0x228, 0x228}, {0x22a, 0x22a}, {0x22c, 0x22c}, {0x22e, 0x22e},
|
| 330 |
+
{0x230, 0x230}, {0x232, 0x232}, {0x386, 0x386}, {0x388, 0x38a},
|
| 331 |
+
{0x38c, 0x38c}, {0x38e, 0x38f}, {0x391, 0x3a1}, {0x3a3, 0x3ab},
|
| 332 |
+
{0x3d2, 0x3d4}, {0x3d8, 0x3d8}, {0x3da, 0x3da}, {0x3dc, 0x3dc},
|
| 333 |
+
{0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3e2}, {0x3e4, 0x3e4},
|
| 334 |
+
{0x3e6, 0x3e6}, {0x3e8, 0x3e8}, {0x3ea, 0x3ea}, {0x3ec, 0x3ec},
|
| 335 |
+
{0x3ee, 0x3ee}, {0x3f4, 0x3f4}, {0x3f7, 0x3f7}, {0x3f9, 0x3fa},
|
| 336 |
+
{0x400, 0x42f}, {0x460, 0x460}, {0x462, 0x462}, {0x464, 0x464},
|
| 337 |
+
{0x466, 0x466}, {0x468, 0x468}, {0x46a, 0x46a}, {0x46c, 0x46c},
|
| 338 |
+
{0x46e, 0x46e}, {0x470, 0x470}, {0x472, 0x472}, {0x474, 0x474},
|
| 339 |
+
{0x476, 0x476}, {0x478, 0x478}, {0x47a, 0x47a}, {0x47c, 0x47c},
|
| 340 |
+
{0x47e, 0x47e}, {0x480, 0x480}, {0x48a, 0x48a}, {0x48c, 0x48c},
|
| 341 |
+
{0x48e, 0x48e}, {0x490, 0x490}, {0x492, 0x492}, {0x494, 0x494},
|
| 342 |
+
{0x496, 0x496}, {0x498, 0x498}, {0x49a, 0x49a}, {0x49c, 0x49c},
|
| 343 |
+
{0x49e, 0x49e}, {0x4a0, 0x4a0}, {0x4a2, 0x4a2}, {0x4a4, 0x4a4},
|
| 344 |
+
{0x4a6, 0x4a6}, {0x4a8, 0x4a8}, {0x4aa, 0x4aa}, {0x4ac, 0x4ac},
|
| 345 |
+
{0x4ae, 0x4ae}, {0x4b0, 0x4b0}, {0x4b2, 0x4b2}, {0x4b4, 0x4b4},
|
| 346 |
+
{0x4b6, 0x4b6}, {0x4b8, 0x4b8}, {0x4ba, 0x4ba}, {0x4bc, 0x4bc},
|
| 347 |
+
{0x4be, 0x4be}, {0x4c0, 0x4c1}, {0x4c3, 0x4c3}, {0x4c5, 0x4c5},
|
| 348 |
+
{0x4c7, 0x4c7}, {0x4c9, 0x4c9}, {0x4cb, 0x4cb}, {0x4cd, 0x4cd},
|
| 349 |
+
{0x4d0, 0x4d0}, {0x4d2, 0x4d2}, {0x4d4, 0x4d4}, {0x4d6, 0x4d6},
|
| 350 |
+
{0x4d8, 0x4d8}, {0x4da, 0x4da}, {0x4dc, 0x4dc}, {0x4de, 0x4de},
|
| 351 |
+
{0x4e0, 0x4e0}, {0x4e2, 0x4e2}, {0x4e4, 0x4e4}, {0x4e6, 0x4e6},
|
| 352 |
+
{0x4e8, 0x4e8}, {0x4ea, 0x4ea}, {0x4ec, 0x4ec}, {0x4ee, 0x4ee},
|
| 353 |
+
{0x4f0, 0x4f0}, {0x4f2, 0x4f2}, {0x4f4, 0x4f4}, {0x4f8, 0x4f8},
|
| 354 |
+
{0x500, 0x500}, {0x502, 0x502}, {0x504, 0x504}, {0x506, 0x506},
|
| 355 |
+
{0x508, 0x508}, {0x50a, 0x50a}, {0x50c, 0x50c}, {0x50e, 0x50e},
|
| 356 |
+
{0x531, 0x556}, {0x10a0, 0x10c5}, {0x1e00, 0x1e00}, {0x1e02, 0x1e02},
|
| 357 |
+
{0x1e04, 0x1e04}, {0x1e06, 0x1e06}, {0x1e08, 0x1e08}, {0x1e0a, 0x1e0a},
|
| 358 |
+
{0x1e0c, 0x1e0c}, {0x1e0e, 0x1e0e}, {0x1e10, 0x1e10}, {0x1e12, 0x1e12},
|
| 359 |
+
{0x1e14, 0x1e14}, {0x1e16, 0x1e16}, {0x1e18, 0x1e18}, {0x1e1a, 0x1e1a},
|
| 360 |
+
{0x1e1c, 0x1e1c}, {0x1e1e, 0x1e1e}, {0x1e20, 0x1e20}, {0x1e22, 0x1e22},
|
| 361 |
+
{0x1e24, 0x1e24}, {0x1e26, 0x1e26}, {0x1e28, 0x1e28}, {0x1e2a, 0x1e2a},
|
| 362 |
+
{0x1e2c, 0x1e2c}, {0x1e2e, 0x1e2e}, {0x1e30, 0x1e30}, {0x1e32, 0x1e32},
|
| 363 |
+
{0x1e34, 0x1e34}, {0x1e36, 0x1e36}, {0x1e38, 0x1e38}, {0x1e3a, 0x1e3a},
|
| 364 |
+
{0x1e3c, 0x1e3c}, {0x1e3e, 0x1e3e}, {0x1e40, 0x1e40}, {0x1e42, 0x1e42},
|
| 365 |
+
{0x1e44, 0x1e44}, {0x1e46, 0x1e46}, {0x1e48, 0x1e48}, {0x1e4a, 0x1e4a},
|
| 366 |
+
{0x1e4c, 0x1e4c}, {0x1e4e, 0x1e4e}, {0x1e50, 0x1e50}, {0x1e52, 0x1e52},
|
| 367 |
+
{0x1e54, 0x1e54}, {0x1e56, 0x1e56}, {0x1e58, 0x1e58}, {0x1e5a, 0x1e5a},
|
| 368 |
+
{0x1e5c, 0x1e5c}, {0x1e5e, 0x1e5e}, {0x1e60, 0x1e60}, {0x1e62, 0x1e62},
|
| 369 |
+
{0x1e64, 0x1e64}, {0x1e66, 0x1e66}, {0x1e68, 0x1e68}, {0x1e6a, 0x1e6a},
|
| 370 |
+
{0x1e6c, 0x1e6c}, {0x1e6e, 0x1e6e}, {0x1e70, 0x1e70}, {0x1e72, 0x1e72},
|
| 371 |
+
{0x1e74, 0x1e74}, {0x1e76, 0x1e76}, {0x1e78, 0x1e78}, {0x1e7a, 0x1e7a},
|
| 372 |
+
{0x1e7c, 0x1e7c}, {0x1e7e, 0x1e7e}, {0x1e80, 0x1e80}, {0x1e82, 0x1e82},
|
| 373 |
+
{0x1e84, 0x1e84}, {0x1e86, 0x1e86}, {0x1e88, 0x1e88}, {0x1e8a, 0x1e8a},
|
| 374 |
+
{0x1e8c, 0x1e8c}, {0x1e8e, 0x1e8e}, {0x1e90, 0x1e90}, {0x1e92, 0x1e92},
|
| 375 |
+
{0x1e94, 0x1e94}, {0x1ea0, 0x1ea0}, {0x1ea2, 0x1ea2}, {0x1ea4, 0x1ea4},
|
| 376 |
+
{0x1ea6, 0x1ea6}, {0x1ea8, 0x1ea8}, {0x1eaa, 0x1eaa}, {0x1eac, 0x1eac},
|
| 377 |
+
{0x1eae, 0x1eae}, {0x1eb0, 0x1eb0}, {0x1eb2, 0x1eb2}, {0x1eb4, 0x1eb4},
|
| 378 |
+
{0x1eb6, 0x1eb6}, {0x1eb8, 0x1eb8}, {0x1eba, 0x1eba}, {0x1ebc, 0x1ebc},
|
| 379 |
+
{0x1ebe, 0x1ebe}, {0x1ec0, 0x1ec0}, {0x1ec2, 0x1ec2}, {0x1ec4, 0x1ec4},
|
| 380 |
+
{0x1ec6, 0x1ec6}, {0x1ec8, 0x1ec8}, {0x1eca, 0x1eca}, {0x1ecc, 0x1ecc},
|
| 381 |
+
{0x1ece, 0x1ece}, {0x1ed0, 0x1ed0}, {0x1ed2, 0x1ed2}, {0x1ed4, 0x1ed4},
|
| 382 |
+
{0x1ed6, 0x1ed6}, {0x1ed8, 0x1ed8}, {0x1eda, 0x1eda}, {0x1edc, 0x1edc},
|
| 383 |
+
{0x1ede, 0x1ede}, {0x1ee0, 0x1ee0}, {0x1ee2, 0x1ee2}, {0x1ee4, 0x1ee4},
|
| 384 |
+
{0x1ee6, 0x1ee6}, {0x1ee8, 0x1ee8}, {0x1eea, 0x1eea}, {0x1eec, 0x1eec},
|
| 385 |
+
{0x1eee, 0x1eee}, {0x1ef0, 0x1ef0}, {0x1ef2, 0x1ef2}, {0x1ef4, 0x1ef4},
|
| 386 |
+
{0x1ef6, 0x1ef6}, {0x1ef8, 0x1ef8}, {0x1f08, 0x1f0f}, {0x1f18, 0x1f1d},
|
| 387 |
+
{0x1f28, 0x1f2f}, {0x1f38, 0x1f3f}, {0x1f48, 0x1f4d}, {0x1f59, 0x1f59},
|
| 388 |
+
{0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f5f}, {0x1f68, 0x1f6f},
|
| 389 |
+
{0x1fb8, 0x1fbb}, {0x1fc8, 0x1fcb}, {0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec},
|
| 390 |
+
{0x1ff8, 0x1ffb}, {0x2102, 0x2102}, {0x2107, 0x2107}, {0x210b, 0x210d},
|
| 391 |
+
{0x2110, 0x2112}, {0x2115, 0x2115}, {0x2119, 0x211d}, {0x2124, 0x2124},
|
| 392 |
+
{0x2126, 0x2126}, {0x2128, 0x2128}, {0x212a, 0x212d}, {0x2130, 0x2131},
|
| 393 |
+
{0x2133, 0x2133}, {0x213e, 0x213f}, {0x2145, 0x2145}, {0xff21, 0xff3a}};
|
| 394 |
+
static const xmlChLRange xmlLuL[] = {{0x10400, 0x10427}, {0x1d400, 0x1d419},
|
| 395 |
+
{0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d49c, 0x1d49c},
|
| 396 |
+
{0x1d49e, 0x1d49f}, {0x1d4a2, 0x1d4a2}, {0x1d4a5, 0x1d4a6},
|
| 397 |
+
{0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9},
|
| 398 |
+
{0x1d504, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
|
| 399 |
+
{0x1d516, 0x1d51c}, {0x1d538, 0x1d539}, {0x1d53b, 0x1d53e},
|
| 400 |
+
{0x1d540, 0x1d544}, {0x1d546, 0x1d546}, {0x1d54a, 0x1d550},
|
| 401 |
+
{0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed},
|
| 402 |
+
{0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689},
|
| 403 |
+
{0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734},
|
| 404 |
+
{0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}};
|
| 405 |
+
static const xmlChRangeGroup xmlLuG = {390,31,xmlLuS,xmlLuL};
|
| 406 |
+
|
| 407 |
+
static const xmlChSRange xmlMS[] = {{0x300, 0x357}, {0x35d, 0x36f},
|
| 408 |
+
{0x483, 0x486}, {0x488, 0x489}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
|
| 409 |
+
{0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4},
|
| 410 |
+
{0x610, 0x615}, {0x64b, 0x658}, {0x670, 0x670}, {0x6d6, 0x6dc},
|
| 411 |
+
{0x6de, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x711, 0x711},
|
| 412 |
+
{0x730, 0x74a}, {0x7a6, 0x7b0}, {0x901, 0x903}, {0x93c, 0x93c},
|
| 413 |
+
{0x93e, 0x94d}, {0x951, 0x954}, {0x962, 0x963}, {0x981, 0x983},
|
| 414 |
+
{0x9bc, 0x9bc}, {0x9be, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd},
|
| 415 |
+
{0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa01, 0xa03}, {0xa3c, 0xa3c},
|
| 416 |
+
{0xa3e, 0xa42}, {0xa47, 0xa48}, {0xa4b, 0xa4d}, {0xa70, 0xa71},
|
| 417 |
+
{0xa81, 0xa83}, {0xabc, 0xabc}, {0xabe, 0xac5}, {0xac7, 0xac9},
|
| 418 |
+
{0xacb, 0xacd}, {0xae2, 0xae3}, {0xb01, 0xb03}, {0xb3c, 0xb3c},
|
| 419 |
+
{0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, {0xb56, 0xb57},
|
| 420 |
+
{0xb82, 0xb82}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd},
|
| 421 |
+
{0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, {0xc46, 0xc48},
|
| 422 |
+
{0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, {0xcbc, 0xcbc},
|
| 423 |
+
{0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6},
|
| 424 |
+
{0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d},
|
| 425 |
+
{0xd57, 0xd57}, {0xd82, 0xd83}, {0xdca, 0xdca}, {0xdcf, 0xdd4},
|
| 426 |
+
{0xdd6, 0xdd6}, {0xdd8, 0xddf}, {0xdf2, 0xdf3}, {0xe31, 0xe31},
|
| 427 |
+
{0xe34, 0xe3a}, {0xe47, 0xe4e}, {0xeb1, 0xeb1}, {0xeb4, 0xeb9},
|
| 428 |
+
{0xebb, 0xebc}, {0xec8, 0xecd}, {0xf18, 0xf19}, {0xf35, 0xf35},
|
| 429 |
+
{0xf37, 0xf37}, {0xf39, 0xf39}, {0xf3e, 0xf3f}, {0xf71, 0xf84},
|
| 430 |
+
{0xf86, 0xf87}, {0xf90, 0xf97}, {0xf99, 0xfbc}, {0xfc6, 0xfc6},
|
| 431 |
+
{0x102c, 0x1032}, {0x1036, 0x1039}, {0x1056, 0x1059}, {0x1712, 0x1714},
|
| 432 |
+
{0x1732, 0x1734}, {0x1752, 0x1753}, {0x1772, 0x1773}, {0x17b6, 0x17d3},
|
| 433 |
+
{0x17dd, 0x17dd}, {0x180b, 0x180d}, {0x18a9, 0x18a9}, {0x1920, 0x192b},
|
| 434 |
+
{0x1930, 0x193b}, {0x20d0, 0x20ea}, {0x302a, 0x302f}, {0x3099, 0x309a},
|
| 435 |
+
{0xfb1e, 0xfb1e}, {0xfe00, 0xfe0f}, {0xfe20, 0xfe23}};
|
| 436 |
+
static const xmlChLRange xmlML[] = {{0x1d165, 0x1d169}, {0x1d16d, 0x1d172},
|
| 437 |
+
{0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad},
|
| 438 |
+
{0xe0100, 0xe01ef}};
|
| 439 |
+
static const xmlChRangeGroup xmlMG = {113,6,xmlMS,xmlML};
|
| 440 |
+
|
| 441 |
+
static const xmlChSRange xmlMcS[] = {{0x903, 0x903}, {0x93e, 0x940},
|
| 442 |
+
{0x949, 0x94c}, {0x982, 0x983}, {0x9be, 0x9c0}, {0x9c7, 0x9c8},
|
| 443 |
+
{0x9cb, 0x9cc}, {0x9d7, 0x9d7}, {0xa03, 0xa03}, {0xa3e, 0xa40},
|
| 444 |
+
{0xa83, 0xa83}, {0xabe, 0xac0}, {0xac9, 0xac9}, {0xacb, 0xacc},
|
| 445 |
+
{0xb02, 0xb03}, {0xb3e, 0xb3e}, {0xb40, 0xb40}, {0xb47, 0xb48},
|
| 446 |
+
{0xb4b, 0xb4c}, {0xb57, 0xb57}, {0xbbe, 0xbbf}, {0xbc1, 0xbc2},
|
| 447 |
+
{0xbc6, 0xbc8}, {0xbca, 0xbcc}, {0xbd7, 0xbd7}, {0xc01, 0xc03},
|
| 448 |
+
{0xc41, 0xc44}, {0xc82, 0xc83}, {0xcbe, 0xcbe}, {0xcc0, 0xcc4},
|
| 449 |
+
{0xcc7, 0xcc8}, {0xcca, 0xccb}, {0xcd5, 0xcd6}, {0xd02, 0xd03},
|
| 450 |
+
{0xd3e, 0xd40}, {0xd46, 0xd48}, {0xd4a, 0xd4c}, {0xd57, 0xd57},
|
| 451 |
+
{0xd82, 0xd83}, {0xdcf, 0xdd1}, {0xdd8, 0xddf}, {0xdf2, 0xdf3},
|
| 452 |
+
{0xf3e, 0xf3f}, {0xf7f, 0xf7f}, {0x102c, 0x102c}, {0x1031, 0x1031},
|
| 453 |
+
{0x1038, 0x1038}, {0x1056, 0x1057}, {0x17b6, 0x17b6}, {0x17be, 0x17c5},
|
| 454 |
+
{0x17c7, 0x17c8}, {0x1923, 0x1926}, {0x1929, 0x192b}, {0x1930, 0x1931},
|
| 455 |
+
{0x1933, 0x1938}};
|
| 456 |
+
static const xmlChLRange xmlMcL[] = {{0x1d165, 0x1d166}, {0x1d16d, 0x1d172}};
|
| 457 |
+
static const xmlChRangeGroup xmlMcG = {55,2,xmlMcS,xmlMcL};
|
| 458 |
+
|
| 459 |
+
static const xmlChSRange xmlMnS[] = {{0x300, 0x357}, {0x35d, 0x36f},
|
| 460 |
+
{0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, {0x5bb, 0x5bd},
|
| 461 |
+
{0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, {0x610, 0x615},
|
| 462 |
+
{0x64b, 0x658}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6df, 0x6e4},
|
| 463 |
+
{0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x711, 0x711}, {0x730, 0x74a},
|
| 464 |
+
{0x7a6, 0x7b0}, {0x901, 0x902}, {0x93c, 0x93c}, {0x941, 0x948},
|
| 465 |
+
{0x94d, 0x94d}, {0x951, 0x954}, {0x962, 0x963}, {0x981, 0x981},
|
| 466 |
+
{0x9bc, 0x9bc}, {0x9c1, 0x9c4}, {0x9cd, 0x9cd}, {0x9e2, 0x9e3},
|
| 467 |
+
{0xa01, 0xa02}, {0xa3c, 0xa3c}, {0xa41, 0xa42}, {0xa47, 0xa48},
|
| 468 |
+
{0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa82}, {0xabc, 0xabc},
|
| 469 |
+
{0xac1, 0xac5}, {0xac7, 0xac8}, {0xacd, 0xacd}, {0xae2, 0xae3},
|
| 470 |
+
{0xb01, 0xb01}, {0xb3c, 0xb3c}, {0xb3f, 0xb3f}, {0xb41, 0xb43},
|
| 471 |
+
{0xb4d, 0xb4d}, {0xb56, 0xb56}, {0xb82, 0xb82}, {0xbc0, 0xbc0},
|
| 472 |
+
{0xbcd, 0xbcd}, {0xc3e, 0xc40}, {0xc46, 0xc48}, {0xc4a, 0xc4d},
|
| 473 |
+
{0xc55, 0xc56}, {0xcbc, 0xcbc}, {0xcbf, 0xcbf}, {0xcc6, 0xcc6},
|
| 474 |
+
{0xccc, 0xccd}, {0xd41, 0xd43}, {0xd4d, 0xd4d}, {0xdca, 0xdca},
|
| 475 |
+
{0xdd2, 0xdd4}, {0xdd6, 0xdd6}, {0xe31, 0xe31}, {0xe34, 0xe3a},
|
| 476 |
+
{0xe47, 0xe4e}, {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc},
|
| 477 |
+
{0xec8, 0xecd}, {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37},
|
| 478 |
+
{0xf39, 0xf39}, {0xf71, 0xf7e}, {0xf80, 0xf84}, {0xf86, 0xf87},
|
| 479 |
+
{0xf90, 0xf97}, {0xf99, 0xfbc}, {0xfc6, 0xfc6}, {0x102d, 0x1030},
|
| 480 |
+
{0x1032, 0x1032}, {0x1036, 0x1037}, {0x1039, 0x1039}, {0x1058, 0x1059},
|
| 481 |
+
{0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753}, {0x1772, 0x1773},
|
| 482 |
+
{0x17b7, 0x17bd}, {0x17c6, 0x17c6}, {0x17c9, 0x17d3}, {0x17dd, 0x17dd},
|
| 483 |
+
{0x180b, 0x180d}, {0x18a9, 0x18a9}, {0x1920, 0x1922}, {0x1927, 0x1928},
|
| 484 |
+
{0x1932, 0x1932}, {0x1939, 0x193b}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1},
|
| 485 |
+
{0x20e5, 0x20ea}, {0x302a, 0x302f}, {0x3099, 0x309a}, {0xfb1e, 0xfb1e},
|
| 486 |
+
{0xfe00, 0xfe0f}, {0xfe20, 0xfe23}};
|
| 487 |
+
static const xmlChLRange xmlMnL[] = {{0x1d167, 0x1d169}, {0x1d17b, 0x1d182},
|
| 488 |
+
{0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, {0xe0100, 0xe01ef}};
|
| 489 |
+
static const xmlChRangeGroup xmlMnG = {108,5,xmlMnS,xmlMnL};
|
| 490 |
+
|
| 491 |
+
static const xmlChSRange xmlNS[] = {{0x30, 0x39}, {0xb2, 0xb3},
|
| 492 |
+
{0xb9, 0xb9}, {0xbc, 0xbe}, {0x660, 0x669}, {0x6f0, 0x6f9},
|
| 493 |
+
{0x966, 0x96f}, {0x9e6, 0x9ef}, {0x9f4, 0x9f9}, {0xa66, 0xa6f},
|
| 494 |
+
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbf2}, {0xc66, 0xc6f},
|
| 495 |
+
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
| 496 |
+
{0xf20, 0xf33}, {0x1040, 0x1049}, {0x1369, 0x137c}, {0x16ee, 0x16f0},
|
| 497 |
+
{0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1810, 0x1819}, {0x1946, 0x194f},
|
| 498 |
+
{0x2070, 0x2070}, {0x2074, 0x2079}, {0x2080, 0x2089}, {0x2153, 0x2183},
|
| 499 |
+
{0x2460, 0x249b}, {0x24ea, 0x24ff}, {0x2776, 0x2793}, {0x3007, 0x3007},
|
| 500 |
+
{0x3021, 0x3029}, {0x3038, 0x303a}, {0x3192, 0x3195}, {0x3220, 0x3229},
|
| 501 |
+
{0x3251, 0x325f}, {0x3280, 0x3289}, {0x32b1, 0x32bf}, {0xff10, 0xff19}};
|
| 502 |
+
static const xmlChLRange xmlNL[] = {{0x10107, 0x10133}, {0x10320, 0x10323},
|
| 503 |
+
{0x1034a, 0x1034a}, {0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff}};
|
| 504 |
+
static const xmlChRangeGroup xmlNG = {42,5,xmlNS,xmlNL};
|
| 505 |
+
|
| 506 |
+
static const xmlChSRange xmlNdS[] = {{0x30, 0x39}, {0x660, 0x669},
|
| 507 |
+
{0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
|
| 508 |
+
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
|
| 509 |
+
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
| 510 |
+
{0xf20, 0xf29}, {0x1040, 0x1049}, {0x1369, 0x1371}, {0x17e0, 0x17e9},
|
| 511 |
+
{0x1810, 0x1819}, {0x1946, 0x194f}, {0xff10, 0xff19}};
|
| 512 |
+
static const xmlChLRange xmlNdL[] = {{0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff}};
|
| 513 |
+
static const xmlChRangeGroup xmlNdG = {21,2,xmlNdS,xmlNdL};
|
| 514 |
+
|
| 515 |
+
static const xmlChSRange xmlNoS[] = {{0xb2, 0xb3}, {0xb9, 0xb9},
|
| 516 |
+
{0xbc, 0xbe}, {0x9f4, 0x9f9}, {0xbf0, 0xbf2}, {0xf2a, 0xf33},
|
| 517 |
+
{0x1372, 0x137c}, {0x17f0, 0x17f9}, {0x2070, 0x2070}, {0x2074, 0x2079},
|
| 518 |
+
{0x2080, 0x2089}, {0x2153, 0x215f}, {0x2460, 0x249b}, {0x24ea, 0x24ff},
|
| 519 |
+
{0x2776, 0x2793}, {0x3192, 0x3195}, {0x3220, 0x3229}, {0x3251, 0x325f},
|
| 520 |
+
{0x3280, 0x3289}, {0x32b1, 0x32bf}};
|
| 521 |
+
static const xmlChLRange xmlNoL[] = {{0x10107, 0x10133}, {0x10320, 0x10323}};
|
| 522 |
+
static const xmlChRangeGroup xmlNoG = {20,2,xmlNoS,xmlNoL};
|
| 523 |
+
|
| 524 |
+
static const xmlChSRange xmlPS[] = {{0x21, 0x23}, {0x25, 0x2a},
|
| 525 |
+
{0x2c, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, {0x5b, 0x5d}, {0x5f, 0x5f},
|
| 526 |
+
{0x7b, 0x7b}, {0x7d, 0x7d}, {0xa1, 0xa1}, {0xab, 0xab}, {0xb7, 0xb7},
|
| 527 |
+
{0xbb, 0xbb}, {0xbf, 0xbf}, {0x37e, 0x37e}, {0x387, 0x387},
|
| 528 |
+
{0x55a, 0x55f}, {0x589, 0x58a}, {0x5be, 0x5be}, {0x5c0, 0x5c0},
|
| 529 |
+
{0x5c3, 0x5c3}, {0x5f3, 0x5f4}, {0x60c, 0x60d}, {0x61b, 0x61b},
|
| 530 |
+
{0x61f, 0x61f}, {0x66a, 0x66d}, {0x6d4, 0x6d4}, {0x700, 0x70d},
|
| 531 |
+
{0x964, 0x965}, {0x970, 0x970}, {0xdf4, 0xdf4}, {0xe4f, 0xe4f},
|
| 532 |
+
{0xe5a, 0xe5b}, {0xf04, 0xf12}, {0xf3a, 0xf3d}, {0xf85, 0xf85},
|
| 533 |
+
{0x104a, 0x104f}, {0x10fb, 0x10fb}, {0x1361, 0x1368}, {0x166d, 0x166e},
|
| 534 |
+
{0x169b, 0x169c}, {0x16eb, 0x16ed}, {0x1735, 0x1736}, {0x17d4, 0x17d6},
|
| 535 |
+
{0x17d8, 0x17da}, {0x1800, 0x180a}, {0x1944, 0x1945}, {0x2010, 0x2027},
|
| 536 |
+
{0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x2054}, {0x2057, 0x2057},
|
| 537 |
+
{0x207d, 0x207e}, {0x208d, 0x208e}, {0x2329, 0x232a}, {0x23b4, 0x23b6},
|
| 538 |
+
{0x2768, 0x2775}, {0x27e6, 0x27eb}, {0x2983, 0x2998}, {0x29d8, 0x29db},
|
| 539 |
+
{0x29fc, 0x29fd}, {0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f},
|
| 540 |
+
{0x3030, 0x3030}, {0x303d, 0x303d}, {0x30a0, 0x30a0}, {0x30fb, 0x30fb},
|
| 541 |
+
{0xfd3e, 0xfd3f}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61}, {0xfe63, 0xfe63},
|
| 542 |
+
{0xfe68, 0xfe68}, {0xfe6a, 0xfe6b}, {0xff01, 0xff03}, {0xff05, 0xff0a},
|
| 543 |
+
{0xff0c, 0xff0f}, {0xff1a, 0xff1b}, {0xff1f, 0xff20}, {0xff3b, 0xff3d},
|
| 544 |
+
{0xff3f, 0xff3f}, {0xff5b, 0xff5b}, {0xff5d, 0xff5d}, {0xff5f, 0xff65}};
|
| 545 |
+
static const xmlChLRange xmlPL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f}};
|
| 546 |
+
static const xmlChRangeGroup xmlPG = {84,2,xmlPS,xmlPL};
|
| 547 |
+
|
| 548 |
+
static const xmlChSRange xmlPdS[] = {{0x2d, 0x2d}, {0x58a, 0x58a},
|
| 549 |
+
{0x1806, 0x1806}, {0x2010, 0x2015}, {0x301c, 0x301c}, {0x3030, 0x3030},
|
| 550 |
+
{0x30a0, 0x30a0}, {0xfe31, 0xfe32}, {0xfe58, 0xfe58}, {0xfe63, 0xfe63},
|
| 551 |
+
{0xff0d, 0xff0d}};
|
| 552 |
+
static const xmlChRangeGroup xmlPdG = {11,0,xmlPdS,NULL};
|
| 553 |
+
|
| 554 |
+
static const xmlChSRange xmlPeS[] = {{0x29, 0x29}, {0x5d, 0x5d},
|
| 555 |
+
{0x7d, 0x7d}, {0xf3b, 0xf3b}, {0xf3d, 0xf3d}, {0x169c, 0x169c},
|
| 556 |
+
{0x2046, 0x2046}, {0x207e, 0x207e}, {0x208e, 0x208e}, {0x232a, 0x232a},
|
| 557 |
+
{0x23b5, 0x23b5}, {0x2769, 0x2769}, {0x276b, 0x276b}, {0x276d, 0x276d},
|
| 558 |
+
{0x276f, 0x276f}, {0x2771, 0x2771}, {0x2773, 0x2773}, {0x2775, 0x2775},
|
| 559 |
+
{0x27e7, 0x27e7}, {0x27e9, 0x27e9}, {0x27eb, 0x27eb}, {0x2984, 0x2984},
|
| 560 |
+
{0x2986, 0x2986}, {0x2988, 0x2988}, {0x298a, 0x298a}, {0x298c, 0x298c},
|
| 561 |
+
{0x298e, 0x298e}, {0x2990, 0x2990}, {0x2992, 0x2992}, {0x2994, 0x2994},
|
| 562 |
+
{0x2996, 0x2996}, {0x2998, 0x2998}, {0x29d9, 0x29d9}, {0x29db, 0x29db},
|
| 563 |
+
{0x29fd, 0x29fd}, {0x3009, 0x3009}, {0x300b, 0x300b}, {0x300d, 0x300d},
|
| 564 |
+
{0x300f, 0x300f}, {0x3011, 0x3011}, {0x3015, 0x3015}, {0x3017, 0x3017},
|
| 565 |
+
{0x3019, 0x3019}, {0x301b, 0x301b}, {0x301e, 0x301f}, {0xfd3f, 0xfd3f},
|
| 566 |
+
{0xfe36, 0xfe36}, {0xfe38, 0xfe38}, {0xfe3a, 0xfe3a}, {0xfe3c, 0xfe3c},
|
| 567 |
+
{0xfe3e, 0xfe3e}, {0xfe40, 0xfe40}, {0xfe42, 0xfe42}, {0xfe44, 0xfe44},
|
| 568 |
+
{0xfe48, 0xfe48}, {0xfe5a, 0xfe5a}, {0xfe5c, 0xfe5c}, {0xfe5e, 0xfe5e},
|
| 569 |
+
{0xff09, 0xff09}, {0xff3d, 0xff3d}, {0xff5d, 0xff5d}, {0xff60, 0xff60},
|
| 570 |
+
{0xff63, 0xff63}};
|
| 571 |
+
static const xmlChRangeGroup xmlPeG = {63,0,xmlPeS,NULL};
|
| 572 |
+
|
| 573 |
+
static const xmlChSRange xmlPoS[] = {{0x21, 0x23}, {0x25, 0x27},
|
| 574 |
+
{0x2a, 0x2a}, {0x2c, 0x2c}, {0x2e, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40},
|
| 575 |
+
{0x5c, 0x5c}, {0xa1, 0xa1}, {0xb7, 0xb7}, {0xbf, 0xbf}, {0x37e, 0x37e},
|
| 576 |
+
{0x387, 0x387}, {0x55a, 0x55f}, {0x589, 0x589}, {0x5be, 0x5be},
|
| 577 |
+
{0x5c0, 0x5c0}, {0x5c3, 0x5c3}, {0x5f3, 0x5f4}, {0x60c, 0x60d},
|
| 578 |
+
{0x61b, 0x61b}, {0x61f, 0x61f}, {0x66a, 0x66d}, {0x6d4, 0x6d4},
|
| 579 |
+
{0x700, 0x70d}, {0x964, 0x965}, {0x970, 0x970}, {0xdf4, 0xdf4},
|
| 580 |
+
{0xe4f, 0xe4f}, {0xe5a, 0xe5b}, {0xf04, 0xf12}, {0xf85, 0xf85},
|
| 581 |
+
{0x104a, 0x104f}, {0x10fb, 0x10fb}, {0x1361, 0x1368}, {0x166d, 0x166e},
|
| 582 |
+
{0x16eb, 0x16ed}, {0x1735, 0x1736}, {0x17d4, 0x17d6}, {0x17d8, 0x17da},
|
| 583 |
+
{0x1800, 0x1805}, {0x1807, 0x180a}, {0x1944, 0x1945}, {0x2016, 0x2017},
|
| 584 |
+
{0x2020, 0x2027}, {0x2030, 0x2038}, {0x203b, 0x203e}, {0x2041, 0x2043},
|
| 585 |
+
{0x2047, 0x2051}, {0x2053, 0x2053}, {0x2057, 0x2057}, {0x23b6, 0x23b6},
|
| 586 |
+
{0x3001, 0x3003}, {0x303d, 0x303d}, {0xfe30, 0xfe30}, {0xfe45, 0xfe46},
|
| 587 |
+
{0xfe49, 0xfe4c}, {0xfe50, 0xfe52}, {0xfe54, 0xfe57}, {0xfe5f, 0xfe61},
|
| 588 |
+
{0xfe68, 0xfe68}, {0xfe6a, 0xfe6b}, {0xff01, 0xff03}, {0xff05, 0xff07},
|
| 589 |
+
{0xff0a, 0xff0a}, {0xff0c, 0xff0c}, {0xff0e, 0xff0f}, {0xff1a, 0xff1b},
|
| 590 |
+
{0xff1f, 0xff20}, {0xff3c, 0xff3c}, {0xff61, 0xff61}, {0xff64, 0xff64}};
|
| 591 |
+
static const xmlChLRange xmlPoL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f}};
|
| 592 |
+
static const xmlChRangeGroup xmlPoG = {72,2,xmlPoS,xmlPoL};
|
| 593 |
+
|
| 594 |
+
static const xmlChSRange xmlPsS[] = {{0x28, 0x28}, {0x5b, 0x5b},
|
| 595 |
+
{0x7b, 0x7b}, {0xf3a, 0xf3a}, {0xf3c, 0xf3c}, {0x169b, 0x169b},
|
| 596 |
+
{0x201a, 0x201a}, {0x201e, 0x201e}, {0x2045, 0x2045}, {0x207d, 0x207d},
|
| 597 |
+
{0x208d, 0x208d}, {0x2329, 0x2329}, {0x23b4, 0x23b4}, {0x2768, 0x2768},
|
| 598 |
+
{0x276a, 0x276a}, {0x276c, 0x276c}, {0x276e, 0x276e}, {0x2770, 0x2770},
|
| 599 |
+
{0x2772, 0x2772}, {0x2774, 0x2774}, {0x27e6, 0x27e6}, {0x27e8, 0x27e8},
|
| 600 |
+
{0x27ea, 0x27ea}, {0x2983, 0x2983}, {0x2985, 0x2985}, {0x2987, 0x2987},
|
| 601 |
+
{0x2989, 0x2989}, {0x298b, 0x298b}, {0x298d, 0x298d}, {0x298f, 0x298f},
|
| 602 |
+
{0x2991, 0x2991}, {0x2993, 0x2993}, {0x2995, 0x2995}, {0x2997, 0x2997},
|
| 603 |
+
{0x29d8, 0x29d8}, {0x29da, 0x29da}, {0x29fc, 0x29fc}, {0x3008, 0x3008},
|
| 604 |
+
{0x300a, 0x300a}, {0x300c, 0x300c}, {0x300e, 0x300e}, {0x3010, 0x3010},
|
| 605 |
+
{0x3014, 0x3014}, {0x3016, 0x3016}, {0x3018, 0x3018}, {0x301a, 0x301a},
|
| 606 |
+
{0x301d, 0x301d}, {0xfd3e, 0xfd3e}, {0xfe35, 0xfe35}, {0xfe37, 0xfe37},
|
| 607 |
+
{0xfe39, 0xfe39}, {0xfe3b, 0xfe3b}, {0xfe3d, 0xfe3d}, {0xfe3f, 0xfe3f},
|
| 608 |
+
{0xfe41, 0xfe41}, {0xfe43, 0xfe43}, {0xfe47, 0xfe47}, {0xfe59, 0xfe59},
|
| 609 |
+
{0xfe5b, 0xfe5b}, {0xfe5d, 0xfe5d}, {0xff08, 0xff08}, {0xff3b, 0xff3b},
|
| 610 |
+
{0xff5b, 0xff5b}, {0xff5f, 0xff5f}, {0xff62, 0xff62}};
|
| 611 |
+
static const xmlChRangeGroup xmlPsG = {65,0,xmlPsS,NULL};
|
| 612 |
+
|
| 613 |
+
static const xmlChSRange xmlSS[] = {{0x24, 0x24}, {0x2b, 0x2b},
|
| 614 |
+
{0x3c, 0x3e}, {0x5e, 0x5e}, {0x60, 0x60}, {0x7c, 0x7c}, {0x7e, 0x7e},
|
| 615 |
+
{0xa2, 0xa9}, {0xac, 0xac}, {0xae, 0xb1}, {0xb4, 0xb4}, {0xb6, 0xb6},
|
| 616 |
+
{0xb8, 0xb8}, {0xd7, 0xd7}, {0xf7, 0xf7}, {0x2c2, 0x2c5},
|
| 617 |
+
{0x2d2, 0x2df}, {0x2e5, 0x2ed}, {0x2ef, 0x2ff}, {0x374, 0x375},
|
| 618 |
+
{0x384, 0x385}, {0x3f6, 0x3f6}, {0x482, 0x482}, {0x60e, 0x60f},
|
| 619 |
+
{0x6e9, 0x6e9}, {0x6fd, 0x6fe}, {0x9f2, 0x9f3}, {0x9fa, 0x9fa},
|
| 620 |
+
{0xaf1, 0xaf1}, {0xb70, 0xb70}, {0xbf3, 0xbfa}, {0xe3f, 0xe3f},
|
| 621 |
+
{0xf01, 0xf03}, {0xf13, 0xf17}, {0xf1a, 0xf1f}, {0xf34, 0xf34},
|
| 622 |
+
{0xf36, 0xf36}, {0xf38, 0xf38}, {0xfbe, 0xfc5}, {0xfc7, 0xfcc},
|
| 623 |
+
{0xfcf, 0xfcf}, {0x17db, 0x17db}, {0x1940, 0x1940}, {0x19e0, 0x19ff},
|
| 624 |
+
{0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf}, {0x1fdd, 0x1fdf},
|
| 625 |
+
{0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x2044, 0x2044}, {0x2052, 0x2052},
|
| 626 |
+
{0x207a, 0x207c}, {0x208a, 0x208c}, {0x20a0, 0x20b1}, {0x2100, 0x2101},
|
| 627 |
+
{0x2103, 0x2106}, {0x2108, 0x2109}, {0x2114, 0x2114}, {0x2116, 0x2118},
|
| 628 |
+
{0x211e, 0x2123}, {0x2125, 0x2125}, {0x2127, 0x2127}, {0x2129, 0x2129},
|
| 629 |
+
{0x212e, 0x212e}, {0x2132, 0x2132}, {0x213a, 0x213b}, {0x2140, 0x2144},
|
| 630 |
+
{0x214a, 0x214b}, {0x2190, 0x2328}, {0x232b, 0x23b3}, {0x23b7, 0x23d0},
|
| 631 |
+
{0x2400, 0x2426}, {0x2440, 0x244a}, {0x249c, 0x24e9}, {0x2500, 0x2617},
|
| 632 |
+
{0x2619, 0x267d}, {0x2680, 0x2691}, {0x26a0, 0x26a1}, {0x2701, 0x2704},
|
| 633 |
+
{0x2706, 0x2709}, {0x270c, 0x2727}, {0x2729, 0x274b}, {0x274d, 0x274d},
|
| 634 |
+
{0x274f, 0x2752}, {0x2756, 0x2756}, {0x2758, 0x275e}, {0x2761, 0x2767},
|
| 635 |
+
{0x2794, 0x2794}, {0x2798, 0x27af}, {0x27b1, 0x27be}, {0x27d0, 0x27e5},
|
| 636 |
+
{0x27f0, 0x2982}, {0x2999, 0x29d7}, {0x29dc, 0x29fb}, {0x29fe, 0x2b0d},
|
| 637 |
+
{0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb},
|
| 638 |
+
{0x3004, 0x3004}, {0x3012, 0x3013}, {0x3020, 0x3020}, {0x3036, 0x3037},
|
| 639 |
+
{0x303e, 0x303f}, {0x309b, 0x309c}, {0x3190, 0x3191}, {0x3196, 0x319f},
|
| 640 |
+
{0x3200, 0x321e}, {0x322a, 0x3243}, {0x3250, 0x3250}, {0x3260, 0x327d},
|
| 641 |
+
{0x327f, 0x327f}, {0x328a, 0x32b0}, {0x32c0, 0x32fe}, {0x3300, 0x33ff},
|
| 642 |
+
{0x4dc0, 0x4dff}, {0xa490, 0xa4c6}, {0xfb29, 0xfb29}, {0xfdfc, 0xfdfd},
|
| 643 |
+
{0xfe62, 0xfe62}, {0xfe64, 0xfe66}, {0xfe69, 0xfe69}, {0xff04, 0xff04},
|
| 644 |
+
{0xff0b, 0xff0b}, {0xff1c, 0xff1e}, {0xff3e, 0xff3e}, {0xff40, 0xff40},
|
| 645 |
+
{0xff5c, 0xff5c}, {0xff5e, 0xff5e}, {0xffe0, 0xffe6}, {0xffe8, 0xffee},
|
| 646 |
+
{0xfffc, 0xfffd}};
|
| 647 |
+
static const xmlChLRange xmlSL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f},
|
| 648 |
+
{0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164},
|
| 649 |
+
{0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9},
|
| 650 |
+
{0x1d1ae, 0x1d1dd}, {0x1d300, 0x1d356}, {0x1d6c1, 0x1d6c1},
|
| 651 |
+
{0x1d6db, 0x1d6db}, {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715},
|
| 652 |
+
{0x1d735, 0x1d735}, {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f},
|
| 653 |
+
{0x1d789, 0x1d789}, {0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3}};
|
| 654 |
+
static const xmlChRangeGroup xmlSG = {133,20,xmlSS,xmlSL};
|
| 655 |
+
|
| 656 |
+
static const xmlChSRange xmlScS[] = {{0x24, 0x24}, {0xa2, 0xa5},
|
| 657 |
+
{0x9f2, 0x9f3}, {0xaf1, 0xaf1}, {0xbf9, 0xbf9}, {0xe3f, 0xe3f},
|
| 658 |
+
{0x17db, 0x17db}, {0x20a0, 0x20b1}, {0xfdfc, 0xfdfc}, {0xfe69, 0xfe69},
|
| 659 |
+
{0xff04, 0xff04}, {0xffe0, 0xffe1}, {0xffe5, 0xffe6}};
|
| 660 |
+
static const xmlChRangeGroup xmlScG = {13,0,xmlScS,NULL};
|
| 661 |
+
|
| 662 |
+
static const xmlChSRange xmlSkS[] = {{0x5e, 0x5e}, {0x60, 0x60},
|
| 663 |
+
{0xa8, 0xa8}, {0xaf, 0xaf}, {0xb4, 0xb4}, {0xb8, 0xb8}, {0x2c2, 0x2c5},
|
| 664 |
+
{0x2d2, 0x2df}, {0x2e5, 0x2ed}, {0x2ef, 0x2ff}, {0x374, 0x375},
|
| 665 |
+
{0x384, 0x385}, {0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf},
|
| 666 |
+
{0x1fdd, 0x1fdf}, {0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x309b, 0x309c},
|
| 667 |
+
{0xff3e, 0xff3e}, {0xff40, 0xff40}, {0xffe3, 0xffe3}};
|
| 668 |
+
static const xmlChRangeGroup xmlSkG = {22,0,xmlSkS,NULL};
|
| 669 |
+
|
| 670 |
+
static const xmlChSRange xmlSmS[] = {{0x2b, 0x2b}, {0x3c, 0x3e},
|
| 671 |
+
{0x7c, 0x7c}, {0x7e, 0x7e}, {0xac, 0xac}, {0xb1, 0xb1}, {0xd7, 0xd7},
|
| 672 |
+
{0xf7, 0xf7}, {0x3f6, 0x3f6}, {0x2044, 0x2044}, {0x2052, 0x2052},
|
| 673 |
+
{0x207a, 0x207c}, {0x208a, 0x208c}, {0x2140, 0x2144}, {0x214b, 0x214b},
|
| 674 |
+
{0x2190, 0x2194}, {0x219a, 0x219b}, {0x21a0, 0x21a0}, {0x21a3, 0x21a3},
|
| 675 |
+
{0x21a6, 0x21a6}, {0x21ae, 0x21ae}, {0x21ce, 0x21cf}, {0x21d2, 0x21d2},
|
| 676 |
+
{0x21d4, 0x21d4}, {0x21f4, 0x22ff}, {0x2308, 0x230b}, {0x2320, 0x2321},
|
| 677 |
+
{0x237c, 0x237c}, {0x239b, 0x23b3}, {0x25b7, 0x25b7}, {0x25c1, 0x25c1},
|
| 678 |
+
{0x25f8, 0x25ff}, {0x266f, 0x266f}, {0x27d0, 0x27e5}, {0x27f0, 0x27ff},
|
| 679 |
+
{0x2900, 0x2982}, {0x2999, 0x29d7}, {0x29dc, 0x29fb}, {0x29fe, 0x2aff},
|
| 680 |
+
{0xfb29, 0xfb29}, {0xfe62, 0xfe62}, {0xfe64, 0xfe66}, {0xff0b, 0xff0b},
|
| 681 |
+
{0xff1c, 0xff1e}, {0xff5c, 0xff5c}, {0xff5e, 0xff5e}, {0xffe2, 0xffe2},
|
| 682 |
+
{0xffe9, 0xffec}};
|
| 683 |
+
static const xmlChLRange xmlSmL[] = {{0x1d6c1, 0x1d6c1}, {0x1d6db, 0x1d6db},
|
| 684 |
+
{0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, {0x1d735, 0x1d735},
|
| 685 |
+
{0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, {0x1d789, 0x1d789},
|
| 686 |
+
{0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3}};
|
| 687 |
+
static const xmlChRangeGroup xmlSmG = {48,10,xmlSmS,xmlSmL};
|
| 688 |
+
|
| 689 |
+
static const xmlChSRange xmlSoS[] = {{0xa6, 0xa7}, {0xa9, 0xa9},
|
| 690 |
+
{0xae, 0xae}, {0xb0, 0xb0}, {0xb6, 0xb6}, {0x482, 0x482},
|
| 691 |
+
{0x60e, 0x60f}, {0x6e9, 0x6e9}, {0x6fd, 0x6fe}, {0x9fa, 0x9fa},
|
| 692 |
+
{0xb70, 0xb70}, {0xbf3, 0xbf8}, {0xbfa, 0xbfa}, {0xf01, 0xf03},
|
| 693 |
+
{0xf13, 0xf17}, {0xf1a, 0xf1f}, {0xf34, 0xf34}, {0xf36, 0xf36},
|
| 694 |
+
{0xf38, 0xf38}, {0xfbe, 0xfc5}, {0xfc7, 0xfcc}, {0xfcf, 0xfcf},
|
| 695 |
+
{0x1940, 0x1940}, {0x19e0, 0x19ff}, {0x2100, 0x2101}, {0x2103, 0x2106},
|
| 696 |
+
{0x2108, 0x2109}, {0x2114, 0x2114}, {0x2116, 0x2118}, {0x211e, 0x2123},
|
| 697 |
+
{0x2125, 0x2125}, {0x2127, 0x2127}, {0x2129, 0x2129}, {0x212e, 0x212e},
|
| 698 |
+
{0x2132, 0x2132}, {0x213a, 0x213b}, {0x214a, 0x214a}, {0x2195, 0x2199},
|
| 699 |
+
{0x219c, 0x219f}, {0x21a1, 0x21a2}, {0x21a4, 0x21a5}, {0x21a7, 0x21ad},
|
| 700 |
+
{0x21af, 0x21cd}, {0x21d0, 0x21d1}, {0x21d3, 0x21d3}, {0x21d5, 0x21f3},
|
| 701 |
+
{0x2300, 0x2307}, {0x230c, 0x231f}, {0x2322, 0x2328}, {0x232b, 0x237b},
|
| 702 |
+
{0x237d, 0x239a}, {0x23b7, 0x23d0}, {0x2400, 0x2426}, {0x2440, 0x244a},
|
| 703 |
+
{0x249c, 0x24e9}, {0x2500, 0x25b6}, {0x25b8, 0x25c0}, {0x25c2, 0x25f7},
|
| 704 |
+
{0x2600, 0x2617}, {0x2619, 0x266e}, {0x2670, 0x267d}, {0x2680, 0x2691},
|
| 705 |
+
{0x26a0, 0x26a1}, {0x2701, 0x2704}, {0x2706, 0x2709}, {0x270c, 0x2727},
|
| 706 |
+
{0x2729, 0x274b}, {0x274d, 0x274d}, {0x274f, 0x2752}, {0x2756, 0x2756},
|
| 707 |
+
{0x2758, 0x275e}, {0x2761, 0x2767}, {0x2794, 0x2794}, {0x2798, 0x27af},
|
| 708 |
+
{0x27b1, 0x27be}, {0x2800, 0x28ff}, {0x2b00, 0x2b0d}, {0x2e80, 0x2e99},
|
| 709 |
+
{0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, {0x3004, 0x3004},
|
| 710 |
+
{0x3012, 0x3013}, {0x3020, 0x3020}, {0x3036, 0x3037}, {0x303e, 0x303f},
|
| 711 |
+
{0x3190, 0x3191}, {0x3196, 0x319f}, {0x3200, 0x321e}, {0x322a, 0x3243},
|
| 712 |
+
{0x3250, 0x3250}, {0x3260, 0x327d}, {0x327f, 0x327f}, {0x328a, 0x32b0},
|
| 713 |
+
{0x32c0, 0x32fe}, {0x3300, 0x33ff}, {0x4dc0, 0x4dff}, {0xa490, 0xa4c6},
|
| 714 |
+
{0xfdfd, 0xfdfd}, {0xffe4, 0xffe4}, {0xffe8, 0xffe8}, {0xffed, 0xffee},
|
| 715 |
+
{0xfffc, 0xfffd}};
|
| 716 |
+
static const xmlChLRange xmlSoL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f},
|
| 717 |
+
{0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164},
|
| 718 |
+
{0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9},
|
| 719 |
+
{0x1d1ae, 0x1d1dd}, {0x1d300, 0x1d356}};
|
| 720 |
+
static const xmlChRangeGroup xmlSoG = {103,10,xmlSoS,xmlSoL};
|
| 721 |
+
|
| 722 |
+
static const xmlChSRange xmlZS[] = {{0x20, 0x20}, {0xa0, 0xa0},
|
| 723 |
+
{0x1680, 0x1680}, {0x180e, 0x180e}, {0x2000, 0x200a}, {0x2028, 0x2029},
|
| 724 |
+
{0x202f, 0x202f}, {0x205f, 0x205f}, {0x3000, 0x3000}};
|
| 725 |
+
static const xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL};
|
| 726 |
+
|
| 727 |
+
static int
|
| 728 |
+
xmlUCSIsCatC(int code) {
|
| 729 |
+
return(xmlCharInRange((unsigned int)code, &xmlCG));
|
| 730 |
+
}
|
| 731 |
+
|
| 732 |
+
static int
|
| 733 |
+
xmlUCSIsCatCc(int code) {
|
| 734 |
+
return(((code >= 0x0) && (code <= 0x1f)) ||
|
| 735 |
+
((code >= 0x7f) && (code <= 0x9f)));
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
static int
|
| 739 |
+
xmlUCSIsCatCf(int code) {
|
| 740 |
+
return(xmlCharInRange((unsigned int)code, &xmlCfG));
|
| 741 |
+
}
|
| 742 |
+
|
| 743 |
+
static int
|
| 744 |
+
xmlUCSIsCatCo(int code) {
|
| 745 |
+
return((code == 0xe000) ||
|
| 746 |
+
(code == 0xf8ff) ||
|
| 747 |
+
(code == 0xf0000) ||
|
| 748 |
+
(code == 0xffffd) ||
|
| 749 |
+
(code == 0x100000) ||
|
| 750 |
+
(code == 0x10fffd));
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
static int
|
| 754 |
+
xmlUCSIsCatL(int code) {
|
| 755 |
+
return(xmlCharInRange((unsigned int)code, &xmlLG));
|
| 756 |
+
}
|
| 757 |
+
|
| 758 |
+
static int
|
| 759 |
+
xmlUCSIsCatLl(int code) {
|
| 760 |
+
return(xmlCharInRange((unsigned int)code, &xmlLlG));
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
static int
|
| 764 |
+
xmlUCSIsCatLm(int code) {
|
| 765 |
+
return(xmlCharInRange((unsigned int)code, &xmlLmG));
|
| 766 |
+
}
|
| 767 |
+
|
| 768 |
+
static int
|
| 769 |
+
xmlUCSIsCatLo(int code) {
|
| 770 |
+
return(xmlCharInRange((unsigned int)code, &xmlLoG));
|
| 771 |
+
}
|
| 772 |
+
|
| 773 |
+
static int
|
| 774 |
+
xmlUCSIsCatLt(int code) {
|
| 775 |
+
return(xmlCharInRange((unsigned int)code, &xmlLtG));
|
| 776 |
+
}
|
| 777 |
+
|
| 778 |
+
static int
|
| 779 |
+
xmlUCSIsCatLu(int code) {
|
| 780 |
+
return(xmlCharInRange((unsigned int)code, &xmlLuG));
|
| 781 |
+
}
|
| 782 |
+
|
| 783 |
+
static int
|
| 784 |
+
xmlUCSIsCatM(int code) {
|
| 785 |
+
return(xmlCharInRange((unsigned int)code, &xmlMG));
|
| 786 |
+
}
|
| 787 |
+
|
| 788 |
+
static int
|
| 789 |
+
xmlUCSIsCatMc(int code) {
|
| 790 |
+
return(xmlCharInRange((unsigned int)code, &xmlMcG));
|
| 791 |
+
}
|
| 792 |
+
|
| 793 |
+
static int
|
| 794 |
+
xmlUCSIsCatMe(int code) {
|
| 795 |
+
return(((code >= 0x488) && (code <= 0x489)) ||
|
| 796 |
+
(code == 0x6de) ||
|
| 797 |
+
((code >= 0x20dd) && (code <= 0x20e0)) ||
|
| 798 |
+
((code >= 0x20e2) && (code <= 0x20e4)));
|
| 799 |
+
}
|
| 800 |
+
|
| 801 |
+
static int
|
| 802 |
+
xmlUCSIsCatMn(int code) {
|
| 803 |
+
return(xmlCharInRange((unsigned int)code, &xmlMnG));
|
| 804 |
+
}
|
| 805 |
+
|
| 806 |
+
static int
|
| 807 |
+
xmlUCSIsCatN(int code) {
|
| 808 |
+
return(xmlCharInRange((unsigned int)code, &xmlNG));
|
| 809 |
+
}
|
| 810 |
+
|
| 811 |
+
static int
|
| 812 |
+
xmlUCSIsCatNd(int code) {
|
| 813 |
+
return(xmlCharInRange((unsigned int)code, &xmlNdG));
|
| 814 |
+
}
|
| 815 |
+
|
| 816 |
+
static int
|
| 817 |
+
xmlUCSIsCatNl(int code) {
|
| 818 |
+
return(((code >= 0x16ee) && (code <= 0x16f0)) ||
|
| 819 |
+
((code >= 0x2160) && (code <= 0x2183)) ||
|
| 820 |
+
(code == 0x3007) ||
|
| 821 |
+
((code >= 0x3021) && (code <= 0x3029)) ||
|
| 822 |
+
((code >= 0x3038) && (code <= 0x303a)) ||
|
| 823 |
+
(code == 0x1034a));
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
static int
|
| 827 |
+
xmlUCSIsCatNo(int code) {
|
| 828 |
+
return(xmlCharInRange((unsigned int)code, &xmlNoG));
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
static int
|
| 832 |
+
xmlUCSIsCatP(int code) {
|
| 833 |
+
return(xmlCharInRange((unsigned int)code, &xmlPG));
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
static int
|
| 837 |
+
xmlUCSIsCatPc(int code) {
|
| 838 |
+
return((code == 0x5f) ||
|
| 839 |
+
((code >= 0x203f) && (code <= 0x2040)) ||
|
| 840 |
+
(code == 0x2054) ||
|
| 841 |
+
(code == 0x30fb) ||
|
| 842 |
+
((code >= 0xfe33) && (code <= 0xfe34)) ||
|
| 843 |
+
((code >= 0xfe4d) && (code <= 0xfe4f)) ||
|
| 844 |
+
(code == 0xff3f) ||
|
| 845 |
+
(code == 0xff65));
|
| 846 |
+
}
|
| 847 |
+
|
| 848 |
+
static int
|
| 849 |
+
xmlUCSIsCatPd(int code) {
|
| 850 |
+
return(xmlCharInRange((unsigned int)code, &xmlPdG));
|
| 851 |
+
}
|
| 852 |
+
|
| 853 |
+
static int
|
| 854 |
+
xmlUCSIsCatPe(int code) {
|
| 855 |
+
return(xmlCharInRange((unsigned int)code, &xmlPeG));
|
| 856 |
+
}
|
| 857 |
+
|
| 858 |
+
static int
|
| 859 |
+
xmlUCSIsCatPf(int code) {
|
| 860 |
+
return((code == 0xbb) ||
|
| 861 |
+
(code == 0x2019) ||
|
| 862 |
+
(code == 0x201d) ||
|
| 863 |
+
(code == 0x203a));
|
| 864 |
+
}
|
| 865 |
+
|
| 866 |
+
static int
|
| 867 |
+
xmlUCSIsCatPi(int code) {
|
| 868 |
+
return((code == 0xab) ||
|
| 869 |
+
(code == 0x2018) ||
|
| 870 |
+
((code >= 0x201b) && (code <= 0x201c)) ||
|
| 871 |
+
(code == 0x201f) ||
|
| 872 |
+
(code == 0x2039));
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
static int
|
| 876 |
+
xmlUCSIsCatPo(int code) {
|
| 877 |
+
return(xmlCharInRange((unsigned int)code, &xmlPoG));
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
static int
|
| 881 |
+
xmlUCSIsCatPs(int code) {
|
| 882 |
+
return(xmlCharInRange((unsigned int)code, &xmlPsG));
|
| 883 |
+
}
|
| 884 |
+
|
| 885 |
+
static int
|
| 886 |
+
xmlUCSIsCatS(int code) {
|
| 887 |
+
return(xmlCharInRange((unsigned int)code, &xmlSG));
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
static int
|
| 891 |
+
xmlUCSIsCatSc(int code) {
|
| 892 |
+
return(xmlCharInRange((unsigned int)code, &xmlScG));
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
static int
|
| 896 |
+
xmlUCSIsCatSk(int code) {
|
| 897 |
+
return(xmlCharInRange((unsigned int)code, &xmlSkG));
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
static int
|
| 901 |
+
xmlUCSIsCatSm(int code) {
|
| 902 |
+
return(xmlCharInRange((unsigned int)code, &xmlSmG));
|
| 903 |
+
}
|
| 904 |
+
|
| 905 |
+
static int
|
| 906 |
+
xmlUCSIsCatSo(int code) {
|
| 907 |
+
return(xmlCharInRange((unsigned int)code, &xmlSoG));
|
| 908 |
+
}
|
| 909 |
+
|
| 910 |
+
static int
|
| 911 |
+
xmlUCSIsCatZ(int code) {
|
| 912 |
+
return(xmlCharInRange((unsigned int)code, &xmlZG));
|
| 913 |
+
}
|
| 914 |
+
|
| 915 |
+
static int
|
| 916 |
+
xmlUCSIsCatZl(int code) {
|
| 917 |
+
return((code == 0x2028));
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
static int
|
| 921 |
+
xmlUCSIsCatZp(int code) {
|
| 922 |
+
return((code == 0x2029));
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
static int
|
| 926 |
+
xmlUCSIsCatZs(int code) {
|
| 927 |
+
return((code == 0x20) ||
|
| 928 |
+
(code == 0xa0) ||
|
| 929 |
+
(code == 0x1680) ||
|
| 930 |
+
(code == 0x180e) ||
|
| 931 |
+
((code >= 0x2000) && (code <= 0x200a)) ||
|
| 932 |
+
(code == 0x202f) ||
|
| 933 |
+
(code == 0x205f) ||
|
| 934 |
+
(code == 0x3000));
|
| 935 |
+
}
|
| 936 |
+
|
| 937 |
+
static const xmlChLRange xmlAegeanNumbersL[] = {{0x10100, 0x1013f}};
|
| 938 |
+
|
| 939 |
+
static const xmlChSRange xmlAlphabeticPresentationFormsS[] = {
|
| 940 |
+
{0xfb00, 0xfb4f}};
|
| 941 |
+
|
| 942 |
+
static const xmlChSRange xmlArabicS[] = {{0x600, 0x6ff}};
|
| 943 |
+
|
| 944 |
+
static const xmlChSRange xmlArabicPresentationFormsAS[] = {{0xfb50, 0xfdff}};
|
| 945 |
+
|
| 946 |
+
static const xmlChSRange xmlArabicPresentationFormsBS[] = {{0xfe70, 0xfeff}};
|
| 947 |
+
|
| 948 |
+
static const xmlChSRange xmlArmenianS[] = {{0x530, 0x58f}};
|
| 949 |
+
|
| 950 |
+
static const xmlChSRange xmlArrowsS[] = {{0x2190, 0x21ff}};
|
| 951 |
+
|
| 952 |
+
static const xmlChSRange xmlBasicLatinS[] = {{0x0, 0x7f}};
|
| 953 |
+
|
| 954 |
+
static const xmlChSRange xmlBengaliS[] = {{0x980, 0x9ff}};
|
| 955 |
+
|
| 956 |
+
static const xmlChSRange xmlBlockElementsS[] = {{0x2580, 0x259f}};
|
| 957 |
+
|
| 958 |
+
static const xmlChSRange xmlBopomofoS[] = {{0x3100, 0x312f}};
|
| 959 |
+
|
| 960 |
+
static const xmlChSRange xmlBopomofoExtendedS[] = {{0x31a0, 0x31bf}};
|
| 961 |
+
|
| 962 |
+
static const xmlChSRange xmlBoxDrawingS[] = {{0x2500, 0x257f}};
|
| 963 |
+
|
| 964 |
+
static const xmlChSRange xmlBraillePatternsS[] = {{0x2800, 0x28ff}};
|
| 965 |
+
|
| 966 |
+
static const xmlChSRange xmlBuhidS[] = {{0x1740, 0x175f}};
|
| 967 |
+
|
| 968 |
+
static const xmlChLRange xmlByzantineMusicalSymbolsL[] = {{0x1d000, 0x1d0ff}};
|
| 969 |
+
|
| 970 |
+
static const xmlChSRange xmlCJKCompatibilityS[] = {{0x3300, 0x33ff}};
|
| 971 |
+
|
| 972 |
+
static const xmlChSRange xmlCJKCompatibilityFormsS[] = {{0xfe30, 0xfe4f}};
|
| 973 |
+
|
| 974 |
+
static const xmlChSRange xmlCJKCompatibilityIdeographsS[] = {
|
| 975 |
+
{0xf900, 0xfaff}};
|
| 976 |
+
|
| 977 |
+
static const xmlChLRange xmlCJKCompatibilityIdeographsSupplementL[] = {
|
| 978 |
+
{0x2f800, 0x2fa1f}};
|
| 979 |
+
|
| 980 |
+
static const xmlChSRange xmlCJKRadicalsSupplementS[] = {{0x2e80, 0x2eff}};
|
| 981 |
+
|
| 982 |
+
static const xmlChSRange xmlCJKSymbolsandPunctuationS[] = {{0x3000, 0x303f}};
|
| 983 |
+
|
| 984 |
+
static const xmlChSRange xmlCJKUnifiedIdeographsS[] = {{0x4e00, 0x9fff}};
|
| 985 |
+
|
| 986 |
+
static const xmlChSRange xmlCJKUnifiedIdeographsExtensionAS[] = {
|
| 987 |
+
{0x3400, 0x4dbf}};
|
| 988 |
+
|
| 989 |
+
static const xmlChLRange xmlCJKUnifiedIdeographsExtensionBL[] = {
|
| 990 |
+
{0x20000, 0x2a6df}};
|
| 991 |
+
|
| 992 |
+
static const xmlChSRange xmlCherokeeS[] = {{0x13a0, 0x13ff}};
|
| 993 |
+
|
| 994 |
+
static const xmlChSRange xmlCombiningDiacriticalMarksS[] = {{0x300, 0x36f}};
|
| 995 |
+
|
| 996 |
+
static const xmlChSRange xmlCombiningDiacriticalMarksforSymbolsS[] = {
|
| 997 |
+
{0x20d0, 0x20ff}};
|
| 998 |
+
|
| 999 |
+
static const xmlChSRange xmlCombiningHalfMarksS[] = {{0xfe20, 0xfe2f}};
|
| 1000 |
+
|
| 1001 |
+
static const xmlChSRange xmlCombiningMarksforSymbolsS[] = {{0x20d0, 0x20ff}};
|
| 1002 |
+
|
| 1003 |
+
static const xmlChSRange xmlControlPicturesS[] = {{0x2400, 0x243f}};
|
| 1004 |
+
|
| 1005 |
+
static const xmlChSRange xmlCurrencySymbolsS[] = {{0x20a0, 0x20cf}};
|
| 1006 |
+
|
| 1007 |
+
static const xmlChLRange xmlCypriotSyllabaryL[] = {{0x10800, 0x1083f}};
|
| 1008 |
+
|
| 1009 |
+
static const xmlChSRange xmlCyrillicS[] = {{0x400, 0x4ff}};
|
| 1010 |
+
|
| 1011 |
+
static const xmlChSRange xmlCyrillicSupplementS[] = {{0x500, 0x52f}};
|
| 1012 |
+
|
| 1013 |
+
static const xmlChLRange xmlDeseretL[] = {{0x10400, 0x1044f}};
|
| 1014 |
+
|
| 1015 |
+
static const xmlChSRange xmlDevanagariS[] = {{0x900, 0x97f}};
|
| 1016 |
+
|
| 1017 |
+
static const xmlChSRange xmlDingbatsS[] = {{0x2700, 0x27bf}};
|
| 1018 |
+
|
| 1019 |
+
static const xmlChSRange xmlEnclosedAlphanumericsS[] = {{0x2460, 0x24ff}};
|
| 1020 |
+
|
| 1021 |
+
static const xmlChSRange xmlEnclosedCJKLettersandMonthsS[] = {
|
| 1022 |
+
{0x3200, 0x32ff}};
|
| 1023 |
+
|
| 1024 |
+
static const xmlChSRange xmlEthiopicS[] = {{0x1200, 0x137f}};
|
| 1025 |
+
|
| 1026 |
+
static const xmlChSRange xmlGeneralPunctuationS[] = {{0x2000, 0x206f}};
|
| 1027 |
+
|
| 1028 |
+
static const xmlChSRange xmlGeometricShapesS[] = {{0x25a0, 0x25ff}};
|
| 1029 |
+
|
| 1030 |
+
static const xmlChSRange xmlGeorgianS[] = {{0x10a0, 0x10ff}};
|
| 1031 |
+
|
| 1032 |
+
static const xmlChLRange xmlGothicL[] = {{0x10330, 0x1034f}};
|
| 1033 |
+
|
| 1034 |
+
static const xmlChSRange xmlGreekS[] = {{0x370, 0x3ff}};
|
| 1035 |
+
|
| 1036 |
+
static const xmlChSRange xmlGreekExtendedS[] = {{0x1f00, 0x1fff}};
|
| 1037 |
+
|
| 1038 |
+
static const xmlChSRange xmlGreekandCopticS[] = {{0x370, 0x3ff}};
|
| 1039 |
+
|
| 1040 |
+
static const xmlChSRange xmlGujaratiS[] = {{0xa80, 0xaff}};
|
| 1041 |
+
|
| 1042 |
+
static const xmlChSRange xmlGurmukhiS[] = {{0xa00, 0xa7f}};
|
| 1043 |
+
|
| 1044 |
+
static const xmlChSRange xmlHalfwidthandFullwidthFormsS[] = {
|
| 1045 |
+
{0xff00, 0xffef}};
|
| 1046 |
+
|
| 1047 |
+
static const xmlChSRange xmlHangulCompatibilityJamoS[] = {{0x3130, 0x318f}};
|
| 1048 |
+
|
| 1049 |
+
static const xmlChSRange xmlHangulJamoS[] = {{0x1100, 0x11ff}};
|
| 1050 |
+
|
| 1051 |
+
static const xmlChSRange xmlHangulSyllablesS[] = {{0xac00, 0xd7af}};
|
| 1052 |
+
|
| 1053 |
+
static const xmlChSRange xmlHanunooS[] = {{0x1720, 0x173f}};
|
| 1054 |
+
|
| 1055 |
+
static const xmlChSRange xmlHebrewS[] = {{0x590, 0x5ff}};
|
| 1056 |
+
|
| 1057 |
+
static const xmlChSRange xmlHighPrivateUseSurrogatesS[] = {{0xdb80, 0xdbff}};
|
| 1058 |
+
|
| 1059 |
+
static const xmlChSRange xmlHighSurrogatesS[] = {{0xd800, 0xdb7f}};
|
| 1060 |
+
|
| 1061 |
+
static const xmlChSRange xmlHiraganaS[] = {{0x3040, 0x309f}};
|
| 1062 |
+
|
| 1063 |
+
static const xmlChSRange xmlIPAExtensionsS[] = {{0x250, 0x2af}};
|
| 1064 |
+
|
| 1065 |
+
static const xmlChSRange xmlIdeographicDescriptionCharactersS[] = {
|
| 1066 |
+
{0x2ff0, 0x2fff}};
|
| 1067 |
+
|
| 1068 |
+
static const xmlChSRange xmlKanbunS[] = {{0x3190, 0x319f}};
|
| 1069 |
+
|
| 1070 |
+
static const xmlChSRange xmlKangxiRadicalsS[] = {{0x2f00, 0x2fdf}};
|
| 1071 |
+
|
| 1072 |
+
static const xmlChSRange xmlKannadaS[] = {{0xc80, 0xcff}};
|
| 1073 |
+
|
| 1074 |
+
static const xmlChSRange xmlKatakanaS[] = {{0x30a0, 0x30ff}};
|
| 1075 |
+
|
| 1076 |
+
static const xmlChSRange xmlKatakanaPhoneticExtensionsS[] = {
|
| 1077 |
+
{0x31f0, 0x31ff}};
|
| 1078 |
+
|
| 1079 |
+
static const xmlChSRange xmlKhmerS[] = {{0x1780, 0x17ff}};
|
| 1080 |
+
|
| 1081 |
+
static const xmlChSRange xmlKhmerSymbolsS[] = {{0x19e0, 0x19ff}};
|
| 1082 |
+
|
| 1083 |
+
static const xmlChSRange xmlLaoS[] = {{0xe80, 0xeff}};
|
| 1084 |
+
|
| 1085 |
+
static const xmlChSRange xmlLatin1SupplementS[] = {{0x80, 0xff}};
|
| 1086 |
+
|
| 1087 |
+
static const xmlChSRange xmlLatinExtendedAS[] = {{0x100, 0x17f}};
|
| 1088 |
+
|
| 1089 |
+
static const xmlChSRange xmlLatinExtendedBS[] = {{0x180, 0x24f}};
|
| 1090 |
+
|
| 1091 |
+
static const xmlChSRange xmlLatinExtendedAdditionalS[] = {{0x1e00, 0x1eff}};
|
| 1092 |
+
|
| 1093 |
+
static const xmlChSRange xmlLetterlikeSymbolsS[] = {{0x2100, 0x214f}};
|
| 1094 |
+
|
| 1095 |
+
static const xmlChSRange xmlLimbuS[] = {{0x1900, 0x194f}};
|
| 1096 |
+
|
| 1097 |
+
static const xmlChLRange xmlLinearBIdeogramsL[] = {{0x10080, 0x100ff}};
|
| 1098 |
+
|
| 1099 |
+
static const xmlChLRange xmlLinearBSyllabaryL[] = {{0x10000, 0x1007f}};
|
| 1100 |
+
|
| 1101 |
+
static const xmlChSRange xmlLowSurrogatesS[] = {{0xdc00, 0xdfff}};
|
| 1102 |
+
|
| 1103 |
+
static const xmlChSRange xmlMalayalamS[] = {{0xd00, 0xd7f}};
|
| 1104 |
+
|
| 1105 |
+
static const xmlChLRange xmlMathematicalAlphanumericSymbolsL[] = {
|
| 1106 |
+
{0x1d400, 0x1d7ff}};
|
| 1107 |
+
|
| 1108 |
+
static const xmlChSRange xmlMathematicalOperatorsS[] = {{0x2200, 0x22ff}};
|
| 1109 |
+
|
| 1110 |
+
static const xmlChSRange xmlMiscellaneousMathematicalSymbolsAS[] = {
|
| 1111 |
+
{0x27c0, 0x27ef}};
|
| 1112 |
+
|
| 1113 |
+
static const xmlChSRange xmlMiscellaneousMathematicalSymbolsBS[] = {
|
| 1114 |
+
{0x2980, 0x29ff}};
|
| 1115 |
+
|
| 1116 |
+
static const xmlChSRange xmlMiscellaneousSymbolsS[] = {{0x2600, 0x26ff}};
|
| 1117 |
+
|
| 1118 |
+
static const xmlChSRange xmlMiscellaneousSymbolsandArrowsS[] = {
|
| 1119 |
+
{0x2b00, 0x2bff}};
|
| 1120 |
+
|
| 1121 |
+
static const xmlChSRange xmlMiscellaneousTechnicalS[] = {{0x2300, 0x23ff}};
|
| 1122 |
+
|
| 1123 |
+
static const xmlChSRange xmlMongolianS[] = {{0x1800, 0x18af}};
|
| 1124 |
+
|
| 1125 |
+
static const xmlChLRange xmlMusicalSymbolsL[] = {{0x1d100, 0x1d1ff}};
|
| 1126 |
+
|
| 1127 |
+
static const xmlChSRange xmlMyanmarS[] = {{0x1000, 0x109f}};
|
| 1128 |
+
|
| 1129 |
+
static const xmlChSRange xmlNumberFormsS[] = {{0x2150, 0x218f}};
|
| 1130 |
+
|
| 1131 |
+
static const xmlChSRange xmlOghamS[] = {{0x1680, 0x169f}};
|
| 1132 |
+
|
| 1133 |
+
static const xmlChLRange xmlOldItalicL[] = {{0x10300, 0x1032f}};
|
| 1134 |
+
|
| 1135 |
+
static const xmlChSRange xmlOpticalCharacterRecognitionS[] = {
|
| 1136 |
+
{0x2440, 0x245f}};
|
| 1137 |
+
|
| 1138 |
+
static const xmlChSRange xmlOriyaS[] = {{0xb00, 0xb7f}};
|
| 1139 |
+
|
| 1140 |
+
static const xmlChLRange xmlOsmanyaL[] = {{0x10480, 0x104af}};
|
| 1141 |
+
|
| 1142 |
+
static const xmlChSRange xmlPhoneticExtensionsS[] = {{0x1d00, 0x1d7f}};
|
| 1143 |
+
|
| 1144 |
+
static const xmlChSRange xmlPrivateUseS[] = {{0xe000, 0xf8ff}};
|
| 1145 |
+
static const xmlChLRange xmlPrivateUseL[] = {{0xf0000, 0xfffff},
|
| 1146 |
+
{0x100000, 0x10ffff}};
|
| 1147 |
+
|
| 1148 |
+
static const xmlChSRange xmlPrivateUseAreaS[] = {{0xe000, 0xf8ff}};
|
| 1149 |
+
|
| 1150 |
+
static const xmlChSRange xmlRunicS[] = {{0x16a0, 0x16ff}};
|
| 1151 |
+
|
| 1152 |
+
static const xmlChLRange xmlShavianL[] = {{0x10450, 0x1047f}};
|
| 1153 |
+
|
| 1154 |
+
static const xmlChSRange xmlSinhalaS[] = {{0xd80, 0xdff}};
|
| 1155 |
+
|
| 1156 |
+
static const xmlChSRange xmlSmallFormVariantsS[] = {{0xfe50, 0xfe6f}};
|
| 1157 |
+
|
| 1158 |
+
static const xmlChSRange xmlSpacingModifierLettersS[] = {{0x2b0, 0x2ff}};
|
| 1159 |
+
|
| 1160 |
+
static const xmlChSRange xmlSpecialsS[] = {{0xfff0, 0xffff}};
|
| 1161 |
+
|
| 1162 |
+
static const xmlChSRange xmlSuperscriptsandSubscriptsS[] = {{0x2070, 0x209f}};
|
| 1163 |
+
|
| 1164 |
+
static const xmlChSRange xmlSupplementalArrowsAS[] = {{0x27f0, 0x27ff}};
|
| 1165 |
+
|
| 1166 |
+
static const xmlChSRange xmlSupplementalArrowsBS[] = {{0x2900, 0x297f}};
|
| 1167 |
+
|
| 1168 |
+
static const xmlChSRange xmlSupplementalMathematicalOperatorsS[] = {
|
| 1169 |
+
{0x2a00, 0x2aff}};
|
| 1170 |
+
|
| 1171 |
+
static const xmlChLRange xmlSupplementaryPrivateUseAreaAL[] = {
|
| 1172 |
+
{0xf0000, 0xfffff}};
|
| 1173 |
+
|
| 1174 |
+
static const xmlChLRange xmlSupplementaryPrivateUseAreaBL[] = {
|
| 1175 |
+
{0x100000, 0x10ffff}};
|
| 1176 |
+
|
| 1177 |
+
static const xmlChSRange xmlSyriacS[] = {{0x700, 0x74f}};
|
| 1178 |
+
|
| 1179 |
+
static const xmlChSRange xmlTagalogS[] = {{0x1700, 0x171f}};
|
| 1180 |
+
|
| 1181 |
+
static const xmlChSRange xmlTagbanwaS[] = {{0x1760, 0x177f}};
|
| 1182 |
+
|
| 1183 |
+
static const xmlChLRange xmlTagsL[] = {{0xe0000, 0xe007f}};
|
| 1184 |
+
|
| 1185 |
+
static const xmlChSRange xmlTaiLeS[] = {{0x1950, 0x197f}};
|
| 1186 |
+
|
| 1187 |
+
static const xmlChLRange xmlTaiXuanJingSymbolsL[] = {{0x1d300, 0x1d35f}};
|
| 1188 |
+
|
| 1189 |
+
static const xmlChSRange xmlTamilS[] = {{0xb80, 0xbff}};
|
| 1190 |
+
|
| 1191 |
+
static const xmlChSRange xmlTeluguS[] = {{0xc00, 0xc7f}};
|
| 1192 |
+
|
| 1193 |
+
static const xmlChSRange xmlThaanaS[] = {{0x780, 0x7bf}};
|
| 1194 |
+
|
| 1195 |
+
static const xmlChSRange xmlThaiS[] = {{0xe00, 0xe7f}};
|
| 1196 |
+
|
| 1197 |
+
static const xmlChSRange xmlTibetanS[] = {{0xf00, 0xfff}};
|
| 1198 |
+
|
| 1199 |
+
static const xmlChLRange xmlUgariticL[] = {{0x10380, 0x1039f}};
|
| 1200 |
+
|
| 1201 |
+
static const xmlChSRange xmlUnifiedCanadianAboriginalSyllabicsS[] = {
|
| 1202 |
+
{0x1400, 0x167f}};
|
| 1203 |
+
|
| 1204 |
+
static const xmlChSRange xmlVariationSelectorsS[] = {{0xfe00, 0xfe0f}};
|
| 1205 |
+
|
| 1206 |
+
static const xmlChLRange xmlVariationSelectorsSupplementL[] = {
|
| 1207 |
+
{0xe0100, 0xe01ef}};
|
| 1208 |
+
|
| 1209 |
+
static const xmlChSRange xmlYiRadicalsS[] = {{0xa490, 0xa4cf}};
|
| 1210 |
+
|
| 1211 |
+
static const xmlChSRange xmlYiSyllablesS[] = {{0xa000, 0xa48f}};
|
| 1212 |
+
|
| 1213 |
+
static const xmlChSRange xmlYijingHexagramSymbolsS[] = {{0x4dc0, 0x4dff}};
|
| 1214 |
+
|
| 1215 |
+
static const xmlUnicodeRange xmlUnicodeBlocks[] = {
|
| 1216 |
+
{"AegeanNumbers",
|
| 1217 |
+
{0,1,NULL,xmlAegeanNumbersL}},
|
| 1218 |
+
{"AlphabeticPresentationForms",
|
| 1219 |
+
{1,0,xmlAlphabeticPresentationFormsS,NULL}},
|
| 1220 |
+
{"Arabic",
|
| 1221 |
+
{1,0,xmlArabicS,NULL}},
|
| 1222 |
+
{"ArabicPresentationForms-A",
|
| 1223 |
+
{1,0,xmlArabicPresentationFormsAS,NULL}},
|
| 1224 |
+
{"ArabicPresentationForms-B",
|
| 1225 |
+
{1,0,xmlArabicPresentationFormsBS,NULL}},
|
| 1226 |
+
{"Armenian",
|
| 1227 |
+
{1,0,xmlArmenianS,NULL}},
|
| 1228 |
+
{"Arrows",
|
| 1229 |
+
{1,0,xmlArrowsS,NULL}},
|
| 1230 |
+
{"BasicLatin",
|
| 1231 |
+
{1,0,xmlBasicLatinS,NULL}},
|
| 1232 |
+
{"Bengali",
|
| 1233 |
+
{1,0,xmlBengaliS,NULL}},
|
| 1234 |
+
{"BlockElements",
|
| 1235 |
+
{1,0,xmlBlockElementsS,NULL}},
|
| 1236 |
+
{"Bopomofo",
|
| 1237 |
+
{1,0,xmlBopomofoS,NULL}},
|
| 1238 |
+
{"BopomofoExtended",
|
| 1239 |
+
{1,0,xmlBopomofoExtendedS,NULL}},
|
| 1240 |
+
{"BoxDrawing",
|
| 1241 |
+
{1,0,xmlBoxDrawingS,NULL}},
|
| 1242 |
+
{"BraillePatterns",
|
| 1243 |
+
{1,0,xmlBraillePatternsS,NULL}},
|
| 1244 |
+
{"Buhid",
|
| 1245 |
+
{1,0,xmlBuhidS,NULL}},
|
| 1246 |
+
{"ByzantineMusicalSymbols",
|
| 1247 |
+
{0,1,NULL,xmlByzantineMusicalSymbolsL}},
|
| 1248 |
+
{"CJKCompatibility",
|
| 1249 |
+
{1,0,xmlCJKCompatibilityS,NULL}},
|
| 1250 |
+
{"CJKCompatibilityForms",
|
| 1251 |
+
{1,0,xmlCJKCompatibilityFormsS,NULL}},
|
| 1252 |
+
{"CJKCompatibilityIdeographs",
|
| 1253 |
+
{1,0,xmlCJKCompatibilityIdeographsS,NULL}},
|
| 1254 |
+
{"CJKCompatibilityIdeographsSupplement",
|
| 1255 |
+
{0,1,NULL,xmlCJKCompatibilityIdeographsSupplementL}},
|
| 1256 |
+
{"CJKRadicalsSupplement",
|
| 1257 |
+
{1,0,xmlCJKRadicalsSupplementS,NULL}},
|
| 1258 |
+
{"CJKSymbolsandPunctuation",
|
| 1259 |
+
{1,0,xmlCJKSymbolsandPunctuationS,NULL}},
|
| 1260 |
+
{"CJKUnifiedIdeographs",
|
| 1261 |
+
{1,0,xmlCJKUnifiedIdeographsS,NULL}},
|
| 1262 |
+
{"CJKUnifiedIdeographsExtensionA",
|
| 1263 |
+
{1,0,xmlCJKUnifiedIdeographsExtensionAS,NULL}},
|
| 1264 |
+
{"CJKUnifiedIdeographsExtensionB",
|
| 1265 |
+
{0,1,NULL,xmlCJKUnifiedIdeographsExtensionBL}},
|
| 1266 |
+
{"Cherokee",
|
| 1267 |
+
{1,0,xmlCherokeeS,NULL}},
|
| 1268 |
+
{"CombiningDiacriticalMarks",
|
| 1269 |
+
{1,0,xmlCombiningDiacriticalMarksS,NULL}},
|
| 1270 |
+
{"CombiningDiacriticalMarksforSymbols",
|
| 1271 |
+
{1,0,xmlCombiningDiacriticalMarksforSymbolsS,NULL}},
|
| 1272 |
+
{"CombiningHalfMarks",
|
| 1273 |
+
{1,0,xmlCombiningHalfMarksS,NULL}},
|
| 1274 |
+
{"CombiningMarksforSymbols",
|
| 1275 |
+
{1,0,xmlCombiningMarksforSymbolsS,NULL}},
|
| 1276 |
+
{"ControlPictures",
|
| 1277 |
+
{1,0,xmlControlPicturesS,NULL}},
|
| 1278 |
+
{"CurrencySymbols",
|
| 1279 |
+
{1,0,xmlCurrencySymbolsS,NULL}},
|
| 1280 |
+
{"CypriotSyllabary",
|
| 1281 |
+
{0,1,NULL,xmlCypriotSyllabaryL}},
|
| 1282 |
+
{"Cyrillic",
|
| 1283 |
+
{1,0,xmlCyrillicS,NULL}},
|
| 1284 |
+
{"CyrillicSupplement",
|
| 1285 |
+
{1,0,xmlCyrillicSupplementS,NULL}},
|
| 1286 |
+
{"Deseret",
|
| 1287 |
+
{0,1,NULL,xmlDeseretL}},
|
| 1288 |
+
{"Devanagari",
|
| 1289 |
+
{1,0,xmlDevanagariS,NULL}},
|
| 1290 |
+
{"Dingbats",
|
| 1291 |
+
{1,0,xmlDingbatsS,NULL}},
|
| 1292 |
+
{"EnclosedAlphanumerics",
|
| 1293 |
+
{1,0,xmlEnclosedAlphanumericsS,NULL}},
|
| 1294 |
+
{"EnclosedCJKLettersandMonths",
|
| 1295 |
+
{1,0,xmlEnclosedCJKLettersandMonthsS,NULL}},
|
| 1296 |
+
{"Ethiopic",
|
| 1297 |
+
{1,0,xmlEthiopicS,NULL}},
|
| 1298 |
+
{"GeneralPunctuation",
|
| 1299 |
+
{1,0,xmlGeneralPunctuationS,NULL}},
|
| 1300 |
+
{"GeometricShapes",
|
| 1301 |
+
{1,0,xmlGeometricShapesS,NULL}},
|
| 1302 |
+
{"Georgian",
|
| 1303 |
+
{1,0,xmlGeorgianS,NULL}},
|
| 1304 |
+
{"Gothic",
|
| 1305 |
+
{0,1,NULL,xmlGothicL}},
|
| 1306 |
+
{"Greek",
|
| 1307 |
+
{1,0,xmlGreekS,NULL}},
|
| 1308 |
+
{"GreekExtended",
|
| 1309 |
+
{1,0,xmlGreekExtendedS,NULL}},
|
| 1310 |
+
{"GreekandCoptic",
|
| 1311 |
+
{1,0,xmlGreekandCopticS,NULL}},
|
| 1312 |
+
{"Gujarati",
|
| 1313 |
+
{1,0,xmlGujaratiS,NULL}},
|
| 1314 |
+
{"Gurmukhi",
|
| 1315 |
+
{1,0,xmlGurmukhiS,NULL}},
|
| 1316 |
+
{"HalfwidthandFullwidthForms",
|
| 1317 |
+
{1,0,xmlHalfwidthandFullwidthFormsS,NULL}},
|
| 1318 |
+
{"HangulCompatibilityJamo",
|
| 1319 |
+
{1,0,xmlHangulCompatibilityJamoS,NULL}},
|
| 1320 |
+
{"HangulJamo",
|
| 1321 |
+
{1,0,xmlHangulJamoS,NULL}},
|
| 1322 |
+
{"HangulSyllables",
|
| 1323 |
+
{1,0,xmlHangulSyllablesS,NULL}},
|
| 1324 |
+
{"Hanunoo",
|
| 1325 |
+
{1,0,xmlHanunooS,NULL}},
|
| 1326 |
+
{"Hebrew",
|
| 1327 |
+
{1,0,xmlHebrewS,NULL}},
|
| 1328 |
+
{"HighPrivateUseSurrogates",
|
| 1329 |
+
{1,0,xmlHighPrivateUseSurrogatesS,NULL}},
|
| 1330 |
+
{"HighSurrogates",
|
| 1331 |
+
{1,0,xmlHighSurrogatesS,NULL}},
|
| 1332 |
+
{"Hiragana",
|
| 1333 |
+
{1,0,xmlHiraganaS,NULL}},
|
| 1334 |
+
{"IPAExtensions",
|
| 1335 |
+
{1,0,xmlIPAExtensionsS,NULL}},
|
| 1336 |
+
{"IdeographicDescriptionCharacters",
|
| 1337 |
+
{1,0,xmlIdeographicDescriptionCharactersS,NULL}},
|
| 1338 |
+
{"Kanbun",
|
| 1339 |
+
{1,0,xmlKanbunS,NULL}},
|
| 1340 |
+
{"KangxiRadicals",
|
| 1341 |
+
{1,0,xmlKangxiRadicalsS,NULL}},
|
| 1342 |
+
{"Kannada",
|
| 1343 |
+
{1,0,xmlKannadaS,NULL}},
|
| 1344 |
+
{"Katakana",
|
| 1345 |
+
{1,0,xmlKatakanaS,NULL}},
|
| 1346 |
+
{"KatakanaPhoneticExtensions",
|
| 1347 |
+
{1,0,xmlKatakanaPhoneticExtensionsS,NULL}},
|
| 1348 |
+
{"Khmer",
|
| 1349 |
+
{1,0,xmlKhmerS,NULL}},
|
| 1350 |
+
{"KhmerSymbols",
|
| 1351 |
+
{1,0,xmlKhmerSymbolsS,NULL}},
|
| 1352 |
+
{"Lao",
|
| 1353 |
+
{1,0,xmlLaoS,NULL}},
|
| 1354 |
+
{"Latin-1Supplement",
|
| 1355 |
+
{1,0,xmlLatin1SupplementS,NULL}},
|
| 1356 |
+
{"LatinExtended-A",
|
| 1357 |
+
{1,0,xmlLatinExtendedAS,NULL}},
|
| 1358 |
+
{"LatinExtended-B",
|
| 1359 |
+
{1,0,xmlLatinExtendedBS,NULL}},
|
| 1360 |
+
{"LatinExtendedAdditional",
|
| 1361 |
+
{1,0,xmlLatinExtendedAdditionalS,NULL}},
|
| 1362 |
+
{"LetterlikeSymbols",
|
| 1363 |
+
{1,0,xmlLetterlikeSymbolsS,NULL}},
|
| 1364 |
+
{"Limbu",
|
| 1365 |
+
{1,0,xmlLimbuS,NULL}},
|
| 1366 |
+
{"LinearBIdeograms",
|
| 1367 |
+
{0,1,NULL,xmlLinearBIdeogramsL}},
|
| 1368 |
+
{"LinearBSyllabary",
|
| 1369 |
+
{0,1,NULL,xmlLinearBSyllabaryL}},
|
| 1370 |
+
{"LowSurrogates",
|
| 1371 |
+
{1,0,xmlLowSurrogatesS,NULL}},
|
| 1372 |
+
{"Malayalam",
|
| 1373 |
+
{1,0,xmlMalayalamS,NULL}},
|
| 1374 |
+
{"MathematicalAlphanumericSymbols",
|
| 1375 |
+
{0,1,NULL,xmlMathematicalAlphanumericSymbolsL}},
|
| 1376 |
+
{"MathematicalOperators",
|
| 1377 |
+
{1,0,xmlMathematicalOperatorsS,NULL}},
|
| 1378 |
+
{"MiscellaneousMathematicalSymbols-A",
|
| 1379 |
+
{1,0,xmlMiscellaneousMathematicalSymbolsAS,NULL}},
|
| 1380 |
+
{"MiscellaneousMathematicalSymbols-B",
|
| 1381 |
+
{1,0,xmlMiscellaneousMathematicalSymbolsBS,NULL}},
|
| 1382 |
+
{"MiscellaneousSymbols",
|
| 1383 |
+
{1,0,xmlMiscellaneousSymbolsS,NULL}},
|
| 1384 |
+
{"MiscellaneousSymbolsandArrows",
|
| 1385 |
+
{1,0,xmlMiscellaneousSymbolsandArrowsS,NULL}},
|
| 1386 |
+
{"MiscellaneousTechnical",
|
| 1387 |
+
{1,0,xmlMiscellaneousTechnicalS,NULL}},
|
| 1388 |
+
{"Mongolian",
|
| 1389 |
+
{1,0,xmlMongolianS,NULL}},
|
| 1390 |
+
{"MusicalSymbols",
|
| 1391 |
+
{0,1,NULL,xmlMusicalSymbolsL}},
|
| 1392 |
+
{"Myanmar",
|
| 1393 |
+
{1,0,xmlMyanmarS,NULL}},
|
| 1394 |
+
{"NumberForms",
|
| 1395 |
+
{1,0,xmlNumberFormsS,NULL}},
|
| 1396 |
+
{"Ogham",
|
| 1397 |
+
{1,0,xmlOghamS,NULL}},
|
| 1398 |
+
{"OldItalic",
|
| 1399 |
+
{0,1,NULL,xmlOldItalicL}},
|
| 1400 |
+
{"OpticalCharacterRecognition",
|
| 1401 |
+
{1,0,xmlOpticalCharacterRecognitionS,NULL}},
|
| 1402 |
+
{"Oriya",
|
| 1403 |
+
{1,0,xmlOriyaS,NULL}},
|
| 1404 |
+
{"Osmanya",
|
| 1405 |
+
{0,1,NULL,xmlOsmanyaL}},
|
| 1406 |
+
{"PhoneticExtensions",
|
| 1407 |
+
{1,0,xmlPhoneticExtensionsS,NULL}},
|
| 1408 |
+
{"PrivateUse",
|
| 1409 |
+
{1,2,xmlPrivateUseS,xmlPrivateUseL}},
|
| 1410 |
+
{"PrivateUseArea",
|
| 1411 |
+
{1,0,xmlPrivateUseAreaS,NULL}},
|
| 1412 |
+
{"Runic",
|
| 1413 |
+
{1,0,xmlRunicS,NULL}},
|
| 1414 |
+
{"Shavian",
|
| 1415 |
+
{0,1,NULL,xmlShavianL}},
|
| 1416 |
+
{"Sinhala",
|
| 1417 |
+
{1,0,xmlSinhalaS,NULL}},
|
| 1418 |
+
{"SmallFormVariants",
|
| 1419 |
+
{1,0,xmlSmallFormVariantsS,NULL}},
|
| 1420 |
+
{"SpacingModifierLetters",
|
| 1421 |
+
{1,0,xmlSpacingModifierLettersS,NULL}},
|
| 1422 |
+
{"Specials",
|
| 1423 |
+
{1,0,xmlSpecialsS,NULL}},
|
| 1424 |
+
{"SuperscriptsandSubscripts",
|
| 1425 |
+
{1,0,xmlSuperscriptsandSubscriptsS,NULL}},
|
| 1426 |
+
{"SupplementalArrows-A",
|
| 1427 |
+
{1,0,xmlSupplementalArrowsAS,NULL}},
|
| 1428 |
+
{"SupplementalArrows-B",
|
| 1429 |
+
{1,0,xmlSupplementalArrowsBS,NULL}},
|
| 1430 |
+
{"SupplementalMathematicalOperators",
|
| 1431 |
+
{1,0,xmlSupplementalMathematicalOperatorsS,NULL}},
|
| 1432 |
+
{"SupplementaryPrivateUseArea-A",
|
| 1433 |
+
{0,1,NULL,xmlSupplementaryPrivateUseAreaAL}},
|
| 1434 |
+
{"SupplementaryPrivateUseArea-B",
|
| 1435 |
+
{0,1,NULL,xmlSupplementaryPrivateUseAreaBL}},
|
| 1436 |
+
{"Syriac",
|
| 1437 |
+
{1,0,xmlSyriacS,NULL}},
|
| 1438 |
+
{"Tagalog",
|
| 1439 |
+
{1,0,xmlTagalogS,NULL}},
|
| 1440 |
+
{"Tagbanwa",
|
| 1441 |
+
{1,0,xmlTagbanwaS,NULL}},
|
| 1442 |
+
{"Tags",
|
| 1443 |
+
{0,1,NULL,xmlTagsL}},
|
| 1444 |
+
{"TaiLe",
|
| 1445 |
+
{1,0,xmlTaiLeS,NULL}},
|
| 1446 |
+
{"TaiXuanJingSymbols",
|
| 1447 |
+
{0,1,NULL,xmlTaiXuanJingSymbolsL}},
|
| 1448 |
+
{"Tamil",
|
| 1449 |
+
{1,0,xmlTamilS,NULL}},
|
| 1450 |
+
{"Telugu",
|
| 1451 |
+
{1,0,xmlTeluguS,NULL}},
|
| 1452 |
+
{"Thaana",
|
| 1453 |
+
{1,0,xmlThaanaS,NULL}},
|
| 1454 |
+
{"Thai",
|
| 1455 |
+
{1,0,xmlThaiS,NULL}},
|
| 1456 |
+
{"Tibetan",
|
| 1457 |
+
{1,0,xmlTibetanS,NULL}},
|
| 1458 |
+
{"Ugaritic",
|
| 1459 |
+
{0,1,NULL,xmlUgariticL}},
|
| 1460 |
+
{"UnifiedCanadianAboriginalSyllabics",
|
| 1461 |
+
{1,0,xmlUnifiedCanadianAboriginalSyllabicsS,NULL}},
|
| 1462 |
+
{"VariationSelectors",
|
| 1463 |
+
{1,0,xmlVariationSelectorsS,NULL}},
|
| 1464 |
+
{"VariationSelectorsSupplement",
|
| 1465 |
+
{0,1,NULL,xmlVariationSelectorsSupplementL}},
|
| 1466 |
+
{"YiRadicals",
|
| 1467 |
+
{1,0,xmlYiRadicalsS,NULL}},
|
| 1468 |
+
{"YiSyllables",
|
| 1469 |
+
{1,0,xmlYiSyllablesS,NULL}},
|
| 1470 |
+
{"YijingHexagramSymbols",
|
| 1471 |
+
{1,0,xmlYijingHexagramSymbolsS,NULL}}
|
| 1472 |
+
};
|
| 1473 |
+
|
codegen/xmlmod.py
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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13 |
+
'nanohttp': 'HTTP',
|
| 14 |
+
'pattern': 'PATTERN',
|
| 15 |
+
'relaxng': 'RELAXNG',
|
| 16 |
+
'schemasInternals': 'SCHEMAS',
|
| 17 |
+
'schematron': 'SCHEMATRON',
|
| 18 |
+
'xinclude': 'XINCLUDE',
|
| 19 |
+
'xlink': 'XPTR',
|
| 20 |
+
'xmlautomata': 'REGEXP',
|
| 21 |
+
'xmlmodule': 'MODULES',
|
| 22 |
+
'xmlreader': 'READER',
|
| 23 |
+
'xmlregexp': 'REGEXP',
|
| 24 |
+
'xmlsave': 'OUTPUT',
|
| 25 |
+
'xmlschemas': 'SCHEMAS',
|
| 26 |
+
'xmlschemastypes': 'SCHEMAS',
|
| 27 |
+
'xmlwriter': 'WRITER',
|
| 28 |
+
'xpath': 'XPATH',
|
| 29 |
+
'xpathInternals': 'XPATH',
|
| 30 |
+
'xpointer': 'XPTR',
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
symbolMap1 = {
|
| 34 |
+
# not VALID
|
| 35 |
+
'xmlValidateNCName': '',
|
| 36 |
+
'xmlValidateNMToken': '',
|
| 37 |
+
'xmlValidateName': '',
|
| 38 |
+
'xmlValidateQName': '',
|
| 39 |
+
|
| 40 |
+
'htmlDefaultSAXHandlerInit': 'HTML',
|
| 41 |
+
'xmlSAX2InitHtmlDefaultSAXHandler': 'HTML',
|
| 42 |
+
|
| 43 |
+
'xmlRegisterHTTPPostCallbacks': 'HTTP',
|
| 44 |
+
|
| 45 |
+
'__xmlOutputBufferCreateFilename': 'OUTPUT',
|
| 46 |
+
'xmlAttrSerializeTxtContent': 'OUTPUT',
|
| 47 |
+
'xmlUTF8ToIsolat1': 'OUTPUT',
|
| 48 |
+
'xmlSprintfElementContent': 'OUTPUT',
|
| 49 |
+
|
| 50 |
+
'xmlCreatePushParserCtxt': 'PUSH',
|
| 51 |
+
'xmlParseChunk': 'PUSH',
|
| 52 |
+
|
| 53 |
+
'xmlParseBalancedChunkMemory': 'SAX1',
|
| 54 |
+
'xmlParseBalancedChunkMemoryRecover': 'SAX1',
|
| 55 |
+
'xmlParseDoc': 'SAX1',
|
| 56 |
+
'xmlParseEntity': 'SAX1',
|
| 57 |
+
'xmlParseExternalEntity': 'SAX1',
|
| 58 |
+
'xmlParseFile': 'SAX1',
|
| 59 |
+
'xmlParseMemory': 'SAX1',
|
| 60 |
+
'xmlSAXDefaultVersion': 'SAX1',
|
| 61 |
+
'xmlSetupParserForBuffer': 'SAX1',
|
| 62 |
+
|
| 63 |
+
'xmlCtxtGetValidCtxt': 'VALID',
|
| 64 |
+
'xmlFreeValidCtxt': 'VALID',
|
| 65 |
+
'xmlNewValidCtxt': 'VALID',
|
| 66 |
+
|
| 67 |
+
'xmlCatalogConvert': 'SGML_CATALOG',
|
| 68 |
+
'xmlConvertSGMLCatalog': 'SGML_CATALOG',
|
| 69 |
+
'xmlLoadSGMLSuperCatalog': 'SGML_CATALOG',
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
symbolMap2 = {
|
| 73 |
+
# not OUTPUT (should be fixed in xmlIO.h)
|
| 74 |
+
'xmlOutputBufferCreateFilenameDefault': '',
|
| 75 |
+
|
| 76 |
+
'xmlXPathDebugDumpCompExpr': 'DEBUG',
|
| 77 |
+
'xmlXPathDebugDumpObject': 'DEBUG',
|
| 78 |
+
'xmlSchemaDump': 'DEBUG',
|
| 79 |
+
'xmlRelaxNGDump': 'DEBUG',
|
| 80 |
+
|
| 81 |
+
'xmlACatalogDump': 'OUTPUT',
|
| 82 |
+
'xmlCatalogDump': 'OUTPUT',
|
| 83 |
+
'xmlIOHTTPOpenW': 'OUTPUT',
|
| 84 |
+
'xmlNanoHTTPSave': 'OUTPUT',
|
| 85 |
+
'xmlRegisterHTTPPostCallbacks': 'OUTPUT',
|
| 86 |
+
'xmlRelaxNGDumpTree': 'OUTPUT',
|
| 87 |
+
|
| 88 |
+
'xmlTextReaderPreservePattern': 'PATTERN',
|
| 89 |
+
|
| 90 |
+
'htmlCreatePushParserCtxt': 'PUSH',
|
| 91 |
+
'htmlParseChunk': 'PUSH',
|
| 92 |
+
|
| 93 |
+
'xmlValidBuildContentModel': 'REGEXP',
|
| 94 |
+
'xmlValidatePopElement': 'REGEXP',
|
| 95 |
+
'xmlValidatePushCData': 'REGEXP',
|
| 96 |
+
'xmlValidatePushElement': 'REGEXP',
|
| 97 |
+
|
| 98 |
+
'xmlTextReaderRelaxNGSetSchema': 'RELAXNG',
|
| 99 |
+
'xmlTextReaderRelaxNGValidate': 'RELAXNG',
|
| 100 |
+
'xmlTextReaderRelaxNGValidateCtxt': 'RELAXNG',
|
| 101 |
+
|
| 102 |
+
'xmlTextReaderSchemaValidate': 'SCHEMAS',
|
| 103 |
+
'xmlTextReaderSchemaValidateCtxt': 'SCHEMAS',
|
| 104 |
+
'xmlTextReaderSetSchema': 'SCHEMAS',
|
| 105 |
+
|
| 106 |
+
'xmlTextReaderReadInnerXml': 'WRITER',
|
| 107 |
+
'xmlTextReaderReadOuterXml': 'WRITER',
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
outputRegex = '|'.join((
|
| 111 |
+
'^(html|xml(Buf)?)(Doc(Content|Format)?|Elem|Node)Dump',
|
| 112 |
+
'^(html|xml)Save(Format)?File',
|
| 113 |
+
'^xmlDump.*(Decl|Table)',
|
| 114 |
+
'^xml(Alloc)?OutputBuffer',
|
| 115 |
+
'^xml.*OutputCallbacks',
|
| 116 |
+
))
|
| 117 |
+
|
| 118 |
+
def findModules(filename, symbol):
|
| 119 |
+
module1 = symbolMap1.get(symbol)
|
| 120 |
+
|
| 121 |
+
if module1 is None:
|
| 122 |
+
module1 = moduleMap.get(filename)
|
| 123 |
+
|
| 124 |
+
if module1 is None:
|
| 125 |
+
if re.search('^xml(Ctxt)?Valid|Parse(DTD|Dtd)', symbol):
|
| 126 |
+
module1 = 'VALID'
|
| 127 |
+
elif re.search('^xml(Recover|SAX(User)?Parse)', symbol):
|
| 128 |
+
module1 = 'SAX1'
|
| 129 |
+
elif re.search('^xmlIOHTTP', symbol):
|
| 130 |
+
module1 = 'HTTP'
|
| 131 |
+
|
| 132 |
+
module2 = symbolMap2.get(symbol)
|
| 133 |
+
|
| 134 |
+
if module2 is None:
|
| 135 |
+
if re.search(outputRegex, symbol):
|
| 136 |
+
if module1 is None:
|
| 137 |
+
module1 = 'OUTPUT'
|
| 138 |
+
else:
|
| 139 |
+
module2 = 'OUTPUT'
|
| 140 |
+
|
| 141 |
+
if module1 is None:
|
| 142 |
+
module1 = ''
|
| 143 |
+
if module2 is None:
|
| 144 |
+
module2 = ''
|
| 145 |
+
|
| 146 |
+
return module1, module2
|