Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- local-test-libxml2-delta-02/afc-libxml2/doc/xml2-config.1 +32 -0
- local-test-libxml2-delta-02/afc-libxml2/doc/xmlcatalog.1 +356 -0
- local-test-libxml2-delta-02/afc-libxml2/doc/xmlcatalog.html +144 -0
- local-test-libxml2-delta-02/afc-libxml2/doc/xmlcatalog.xml +475 -0
- local-test-libxml2-delta-02/afc-libxml2/doc/xmllint.html +188 -0
- local-test-libxml2-delta-02/afc-libxml2/doc/xmllint.xml +1045 -0
- local-test-libxml2-delta-02/afc-libxml2/example/Makefile.am +44 -0
- local-test-libxml2-delta-02/afc-libxml2/example/gjobread.c +301 -0
- local-test-libxml2-delta-02/afc-libxml2/example/gjobs.xml +57 -0
- local-test-libxml2-delta-02/afc-libxml2/example/io1.c +159 -0
- local-test-libxml2-delta-02/afc-libxml2/example/parse1.c +48 -0
- local-test-libxml2-delta-02/afc-libxml2/example/parse2.c +64 -0
- local-test-libxml2-delta-02/afc-libxml2/example/reader1.c +99 -0
- local-test-libxml2-delta-02/afc-libxml2/example/reader2.c +115 -0
- local-test-libxml2-delta-02/afc-libxml2/example/reader3.c +111 -0
- local-test-libxml2-delta-02/afc-libxml2/example/reader4.c +114 -0
- local-test-libxml2-delta-02/afc-libxml2/example/test1.xml +1 -0
- local-test-libxml2-delta-02/afc-libxml2/example/test2.xml +13 -0
- local-test-libxml2-delta-02/afc-libxml2/example/test3.xml +39 -0
- local-test-libxml2-delta-02/afc-libxml2/example/tree1.c +80 -0
- local-test-libxml2-delta-02/afc-libxml2/include/Makefile.am +5 -0
- local-test-libxml2-delta-02/afc-libxml2/include/meson.build +2 -0
- local-test-libxml2-delta-02/afc-libxml2/include/wsockcompat.h +49 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/README400 +226 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/initscript.sh +315 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/libxmlmain.c +102 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/make-bldcsndfa.sh +43 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/make-include.sh +78 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/make-rpg.sh +100 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/make-src.sh +355 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/make.sh +84 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/os400config.h.in +175 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/rpgsupport.c +270 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/rpgsupport.h +157 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/transcode.c +268 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/transcode.h +43 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/wrappers.c +170 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/wrappers.h +70 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/xmlcatalog.cmd +112 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/xmlcatlgcl.c +288 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/xmllint.cmd +146 -0
- local-test-libxml2-delta-02/afc-libxml2/os400/xmllintcl.c +216 -0
- local-test-libxml2-delta-02/afc-libxml2/python/.gitignore +9 -0
- local-test-libxml2-delta-02/afc-libxml2/python/Makefile.am +52 -0
- local-test-libxml2-delta-02/afc-libxml2/python/README +34 -0
- local-test-libxml2-delta-02/afc-libxml2/python/drv_libxml2.py +382 -0
- local-test-libxml2-delta-02/afc-libxml2/python/generator.py +1382 -0
- local-test-libxml2-delta-02/afc-libxml2/python/libxml.c +0 -0
- local-test-libxml2-delta-02/afc-libxml2/python/libxml2-python-api.xml +346 -0
- local-test-libxml2-delta-02/afc-libxml2/python/libxml_wrap.h +309 -0
local-test-libxml2-delta-02/afc-libxml2/doc/xml2-config.1
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.TH xml2-config 1 "3 April 2022" Version 1.2.0
|
| 2 |
+
.SH NAME
|
| 3 |
+
xml2-config - script to get information about the installed version of libxml2
|
| 4 |
+
.SH SYNOPSIS
|
| 5 |
+
.B xml2-config
|
| 6 |
+
[\-\-prefix\fI[=DIR]\fP] [\-\-libs] [\-\-cflags] [\-\-version] [\-\-help]
|
| 7 |
+
.SH DESCRIPTION
|
| 8 |
+
\fIxml2-config\fP is a tool that is used to determine the compile and
|
| 9 |
+
linker flags that should be used to compile and link programs that use
|
| 10 |
+
\fIlibxml2\fP.
|
| 11 |
+
.SH OPTIONS
|
| 12 |
+
\fIxml2-config\fP accepts the following options:
|
| 13 |
+
.TP 8
|
| 14 |
+
.B \-\-version
|
| 15 |
+
Print the currently installed version of \fIlibxml2\fP on the standard output.
|
| 16 |
+
.TP 8
|
| 17 |
+
.B \-\-libs
|
| 18 |
+
Print the linker flags that are necessary to link a \fIlibxml2\fP program.
|
| 19 |
+
Add \-\-dynamic after \-\-libs to print only shared library linking
|
| 20 |
+
information.
|
| 21 |
+
.TP 8
|
| 22 |
+
.B \-\-cflags
|
| 23 |
+
Print the compiler flags that are necessary to compile a \fIlibxml2\fP program.
|
| 24 |
+
.TP 8
|
| 25 |
+
.B \-\-prefix=PREFIX
|
| 26 |
+
If specified, use PREFIX instead of the installation prefix that
|
| 27 |
+
\fIlibxml2\fP was built with when computing the output for the
|
| 28 |
+
\-\-cflags and \-\-libs options. This option must be specified before
|
| 29 |
+
any \-\-libs or \-\-cflags options.
|
| 30 |
+
.SH AUTHOR
|
| 31 |
+
This manual page was written by Fredrik Hallenberg <hallon@lysator.liu.se>,
|
| 32 |
+
for the Debian GNU/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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'\" t
|
| 2 |
+
.\" Title: xmlcatalog
|
| 3 |
+
.\" Author: John Fleck <jfleck@inkstain.net>
|
| 4 |
+
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
|
| 5 |
+
.\" Date: 06/12/2024
|
| 6 |
+
.\" Manual: xmlcatalog Manual
|
| 7 |
+
.\" Source: libxml2
|
| 8 |
+
.\" Language: English
|
| 9 |
+
.\"
|
| 10 |
+
.TH "XMLCATALOG" "1" "06/12/2024" "libxml2" "xmlcatalog Manual"
|
| 11 |
+
.\" -----------------------------------------------------------------
|
| 12 |
+
.\" * Define some portability stuff
|
| 13 |
+
.\" -----------------------------------------------------------------
|
| 14 |
+
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 15 |
+
.\" http://bugs.debian.org/507673
|
| 16 |
+
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
| 17 |
+
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 18 |
+
.ie \n(.g .ds Aq \(aq
|
| 19 |
+
.el .ds Aq '
|
| 20 |
+
.\" -----------------------------------------------------------------
|
| 21 |
+
.\" * set default formatting
|
| 22 |
+
.\" -----------------------------------------------------------------
|
| 23 |
+
.\" disable hyphenation
|
| 24 |
+
.nh
|
| 25 |
+
.\" disable justification (adjust text to left margin only)
|
| 26 |
+
.ad l
|
| 27 |
+
.\" -----------------------------------------------------------------
|
| 28 |
+
.\" * MAIN CONTENT STARTS HERE *
|
| 29 |
+
.\" -----------------------------------------------------------------
|
| 30 |
+
.SH "NAME"
|
| 31 |
+
xmlcatalog \- Command line tool to parse and manipulate XML or SGML catalog files\&.
|
| 32 |
+
.SH "SYNOPSIS"
|
| 33 |
+
.HP \w'\fBxmlcatalog\fR\ 'u
|
| 34 |
+
\fBxmlcatalog\fR [\fB\-\-sgml\fR | \fB\-\-shell\fR | \fB\-\-convert\fR | \fB\-\-create\fR | \fB\-\-del\ \fR\fB\fIVALUE(S)\fR\fR | [\ \fB\-\-add\ \fR\fB\fITYPE\fR\fR\fB\ \fR\fB\fIORIG\fR\fR\fB\ \fR\fB\fIREPLACE\fR\fR\fB\ \fR\ |\ \fB\-\-add\ \fR\fB\fIFILENAME\fR\fR] | \fB\-\-noout\fR | \fB\-\-no\-super\-update\fR | [\fB\-v\fR\ |\ \fB\-\-verbose\fR]] {\fICATALOGFILE\fR} {\fIENTITIES\fR...}
|
| 35 |
+
.SH "DESCRIPTION"
|
| 36 |
+
.PP
|
| 37 |
+
\fBxmlcatalog\fR
|
| 38 |
+
is a command line application allowing users to monitor and manipulate
|
| 39 |
+
XML
|
| 40 |
+
and
|
| 41 |
+
SGML
|
| 42 |
+
catalogs\&. It is included in
|
| 43 |
+
\fBlibxml\fR(3)\&.
|
| 44 |
+
.PP
|
| 45 |
+
Its functions can be invoked from a single command from the command line, or it can perform multiple functions in interactive mode\&. It can operate on both
|
| 46 |
+
XML
|
| 47 |
+
and
|
| 48 |
+
SGML
|
| 49 |
+
files\&.
|
| 50 |
+
.SH "OPTIONS"
|
| 51 |
+
.PP
|
| 52 |
+
\fBxmlcatalog\fR
|
| 53 |
+
accepts the following options (in alphabetical order):
|
| 54 |
+
.PP
|
| 55 |
+
\fB\-\-add \fR\fB\fITYPE\fR\fR\fB \fR\fB\fIORIG\fR\fR\fB \fR\fB\fIREPLACE\fR\fR\fB \fR
|
| 56 |
+
.RS 4
|
| 57 |
+
Add an entry to
|
| 58 |
+
CATALOGFILE\&.
|
| 59 |
+
\fITYPE\fR
|
| 60 |
+
indicates the type of entry\&. Possible types are:
|
| 61 |
+
\fIpublic\fR, \fIsystem\fR, \fIuri\fR, \fIrewriteSystem\fR, \fIrewriteURI\fR, \fIdelegatePublic\fR, \fIdelegateSystem\fR, \fIdelegateURI\fR, \fInextCatalog\fR\&.
|
| 62 |
+
\fIORIG\fR
|
| 63 |
+
is the original reference to be replaced, and
|
| 64 |
+
\fIREPLACE\fR
|
| 65 |
+
is the
|
| 66 |
+
URI
|
| 67 |
+
of the replacement entity to be used\&. The
|
| 68 |
+
\fB\-\-add\fR
|
| 69 |
+
option will not overwrite
|
| 70 |
+
CATALOGFILE, outputting to
|
| 71 |
+
stdout, unless
|
| 72 |
+
\fB\-\-noout\fR
|
| 73 |
+
is used\&. The
|
| 74 |
+
\fB\-\-add\fR
|
| 75 |
+
will always take three parameters even if some of the
|
| 76 |
+
XML
|
| 77 |
+
catalog constructs will have only a single argument\&.
|
| 78 |
+
.RE
|
| 79 |
+
.PP
|
| 80 |
+
\fB\-\-add \fR\fB\fIFILENAME\fR\fR
|
| 81 |
+
.RS 4
|
| 82 |
+
If the
|
| 83 |
+
\fB\-\-add\fR
|
| 84 |
+
option is used following the
|
| 85 |
+
\fB\-\-sgml\fR
|
| 86 |
+
option, only a single argument, a
|
| 87 |
+
\fIFILENAME\fR, is used\&. This is used to add the name of a catalog file to an
|
| 88 |
+
SGML
|
| 89 |
+
supercatalog, a file that contains references to other included
|
| 90 |
+
SGML
|
| 91 |
+
catalog files\&.
|
| 92 |
+
.RE
|
| 93 |
+
.PP
|
| 94 |
+
\fB\-\-convert\fR
|
| 95 |
+
.RS 4
|
| 96 |
+
Convert SGML catalog to XML\&.
|
| 97 |
+
.RE
|
| 98 |
+
.PP
|
| 99 |
+
\fB\-\-create\fR
|
| 100 |
+
.RS 4
|
| 101 |
+
Create a new
|
| 102 |
+
XML
|
| 103 |
+
catalog\&. Outputs to
|
| 104 |
+
stdout, ignoring
|
| 105 |
+
\fIfilename\fR
|
| 106 |
+
unless
|
| 107 |
+
\fB\-\-noout\fR
|
| 108 |
+
is used, in which case it creates a new catalog file
|
| 109 |
+
\fIfilename\fR\&.
|
| 110 |
+
.RE
|
| 111 |
+
.PP
|
| 112 |
+
\fB\-\-del \fR\fB\fIVALUE(S)\fR\fR
|
| 113 |
+
.RS 4
|
| 114 |
+
Remove entries from
|
| 115 |
+
\fICATALOGFILE\fR
|
| 116 |
+
matching
|
| 117 |
+
\fIVALUE(S)\fR\&. The
|
| 118 |
+
\fB\-\-del\fR
|
| 119 |
+
option will not overwrite
|
| 120 |
+
\fICATALOGFILE\fR, outputting to
|
| 121 |
+
stdout, unless
|
| 122 |
+
\fB\-\-noout\fR
|
| 123 |
+
is used\&.
|
| 124 |
+
.RE
|
| 125 |
+
.PP
|
| 126 |
+
\fB\-\-noout\fR
|
| 127 |
+
.RS 4
|
| 128 |
+
Save output to the named file rather than outputting to
|
| 129 |
+
stdout\&.
|
| 130 |
+
.RE
|
| 131 |
+
.PP
|
| 132 |
+
\fB\-\-no\-super\-update\fR
|
| 133 |
+
.RS 4
|
| 134 |
+
Do not update the
|
| 135 |
+
SGML
|
| 136 |
+
super catalog\&.
|
| 137 |
+
.RE
|
| 138 |
+
.PP
|
| 139 |
+
\fB\-\-shell\fR
|
| 140 |
+
.RS 4
|
| 141 |
+
Run a shell allowing interactive queries on catalog file
|
| 142 |
+
\fICATALOGFILE\fR\&. For the set of available commands see
|
| 143 |
+
the section called \(lqSHELL COMMANDS\(rq\&.
|
| 144 |
+
.RE
|
| 145 |
+
.PP
|
| 146 |
+
\fB\-\-sgml\fR
|
| 147 |
+
.RS 4
|
| 148 |
+
Uses
|
| 149 |
+
SGML
|
| 150 |
+
super catalogs for
|
| 151 |
+
\fB\-\-add\fR
|
| 152 |
+
and
|
| 153 |
+
\fB\-\-del\fR
|
| 154 |
+
options\&.
|
| 155 |
+
.RE
|
| 156 |
+
.PP
|
| 157 |
+
\fB\-v\fR, \fB\-\-verbose\fR
|
| 158 |
+
.RS 4
|
| 159 |
+
Output debugging information\&.
|
| 160 |
+
.RE
|
| 161 |
+
.PP
|
| 162 |
+
Invoking
|
| 163 |
+
\fBxmlcatalog\fR
|
| 164 |
+
non\-interactively without a designated action (imposed with options like
|
| 165 |
+
\fB\-\-add\fR) will result in a lookup of the catalog entry for
|
| 166 |
+
\fIENTITIES\fR
|
| 167 |
+
in the catalog denoted with
|
| 168 |
+
\fICATALOGFILE\fR\&. The corresponding entries will be output to the command line\&. This mode of operation, together with
|
| 169 |
+
\fB\-\-shell\fR
|
| 170 |
+
mode and non\-modifying (i\&.e\&. without
|
| 171 |
+
\fB\-\-noout\fR) direct actions, allows for a special shortcut of the void
|
| 172 |
+
\fICATALOGFILE\fR
|
| 173 |
+
specification (possibly expressed as "" in the shell environment) appointing the default system catalog\&. That simplifies the handling when its exact location is irrelevant but the respective built\-in still needs to be consulted\&.
|
| 174 |
+
.SH "SHELL COMMANDS"
|
| 175 |
+
.PP
|
| 176 |
+
Invoking
|
| 177 |
+
\fBxmlcatalog\fR
|
| 178 |
+
with the
|
| 179 |
+
\fB\-\-shell \fR\fB\fICATALOGFILE\fR\fR
|
| 180 |
+
option opens a command line shell allowing interactive access to the catalog file identified by
|
| 181 |
+
\fICATALOGFILE\fR\&. Invoking the shell provides a command line prompt after which the following commands (described in alphabetical order) can be entered\&.
|
| 182 |
+
.PP
|
| 183 |
+
\fBadd \fR\fB\fITYPE\fR\fR\fB \fR\fB\fIORIG\fR\fR\fB \fR\fB\fIREPLACE\fR\fR\fB \fR
|
| 184 |
+
.RS 4
|
| 185 |
+
Add an entry to the catalog file\&.
|
| 186 |
+
\fITYPE\fR
|
| 187 |
+
indicates the type of entry\&. Possible types are:
|
| 188 |
+
\fIpublic\fR, \fIsystem\fR, \fIuri\fR, \fIrewriteSystem\fR, \fIrewriteURI\fR, \fIdelegatePublic\fR, \fIdelegateSystem\fR, \fIdelegateURI\fR, \fInextCatalog\fR\&.
|
| 189 |
+
\fIORIG\fR
|
| 190 |
+
is the original reference to be replaced, and
|
| 191 |
+
\fIREPLACE\fR
|
| 192 |
+
is the
|
| 193 |
+
URI
|
| 194 |
+
of the replacement entity to be used\&. The
|
| 195 |
+
\fB\-\-add\fR
|
| 196 |
+
option will not overwrite
|
| 197 |
+
CATALOGFILE, outputting to
|
| 198 |
+
stdout, unless
|
| 199 |
+
\fB\-\-noout\fR
|
| 200 |
+
is used\&. The
|
| 201 |
+
\fB\-\-add\fR
|
| 202 |
+
will always take three parameters even if some of the
|
| 203 |
+
XML
|
| 204 |
+
catalog constructs will have only a single argument\&.
|
| 205 |
+
.RE
|
| 206 |
+
.PP
|
| 207 |
+
\fBdebug\fR
|
| 208 |
+
.RS 4
|
| 209 |
+
Print debugging statements showing the steps
|
| 210 |
+
\fBxmlcatalog\fR
|
| 211 |
+
is executing\&.
|
| 212 |
+
.RE
|
| 213 |
+
.PP
|
| 214 |
+
\fBdel \fR\fB\fIVALUE(S)\fR\fR
|
| 215 |
+
.RS 4
|
| 216 |
+
Remove the catalog entry corresponding to
|
| 217 |
+
\fIVALUE(S)\fR\&.
|
| 218 |
+
.RE
|
| 219 |
+
.PP
|
| 220 |
+
\fBdump\fR
|
| 221 |
+
.RS 4
|
| 222 |
+
Print the current catalog\&.
|
| 223 |
+
.RE
|
| 224 |
+
.PP
|
| 225 |
+
\fBexit\fR
|
| 226 |
+
.RS 4
|
| 227 |
+
Quit the shell\&.
|
| 228 |
+
.RE
|
| 229 |
+
.PP
|
| 230 |
+
\fBpublic \fR\fB\fIPUBLIC\-ID\fR\fR
|
| 231 |
+
.RS 4
|
| 232 |
+
Execute a Formal Public Identifier lookup of the catalog entry for
|
| 233 |
+
\fIPUBLIC\-ID\fR\&. The corresponding entry will be output to the command line\&.
|
| 234 |
+
.RE
|
| 235 |
+
.PP
|
| 236 |
+
\fBquiet\fR
|
| 237 |
+
.RS 4
|
| 238 |
+
Stop printing debugging statements\&.
|
| 239 |
+
.RE
|
| 240 |
+
.PP
|
| 241 |
+
\fBsystem \fR\fB\fISYSTEM\-ID\fR\fR
|
| 242 |
+
.RS 4
|
| 243 |
+
Execute a Formal Public Identifier lookup of the catalog entry for
|
| 244 |
+
\fISYSTEM\-ID\fR\&. The corresponding entry will be output to the command line\&.
|
| 245 |
+
.RE
|
| 246 |
+
.SH "ENVIRONMENT"
|
| 247 |
+
.PP
|
| 248 |
+
\fBXML_CATALOG_FILES\fR
|
| 249 |
+
.RS 4
|
| 250 |
+
XML
|
| 251 |
+
catalog behavior can be changed by redirecting queries to the user\*(Aqs own set of catalogs\&. This can be done by setting the
|
| 252 |
+
\fBXML_CATALOG_FILES\fR
|
| 253 |
+
environment variable to a space\-separated list of catalogs\&. Use percent\-encoding to escape spaces or other characters\&. An empty variable should deactivate loading the default catalog from
|
| 254 |
+
/etc/xml/catalog
|
| 255 |
+
or, more specifically,
|
| 256 |
+
${sysconfdir}/xml/catalog\&.
|
| 257 |
+
.RE
|
| 258 |
+
.SH "DIAGNOSTICS"
|
| 259 |
+
.PP
|
| 260 |
+
\fBxmlcatalog\fR
|
| 261 |
+
return codes provide information that can be used when calling it from scripts\&.
|
| 262 |
+
.PP
|
| 263 |
+
\fB0\fR
|
| 264 |
+
.RS 4
|
| 265 |
+
No error
|
| 266 |
+
.RE
|
| 267 |
+
.PP
|
| 268 |
+
\fB1\fR
|
| 269 |
+
.RS 4
|
| 270 |
+
Failed to remove an entry from the catalog
|
| 271 |
+
.RE
|
| 272 |
+
.PP
|
| 273 |
+
\fB2\fR
|
| 274 |
+
.RS 4
|
| 275 |
+
Failed to save to the catalog, check file permissions
|
| 276 |
+
.RE
|
| 277 |
+
.PP
|
| 278 |
+
\fB3\fR
|
| 279 |
+
.RS 4
|
| 280 |
+
Failed to add an entry to the catalog
|
| 281 |
+
.RE
|
| 282 |
+
.PP
|
| 283 |
+
\fB4\fR
|
| 284 |
+
.RS 4
|
| 285 |
+
Failed to look up an entry in the catalog
|
| 286 |
+
.RE
|
| 287 |
+
.SH "SEE ALSO"
|
| 288 |
+
.PP
|
| 289 |
+
\fBlibxml\fR(3)
|
| 290 |
+
.PP
|
| 291 |
+
More information can be found at
|
| 292 |
+
.sp
|
| 293 |
+
.RS 4
|
| 294 |
+
.ie n \{\
|
| 295 |
+
\h'-04'\(bu\h'+03'\c
|
| 296 |
+
.\}
|
| 297 |
+
.el \{\
|
| 298 |
+
.sp -1
|
| 299 |
+
.IP \(bu 2.3
|
| 300 |
+
.\}
|
| 301 |
+
\fBlibxml\fR(3)
|
| 302 |
+
web page
|
| 303 |
+
\m[blue]\fB\%https://gitlab.gnome.org/GNOME/libxml2\fR\m[]
|
| 304 |
+
.RE
|
| 305 |
+
.sp
|
| 306 |
+
.RS 4
|
| 307 |
+
.ie n \{\
|
| 308 |
+
\h'-04'\(bu\h'+03'\c
|
| 309 |
+
.\}
|
| 310 |
+
.el \{\
|
| 311 |
+
.sp -1
|
| 312 |
+
.IP \(bu 2.3
|
| 313 |
+
.\}
|
| 314 |
+
\fBlibxml\fR(3)
|
| 315 |
+
catalog support web page at
|
| 316 |
+
\m[blue]\fB\%https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support\fR\m[]
|
| 317 |
+
.RE
|
| 318 |
+
.sp
|
| 319 |
+
.RS 4
|
| 320 |
+
.ie n \{\
|
| 321 |
+
\h'-04'\(bu\h'+03'\c
|
| 322 |
+
.\}
|
| 323 |
+
.el \{\
|
| 324 |
+
.sp -1
|
| 325 |
+
.IP \(bu 2.3
|
| 326 |
+
.\}
|
| 327 |
+
James Clark\*(Aqs
|
| 328 |
+
SGML
|
| 329 |
+
catalog page
|
| 330 |
+
\m[blue]\fB\%http://www.jclark.com/sp/catalog.htm\fR\m[]
|
| 331 |
+
.RE
|
| 332 |
+
.sp
|
| 333 |
+
.RS 4
|
| 334 |
+
.ie n \{\
|
| 335 |
+
\h'-04'\(bu\h'+03'\c
|
| 336 |
+
.\}
|
| 337 |
+
.el \{\
|
| 338 |
+
.sp -1
|
| 339 |
+
.IP \(bu 2.3
|
| 340 |
+
.\}
|
| 341 |
+
OASIS
|
| 342 |
+
XML
|
| 343 |
+
catalog specification
|
| 344 |
+
\m[blue]\fB\%http://www.oasis-open.org/committees/entity/spec.html\fR\m[]
|
| 345 |
+
.RE
|
| 346 |
+
.sp
|
| 347 |
+
.SH "AUTHOR"
|
| 348 |
+
.PP
|
| 349 |
+
\fBJohn Fleck\fR <\&jfleck@inkstain\&.net\&>
|
| 350 |
+
.RS 4
|
| 351 |
+
Author.
|
| 352 |
+
.RE
|
| 353 |
+
.SH "COPYRIGHT"
|
| 354 |
+
.br
|
| 355 |
+
Copyright \(co 2001, 2004
|
| 356 |
+
.br
|
local-test-libxml2-delta-02/afc-libxml2/doc/xmlcatalog.html
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlcatalog</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmlcatalog —
|
| 2 |
+
Command line tool to parse and manipulate <acronym class="acronym">XML</acronym>
|
| 3 |
+
or <acronym class="acronym">SGML</acronym> catalog files.
|
| 4 |
+
</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmlcatalog</code> [ <code class="option">--sgml</code> | <code class="option">--shell</code> | <code class="option">--convert</code> | <code class="option">--create</code> | <code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code> |
|
| 5 |
+
[
|
| 6 |
+
<code class="option">--add
|
| 7 |
+
<em class="replaceable"><code>TYPE</code></em>
|
| 8 |
+
<em class="replaceable"><code>ORIG</code></em>
|
| 9 |
+
<em class="replaceable"><code>REPLACE</code></em>
|
| 10 |
+
</code>
|
| 11 |
+
| <code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code> ]
|
| 12 |
+
| <code class="option">--noout</code> | <code class="option">--no-super-update</code> |
|
| 13 |
+
[ <code class="option">-v</code> | <code class="option">--verbose</code> ]
|
| 14 |
+
] {<em class="replaceable"><code>CATALOGFILE</code></em>} {<em class="replaceable"><code>ENTITIES</code></em>...}</p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
|
| 15 |
+
<span class="command"><strong>xmlcatalog</strong></span> is a command line application allowing users to monitor and
|
| 16 |
+
manipulate <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> catalogs. It
|
| 17 |
+
is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.
|
| 18 |
+
</p><p>
|
| 19 |
+
Its functions can be invoked from a single command from the command line,
|
| 20 |
+
or it can perform multiple functions in interactive mode. It can operate
|
| 21 |
+
on both <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> files.
|
| 22 |
+
</p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
|
| 23 |
+
<span class="command"><strong>xmlcatalog</strong></span> accepts the following options (in alphabetical order):
|
| 24 |
+
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
|
| 25 |
+
<code class="option">--add
|
| 26 |
+
<em class="replaceable"><code>TYPE</code></em>
|
| 27 |
+
<em class="replaceable"><code>ORIG</code></em>
|
| 28 |
+
<em class="replaceable"><code>REPLACE</code></em>
|
| 29 |
+
</code>
|
| 30 |
+
</span></dt><dd><p>
|
| 31 |
+
Add an entry to <code class="filename">CATALOGFILE</code>. <em class="replaceable"><code>TYPE</code></em>
|
| 32 |
+
indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
|
| 33 |
+
reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
|
| 34 |
+
is the <acronym class="acronym">URI</acronym> of the replacement entity to be
|
| 35 |
+
used. The <code class="option">--add</code> option will not overwrite
|
| 36 |
+
<code class="filename">CATALOGFILE</code>, outputting
|
| 37 |
+
to <code class="filename">stdout</code>, unless
|
| 38 |
+
<code class="option">--noout</code> is used. The <code class="option">--add</code> will
|
| 39 |
+
always take three parameters even if some of the <acronym class="acronym">XML</acronym>
|
| 40 |
+
catalog constructs will have only a single argument.
|
| 41 |
+
</p></dd><dt><span class="term"><code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code></span></dt><dd><p>
|
| 42 |
+
If the <code class="option">--add</code> option is used following
|
| 43 |
+
the <code class="option">--sgml</code> option, only a single argument,
|
| 44 |
+
a <em class="replaceable"><code>FILENAME</code></em>, is used. This is used to add
|
| 45 |
+
the name of a catalog file to an <acronym class="acronym">SGML</acronym> supercatalog,
|
| 46 |
+
a file that contains references to other included <acronym class="acronym">SGML</acronym>
|
| 47 |
+
catalog files.
|
| 48 |
+
</p></dd><dt><span class="term"><code class="option">--convert</code></span></dt><dd><p>
|
| 49 |
+
Convert SGML catalog to XML.
|
| 50 |
+
</p></dd><dt><span class="term"><code class="option">--create</code></span></dt><dd><p>
|
| 51 |
+
Create a new <acronym class="acronym">XML</acronym> catalog. Outputs
|
| 52 |
+
to <code class="filename">stdout</code>,
|
| 53 |
+
ignoring <em class="replaceable"><code>filename</code></em> unless <code class="option">--noout</code> is
|
| 54 |
+
used, in which case it creates a new catalog
|
| 55 |
+
file <em class="replaceable"><code>filename</code></em>.
|
| 56 |
+
</p></dd><dt><span class="term"><code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
|
| 57 |
+
Remove entries from <em class="replaceable"><code>CATALOGFILE</code></em>
|
| 58 |
+
matching <em class="replaceable"><code>VALUE(S)</code></em>. The <code class="option">--del</code>
|
| 59 |
+
option will not overwrite <em class="replaceable"><code>CATALOGFILE</code></em>,
|
| 60 |
+
outputting to <code class="filename">stdout</code>,
|
| 61 |
+
unless <code class="option">--noout</code> is used.
|
| 62 |
+
</p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
|
| 63 |
+
Save output to the named file rather than outputting
|
| 64 |
+
to <code class="filename">stdout</code>.
|
| 65 |
+
</p></dd><dt><span class="term"><code class="option">--no-super-update</code></span></dt><dd><p>
|
| 66 |
+
Do not update the <acronym class="acronym">SGML</acronym> super catalog.
|
| 67 |
+
</p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
|
| 68 |
+
Run a shell allowing interactive queries on catalog
|
| 69 |
+
file <em class="replaceable"><code>CATALOGFILE</code></em>. For the set of available
|
| 70 |
+
commands see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called “SHELL COMMANDS”</a>.
|
| 71 |
+
</p></dd><dt><span class="term"><code class="option">--sgml</code></span></dt><dd><p>
|
| 72 |
+
Uses <acronym class="acronym">SGML</acronym> super catalogs for <code class="option">--add</code>
|
| 73 |
+
and <code class="option">--del</code> options.
|
| 74 |
+
</p></dd><dt><span class="term"><code class="option">-v</code>, </span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>Output debugging information.</p></dd></dl></div><p>
|
| 75 |
+
Invoking <span class="command"><strong>xmlcatalog</strong></span> non-interactively without a designated action
|
| 76 |
+
(imposed with options like <code class="option">--add</code>) will result in a lookup
|
| 77 |
+
of the catalog entry for <em class="replaceable"><code>ENTITIES</code></em> in the
|
| 78 |
+
catalog denoted with <em class="replaceable"><code>CATALOGFILE</code></em>. The
|
| 79 |
+
corresponding entries will be output to the command line. This mode of
|
| 80 |
+
operation, together with <code class="option">--shell</code> mode and non-modifying
|
| 81 |
+
(i.e. without <code class="option">--noout</code>) direct actions, allows for
|
| 82 |
+
a special shortcut of the void <em class="replaceable"><code>CATALOGFILE</code></em>
|
| 83 |
+
specification (possibly expressed as "" in the shell
|
| 84 |
+
environment) appointing the default system catalog. That simplifies the
|
| 85 |
+
handling when its exact location is irrelevant but the respective built-in
|
| 86 |
+
still needs to be consulted.
|
| 87 |
+
</p></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
|
| 88 |
+
Invoking <span class="command"><strong>xmlcatalog</strong></span> with
|
| 89 |
+
the <code class="option">--shell <em class="replaceable"><code>CATALOGFILE</code></em></code> option opens
|
| 90 |
+
a command line shell allowing interactive access to the catalog file
|
| 91 |
+
identified by <em class="replaceable"><code>CATALOGFILE</code></em>. Invoking the shell
|
| 92 |
+
provides a command line prompt after which the following commands (described in
|
| 93 |
+
alphabetical order) can be entered.
|
| 94 |
+
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
|
| 95 |
+
<code class="option">add
|
| 96 |
+
<em class="replaceable"><code>TYPE</code></em>
|
| 97 |
+
<em class="replaceable"><code>ORIG</code></em>
|
| 98 |
+
<em class="replaceable"><code>REPLACE</code></em>
|
| 99 |
+
</code>
|
| 100 |
+
</span></dt><dd><p>
|
| 101 |
+
Add an entry to the catalog file. <em class="replaceable"><code>TYPE</code></em>
|
| 102 |
+
indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
|
| 103 |
+
reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
|
| 104 |
+
is the <acronym class="acronym">URI</acronym> of the replacement entity to be
|
| 105 |
+
used. The <code class="option">--add</code> option will not overwrite
|
| 106 |
+
<code class="filename">CATALOGFILE</code>, outputting
|
| 107 |
+
to <code class="filename">stdout</code>, unless
|
| 108 |
+
<code class="option">--noout</code> is used. The <code class="option">--add</code> will
|
| 109 |
+
always take three parameters even if some of the <acronym class="acronym">XML</acronym>
|
| 110 |
+
catalog constructs will have only a single argument.
|
| 111 |
+
</p></dd><dt><span class="term"><code class="option">debug</code></span></dt><dd><p>
|
| 112 |
+
Print debugging statements showing the steps <span class="command"><strong>xmlcatalog</strong></span> is executing.
|
| 113 |
+
</p></dd><dt><span class="term"><code class="option">del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
|
| 114 |
+
Remove the catalog entry corresponding to <em class="replaceable"><code>VALUE(S)</code></em>.
|
| 115 |
+
</p></dd><dt><span class="term"><code class="option">dump</code></span></dt><dd><p>Print the current catalog.</p></dd><dt><span class="term"><code class="option">exit</code></span></dt><dd><p>Quit the shell.</p></dd><dt><span class="term"><code class="option">public <em class="replaceable"><code>PUBLIC-ID</code></em></code></span></dt><dd><p>
|
| 116 |
+
Execute a Formal Public Identifier lookup of the catalog entry
|
| 117 |
+
for <em class="replaceable"><code>PUBLIC-ID</code></em>. The corresponding entry will be
|
| 118 |
+
output to the command line.
|
| 119 |
+
</p></dd><dt><span class="term"><code class="option">quiet</code></span></dt><dd><p>Stop printing debugging statements.</p></dd><dt><span class="term"><code class="option">system <em class="replaceable"><code>SYSTEM-ID</code></em></code></span></dt><dd><p>
|
| 120 |
+
Execute a Formal Public Identifier lookup of the catalog entry
|
| 121 |
+
for <em class="replaceable"><code>SYSTEM-ID</code></em>. The corresponding entry will be
|
| 122 |
+
output to the command line.
|
| 123 |
+
</p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
|
| 124 |
+
queries to the user's own set of catalogs. This can be done by setting
|
| 125 |
+
the <code class="envar">XML_CATALOG_FILES</code> environment variable to a space-separated
|
| 126 |
+
list of catalogs. Use percent-encoding to escape spaces or other characters.
|
| 127 |
+
An empty variable should deactivate loading the default catalog from
|
| 128 |
+
<code class="filename">/etc/xml/catalog</code> or, more specifically,
|
| 129 |
+
<code class="filename">${sysconfdir}/xml/catalog</code>.
|
| 130 |
+
</p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
|
| 131 |
+
<span class="command"><strong>xmlcatalog</strong></span> return codes provide information that can be used when
|
| 132 |
+
calling it from scripts.
|
| 133 |
+
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Failed to remove an entry from the catalog</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Failed to save to the catalog, check file permissions</p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Failed to add an entry to the catalog</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Failed to look up an entry in the catalog</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
|
| 134 |
+
</p><p>
|
| 135 |
+
More information can be found at
|
| 136 |
+
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2" target="_top">https://gitlab.gnome.org/GNOME/libxml2</a>
|
| 137 |
+
</p></li><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> catalog support web page
|
| 138 |
+
at <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support" target="_top">https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support</a>
|
| 139 |
+
</p></li><li class="listitem"><p>James Clark's <acronym class="acronym">SGML</acronym> catalog
|
| 140 |
+
page <a class="ulink" href="http://www.jclark.com/sp/catalog.htm" target="_top">http://www.jclark.com/sp/catalog.htm</a>
|
| 141 |
+
</p></li><li class="listitem"><p><acronym class="acronym">OASIS</acronym> <acronym class="acronym">XML</acronym> catalog specification
|
| 142 |
+
<a class="ulink" href="http://www.oasis-open.org/committees/entity/spec.html" target="_top">http://www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pages/docbook.xsl"?>
|
| 4 |
+
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
| 5 |
+
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
|
| 6 |
+
|
| 7 |
+
<!ENTITY xmlcatalog "<command>xmlcatalog</command>">
|
| 8 |
+
]>
|
| 9 |
+
|
| 10 |
+
<refentry>
|
| 11 |
+
|
| 12 |
+
<refentryinfo>
|
| 13 |
+
<title>xmlcatalog Manual</title>
|
| 14 |
+
<productname>libxml2</productname>
|
| 15 |
+
<copyright>
|
| 16 |
+
<year>2001</year>
|
| 17 |
+
<year>2004</year>
|
| 18 |
+
</copyright>
|
| 19 |
+
<author>
|
| 20 |
+
<firstname>John</firstname>
|
| 21 |
+
<surname>Fleck</surname>
|
| 22 |
+
<affiliation>
|
| 23 |
+
<address>
|
| 24 |
+
<email>jfleck@inkstain.net</email>
|
| 25 |
+
</address>
|
| 26 |
+
</affiliation>
|
| 27 |
+
</author>
|
| 28 |
+
<!-- still a bit buggy output, will talk to docbook-xsl upstream to fix this -->
|
| 29 |
+
<!-- <releaseinfo>This is release 0.3 of the xmlcatalog Manual.</releaseinfo> -->
|
| 30 |
+
<!-- <edition>0.3</edition> -->
|
| 31 |
+
</refentryinfo>
|
| 32 |
+
|
| 33 |
+
<refmeta>
|
| 34 |
+
<refentrytitle>xmlcatalog</refentrytitle>
|
| 35 |
+
<manvolnum>1</manvolnum>
|
| 36 |
+
</refmeta>
|
| 37 |
+
|
| 38 |
+
<refnamediv>
|
| 39 |
+
<refname>xmlcatalog</refname>
|
| 40 |
+
<refpurpose>
|
| 41 |
+
Command line tool to parse and manipulate <acronym>XML</acronym>
|
| 42 |
+
or <acronym>SGML</acronym> catalog files.
|
| 43 |
+
</refpurpose>
|
| 44 |
+
</refnamediv>
|
| 45 |
+
|
| 46 |
+
<refsynopsisdiv>
|
| 47 |
+
<cmdsynopsis>
|
| 48 |
+
<command>xmlcatalog</command>
|
| 49 |
+
<group choice="opt">
|
| 50 |
+
<arg choice="plain"><option>--sgml</option></arg>
|
| 51 |
+
<arg choice="plain"><option>--shell</option></arg>
|
| 52 |
+
<arg choice="plain"><option>--convert</option></arg>
|
| 53 |
+
<arg choice="plain"><option>--create</option></arg>
|
| 54 |
+
<arg choice="plain"><option>--del <replaceable>VALUE(S)</replaceable></option></arg>
|
| 55 |
+
<arg choice="plain">
|
| 56 |
+
<group choice="opt">
|
| 57 |
+
<arg choice="plain">
|
| 58 |
+
<option>--add
|
| 59 |
+
<replaceable>TYPE</replaceable>
|
| 60 |
+
<replaceable>ORIG</replaceable>
|
| 61 |
+
<replaceable>REPLACE</replaceable>
|
| 62 |
+
</option>
|
| 63 |
+
</arg>
|
| 64 |
+
<arg choice="plain"><option>--add <replaceable>FILENAME</replaceable></option></arg>
|
| 65 |
+
</group>
|
| 66 |
+
</arg>
|
| 67 |
+
<arg choice="plain"><option>--noout</option></arg>
|
| 68 |
+
<arg choice="plain"><option>--no-super-update</option></arg>
|
| 69 |
+
<arg choice="plain">
|
| 70 |
+
<group choice="opt">
|
| 71 |
+
<arg choice="plain"><option>-v</option></arg>
|
| 72 |
+
<arg choice="plain"><option>--verbose</option></arg>
|
| 73 |
+
</group>
|
| 74 |
+
</arg>
|
| 75 |
+
</group>
|
| 76 |
+
<arg choice="req" rep="norepeat"><replaceable>CATALOGFILE</replaceable></arg>
|
| 77 |
+
<arg choice="req" rep="repeat"><replaceable>ENTITIES</replaceable></arg>
|
| 78 |
+
</cmdsynopsis>
|
| 79 |
+
</refsynopsisdiv>
|
| 80 |
+
|
| 81 |
+
<refsect1 id="description">
|
| 82 |
+
<title>DESCRIPTION</title>
|
| 83 |
+
<para>
|
| 84 |
+
&xmlcatalog; is a command line application allowing users to monitor and
|
| 85 |
+
manipulate <acronym>XML</acronym> and <acronym>SGML</acronym> catalogs. It
|
| 86 |
+
is included in <citerefentry>
|
| 87 |
+
<refentrytitle>libxml</refentrytitle>
|
| 88 |
+
<manvolnum>3</manvolnum>
|
| 89 |
+
</citerefentry>.
|
| 90 |
+
</para>
|
| 91 |
+
<para>
|
| 92 |
+
Its functions can be invoked from a single command from the command line,
|
| 93 |
+
or it can perform multiple functions in interactive mode. It can operate
|
| 94 |
+
on both <acronym>XML</acronym> and <acronym>SGML</acronym> files.
|
| 95 |
+
</para>
|
| 96 |
+
</refsect1>
|
| 97 |
+
|
| 98 |
+
<refsect1 id="options">
|
| 99 |
+
<title>OPTIONS</title>
|
| 100 |
+
<para>
|
| 101 |
+
&xmlcatalog; accepts the following options (in alphabetical order):
|
| 102 |
+
</para>
|
| 103 |
+
|
| 104 |
+
<variablelist>
|
| 105 |
+
|
| 106 |
+
<varlistentry>
|
| 107 |
+
<term>
|
| 108 |
+
<option>--add
|
| 109 |
+
<replaceable>TYPE</replaceable>
|
| 110 |
+
<replaceable>ORIG</replaceable>
|
| 111 |
+
<replaceable>REPLACE</replaceable>
|
| 112 |
+
</option>
|
| 113 |
+
</term>
|
| 114 |
+
<listitem>
|
| 115 |
+
<para>
|
| 116 |
+
Add an entry to <filename>CATALOGFILE</filename>. <replaceable>TYPE</replaceable>
|
| 117 |
+
indicates the type of entry. Possible types are: <simplelist type="inline">
|
| 118 |
+
<member><parameter>public</parameter></member>
|
| 119 |
+
<member><parameter>system</parameter></member>
|
| 120 |
+
<member><parameter>uri</parameter></member>
|
| 121 |
+
<member><parameter>rewriteSystem</parameter></member>
|
| 122 |
+
<member><parameter>rewriteURI</parameter></member>
|
| 123 |
+
<member><parameter>delegatePublic</parameter></member>
|
| 124 |
+
<member><parameter>delegateSystem</parameter></member>
|
| 125 |
+
<member><parameter>delegateURI</parameter></member>
|
| 126 |
+
<member><parameter>nextCatalog</parameter></member>
|
| 127 |
+
</simplelist>. <replaceable>ORIG</replaceable> is the original
|
| 128 |
+
reference to be replaced, and <replaceable>REPLACE</replaceable>
|
| 129 |
+
is the <acronym>URI</acronym> of the replacement entity to be
|
| 130 |
+
used. The <option>--add</option> option will not overwrite
|
| 131 |
+
<filename>CATALOGFILE</filename>, outputting
|
| 132 |
+
to <filename class="devicefile">stdout</filename>, unless
|
| 133 |
+
<option>--noout</option> is used. The <option>--add</option> will
|
| 134 |
+
always take three parameters even if some of the <acronym>XML</acronym>
|
| 135 |
+
catalog constructs will have only a single argument.
|
| 136 |
+
</para>
|
| 137 |
+
<!--
|
| 138 |
+
FIXME - Is my list of possible types correct? Are SGML types the same?
|
| 139 |
+
-->
|
| 140 |
+
</listitem>
|
| 141 |
+
</varlistentry>
|
| 142 |
+
|
| 143 |
+
<varlistentry>
|
| 144 |
+
<term><option>--add <replaceable>FILENAME</replaceable></option></term>
|
| 145 |
+
<listitem>
|
| 146 |
+
<para>
|
| 147 |
+
If the <option>--add</option> option is used following
|
| 148 |
+
the <option>--sgml</option> option, only a single argument,
|
| 149 |
+
a <replaceable>FILENAME</replaceable>, is used. This is used to add
|
| 150 |
+
the name of a catalog file to an <acronym>SGML</acronym> supercatalog,
|
| 151 |
+
a file that contains references to other included <acronym>SGML</acronym>
|
| 152 |
+
catalog files.
|
| 153 |
+
</para>
|
| 154 |
+
</listitem>
|
| 155 |
+
</varlistentry>
|
| 156 |
+
|
| 157 |
+
<varlistentry>
|
| 158 |
+
<term><option>--convert</option></term>
|
| 159 |
+
<listitem>
|
| 160 |
+
<para>
|
| 161 |
+
Convert SGML catalog to XML.
|
| 162 |
+
</para>
|
| 163 |
+
</listitem>
|
| 164 |
+
</varlistentry>
|
| 165 |
+
|
| 166 |
+
<varlistentry>
|
| 167 |
+
<term><option>--create</option></term>
|
| 168 |
+
<listitem>
|
| 169 |
+
<para>
|
| 170 |
+
Create a new <acronym>XML</acronym> catalog. Outputs
|
| 171 |
+
to <filename class="devicefile">stdout</filename>,
|
| 172 |
+
ignoring <replaceable>filename</replaceable> unless <option>--noout</option> is
|
| 173 |
+
used, in which case it creates a new catalog
|
| 174 |
+
file <replaceable>filename</replaceable>.
|
| 175 |
+
</para>
|
| 176 |
+
</listitem>
|
| 177 |
+
</varlistentry>
|
| 178 |
+
|
| 179 |
+
<varlistentry>
|
| 180 |
+
<term><option>--del <replaceable>VALUE(S)</replaceable></option></term>
|
| 181 |
+
<listitem>
|
| 182 |
+
<para>
|
| 183 |
+
Remove entries from <replaceable>CATALOGFILE</replaceable>
|
| 184 |
+
matching <replaceable>VALUE(S)</replaceable>. The <option>--del</option>
|
| 185 |
+
option will not overwrite <replaceable>CATALOGFILE</replaceable>,
|
| 186 |
+
outputting to <filename class="devicefile">stdout</filename>,
|
| 187 |
+
unless <option>--noout</option> is used.
|
| 188 |
+
</para>
|
| 189 |
+
</listitem>
|
| 190 |
+
</varlistentry>
|
| 191 |
+
|
| 192 |
+
<varlistentry>
|
| 193 |
+
<term><option>--noout</option></term>
|
| 194 |
+
<listitem>
|
| 195 |
+
<para>
|
| 196 |
+
Save output to the named file rather than outputting
|
| 197 |
+
to <filename class="devicefile">stdout</filename>.
|
| 198 |
+
</para>
|
| 199 |
+
</listitem>
|
| 200 |
+
</varlistentry>
|
| 201 |
+
|
| 202 |
+
<varlistentry>
|
| 203 |
+
<term><option>--no-super-update</option></term>
|
| 204 |
+
<listitem>
|
| 205 |
+
<para>
|
| 206 |
+
Do not update the <acronym>SGML</acronym> super catalog.
|
| 207 |
+
</para>
|
| 208 |
+
</listitem>
|
| 209 |
+
</varlistentry>
|
| 210 |
+
|
| 211 |
+
<varlistentry>
|
| 212 |
+
<term><option>--shell</option></term>
|
| 213 |
+
<listitem>
|
| 214 |
+
<para>
|
| 215 |
+
Run a shell allowing interactive queries on catalog
|
| 216 |
+
file <replaceable>CATALOGFILE</replaceable>. For the set of available
|
| 217 |
+
commands see <xref linkend="shell"/>.
|
| 218 |
+
</para>
|
| 219 |
+
</listitem>
|
| 220 |
+
</varlistentry>
|
| 221 |
+
|
| 222 |
+
<varlistentry>
|
| 223 |
+
<term><option>--sgml</option></term>
|
| 224 |
+
<listitem>
|
| 225 |
+
<para>
|
| 226 |
+
Uses <acronym>SGML</acronym> super catalogs for <option>--add</option>
|
| 227 |
+
and <option>--del</option> options.
|
| 228 |
+
</para>
|
| 229 |
+
</listitem>
|
| 230 |
+
</varlistentry>
|
| 231 |
+
|
| 232 |
+
<varlistentry>
|
| 233 |
+
<term><option>-v</option></term>
|
| 234 |
+
<term><option>--verbose</option></term>
|
| 235 |
+
<listitem>
|
| 236 |
+
<para>Output debugging information.</para>
|
| 237 |
+
</listitem>
|
| 238 |
+
</varlistentry>
|
| 239 |
+
|
| 240 |
+
</variablelist>
|
| 241 |
+
|
| 242 |
+
<para>
|
| 243 |
+
Invoking &xmlcatalog; non-interactively without a designated action
|
| 244 |
+
(imposed with options like <option>--add</option>) will result in a lookup
|
| 245 |
+
of the catalog entry for <replaceable>ENTITIES</replaceable> in the
|
| 246 |
+
catalog denoted with <replaceable>CATALOGFILE</replaceable>. The
|
| 247 |
+
corresponding entries will be output to the command line. This mode of
|
| 248 |
+
operation, together with <option>--shell</option> mode and non-modifying
|
| 249 |
+
(i.e. without <option>--noout</option>) direct actions, allows for
|
| 250 |
+
a special shortcut of the void <replaceable>CATALOGFILE</replaceable>
|
| 251 |
+
specification (possibly expressed as "" in the shell
|
| 252 |
+
environment) appointing the default system catalog. That simplifies the
|
| 253 |
+
handling when its exact location is irrelevant but the respective built-in
|
| 254 |
+
still needs to be consulted.
|
| 255 |
+
</para>
|
| 256 |
+
</refsect1>
|
| 257 |
+
|
| 258 |
+
<refsect1 id="shell">
|
| 259 |
+
<title>SHELL COMMANDS</title>
|
| 260 |
+
<para>
|
| 261 |
+
Invoking &xmlcatalog; with
|
| 262 |
+
the <option>--shell <replaceable>CATALOGFILE</replaceable></option> option opens
|
| 263 |
+
a command line shell allowing interactive access to the catalog file
|
| 264 |
+
identified by <replaceable>CATALOGFILE</replaceable>. Invoking the shell
|
| 265 |
+
provides a command line prompt after which the following commands (described in
|
| 266 |
+
alphabetical order) can be entered.
|
| 267 |
+
</para>
|
| 268 |
+
|
| 269 |
+
<variablelist>
|
| 270 |
+
|
| 271 |
+
<varlistentry>
|
| 272 |
+
<term>
|
| 273 |
+
<option>add
|
| 274 |
+
<replaceable>TYPE</replaceable>
|
| 275 |
+
<replaceable>ORIG</replaceable>
|
| 276 |
+
<replaceable>REPLACE</replaceable>
|
| 277 |
+
</option>
|
| 278 |
+
</term>
|
| 279 |
+
<listitem>
|
| 280 |
+
<para>
|
| 281 |
+
Add an entry to the catalog file. <replaceable>TYPE</replaceable>
|
| 282 |
+
indicates the type of entry. Possible types are: <simplelist type="inline">
|
| 283 |
+
<member><parameter>public</parameter></member>
|
| 284 |
+
<member><parameter>system</parameter></member>
|
| 285 |
+
<member><parameter>uri</parameter></member>
|
| 286 |
+
<member><parameter>rewriteSystem</parameter></member>
|
| 287 |
+
<member><parameter>rewriteURI</parameter></member>
|
| 288 |
+
<member><parameter>delegatePublic</parameter></member>
|
| 289 |
+
<member><parameter>delegateSystem</parameter></member>
|
| 290 |
+
<member><parameter>delegateURI</parameter></member>
|
| 291 |
+
<member><parameter>nextCatalog</parameter></member>
|
| 292 |
+
</simplelist>. <replaceable>ORIG</replaceable> is the original
|
| 293 |
+
reference to be replaced, and <replaceable>REPLACE</replaceable>
|
| 294 |
+
is the <acronym>URI</acronym> of the replacement entity to be
|
| 295 |
+
used. The <option>--add</option> option will not overwrite
|
| 296 |
+
<filename>CATALOGFILE</filename>, outputting
|
| 297 |
+
to <filename class="devicefile">stdout</filename>, unless
|
| 298 |
+
<option>--noout</option> is used. The <option>--add</option> will
|
| 299 |
+
always take three parameters even if some of the <acronym>XML</acronym>
|
| 300 |
+
catalog constructs will have only a single argument.
|
| 301 |
+
</para>
|
| 302 |
+
</listitem>
|
| 303 |
+
</varlistentry>
|
| 304 |
+
|
| 305 |
+
<varlistentry>
|
| 306 |
+
<term><option>debug</option></term>
|
| 307 |
+
<listitem>
|
| 308 |
+
<para>
|
| 309 |
+
Print debugging statements showing the steps &xmlcatalog; is executing.
|
| 310 |
+
</para>
|
| 311 |
+
</listitem>
|
| 312 |
+
</varlistentry>
|
| 313 |
+
|
| 314 |
+
<varlistentry>
|
| 315 |
+
<term><option>del <replaceable>VALUE(S)</replaceable></option></term>
|
| 316 |
+
<listitem>
|
| 317 |
+
<para>
|
| 318 |
+
Remove the catalog entry corresponding to <replaceable>VALUE(S)</replaceable>.
|
| 319 |
+
</para>
|
| 320 |
+
</listitem>
|
| 321 |
+
</varlistentry>
|
| 322 |
+
|
| 323 |
+
<varlistentry>
|
| 324 |
+
<term><option>dump</option></term>
|
| 325 |
+
<listitem>
|
| 326 |
+
<para>Print the current catalog.</para>
|
| 327 |
+
</listitem>
|
| 328 |
+
</varlistentry>
|
| 329 |
+
|
| 330 |
+
<varlistentry>
|
| 331 |
+
<term><option>exit</option></term>
|
| 332 |
+
<listitem>
|
| 333 |
+
<para>Quit the shell.</para>
|
| 334 |
+
</listitem>
|
| 335 |
+
</varlistentry>
|
| 336 |
+
|
| 337 |
+
<varlistentry>
|
| 338 |
+
<term><option>public <replaceable>PUBLIC-ID</replaceable></option></term>
|
| 339 |
+
<listitem>
|
| 340 |
+
<para>
|
| 341 |
+
Execute a Formal Public Identifier lookup of the catalog entry
|
| 342 |
+
for <replaceable>PUBLIC-ID</replaceable>. The corresponding entry will be
|
| 343 |
+
output to the command line.
|
| 344 |
+
</para>
|
| 345 |
+
</listitem>
|
| 346 |
+
</varlistentry>
|
| 347 |
+
|
| 348 |
+
<varlistentry>
|
| 349 |
+
<term><option>quiet</option></term>
|
| 350 |
+
<listitem>
|
| 351 |
+
<para>Stop printing debugging statements.</para>
|
| 352 |
+
</listitem>
|
| 353 |
+
</varlistentry>
|
| 354 |
+
|
| 355 |
+
<varlistentry>
|
| 356 |
+
<term><option>system <replaceable>SYSTEM-ID</replaceable></option></term>
|
| 357 |
+
<listitem>
|
| 358 |
+
<para>
|
| 359 |
+
Execute a Formal Public Identifier lookup of the catalog entry
|
| 360 |
+
for <replaceable>SYSTEM-ID</replaceable>. The corresponding entry will be
|
| 361 |
+
output to the command line.
|
| 362 |
+
</para>
|
| 363 |
+
</listitem>
|
| 364 |
+
</varlistentry>
|
| 365 |
+
|
| 366 |
+
</variablelist>
|
| 367 |
+
</refsect1>
|
| 368 |
+
|
| 369 |
+
<refsect1 id="environment">
|
| 370 |
+
<title>ENVIRONMENT</title>
|
| 371 |
+
<variablelist>
|
| 372 |
+
|
| 373 |
+
<varlistentry>
|
| 374 |
+
<term><envar>XML_CATALOG_FILES</envar></term>
|
| 375 |
+
<listitem>
|
| 376 |
+
<para><acronym>XML</acronym> catalog behavior can be changed by redirecting
|
| 377 |
+
queries to the user's own set of catalogs. This can be done by setting
|
| 378 |
+
the <envar>XML_CATALOG_FILES</envar> environment variable to a space-separated
|
| 379 |
+
list of catalogs. Use percent-encoding to escape spaces or other characters.
|
| 380 |
+
An empty variable should deactivate loading the default catalog from
|
| 381 |
+
<filename>/etc/xml/catalog</filename> or, more specifically,
|
| 382 |
+
<filename>${sysconfdir}/xml/catalog</filename>.
|
| 383 |
+
</para>
|
| 384 |
+
</listitem>
|
| 385 |
+
</varlistentry>
|
| 386 |
+
|
| 387 |
+
</variablelist>
|
| 388 |
+
</refsect1>
|
| 389 |
+
|
| 390 |
+
<refsect1 id="diagnostics">
|
| 391 |
+
<title>DIAGNOSTICS</title>
|
| 392 |
+
<para>
|
| 393 |
+
&xmlcatalog; return codes provide information that can be used when
|
| 394 |
+
calling it from scripts.
|
| 395 |
+
</para>
|
| 396 |
+
<variablelist>
|
| 397 |
+
|
| 398 |
+
<varlistentry>
|
| 399 |
+
<term><errorcode>0</errorcode></term>
|
| 400 |
+
<listitem>
|
| 401 |
+
<para>No error</para>
|
| 402 |
+
</listitem>
|
| 403 |
+
</varlistentry>
|
| 404 |
+
|
| 405 |
+
<varlistentry>
|
| 406 |
+
<term><errorcode>1</errorcode></term>
|
| 407 |
+
<listitem>
|
| 408 |
+
<para>Failed to remove an entry from the catalog</para>
|
| 409 |
+
</listitem>
|
| 410 |
+
</varlistentry>
|
| 411 |
+
|
| 412 |
+
<varlistentry>
|
| 413 |
+
<term><errorcode>2</errorcode></term>
|
| 414 |
+
<listitem>
|
| 415 |
+
<para>Failed to save to the catalog, check file permissions</para>
|
| 416 |
+
</listitem>
|
| 417 |
+
</varlistentry>
|
| 418 |
+
|
| 419 |
+
<varlistentry>
|
| 420 |
+
<term><errorcode>3</errorcode></term>
|
| 421 |
+
<listitem>
|
| 422 |
+
<para>Failed to add an entry to the catalog</para>
|
| 423 |
+
</listitem>
|
| 424 |
+
</varlistentry>
|
| 425 |
+
|
| 426 |
+
<varlistentry>
|
| 427 |
+
<term><errorcode>4</errorcode></term>
|
| 428 |
+
<listitem>
|
| 429 |
+
<para>Failed to look up an entry in the catalog</para>
|
| 430 |
+
</listitem>
|
| 431 |
+
</varlistentry>
|
| 432 |
+
|
| 433 |
+
</variablelist>
|
| 434 |
+
</refsect1>
|
| 435 |
+
|
| 436 |
+
<refsect1 id="seealso">
|
| 437 |
+
<title>SEE ALSO</title>
|
| 438 |
+
<para><citerefentry>
|
| 439 |
+
<refentrytitle>libxml</refentrytitle>
|
| 440 |
+
<manvolnum>3</manvolnum>
|
| 441 |
+
</citerefentry>
|
| 442 |
+
</para>
|
| 443 |
+
<para>
|
| 444 |
+
More information can be found at
|
| 445 |
+
<itemizedlist>
|
| 446 |
+
<listitem>
|
| 447 |
+
<para><citerefentry>
|
| 448 |
+
<refentrytitle>libxml</refentrytitle>
|
| 449 |
+
<manvolnum>3</manvolnum>
|
| 450 |
+
</citerefentry> web page <ulink url="https://gitlab.gnome.org/GNOME/libxml2"/>
|
| 451 |
+
</para>
|
| 452 |
+
</listitem>
|
| 453 |
+
<listitem>
|
| 454 |
+
<para><citerefentry>
|
| 455 |
+
<refentrytitle>libxml</refentrytitle>
|
| 456 |
+
<manvolnum>3</manvolnum>
|
| 457 |
+
</citerefentry> catalog support web page
|
| 458 |
+
at <ulink url="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support"/>
|
| 459 |
+
</para>
|
| 460 |
+
</listitem>
|
| 461 |
+
<listitem>
|
| 462 |
+
<para>James Clark's <acronym>SGML</acronym> catalog
|
| 463 |
+
page <ulink url="http://www.jclark.com/sp/catalog.htm"/>
|
| 464 |
+
</para>
|
| 465 |
+
</listitem>
|
| 466 |
+
<listitem>
|
| 467 |
+
<para><acronym>OASIS</acronym> <acronym>XML</acronym> catalog specification
|
| 468 |
+
<ulink url="http://www.oasis-open.org/committees/entity/spec.html"/>
|
| 469 |
+
</para>
|
| 470 |
+
</listitem>
|
| 471 |
+
</itemizedlist>
|
| 472 |
+
</para>
|
| 473 |
+
</refsect1>
|
| 474 |
+
|
| 475 |
+
</refentry>
|
local-test-libxml2-delta-02/afc-libxml2/doc/xmllint.html
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmllint</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="id1337"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmllint — command line <acronym class="acronym">XML</acronym> tool</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmllint</code> [ <code class="option">--version</code> | <code class="option">--debug</code> | <code class="option">--quiet</code> | <code class="option">--shell</code> | <code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code> | <code class="option">--debugent</code> | <code class="option">--copy</code> | <code class="option">--recover</code> | <code class="option">--huge</code> | <code class="option">--nocompact</code> | <code class="option">--nodefdtd</code> | <code class="option">--nodict</code> | <code class="option">--noenc</code> | <code class="option">--noent</code> | <code class="option">--nofixup-base-uris</code> | <code class="option">--noout</code> | <code class="option">--nonet</code> | <code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code> | <code class="option">--load-trace</code> | <code class="option">--htmlout</code> | <code class="option">--nowrap</code> | <code class="option">--valid</code> | <code class="option">--postvalid</code> | <code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code> | <code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code> | <code class="option">--timing</code> | <code class="option">--output <em class="replaceable"><code>FILE</code></em></code> | <code class="option">--repeat</code> | <code class="option">--insert</code> | <code class="option">--compress</code> | <code class="option">--html</code> | <code class="option">--xmlout</code> | <code class="option">--push</code> | <code class="option">--memory</code> | <code class="option">--max-ampl <em class="replaceable"><code>INTEGER</code></em></code> | <code class="option">--maxmem <em class="replaceable"><code>NBBYTES</code></em></code> | <code class="option">--nowarning</code> | <code class="option">--noblanks</code> | <code class="option">--nocdata</code> | <code class="option">--format</code> | <code class="option">--pretty <em class="replaceable"><code>INTEGER</code></em></code> | <code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code> | <code class="option">--dropdtd</code> | <code class="option">--nsclean</code> | <code class="option">--testIO</code> | <code class="option">--catalogs</code> | <code class="option">--nocatalogs</code> | <code class="option">--auto</code> | <code class="option">--xinclude</code> | <code class="option">--noxincludenode</code> | <code class="option">--loaddtd</code> | <code class="option">--dtdattr</code> | <code class="option">--stream</code> | <code class="option">--walker</code> | <code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code> | <code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code> | <code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code> | <code class="option">--schematron <em class="replaceable"><code>SCHEMA</code></em></code> | <code class="option">--c14n</code> | <code class="option">--c14n11</code> | <code class="option">--exc-c14n</code> | <code class="option">--pedantic</code> | <code class="option">--sax</code> | <code class="option">--sax1</code> | <code class="option">--oldxml10</code> ] { <em class="replaceable"><code>XML-FILE(S)</code></em>... | - }</p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
|
| 2 |
+
The <span class="command"><strong>xmllint</strong></span> program parses one or more <acronym class="acronym">XML</acronym> files,
|
| 3 |
+
specified on the command line as <em class="replaceable"><code>XML-FILE</code></em>
|
| 4 |
+
(or the standard input if the filename provided
|
| 5 |
+
is <span class="bold"><strong>-</strong></span> ). It prints various types of
|
| 6 |
+
output, depending upon the options selected. It is useful for detecting
|
| 7 |
+
errors both in <acronym class="acronym">XML</acronym> code and in
|
| 8 |
+
the <acronym class="acronym">XML</acronym> parser itself.
|
| 9 |
+
</p><p><span class="command"><strong>xmllint</strong></span> is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.</p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
|
| 10 |
+
<span class="command"><strong>xmllint</strong></span> accepts the following options (in alphabetical order):
|
| 11 |
+
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--auto</code></span></dt><dd><p>Generate a small document for testing purposes.</p></dd><dt><span class="term"><code class="option">--catalogs</code></span></dt><dd><p>
|
| 12 |
+
Use the <acronym class="acronym">SGML</acronym> catalog(s) from <code class="envar">SGML_CATALOG_FILES</code>.
|
| 13 |
+
Otherwise <acronym class="acronym">XML</acronym> catalogs starting
|
| 14 |
+
from <code class="filename">/etc/xml/catalog</code> or, more specifically,
|
| 15 |
+
<code class="filename">${sysconfdir}/xml/catalog</code> are used by default.
|
| 16 |
+
</p></dd><dt><span class="term"><code class="option">--compress</code></span></dt><dd><p>
|
| 17 |
+
Turn on <span class="citerefentry"><span class="refentrytitle">gzip</span>(1)</span> compression of output.
|
| 18 |
+
</p></dd><dt><span class="term"><code class="option">--copy</code></span></dt><dd><p>Test the internal copy implementation.</p></dd><dt><span class="term"><code class="option">--c14n</code>, </span><span class="term"><code class="option">--c14n11</code>, </span><span class="term"><code class="option">--exc-c14n</code></span></dt><dd><p>
|
| 19 |
+
Use the W3C <acronym class="acronym">XML</acronym> Canonicalisation (<acronym class="acronym">C14N</acronym>) to
|
| 20 |
+
serialize the result of parsing to <code class="filename">stdout</code>.
|
| 21 |
+
It keeps comments in the result.
|
| 22 |
+
</p></dd><dt><span class="term"><code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code></span></dt><dd><p>
|
| 23 |
+
Use the <acronym class="acronym">DTD</acronym> specified by
|
| 24 |
+
an <em class="replaceable"><code>URL</code></em> for validation.
|
| 25 |
+
</p></dd><dt><span class="term"><code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code></span></dt><dd><p>
|
| 26 |
+
Use the <acronym class="acronym">DTD</acronym> specified by a Formal Public
|
| 27 |
+
Identifier <em class="replaceable"><code>FPI</code></em> for validation, note that this
|
| 28 |
+
will require a catalog exporting that Formal Public Identifier to work.
|
| 29 |
+
</p></dd><dt><span class="term"><code class="option">--debug</code></span></dt><dd><p>
|
| 30 |
+
Parse a file and output an annotated tree of the
|
| 31 |
+
in-memory version of the document.
|
| 32 |
+
</p></dd><dt><span class="term"><code class="option">--debugent</code></span></dt><dd><p>Debug the entities defined in the document.</p></dd><dt><span class="term"><code class="option">--dropdtd</code></span></dt><dd><p>Remove <acronym class="acronym">DTD</acronym> from output.</p></dd><dt><span class="term"><code class="option">--dtdattr</code></span></dt><dd><p>
|
| 33 |
+
Fetch external <acronym class="acronym">DTD</acronym> and populate the tree with
|
| 34 |
+
inherited attributes.
|
| 35 |
+
</p></dd><dt><span class="term"><code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code></span></dt><dd><p>Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.</p></dd><dt><span class="term"><code class="option">--format</code></span></dt><dd><p>
|
| 36 |
+
Reformat and reindent the output. The <code class="envar">XMLLINT_INDENT</code>
|
| 37 |
+
environment variable controls the indentation. The default value is two
|
| 38 |
+
spaces " ").
|
| 39 |
+
</p></dd><dt><span class="term"><code class="option">--html</code></span></dt><dd><p>Use the <acronym class="acronym">HTML</acronym> parser.</p></dd><dt><span class="term"><code class="option">--htmlout</code></span></dt><dd><p>
|
| 40 |
+
Output results as an <acronym class="acronym">HTML</acronym> file. This
|
| 41 |
+
causes <span class="command"><strong>xmllint</strong></span> to output the necessary <acronym class="acronym">HTML</acronym>
|
| 42 |
+
tags surrounding the result tree output so the results can be
|
| 43 |
+
displayed/viewed in a browser.
|
| 44 |
+
</p></dd><dt><span class="term"><code class="option">--huge</code></span></dt><dd><p>Ignore some hardcoded parser limits.</p></dd><dt><span class="term"><code class="option">--insert</code></span></dt><dd><p>Test for valid insertions.</p></dd><dt><span class="term"><code class="option">--loaddtd</code></span></dt><dd><p>Fetch an external <acronym class="acronym">DTD</acronym>.</p></dd><dt><span class="term"><code class="option">--load-trace</code></span></dt><dd><p>
|
| 45 |
+
Display all the documents loaded during the processing
|
| 46 |
+
to <code class="filename">stderr</code>.
|
| 47 |
+
</p></dd><dt><span class="term"><code class="option">--max-ampl <em class="replaceable"><code>INTEGER</code></em></code></span></dt><dd><p>
|
| 48 |
+
Set the maximum amplification factor which protects against
|
| 49 |
+
exponential entity expansion ("billion laughs"). The default value
|
| 50 |
+
is 5. Documents making heavy use of entity expansion may require a
|
| 51 |
+
higher value.
|
| 52 |
+
</p></dd><dt><span class="term"><code class="option">--maxmem <em class="replaceable"><code>NNBYTES</code></em></code></span></dt><dd><p>
|
| 53 |
+
Test the parser memory support. <em class="replaceable"><code>NNBYTES</code></em>
|
| 54 |
+
is the maximum number of bytes the library is allowed to allocate.
|
| 55 |
+
This can also be used to make sure batch processing
|
| 56 |
+
of <acronym class="acronym">XML</acronym> files will not exhaust the virtual memory
|
| 57 |
+
of the server running them.
|
| 58 |
+
</p></dd><dt><span class="term"><code class="option">--memory</code></span></dt><dd><p>Parse from memory.</p></dd><dt><span class="term"><code class="option">--noblanks</code></span></dt><dd><p>Drop ignorable blank spaces.</p></dd><dt><span class="term"><code class="option">--nocatalogs</code></span></dt><dd><p>Do not use any catalogs.</p></dd><dt><span class="term"><code class="option">--nocdata</code></span></dt><dd><p>Substitute CDATA section by equivalent text nodes.</p></dd><dt><span class="term"><code class="option">--nocompact</code></span></dt><dd><p>
|
| 59 |
+
Do not generate compact text nodes (parser option
|
| 60 |
+
XML_PARSE_COMPACT). Only for debugging.
|
| 61 |
+
</p></dd><dt><span class="term"><code class="option">--nodefdtd</code></span></dt><dd><p>
|
| 62 |
+
Do not set default HTML doctype (parser option
|
| 63 |
+
HTML_PARSE_NODEFDTD).
|
| 64 |
+
</p></dd><dt><span class="term"><code class="option">--nodict</code></span></dt><dd><p>
|
| 65 |
+
Don't use dictionaries (parser option XML_PARSE_NODICT).
|
| 66 |
+
Only for debugging.
|
| 67 |
+
</p></dd><dt><span class="term"><code class="option">--noenc</code></span></dt><dd><p>
|
| 68 |
+
Ignore encoding declaration (parser option
|
| 69 |
+
XML_PARSE_IGNORE_ENC).
|
| 70 |
+
</p></dd><dt><span class="term"><code class="option">--noent</code></span></dt><dd><p>
|
| 71 |
+
Substitute entity values for entity references. By default, <span class="command"><strong>xmllint</strong></span>
|
| 72 |
+
leaves entity references in place.
|
| 73 |
+
</p></dd><dt><span class="term"><code class="option">--nofixup-base-uris</code></span></dt><dd><p>
|
| 74 |
+
Don't fix xml:base URIs when processing XIncludes
|
| 75 |
+
(parser option XML_PARSE_NOBASEFIX).
|
| 76 |
+
</p></dd><dt><span class="term"><code class="option">--nonet</code></span></dt><dd><p>
|
| 77 |
+
Do not use the Internet to fetch <acronym class="acronym">DTD</acronym>s or entities.
|
| 78 |
+
</p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
|
| 79 |
+
Suppress output. By default, <span class="command"><strong>xmllint</strong></span> outputs the result tree.
|
| 80 |
+
</p></dd><dt><span class="term"><code class="option">--nowarning</code></span></dt><dd><p>Do not emit warnings from the parser and/or validator.</p></dd><dt><span class="term"><code class="option">--nowrap</code></span></dt><dd><p>Do not output <acronym class="acronym">HTML</acronym> doc wrapper.</p></dd><dt><span class="term"><code class="option">--noxincludenode</code></span></dt><dd><p>
|
| 81 |
+
Do XInclude processing but do not generate XInclude start and end nodes.
|
| 82 |
+
</p></dd><dt><span class="term"><code class="option">--nsclean</code></span></dt><dd><p>Remove redundant namespace declarations.</p></dd><dt><span class="term"><code class="option">--oldxml10</code></span></dt><dd><p>
|
| 83 |
+
Use deprecated parsing rules before XML 1.0,
|
| 84 |
+
5th edition.
|
| 85 |
+
</p></dd><dt><span class="term"><code class="option">--output <em class="replaceable"><code>FILE</code></em></code></span></dt><dd><p>
|
| 86 |
+
Define a file path where <span class="command"><strong>xmllint</strong></span> will save the result of parsing.
|
| 87 |
+
Usually the programs build a tree and save it
|
| 88 |
+
on <code class="filename">stdout</code>, with this option
|
| 89 |
+
the result <acronym class="acronym">XML</acronym> instance will be saved onto a file.
|
| 90 |
+
</p></dd><dt><span class="term"><code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code></span></dt><dd><p>
|
| 91 |
+
Use the (space- or colon-separated) list of filesystem paths specified
|
| 92 |
+
by <em class="replaceable"><code>PATHS</code></em> to load <acronym class="acronym">DTD</acronym>s or
|
| 93 |
+
entities. Enclose space-separated lists by quotation marks.
|
| 94 |
+
</p></dd><dt><span class="term"><code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code></span></dt><dd><p>
|
| 95 |
+
Used to exercise the pattern recognition engine, which can be used
|
| 96 |
+
with the reader interface to the parser. It allows to select some
|
| 97 |
+
nodes in the document based on an XPath (subset) expression. Used
|
| 98 |
+
for debugging.
|
| 99 |
+
</p></dd><dt><span class="term"><code class="option">--pedantic</code></span></dt><dd><p>Enable additional warnings.</p></dd><dt><span class="term"><code class="option">--postvalid</code></span></dt><dd><p>Validate after parsing has completed.</p></dd><dt><span class="term"><code class="option">--pretty <em class="replaceable"><code>INTEGER</code></em></code></span></dt><dd><p>
|
| 100 |
+
Value 0 means no formatting, 1 means XML_SAVE_FORMAT
|
| 101 |
+
(same as --format), 2 means XML_SAVE_WSNONSIG.
|
| 102 |
+
</p></dd><dt><span class="term"><code class="option">--push</code></span></dt><dd><p>Use the push mode of the parser.</p></dd><dt><span class="term"><code class="option">--quiet</code></span></dt><dd><p>Don't print informational messages to stderr.</p></dd><dt><span class="term"><code class="option">--recover</code></span></dt><dd><p>Output any parsable portions of an invalid document.</p></dd><dt><span class="term"><code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
|
| 103 |
+
Use RelaxNG file named <em class="replaceable"><code>SCHEMA</code></em>
|
| 104 |
+
for validation.
|
| 105 |
+
</p></dd><dt><span class="term"><code class="option">--repeat</code></span></dt><dd><p>Repeat 100 times, for timing or profiling.</p></dd><dt><span class="term"><code class="option">--sax</code></span></dt><dd><p>Print SAX callbacks (only for debugging).</p></dd><dt><span class="term"><code class="option">--sax1</code></span></dt><dd><p>Use deprecated SAX1 interface (only for debugging).</p></dd><dt><span class="term"><code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
|
| 106 |
+
Use a W3C <acronym class="acronym">XML</acronym> Schema file
|
| 107 |
+
named <em class="replaceable"><code>SCHEMA</code></em> for validation.
|
| 108 |
+
</p></dd><dt><span class="term"><code class="option">--schematron <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
|
| 109 |
+
Use a Schematron file
|
| 110 |
+
named <em class="replaceable"><code>SCHEMA</code></em> for validation.
|
| 111 |
+
</p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
|
| 112 |
+
Run a navigating shell. Details on available commands in shell mode
|
| 113 |
+
are below (see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called “SHELL COMMANDS”</a>).
|
| 114 |
+
</p></dd><dt><span class="term"><code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code></span></dt><dd><p>
|
| 115 |
+
Run an XPath expression given as argument and print the
|
| 116 |
+
result. In case of a nodeset result, each node in the
|
| 117 |
+
node set is serialized in full in the output. In case
|
| 118 |
+
of an empty node set the "XPath set is empty" result
|
| 119 |
+
will be shown and exit code 11 will be returned..
|
| 120 |
+
This feature is EXPERIMENTAL. Implementation details can
|
| 121 |
+
change without futher notice.
|
| 122 |
+
</p></dd><dt><span class="term"><code class="option">--stream</code></span></dt><dd><p>
|
| 123 |
+
Use streaming <acronym class="acronym">API</acronym> - useful when used in combination
|
| 124 |
+
with <code class="option">--relaxng</code> or <code class="option">--valid</code> options
|
| 125 |
+
for validation of files that are too large to be held in memory.
|
| 126 |
+
</p></dd><dt><span class="term"><code class="option">--testIO</code></span></dt><dd><p>Test user input/output support.</p></dd><dt><span class="term"><code class="option">--timing</code></span></dt><dd><p>
|
| 127 |
+
Output information about the time it takes <span class="command"><strong>xmllint</strong></span> to perform the
|
| 128 |
+
various steps.
|
| 129 |
+
</p></dd><dt><span class="term"><code class="option">--valid</code></span></dt><dd><p>
|
| 130 |
+
Determine if the document is a valid instance of the included
|
| 131 |
+
Document Type Definition (<acronym class="acronym">DTD</acronym>).
|
| 132 |
+
A <acronym class="acronym">DTD</acronym> to be validated against also can be
|
| 133 |
+
specified at the command line using the <code class="option">--dtdvalid</code>
|
| 134 |
+
option. By default, <span class="command"><strong>xmllint</strong></span> also checks to determine if the
|
| 135 |
+
document is well-formed.
|
| 136 |
+
</p></dd><dt><span class="term"><code class="option">--version</code></span></dt><dd><p>
|
| 137 |
+
Display the version of <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> used.
|
| 138 |
+
</p></dd><dt><span class="term"><code class="option">--walker</code></span></dt><dd><p>
|
| 139 |
+
Test the walker module, which is a reader interface but for a
|
| 140 |
+
document tree, instead of using the reader <acronym class="acronym">API</acronym> on
|
| 141 |
+
an unparsed document it works on an existing in-memory tree. Used for
|
| 142 |
+
debugging.
|
| 143 |
+
</p></dd><dt><span class="term"><code class="option">--xinclude</code></span></dt><dd><p>Do XInclude processing.</p></dd><dt><span class="term"><code class="option">--xmlout</code></span></dt><dd><p>
|
| 144 |
+
Used in conjunction with <code class="option">--html</code>. Usually
|
| 145 |
+
when <acronym class="acronym">HTML</acronym> is parsed the document is saved with
|
| 146 |
+
the <acronym class="acronym">HTML</acronym> serializer. But with this option the
|
| 147 |
+
resulting document is saved with the <acronym class="acronym">XML</acronym>
|
| 148 |
+
serializer. This is primarily used to
|
| 149 |
+
generate <acronym class="acronym">XHTML</acronym> from <acronym class="acronym">HTML</acronym> input.
|
| 150 |
+
</p></dd></dl></div></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
|
| 151 |
+
<span class="command"><strong>xmllint</strong></span> offers an interactive shell mode invoked with
|
| 152 |
+
the <code class="option">--shell</code> command. Available commands in shell mode
|
| 153 |
+
include (in alphabetical order):
|
| 154 |
+
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="command"><strong>base</strong></span></span></dt><dd><p>Display <acronym class="acronym">XML</acronym> base of the node.</p></dd><dt><span class="term"><span class="command"><strong>bye</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>cat <em class="replaceable"><code>NODE</code></em></strong></span></span></dt><dd><p>Display the given node or the current one.</p></dd><dt><span class="term"><span class="command"><strong>cd <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
|
| 155 |
+
Change the current node to the given path (if unique) or root if no
|
| 156 |
+
argument is given.
|
| 157 |
+
</p></dd><dt><span class="term"><span class="command"><strong>dir <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
|
| 158 |
+
Dumps information about the node (namespace, attributes, content).
|
| 159 |
+
</p></dd><dt><span class="term"><span class="command"><strong>du <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
|
| 160 |
+
Show the structure of the subtree under the given path or the current node.
|
| 161 |
+
</p></dd><dt><span class="term"><span class="command"><strong>exit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>help</strong></span></span></dt><dd><p>Show this help.</p></dd><dt><span class="term"><span class="command"><strong>load <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Load a new document with the given filename.</p></dd><dt><span class="term"><span class="command"><strong>ls <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>List contents of the given path or the current directory.</p></dd><dt><span class="term"><span class="command"><strong>pwd</strong></span></span></dt><dd><p>Display the path to the current node.</p></dd><dt><span class="term"><span class="command"><strong>quit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>save <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>
|
| 162 |
+
Save the current document to the given filename or to the original name.
|
| 163 |
+
</p></dd><dt><span class="term"><code class="option">validate</code></span></dt><dd><p>Check the document for errors.</p></dd><dt><span class="term"><span class="command"><strong>write <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Write the current node to the given filename.</p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">SGML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">SGML</acronym> catalog behavior can be changed by redirecting
|
| 164 |
+
queries to the user's own set of catalogs. This can be done by setting
|
| 165 |
+
the <code class="envar">SGML_CATALOG_FILES</code> environment variable to a list
|
| 166 |
+
of catalogs. An empty one should deactivate loading the
|
| 167 |
+
default catalog.
|
| 168 |
+
</p></dd><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
|
| 169 |
+
queries to the user's own set of catalogs. This can be done by setting
|
| 170 |
+
the <code class="envar">XML_CATALOG_FILES</code> environment variable to a space-separated
|
| 171 |
+
list of catalogs. Use percent-encoding to escape spaces or other characters.
|
| 172 |
+
An empty variable should deactivate loading the default catalog.
|
| 173 |
+
</p></dd><dt><span class="term"><code class="envar">XML_DEBUG_CATALOG</code></span></dt><dd><p>Setting the environment variable <code class="envar">XML_DEBUG_CATALOG</code>
|
| 174 |
+
to <em class="parameter"><code>non-zero</code></em> using the <span class="command"><strong>export</strong></span>
|
| 175 |
+
command outputs debugging information related to catalog operations.
|
| 176 |
+
</p></dd><dt><span class="term"><code class="envar">XMLLINT_INDENT</code></span></dt><dd><p>Setting the environment variable <code class="envar">XMLLINT_INDENT</code>
|
| 177 |
+
controls the indentation. The default value is two spaces " ".
|
| 178 |
+
</p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
|
| 179 |
+
<span class="command"><strong>xmllint</strong></span> return codes provide information that can be used when
|
| 180 |
+
calling it from scripts.
|
| 181 |
+
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Unclassified</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Error in <acronym class="acronym">DTD</acronym></p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">5</span></span></dt><dd><p>Error in schema compilation</p></dd><dt><span class="term"><span class="errorcode">6</span></span></dt><dd><p>Error writing output</p></dd><dt><span class="term"><span class="errorcode">7</span></span></dt><dd><p>
|
| 182 |
+
Error in pattern (generated when <code class="option">--pattern</code> option is used)
|
| 183 |
+
</p></dd><dt><span class="term"><span class="errorcode">9</span></span></dt><dd><p>Out of memory error</p></dd><dt><span class="term"><span class="errorcode">10</span></span></dt><dd><p>XPath evaluation error</p></dd><dt><span class="term"><span class="errorcode">11</span></span></dt><dd><p>XPath result is empty</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
|
| 184 |
+
</p><p>
|
| 185 |
+
More information can be found at
|
| 186 |
+
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2" target="_top">https://gitlab.gnome.org/G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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<?xml-stylesheet type="text/xsl"
|
| 3 |
+
href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?>
|
| 4 |
+
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
| 5 |
+
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
|
| 6 |
+
|
| 7 |
+
<!ENTITY xmllint "<command>xmllint</command>">
|
| 8 |
+
]>
|
| 9 |
+
|
| 10 |
+
<refentry>
|
| 11 |
+
|
| 12 |
+
<refentryinfo>
|
| 13 |
+
<title>xmllint Manual</title>
|
| 14 |
+
<productname>libxml2</productname>
|
| 15 |
+
<copyright>
|
| 16 |
+
<year>2001</year>
|
| 17 |
+
<year>2004</year>
|
| 18 |
+
</copyright>
|
| 19 |
+
<authorgroup>
|
| 20 |
+
<author>
|
| 21 |
+
<firstname>John</firstname>
|
| 22 |
+
<surname>Fleck</surname>
|
| 23 |
+
<affiliation>
|
| 24 |
+
<address>
|
| 25 |
+
<email>jfleck@inkstain.net</email>
|
| 26 |
+
</address>
|
| 27 |
+
</affiliation>
|
| 28 |
+
</author>
|
| 29 |
+
<author>
|
| 30 |
+
<firstname>Ziying</firstname>
|
| 31 |
+
<surname>Sherwin</surname>
|
| 32 |
+
<affiliation>
|
| 33 |
+
<address>
|
| 34 |
+
<email>sherwin@nlm.nih.gov</email>
|
| 35 |
+
</address>
|
| 36 |
+
</affiliation>
|
| 37 |
+
</author>
|
| 38 |
+
<author>
|
| 39 |
+
<firstname>Heiko</firstname>
|
| 40 |
+
<surname>Rupp</surname>
|
| 41 |
+
<affiliation>
|
| 42 |
+
<address>
|
| 43 |
+
<email>hwr@pilhuhn.de</email>
|
| 44 |
+
</address>
|
| 45 |
+
</affiliation>
|
| 46 |
+
</author>
|
| 47 |
+
</authorgroup>
|
| 48 |
+
<!-- still a bit buggy output, will talk to docbook-xsl upstream to fix this -->
|
| 49 |
+
<!-- <releaseinfo>This is release 0.5 of the xmllint Manual.</releaseinfo> -->
|
| 50 |
+
<!-- <edition>0.5</edition> -->
|
| 51 |
+
</refentryinfo>
|
| 52 |
+
|
| 53 |
+
<refmeta>
|
| 54 |
+
<refentrytitle>xmllint</refentrytitle>
|
| 55 |
+
<manvolnum>1</manvolnum>
|
| 56 |
+
</refmeta>
|
| 57 |
+
|
| 58 |
+
<refnamediv>
|
| 59 |
+
<refname>xmllint</refname>
|
| 60 |
+
<refpurpose>command line <acronym>XML</acronym> tool</refpurpose>
|
| 61 |
+
</refnamediv>
|
| 62 |
+
|
| 63 |
+
<refsynopsisdiv>
|
| 64 |
+
<cmdsynopsis>
|
| 65 |
+
<command>xmllint</command>
|
| 66 |
+
<group choice="opt">
|
| 67 |
+
<arg choice="plain"><option>--version</option></arg>
|
| 68 |
+
<arg choice="plain"><option>--debug</option></arg>
|
| 69 |
+
<arg choice="plain"><option>--quiet</option></arg>
|
| 70 |
+
<arg choice="plain"><option>--shell</option></arg>
|
| 71 |
+
<arg choice="plain"><option>--xpath "<replaceable class="option">XPath_expression</replaceable>"</option></arg>
|
| 72 |
+
<arg choice="plain"><option>--debugent</option></arg>
|
| 73 |
+
<arg choice="plain"><option>--copy</option></arg>
|
| 74 |
+
<arg choice="plain"><option>--recover</option></arg>
|
| 75 |
+
<arg choice="plain"><option>--huge</option></arg>
|
| 76 |
+
<arg choice="plain"><option>--nocompact</option></arg>
|
| 77 |
+
<arg choice="plain"><option>--nodefdtd</option></arg>
|
| 78 |
+
<arg choice="plain"><option>--nodict</option></arg>
|
| 79 |
+
<arg choice="plain"><option>--noenc</option></arg>
|
| 80 |
+
<arg choice="plain"><option>--noent</option></arg>
|
| 81 |
+
<arg choice="plain"><option>--nofixup-base-uris</option></arg>
|
| 82 |
+
<arg choice="plain"><option>--noout</option></arg>
|
| 83 |
+
<arg choice="plain"><option>--nonet</option></arg>
|
| 84 |
+
<arg choice="plain"><option>--path "<replaceable class="option">PATH(S)</replaceable>"</option></arg>
|
| 85 |
+
<arg choice="plain"><option>--load-trace</option></arg>
|
| 86 |
+
<arg choice="plain"><option>--htmlout</option></arg>
|
| 87 |
+
<arg choice="plain"><option>--nowrap</option></arg>
|
| 88 |
+
<arg choice="plain"><option>--valid</option></arg>
|
| 89 |
+
<arg choice="plain"><option>--postvalid</option></arg>
|
| 90 |
+
<arg choice="plain"><option>--dtdvalid <replaceable class="option">URL</replaceable></option></arg>
|
| 91 |
+
<arg choice="plain"><option>--dtdvalidfpi <replaceable class="option">FPI</replaceable></option></arg>
|
| 92 |
+
<arg choice="plain"><option>--timing</option></arg>
|
| 93 |
+
<arg choice="plain"><option>--output <replaceable class="option">FILE</replaceable></option></arg>
|
| 94 |
+
<arg choice="plain"><option>--repeat</option></arg>
|
| 95 |
+
<arg choice="plain"><option>--insert</option></arg>
|
| 96 |
+
<arg choice="plain"><option>--compress</option></arg>
|
| 97 |
+
<arg choice="plain"><option>--html</option></arg>
|
| 98 |
+
<arg choice="plain"><option>--xmlout</option></arg>
|
| 99 |
+
<arg choice="plain"><option>--push</option></arg>
|
| 100 |
+
<arg choice="plain"><option>--memory</option></arg>
|
| 101 |
+
<arg choice="plain"><option>--max-ampl <replaceable class="option">INTEGER</replaceable></option></arg>
|
| 102 |
+
<arg choice="plain"><option>--maxmem <replaceable class="option">NBBYTES</replaceable></option></arg>
|
| 103 |
+
<arg choice="plain"><option>--nowarning</option></arg>
|
| 104 |
+
<arg choice="plain"><option>--noblanks</option></arg>
|
| 105 |
+
<arg choice="plain"><option>--nocdata</option></arg>
|
| 106 |
+
<arg choice="plain"><option>--format</option></arg>
|
| 107 |
+
<arg choice="plain"><option>--pretty <replaceable class="option">INTEGER</replaceable></option></arg>
|
| 108 |
+
<arg choice="plain"><option>--encode <replaceable class="option">ENCODING</replaceable></option></arg>
|
| 109 |
+
<arg choice="plain"><option>--dropdtd</option></arg>
|
| 110 |
+
<arg choice="plain"><option>--nsclean</option></arg>
|
| 111 |
+
<arg choice="plain"><option>--testIO</option></arg>
|
| 112 |
+
<arg choice="plain"><option>--catalogs</option></arg>
|
| 113 |
+
<arg choice="plain"><option>--nocatalogs</option></arg>
|
| 114 |
+
<arg choice="plain"><option>--auto</option></arg>
|
| 115 |
+
<arg choice="plain"><option>--xinclude</option></arg>
|
| 116 |
+
<arg choice="plain"><option>--noxincludenode</option></arg>
|
| 117 |
+
<arg choice="plain"><option>--loaddtd</option></arg>
|
| 118 |
+
<arg choice="plain"><option>--dtdattr</option></arg>
|
| 119 |
+
<arg choice="plain"><option>--stream</option></arg>
|
| 120 |
+
<arg choice="plain"><option>--walker</option></arg>
|
| 121 |
+
<arg choice="plain"><option>--pattern <replaceable class="option">PATTERNVALUE</replaceable></option></arg>
|
| 122 |
+
<arg choice="plain"><option>--relaxng <replaceable class="option">SCHEMA</replaceable></option></arg>
|
| 123 |
+
<arg choice="plain"><option>--schema <replaceable class="option">SCHEMA</replaceable></option></arg>
|
| 124 |
+
<arg choice="plain"><option>--schematron <replaceable class="option">SCHEMA</replaceable></option></arg>
|
| 125 |
+
<arg choice="plain"><option>--c14n</option></arg>
|
| 126 |
+
<arg choice="plain"><option>--c14n11</option></arg>
|
| 127 |
+
<arg choice="plain"><option>--exc-c14n</option></arg>
|
| 128 |
+
<arg choice="plain"><option>--pedantic</option></arg>
|
| 129 |
+
<arg choice="plain"><option>--sax</option></arg>
|
| 130 |
+
<arg choice="plain"><option>--sax1</option></arg>
|
| 131 |
+
<arg choice="plain"><option>--oldxml10</option></arg>
|
| 132 |
+
</group>
|
| 133 |
+
<group choice="req">
|
| 134 |
+
<arg choice="plain" rep="repeat"><replaceable>XML-FILE(S)</replaceable></arg>
|
| 135 |
+
<arg choice="plain" rep="norepeat">-</arg>
|
| 136 |
+
</group>
|
| 137 |
+
</cmdsynopsis>
|
| 138 |
+
</refsynopsisdiv>
|
| 139 |
+
|
| 140 |
+
<refsect1 id="description">
|
| 141 |
+
<title>DESCRIPTION</title>
|
| 142 |
+
<para>
|
| 143 |
+
The &xmllint; program parses one or more <acronym>XML</acronym> files,
|
| 144 |
+
specified on the command line as <replaceable>XML-FILE</replaceable>
|
| 145 |
+
(or the standard input if the filename provided
|
| 146 |
+
is <emphasis role="bold">-</emphasis> ). It prints various types of
|
| 147 |
+
output, depending upon the options selected. It is useful for detecting
|
| 148 |
+
errors both in <acronym>XML</acronym> code and in
|
| 149 |
+
the <acronym>XML</acronym> parser itself.
|
| 150 |
+
</para>
|
| 151 |
+
<para>&xmllint; is included in <citerefentry>
|
| 152 |
+
<refentrytitle>libxml</refentrytitle>
|
| 153 |
+
<manvolnum>3</manvolnum>
|
| 154 |
+
</citerefentry>.</para>
|
| 155 |
+
</refsect1>
|
| 156 |
+
|
| 157 |
+
<refsect1 id="options">
|
| 158 |
+
<title>OPTIONS</title>
|
| 159 |
+
<para>
|
| 160 |
+
&xmllint; accepts the following options (in alphabetical order):
|
| 161 |
+
</para>
|
| 162 |
+
|
| 163 |
+
<variablelist>
|
| 164 |
+
|
| 165 |
+
<varlistentry>
|
| 166 |
+
<term><option>--auto</option></term>
|
| 167 |
+
<listitem>
|
| 168 |
+
<para>Generate a small document for testing purposes.</para>
|
| 169 |
+
</listitem>
|
| 170 |
+
</varlistentry>
|
| 171 |
+
|
| 172 |
+
<varlistentry>
|
| 173 |
+
<term><option>--catalogs</option></term>
|
| 174 |
+
<listitem>
|
| 175 |
+
<para>
|
| 176 |
+
Use the <acronym>SGML</acronym> catalog(s) from <envar>SGML_CATALOG_FILES</envar>.
|
| 177 |
+
Otherwise <acronym>XML</acronym> catalogs starting
|
| 178 |
+
from <filename>/etc/xml/catalog</filename> or, more specifically,
|
| 179 |
+
<filename>${sysconfdir}/xml/catalog</filename> are used by default.
|
| 180 |
+
</para>
|
| 181 |
+
</listitem>
|
| 182 |
+
</varlistentry>
|
| 183 |
+
|
| 184 |
+
<varlistentry>
|
| 185 |
+
<term><option>--compress</option></term>
|
| 186 |
+
<listitem>
|
| 187 |
+
<para>
|
| 188 |
+
Turn on <citerefentry>
|
| 189 |
+
<refentrytitle>gzip</refentrytitle>
|
| 190 |
+
<manvolnum>1</manvolnum>
|
| 191 |
+
</citerefentry> compression of output.
|
| 192 |
+
</para>
|
| 193 |
+
</listitem>
|
| 194 |
+
</varlistentry>
|
| 195 |
+
|
| 196 |
+
<varlistentry>
|
| 197 |
+
<term><option>--copy</option></term>
|
| 198 |
+
<listitem>
|
| 199 |
+
<para>Test the internal copy implementation.</para>
|
| 200 |
+
</listitem>
|
| 201 |
+
</varlistentry>
|
| 202 |
+
|
| 203 |
+
<varlistentry>
|
| 204 |
+
<term><option>--c14n</option></term>
|
| 205 |
+
<term><option>--c14n11</option></term>
|
| 206 |
+
<term><option>--exc-c14n</option></term>
|
| 207 |
+
<listitem>
|
| 208 |
+
<para>
|
| 209 |
+
Use the W3C <acronym>XML</acronym> Canonicalisation (<acronym>C14N</acronym>) to
|
| 210 |
+
serialize the result of parsing to <filename class="devicefile">stdout</filename>.
|
| 211 |
+
It keeps comments in the result.
|
| 212 |
+
</para>
|
| 213 |
+
</listitem>
|
| 214 |
+
</varlistentry>
|
| 215 |
+
|
| 216 |
+
<varlistentry>
|
| 217 |
+
<term><option>--dtdvalid <replaceable class="option">URL</replaceable></option></term>
|
| 218 |
+
<listitem>
|
| 219 |
+
<para>
|
| 220 |
+
Use the <acronym>DTD</acronym> specified by
|
| 221 |
+
an <replaceable>URL</replaceable> for validation.
|
| 222 |
+
</para>
|
| 223 |
+
</listitem>
|
| 224 |
+
</varlistentry>
|
| 225 |
+
|
| 226 |
+
<varlistentry>
|
| 227 |
+
<term><option>--dtdvalidfpi <replaceable class="option">FPI</replaceable></option></term>
|
| 228 |
+
<listitem>
|
| 229 |
+
<para>
|
| 230 |
+
Use the <acronym>DTD</acronym> specified by a Formal Public
|
| 231 |
+
Identifier <replaceable>FPI</replaceable> for validation, note that this
|
| 232 |
+
will require a catalog exporting that Formal Public Identifier to work.
|
| 233 |
+
</para>
|
| 234 |
+
</listitem>
|
| 235 |
+
</varlistentry>
|
| 236 |
+
|
| 237 |
+
<varlistentry>
|
| 238 |
+
<term><option>--debug</option></term>
|
| 239 |
+
<listitem>
|
| 240 |
+
<para>
|
| 241 |
+
Parse a file and output an annotated tree of the
|
| 242 |
+
in-memory version of the document.
|
| 243 |
+
</para>
|
| 244 |
+
</listitem>
|
| 245 |
+
</varlistentry>
|
| 246 |
+
|
| 247 |
+
<varlistentry>
|
| 248 |
+
<term><option>--debugent</option></term>
|
| 249 |
+
<listitem>
|
| 250 |
+
<para>Debug the entities defined in the document.</para>
|
| 251 |
+
</listitem>
|
| 252 |
+
</varlistentry>
|
| 253 |
+
|
| 254 |
+
<varlistentry>
|
| 255 |
+
<term><option>--dropdtd</option></term>
|
| 256 |
+
<listitem>
|
| 257 |
+
<para>Remove <acronym>DTD</acronym> from output.</para>
|
| 258 |
+
</listitem>
|
| 259 |
+
</varlistentry>
|
| 260 |
+
|
| 261 |
+
<varlistentry>
|
| 262 |
+
<term><option>--dtdattr</option></term>
|
| 263 |
+
<listitem>
|
| 264 |
+
<para>
|
| 265 |
+
Fetch external <acronym>DTD</acronym> and populate the tree with
|
| 266 |
+
inherited attributes.
|
| 267 |
+
</para>
|
| 268 |
+
</listitem>
|
| 269 |
+
</varlistentry>
|
| 270 |
+
|
| 271 |
+
<varlistentry>
|
| 272 |
+
<term><option>--encode <replaceable class="option">ENCODING</replaceable></option></term>
|
| 273 |
+
<listitem>
|
| 274 |
+
<para>Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.</para>
|
| 275 |
+
</listitem>
|
| 276 |
+
</varlistentry>
|
| 277 |
+
|
| 278 |
+
<varlistentry>
|
| 279 |
+
<term><option>--format</option></term>
|
| 280 |
+
<listitem>
|
| 281 |
+
<para>
|
| 282 |
+
Reformat and reindent the output. The <envar>XMLLINT_INDENT</envar>
|
| 283 |
+
environment variable controls the indentation. The default value is two
|
| 284 |
+
spaces " ").
|
| 285 |
+
</para>
|
| 286 |
+
</listitem>
|
| 287 |
+
</varlistentry>
|
| 288 |
+
|
| 289 |
+
<varlistentry>
|
| 290 |
+
<term><option>--html</option></term>
|
| 291 |
+
<listitem>
|
| 292 |
+
<para>Use the <acronym>HTML</acronym> parser.</para>
|
| 293 |
+
</listitem>
|
| 294 |
+
</varlistentry>
|
| 295 |
+
|
| 296 |
+
<varlistentry>
|
| 297 |
+
<term><option>--htmlout</option></term>
|
| 298 |
+
<listitem>
|
| 299 |
+
<para>
|
| 300 |
+
Output results as an <acronym>HTML</acronym> file. This
|
| 301 |
+
causes &xmllint; to output the necessary <acronym>HTML</acronym>
|
| 302 |
+
tags surrounding the result tree output so the results can be
|
| 303 |
+
displayed/viewed in a browser.
|
| 304 |
+
</para>
|
| 305 |
+
</listitem>
|
| 306 |
+
</varlistentry>
|
| 307 |
+
|
| 308 |
+
<varlistentry>
|
| 309 |
+
<term><option>--huge</option></term>
|
| 310 |
+
<listitem>
|
| 311 |
+
<para>Ignore some hardcoded parser limits.</para>
|
| 312 |
+
</listitem>
|
| 313 |
+
</varlistentry>
|
| 314 |
+
|
| 315 |
+
<varlistentry>
|
| 316 |
+
<term><option>--insert</option></term>
|
| 317 |
+
<listitem>
|
| 318 |
+
<para>Test for valid insertions.</para>
|
| 319 |
+
</listitem>
|
| 320 |
+
</varlistentry>
|
| 321 |
+
|
| 322 |
+
<varlistentry>
|
| 323 |
+
<term><option>--loaddtd</option></term>
|
| 324 |
+
<listitem>
|
| 325 |
+
<para>Fetch an external <acronym>DTD</acronym>.</para>
|
| 326 |
+
</listitem>
|
| 327 |
+
</varlistentry>
|
| 328 |
+
|
| 329 |
+
<varlistentry>
|
| 330 |
+
<term><option>--load-trace</option></term>
|
| 331 |
+
<listitem>
|
| 332 |
+
<para>
|
| 333 |
+
Display all the documents loaded during the processing
|
| 334 |
+
to <filename class="devicefile">stderr</filename>.
|
| 335 |
+
</para>
|
| 336 |
+
</listitem>
|
| 337 |
+
</varlistentry>
|
| 338 |
+
|
| 339 |
+
<varlistentry>
|
| 340 |
+
<term><option>--max-ampl <replaceable class="option">INTEGER</replaceable></option></term>
|
| 341 |
+
<listitem>
|
| 342 |
+
<para>
|
| 343 |
+
Set the maximum amplification factor which protects against
|
| 344 |
+
exponential entity expansion ("billion laughs"). The default value
|
| 345 |
+
is 5. Documents making heavy use of entity expansion may require a
|
| 346 |
+
higher value.
|
| 347 |
+
</para>
|
| 348 |
+
</listitem>
|
| 349 |
+
</varlistentry>
|
| 350 |
+
|
| 351 |
+
<varlistentry>
|
| 352 |
+
<term><option>--maxmem <replaceable class="option">NNBYTES</replaceable></option></term>
|
| 353 |
+
<listitem>
|
| 354 |
+
<para>
|
| 355 |
+
Test the parser memory support. <replaceable>NNBYTES</replaceable>
|
| 356 |
+
is the maximum number of bytes the library is allowed to allocate.
|
| 357 |
+
This can also be used to make sure batch processing
|
| 358 |
+
of <acronym>XML</acronym> files will not exhaust the virtual memory
|
| 359 |
+
of the server running them.
|
| 360 |
+
</para>
|
| 361 |
+
</listitem>
|
| 362 |
+
</varlistentry>
|
| 363 |
+
|
| 364 |
+
<varlistentry>
|
| 365 |
+
<term><option>--memory</option></term>
|
| 366 |
+
<listitem>
|
| 367 |
+
<para>Parse from memory.</para>
|
| 368 |
+
</listitem>
|
| 369 |
+
</varlistentry>
|
| 370 |
+
|
| 371 |
+
<varlistentry>
|
| 372 |
+
<term><option>--noblanks</option></term>
|
| 373 |
+
<listitem>
|
| 374 |
+
<para>Drop ignorable blank spaces.</para>
|
| 375 |
+
</listitem>
|
| 376 |
+
</varlistentry>
|
| 377 |
+
|
| 378 |
+
<varlistentry>
|
| 379 |
+
<term><option>--nocatalogs</option></term>
|
| 380 |
+
<listitem>
|
| 381 |
+
<para>Do not use any catalogs.</para>
|
| 382 |
+
</listitem>
|
| 383 |
+
</varlistentry>
|
| 384 |
+
|
| 385 |
+
<varlistentry>
|
| 386 |
+
<term><option>--nocdata</option></term>
|
| 387 |
+
<listitem>
|
| 388 |
+
<para>Substitute CDATA section by equivalent text nodes.</para>
|
| 389 |
+
</listitem>
|
| 390 |
+
</varlistentry>
|
| 391 |
+
|
| 392 |
+
<varlistentry>
|
| 393 |
+
<term><option>--nocompact</option></term>
|
| 394 |
+
<listitem>
|
| 395 |
+
<para>
|
| 396 |
+
Do not generate compact text nodes (parser option
|
| 397 |
+
XML_PARSE_COMPACT). Only for debugging.
|
| 398 |
+
</para>
|
| 399 |
+
</listitem>
|
| 400 |
+
</varlistentry>
|
| 401 |
+
|
| 402 |
+
<varlistentry>
|
| 403 |
+
<term><option>--nodefdtd</option></term>
|
| 404 |
+
<listitem>
|
| 405 |
+
<para>
|
| 406 |
+
Do not set default HTML doctype (parser option
|
| 407 |
+
HTML_PARSE_NODEFDTD).
|
| 408 |
+
</para>
|
| 409 |
+
</listitem>
|
| 410 |
+
</varlistentry>
|
| 411 |
+
|
| 412 |
+
<varlistentry>
|
| 413 |
+
<term><option>--nodict</option></term>
|
| 414 |
+
<listitem>
|
| 415 |
+
<para>
|
| 416 |
+
Don't use dictionaries (parser option XML_PARSE_NODICT).
|
| 417 |
+
Only for debugging.
|
| 418 |
+
</para>
|
| 419 |
+
</listitem>
|
| 420 |
+
</varlistentry>
|
| 421 |
+
|
| 422 |
+
<varlistentry>
|
| 423 |
+
<term><option>--noenc</option></term>
|
| 424 |
+
<listitem>
|
| 425 |
+
<para>
|
| 426 |
+
Ignore encoding declaration (parser option
|
| 427 |
+
XML_PARSE_IGNORE_ENC).
|
| 428 |
+
</para>
|
| 429 |
+
</listitem>
|
| 430 |
+
</varlistentry>
|
| 431 |
+
|
| 432 |
+
<varlistentry>
|
| 433 |
+
<term><option>--noent</option></term>
|
| 434 |
+
<listitem>
|
| 435 |
+
<para>
|
| 436 |
+
Substitute entity values for entity references. By default, &xmllint;
|
| 437 |
+
leaves entity references in place.
|
| 438 |
+
</para>
|
| 439 |
+
</listitem>
|
| 440 |
+
</varlistentry>
|
| 441 |
+
|
| 442 |
+
<varlistentry>
|
| 443 |
+
<term><option>--nofixup-base-uris</option></term>
|
| 444 |
+
<listitem>
|
| 445 |
+
<para>
|
| 446 |
+
Don't fix xml:base URIs when processing XIncludes
|
| 447 |
+
(parser option XML_PARSE_NOBASEFIX).
|
| 448 |
+
</para>
|
| 449 |
+
</listitem>
|
| 450 |
+
</varlistentry>
|
| 451 |
+
|
| 452 |
+
<varlistentry>
|
| 453 |
+
<term><option>--nonet</option></term>
|
| 454 |
+
<listitem>
|
| 455 |
+
<para>
|
| 456 |
+
Do not use the Internet to fetch <acronym>DTD</acronym>s or entities.
|
| 457 |
+
</para>
|
| 458 |
+
</listitem>
|
| 459 |
+
</varlistentry>
|
| 460 |
+
|
| 461 |
+
<varlistentry>
|
| 462 |
+
<term><option>--noout</option></term>
|
| 463 |
+
<listitem>
|
| 464 |
+
<para>
|
| 465 |
+
Suppress output. By default, &xmllint; outputs the result tree.
|
| 466 |
+
</para>
|
| 467 |
+
</listitem>
|
| 468 |
+
</varlistentry>
|
| 469 |
+
|
| 470 |
+
<varlistentry>
|
| 471 |
+
<term><option>--nowarning</option></term>
|
| 472 |
+
<listitem>
|
| 473 |
+
<para>Do not emit warnings from the parser and/or validator.</para>
|
| 474 |
+
</listitem>
|
| 475 |
+
</varlistentry>
|
| 476 |
+
|
| 477 |
+
<varlistentry>
|
| 478 |
+
<term><option>--nowrap</option></term>
|
| 479 |
+
<listitem>
|
| 480 |
+
<para>Do not output <acronym>HTML</acronym> doc wrapper.</para>
|
| 481 |
+
</listitem>
|
| 482 |
+
</varlistentry>
|
| 483 |
+
|
| 484 |
+
<varlistentry>
|
| 485 |
+
<term><option>--noxincludenode</option></term>
|
| 486 |
+
<listitem>
|
| 487 |
+
<para>
|
| 488 |
+
Do XInclude processing but do not generate XInclude start and end nodes.
|
| 489 |
+
</para>
|
| 490 |
+
</listitem>
|
| 491 |
+
</varlistentry>
|
| 492 |
+
|
| 493 |
+
<varlistentry>
|
| 494 |
+
<term><option>--nsclean</option></term>
|
| 495 |
+
<listitem>
|
| 496 |
+
<para>Remove redundant namespace declarations.</para>
|
| 497 |
+
</listitem>
|
| 498 |
+
</varlistentry>
|
| 499 |
+
|
| 500 |
+
<varlistentry>
|
| 501 |
+
<term><option>--oldxml10</option></term>
|
| 502 |
+
<listitem>
|
| 503 |
+
<para>
|
| 504 |
+
Use deprecated parsing rules before XML 1.0,
|
| 505 |
+
5th edition.
|
| 506 |
+
</para>
|
| 507 |
+
</listitem>
|
| 508 |
+
</varlistentry>
|
| 509 |
+
|
| 510 |
+
<varlistentry>
|
| 511 |
+
<term><option>--output <replaceable class="option">FILE</replaceable></option></term>
|
| 512 |
+
<listitem>
|
| 513 |
+
<para>
|
| 514 |
+
Define a file path where &xmllint; will save the result of parsing.
|
| 515 |
+
Usually the programs build a tree and save it
|
| 516 |
+
on <filename class="devicefile">stdout</filename>, with this option
|
| 517 |
+
the result <acronym>XML</acronym> instance will be saved onto a file.
|
| 518 |
+
</para>
|
| 519 |
+
</listitem>
|
| 520 |
+
</varlistentry>
|
| 521 |
+
|
| 522 |
+
<varlistentry>
|
| 523 |
+
<term><option>--path "<replaceable class="option">PATH(S)</replaceable>"</option></term>
|
| 524 |
+
<listitem>
|
| 525 |
+
<para>
|
| 526 |
+
Use the (space- or colon-separated) list of filesystem paths specified
|
| 527 |
+
by <replaceable>PATHS</replaceable> to load <acronym>DTD</acronym>s or
|
| 528 |
+
entities. Enclose space-separated lists by quotation marks.
|
| 529 |
+
</para>
|
| 530 |
+
</listitem>
|
| 531 |
+
</varlistentry>
|
| 532 |
+
|
| 533 |
+
<varlistentry>
|
| 534 |
+
<term><option>--pattern <replaceable class="option">PATTERNVALUE</replaceable></option></term>
|
| 535 |
+
<listitem>
|
| 536 |
+
<para>
|
| 537 |
+
Used to exercise the pattern recognition engine, which can be used
|
| 538 |
+
with the reader interface to the parser. It allows to select some
|
| 539 |
+
nodes in the document based on an XPath (subset) expression. Used
|
| 540 |
+
for debugging.
|
| 541 |
+
</para>
|
| 542 |
+
</listitem>
|
| 543 |
+
</varlistentry>
|
| 544 |
+
|
| 545 |
+
<varlistentry>
|
| 546 |
+
<term><option>--pedantic</option></term>
|
| 547 |
+
<listitem>
|
| 548 |
+
<para>Enable additional warnings.</para>
|
| 549 |
+
</listitem>
|
| 550 |
+
</varlistentry>
|
| 551 |
+
|
| 552 |
+
<varlistentry>
|
| 553 |
+
<term><option>--postvalid</option></term>
|
| 554 |
+
<listitem>
|
| 555 |
+
<para>Validate after parsing has completed.</para>
|
| 556 |
+
</listitem>
|
| 557 |
+
</varlistentry>
|
| 558 |
+
|
| 559 |
+
<varlistentry>
|
| 560 |
+
<term><option>--pretty <replaceable class="option">INTEGER</replaceable></option></term>
|
| 561 |
+
<listitem>
|
| 562 |
+
<para>
|
| 563 |
+
Value 0 means no formatting, 1 means XML_SAVE_FORMAT
|
| 564 |
+
(same as --format), 2 means XML_SAVE_WSNONSIG.
|
| 565 |
+
</para>
|
| 566 |
+
</listitem>
|
| 567 |
+
</varlistentry>
|
| 568 |
+
|
| 569 |
+
<varlistentry>
|
| 570 |
+
<term><option>--push</option></term>
|
| 571 |
+
<listitem>
|
| 572 |
+
<para>Use the push mode of the parser.</para>
|
| 573 |
+
</listitem>
|
| 574 |
+
</varlistentry>
|
| 575 |
+
|
| 576 |
+
<varlistentry>
|
| 577 |
+
<term><option>--quiet</option></term>
|
| 578 |
+
<listitem>
|
| 579 |
+
<para>Don't print informational messages to stderr.</para>
|
| 580 |
+
</listitem>
|
| 581 |
+
</varlistentry>
|
| 582 |
+
|
| 583 |
+
<varlistentry>
|
| 584 |
+
<term><option>--recover</option></term>
|
| 585 |
+
<listitem>
|
| 586 |
+
<para>Output any parsable portions of an invalid document.</para>
|
| 587 |
+
</listitem>
|
| 588 |
+
</varlistentry>
|
| 589 |
+
|
| 590 |
+
<varlistentry>
|
| 591 |
+
<term><option>--relaxng <replaceable class="option">SCHEMA</replaceable></option></term>
|
| 592 |
+
<listitem>
|
| 593 |
+
<para>
|
| 594 |
+
Use RelaxNG file named <replaceable class="option">SCHEMA</replaceable>
|
| 595 |
+
for validation.
|
| 596 |
+
</para>
|
| 597 |
+
</listitem>
|
| 598 |
+
</varlistentry>
|
| 599 |
+
|
| 600 |
+
<varlistentry>
|
| 601 |
+
<term><option>--repeat</option></term>
|
| 602 |
+
<listitem>
|
| 603 |
+
<para>Repeat 100 times, for timing or profiling.</para>
|
| 604 |
+
</listitem>
|
| 605 |
+
</varlistentry>
|
| 606 |
+
|
| 607 |
+
<varlistentry>
|
| 608 |
+
<term><option>--sax</option></term>
|
| 609 |
+
<listitem>
|
| 610 |
+
<para>Print SAX callbacks (only for debugging).</para>
|
| 611 |
+
</listitem>
|
| 612 |
+
</varlistentry>
|
| 613 |
+
|
| 614 |
+
<varlistentry>
|
| 615 |
+
<term><option>--sax1</option></term>
|
| 616 |
+
<listitem>
|
| 617 |
+
<para>Use deprecated SAX1 interface (only for debugging).</para>
|
| 618 |
+
</listitem>
|
| 619 |
+
</varlistentry>
|
| 620 |
+
|
| 621 |
+
<varlistentry>
|
| 622 |
+
<term><option>--schema <replaceable>SCHEMA</replaceable></option></term>
|
| 623 |
+
<listitem>
|
| 624 |
+
<para>
|
| 625 |
+
Use a W3C <acronym>XML</acronym> Schema file
|
| 626 |
+
named <replaceable>SCHEMA</replaceable> for validation.
|
| 627 |
+
</para>
|
| 628 |
+
</listitem>
|
| 629 |
+
</varlistentry>
|
| 630 |
+
|
| 631 |
+
<varlistentry>
|
| 632 |
+
<term><option>--schematron <replaceable>SCHEMA</replaceable></option></term>
|
| 633 |
+
<listitem>
|
| 634 |
+
<para>
|
| 635 |
+
Use a Schematron file
|
| 636 |
+
named <replaceable>SCHEMA</replaceable> for validation.
|
| 637 |
+
</para>
|
| 638 |
+
</listitem>
|
| 639 |
+
</varlistentry>
|
| 640 |
+
|
| 641 |
+
<varlistentry>
|
| 642 |
+
<term><option>--shell</option></term>
|
| 643 |
+
<listitem>
|
| 644 |
+
<para>
|
| 645 |
+
Run a navigating shell. Details on available commands in shell mode
|
| 646 |
+
are below (see <xref linkend="shell"/>).
|
| 647 |
+
</para>
|
| 648 |
+
</listitem>
|
| 649 |
+
</varlistentry>
|
| 650 |
+
|
| 651 |
+
<varlistentry>
|
| 652 |
+
<term><option>--xpath "<replaceable class="option">XPath_expression</replaceable>"</option></term>
|
| 653 |
+
<listitem>
|
| 654 |
+
<para>
|
| 655 |
+
Run an XPath expression given as argument and print the
|
| 656 |
+
result. In case of a nodeset result, each node in the
|
| 657 |
+
node set is serialized in full in the output. In case
|
| 658 |
+
of an empty node set the "XPath set is empty" result
|
| 659 |
+
will be shown and exit code 11 will be returned..
|
| 660 |
+
This feature is EXPERIMENTAL. Implementation details can
|
| 661 |
+
change without futher notice.
|
| 662 |
+
</para>
|
| 663 |
+
</listitem>
|
| 664 |
+
</varlistentry>
|
| 665 |
+
|
| 666 |
+
<varlistentry>
|
| 667 |
+
<term><option>--stream</option></term>
|
| 668 |
+
<listitem>
|
| 669 |
+
<para>
|
| 670 |
+
Use streaming <acronym>API</acronym> - useful when used in combination
|
| 671 |
+
with <option>--relaxng</option> or <option>--valid</option> options
|
| 672 |
+
for validation of files that are too large to be held in memory.
|
| 673 |
+
</para>
|
| 674 |
+
</listitem>
|
| 675 |
+
</varlistentry>
|
| 676 |
+
|
| 677 |
+
<varlistentry>
|
| 678 |
+
<term><option>--testIO</option></term>
|
| 679 |
+
<listitem>
|
| 680 |
+
<para>Test user input/output support.</para>
|
| 681 |
+
</listitem>
|
| 682 |
+
</varlistentry>
|
| 683 |
+
|
| 684 |
+
<varlistentry>
|
| 685 |
+
<term><option>--timing</option></term>
|
| 686 |
+
<listitem>
|
| 687 |
+
<para>
|
| 688 |
+
Output information about the time it takes &xmllint; to perform the
|
| 689 |
+
various steps.
|
| 690 |
+
</para>
|
| 691 |
+
</listitem>
|
| 692 |
+
</varlistentry>
|
| 693 |
+
|
| 694 |
+
<varlistentry>
|
| 695 |
+
<term><option>--valid</option></term>
|
| 696 |
+
<listitem>
|
| 697 |
+
<para>
|
| 698 |
+
Determine if the document is a valid instance of the included
|
| 699 |
+
Document Type Definition (<acronym>DTD</acronym>).
|
| 700 |
+
A <acronym>DTD</acronym> to be validated against also can be
|
| 701 |
+
specified at the command line using the <option>--dtdvalid</option>
|
| 702 |
+
option. By default, &xmllint; also checks to determine if the
|
| 703 |
+
document is well-formed.
|
| 704 |
+
</para>
|
| 705 |
+
</listitem>
|
| 706 |
+
</varlistentry>
|
| 707 |
+
|
| 708 |
+
<varlistentry>
|
| 709 |
+
<term><option>--version</option></term>
|
| 710 |
+
<listitem>
|
| 711 |
+
<para>
|
| 712 |
+
Display the version of <citerefentry>
|
| 713 |
+
<refentrytitle>libxml</refentrytitle>
|
| 714 |
+
<manvolnum>3</manvolnum>
|
| 715 |
+
</citerefentry> used.
|
| 716 |
+
</para>
|
| 717 |
+
</listitem>
|
| 718 |
+
</varlistentry>
|
| 719 |
+
|
| 720 |
+
<varlistentry>
|
| 721 |
+
<term><option>--walker</option></term>
|
| 722 |
+
<listitem>
|
| 723 |
+
<para>
|
| 724 |
+
Test the walker module, which is a reader interface but for a
|
| 725 |
+
document tree, instead of using the reader <acronym>API</acronym> on
|
| 726 |
+
an unparsed document it works on an existing in-memory tree. Used for
|
| 727 |
+
debugging.
|
| 728 |
+
</para>
|
| 729 |
+
</listitem>
|
| 730 |
+
</varlistentry>
|
| 731 |
+
|
| 732 |
+
<varlistentry>
|
| 733 |
+
<term><option>--xinclude</option></term>
|
| 734 |
+
<listitem>
|
| 735 |
+
<para>Do XInclude processing.</para>
|
| 736 |
+
</listitem>
|
| 737 |
+
</varlistentry>
|
| 738 |
+
|
| 739 |
+
<varlistentry>
|
| 740 |
+
<term><option>--xmlout</option></term>
|
| 741 |
+
<listitem>
|
| 742 |
+
<para>
|
| 743 |
+
Used in conjunction with <option>--html</option>. Usually
|
| 744 |
+
when <acronym>HTML</acronym> is parsed the document is saved with
|
| 745 |
+
the <acronym>HTML</acronym> serializer. But with this option the
|
| 746 |
+
resulting document is saved with the <acronym>XML</acronym>
|
| 747 |
+
serializer. This is primarily used to
|
| 748 |
+
generate <acronym>XHTML</acronym> from <acronym>HTML</acronym> input.
|
| 749 |
+
</para>
|
| 750 |
+
</listitem>
|
| 751 |
+
</varlistentry>
|
| 752 |
+
|
| 753 |
+
</variablelist>
|
| 754 |
+
</refsect1>
|
| 755 |
+
|
| 756 |
+
<refsect1 id="shell">
|
| 757 |
+
<title>SHELL COMMANDS</title>
|
| 758 |
+
<para>
|
| 759 |
+
&xmllint; offers an interactive shell mode invoked with
|
| 760 |
+
the <option>--shell</option> command. Available commands in shell mode
|
| 761 |
+
include (in alphabetical order):
|
| 762 |
+
</para>
|
| 763 |
+
<variablelist>
|
| 764 |
+
|
| 765 |
+
<varlistentry>
|
| 766 |
+
<term><command>base</command></term>
|
| 767 |
+
<listitem>
|
| 768 |
+
<para>Display <acronym>XML</acronym> base of the node.</para>
|
| 769 |
+
</listitem>
|
| 770 |
+
</varlistentry>
|
| 771 |
+
|
| 772 |
+
<varlistentry>
|
| 773 |
+
<term><command>bye</command></term>
|
| 774 |
+
<listitem>
|
| 775 |
+
<para>Leave the shell.</para>
|
| 776 |
+
</listitem>
|
| 777 |
+
</varlistentry>
|
| 778 |
+
|
| 779 |
+
<varlistentry>
|
| 780 |
+
<term><command>cat <replaceable>NODE</replaceable></command></term>
|
| 781 |
+
<listitem>
|
| 782 |
+
<para>Display the given node or the current one.</para>
|
| 783 |
+
</listitem>
|
| 784 |
+
</varlistentry>
|
| 785 |
+
|
| 786 |
+
<varlistentry>
|
| 787 |
+
<term><command>cd <replaceable>PATH</replaceable></command></term>
|
| 788 |
+
<listitem>
|
| 789 |
+
<para>
|
| 790 |
+
Change the current node to the given path (if unique) or root if no
|
| 791 |
+
argument is given.
|
| 792 |
+
</para>
|
| 793 |
+
</listitem>
|
| 794 |
+
</varlistentry>
|
| 795 |
+
|
| 796 |
+
<varlistentry>
|
| 797 |
+
<term><command>dir <replaceable>PATH</replaceable></command></term>
|
| 798 |
+
<listitem>
|
| 799 |
+
<para>
|
| 800 |
+
Dumps information about the node (namespace, attributes, content).
|
| 801 |
+
</para>
|
| 802 |
+
</listitem>
|
| 803 |
+
</varlistentry>
|
| 804 |
+
|
| 805 |
+
<varlistentry>
|
| 806 |
+
<term><command>du <replaceable>PATH</replaceable></command></term>
|
| 807 |
+
<listitem>
|
| 808 |
+
<para>
|
| 809 |
+
Show the structure of the subtree under the given path or the current node.
|
| 810 |
+
</para>
|
| 811 |
+
</listitem>
|
| 812 |
+
</varlistentry>
|
| 813 |
+
|
| 814 |
+
<varlistentry>
|
| 815 |
+
<term><command>exit</command></term>
|
| 816 |
+
<listitem>
|
| 817 |
+
<para>Leave the shell.</para>
|
| 818 |
+
</listitem>
|
| 819 |
+
</varlistentry>
|
| 820 |
+
|
| 821 |
+
<varlistentry>
|
| 822 |
+
<term><command>help</command></term>
|
| 823 |
+
<listitem>
|
| 824 |
+
<para>Show this help.</para>
|
| 825 |
+
</listitem>
|
| 826 |
+
</varlistentry>
|
| 827 |
+
|
| 828 |
+
<varlistentry>
|
| 829 |
+
<term><command>load <replaceable>FILENAME</replaceable></command></term>
|
| 830 |
+
<listitem>
|
| 831 |
+
<para>Load a new document with the given filename.</para>
|
| 832 |
+
</listitem>
|
| 833 |
+
</varlistentry>
|
| 834 |
+
|
| 835 |
+
<varlistentry>
|
| 836 |
+
<term><command>ls <replaceable>PATH</replaceable></command></term>
|
| 837 |
+
<listitem>
|
| 838 |
+
<para>List contents of the given path or the current directory.</para>
|
| 839 |
+
</listitem>
|
| 840 |
+
</varlistentry>
|
| 841 |
+
|
| 842 |
+
<varlistentry>
|
| 843 |
+
<term><command>pwd</command></term>
|
| 844 |
+
<listitem>
|
| 845 |
+
<para>Display the path to the current node.</para>
|
| 846 |
+
</listitem>
|
| 847 |
+
</varlistentry>
|
| 848 |
+
|
| 849 |
+
<varlistentry>
|
| 850 |
+
<term><command>quit</command></term>
|
| 851 |
+
<listitem>
|
| 852 |
+
<para>Leave the shell.</para>
|
| 853 |
+
</listitem>
|
| 854 |
+
</varlistentry>
|
| 855 |
+
|
| 856 |
+
<varlistentry>
|
| 857 |
+
<term><command>save <replaceable>FILENAME</replaceable></command></term>
|
| 858 |
+
<listitem>
|
| 859 |
+
<para>
|
| 860 |
+
Save the current document to the given filename or to the original name.
|
| 861 |
+
</para>
|
| 862 |
+
</listitem>
|
| 863 |
+
</varlistentry>
|
| 864 |
+
|
| 865 |
+
<varlistentry>
|
| 866 |
+
<term><option>validate</option></term>
|
| 867 |
+
<listitem>
|
| 868 |
+
<para>Check the document for errors.</para>
|
| 869 |
+
</listitem>
|
| 870 |
+
</varlistentry>
|
| 871 |
+
|
| 872 |
+
<varlistentry>
|
| 873 |
+
<term><command>write <replaceable>FILENAME</replaceable></command></term>
|
| 874 |
+
<listitem>
|
| 875 |
+
<para>Write the current node to the given filename.</para>
|
| 876 |
+
</listitem>
|
| 877 |
+
</varlistentry>
|
| 878 |
+
|
| 879 |
+
</variablelist>
|
| 880 |
+
</refsect1>
|
| 881 |
+
|
| 882 |
+
<refsect1 id="environment">
|
| 883 |
+
<title>ENVIRONMENT</title>
|
| 884 |
+
<variablelist>
|
| 885 |
+
|
| 886 |
+
<varlistentry>
|
| 887 |
+
<term><envar>SGML_CATALOG_FILES</envar></term>
|
| 888 |
+
<listitem>
|
| 889 |
+
<para><acronym>SGML</acronym> catalog behavior can be changed by redirecting
|
| 890 |
+
queries to the user's own set of catalogs. This can be done by setting
|
| 891 |
+
the <envar>SGML_CATALOG_FILES</envar> environment variable to a list
|
| 892 |
+
of catalogs. An empty one should deactivate loading the
|
| 893 |
+
default catalog.
|
| 894 |
+
</para>
|
| 895 |
+
</listitem>
|
| 896 |
+
</varlistentry>
|
| 897 |
+
|
| 898 |
+
<varlistentry>
|
| 899 |
+
<term><envar>XML_CATALOG_FILES</envar></term>
|
| 900 |
+
<listitem>
|
| 901 |
+
<para><acronym>XML</acronym> catalog behavior can be changed by redirecting
|
| 902 |
+
queries to the user's own set of catalogs. This can be done by setting
|
| 903 |
+
the <envar>XML_CATALOG_FILES</envar> environment variable to a space-separated
|
| 904 |
+
list of catalogs. Use percent-encoding to escape spaces or other characters.
|
| 905 |
+
An empty variable should deactivate loading the default catalog.
|
| 906 |
+
</para>
|
| 907 |
+
</listitem>
|
| 908 |
+
</varlistentry>
|
| 909 |
+
|
| 910 |
+
<varlistentry>
|
| 911 |
+
<term><envar>XML_DEBUG_CATALOG</envar></term>
|
| 912 |
+
<listitem>
|
| 913 |
+
<para>Setting the environment variable <envar>XML_DEBUG_CATALOG</envar>
|
| 914 |
+
to <parameter>non-zero</parameter> using the <command>export</command>
|
| 915 |
+
command outputs debugging information related to catalog operations.
|
| 916 |
+
</para>
|
| 917 |
+
</listitem>
|
| 918 |
+
</varlistentry>
|
| 919 |
+
|
| 920 |
+
<varlistentry>
|
| 921 |
+
<term><envar>XMLLINT_INDENT</envar></term>
|
| 922 |
+
<listitem>
|
| 923 |
+
<para>Setting the environment variable <envar>XMLLINT_INDENT</envar>
|
| 924 |
+
controls the indentation. The default value is two spaces " ".
|
| 925 |
+
</para>
|
| 926 |
+
</listitem>
|
| 927 |
+
</varlistentry>
|
| 928 |
+
|
| 929 |
+
</variablelist>
|
| 930 |
+
</refsect1>
|
| 931 |
+
|
| 932 |
+
<refsect1 id="diagnostics">
|
| 933 |
+
<title>DIAGNOSTICS</title>
|
| 934 |
+
<para>
|
| 935 |
+
&xmllint; return codes provide information that can be used when
|
| 936 |
+
calling it from scripts.
|
| 937 |
+
</para>
|
| 938 |
+
<!-- better use segmentedlist element later,
|
| 939 |
+
which is currently only supported in snapshots -->
|
| 940 |
+
<variablelist>
|
| 941 |
+
|
| 942 |
+
<varlistentry>
|
| 943 |
+
<term><errorcode>0</errorcode></term>
|
| 944 |
+
<listitem>
|
| 945 |
+
<para>No error</para>
|
| 946 |
+
</listitem>
|
| 947 |
+
</varlistentry>
|
| 948 |
+
|
| 949 |
+
<varlistentry>
|
| 950 |
+
<term><errorcode>1</errorcode></term>
|
| 951 |
+
<listitem>
|
| 952 |
+
<para>Unclassified</para>
|
| 953 |
+
</listitem>
|
| 954 |
+
</varlistentry>
|
| 955 |
+
|
| 956 |
+
<varlistentry>
|
| 957 |
+
<term><errorcode>2</errorcode></term>
|
| 958 |
+
<listitem>
|
| 959 |
+
<para>Error in <acronym>DTD</acronym></para>
|
| 960 |
+
</listitem>
|
| 961 |
+
</varlistentry>
|
| 962 |
+
|
| 963 |
+
<varlistentry>
|
| 964 |
+
<term><errorcode>3</errorcode></term>
|
| 965 |
+
<listitem>
|
| 966 |
+
<para>Validation error</para>
|
| 967 |
+
</listitem>
|
| 968 |
+
</varlistentry>
|
| 969 |
+
|
| 970 |
+
<varlistentry>
|
| 971 |
+
<term><errorcode>4</errorcode></term>
|
| 972 |
+
<listitem>
|
| 973 |
+
<para>Validation error</para>
|
| 974 |
+
</listitem>
|
| 975 |
+
</varlistentry>
|
| 976 |
+
|
| 977 |
+
<varlistentry>
|
| 978 |
+
<term><errorcode>5</errorcode></term>
|
| 979 |
+
<listitem>
|
| 980 |
+
<para>Error in schema compilation</para>
|
| 981 |
+
</listitem>
|
| 982 |
+
</varlistentry>
|
| 983 |
+
|
| 984 |
+
<varlistentry>
|
| 985 |
+
<term><errorcode>6</errorcode></term>
|
| 986 |
+
<listitem>
|
| 987 |
+
<para>Error writing output</para>
|
| 988 |
+
</listitem>
|
| 989 |
+
</varlistentry>
|
| 990 |
+
|
| 991 |
+
<varlistentry>
|
| 992 |
+
<term><errorcode>7</errorcode></term>
|
| 993 |
+
<listitem>
|
| 994 |
+
<para>
|
| 995 |
+
Error in pattern (generated when <option>--pattern</option> option is used)
|
| 996 |
+
</para>
|
| 997 |
+
</listitem>
|
| 998 |
+
</varlistentry>
|
| 999 |
+
|
| 1000 |
+
<varlistentry>
|
| 1001 |
+
<term><errorcode>9</errorcode></term>
|
| 1002 |
+
<listitem>
|
| 1003 |
+
<para>Out of memory error</para>
|
| 1004 |
+
</listitem>
|
| 1005 |
+
</varlistentry>
|
| 1006 |
+
|
| 1007 |
+
<varlistentry>
|
| 1008 |
+
<term><errorcode>10</errorcode></term>
|
| 1009 |
+
<listitem>
|
| 1010 |
+
<para>XPath evaluation error</para>
|
| 1011 |
+
</listitem>
|
| 1012 |
+
</varlistentry>
|
| 1013 |
+
|
| 1014 |
+
<varlistentry>
|
| 1015 |
+
<term><errorcode>11</errorcode></term>
|
| 1016 |
+
<listitem>
|
| 1017 |
+
<para>XPath result is empty</para>
|
| 1018 |
+
</listitem>
|
| 1019 |
+
</varlistentry>
|
| 1020 |
+
|
| 1021 |
+
</variablelist>
|
| 1022 |
+
</refsect1>
|
| 1023 |
+
|
| 1024 |
+
<refsect1 id="seealso">
|
| 1025 |
+
<title>SEE ALSO</title>
|
| 1026 |
+
<para><citerefentry>
|
| 1027 |
+
<refentrytitle>libxml</refentrytitle>
|
| 1028 |
+
<manvolnum>3</manvolnum>
|
| 1029 |
+
</citerefentry>
|
| 1030 |
+
</para>
|
| 1031 |
+
<para>
|
| 1032 |
+
More information can be found at
|
| 1033 |
+
<itemizedlist>
|
| 1034 |
+
<listitem>
|
| 1035 |
+
<para><citerefentry>
|
| 1036 |
+
<refentrytitle>libxml</refentrytitle>
|
| 1037 |
+
<manvolnum>3</manvolnum>
|
| 1038 |
+
</citerefentry> web page <ulink url="https://gitlab.gnome.org/GNOME/libxml2"/>
|
| 1039 |
+
</para>
|
| 1040 |
+
</listitem>
|
| 1041 |
+
</itemizedlist>
|
| 1042 |
+
</para>
|
| 1043 |
+
</refsect1>
|
| 1044 |
+
|
| 1045 |
+
</refentry>
|
local-test-libxml2-delta-02/afc-libxml2/example/Makefile.am
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
EXTRA_DIST = \
|
| 2 |
+
gjobs.xml \
|
| 3 |
+
meson.build \
|
| 4 |
+
test1.xml \
|
| 5 |
+
test2.xml \
|
| 6 |
+
test3.xml
|
| 7 |
+
|
| 8 |
+
check_PROGRAMS = \
|
| 9 |
+
gjobread \
|
| 10 |
+
io1 \
|
| 11 |
+
io2 \
|
| 12 |
+
parse1 \
|
| 13 |
+
parse2 \
|
| 14 |
+
parse3 \
|
| 15 |
+
parse4 \
|
| 16 |
+
reader1 \
|
| 17 |
+
reader2 \
|
| 18 |
+
reader3 \
|
| 19 |
+
reader4 \
|
| 20 |
+
testWriter \
|
| 21 |
+
tree1 \
|
| 22 |
+
tree2 \
|
| 23 |
+
xpath1 \
|
| 24 |
+
xpath2
|
| 25 |
+
|
| 26 |
+
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
|
| 27 |
+
LDADD = $(top_builddir)/libxml2.la
|
| 28 |
+
|
| 29 |
+
gjobread_SOURCES=gjobread.c
|
| 30 |
+
io1_SOURCES = io1.c
|
| 31 |
+
io2_SOURCES = io2.c
|
| 32 |
+
parse1_SOURCES = parse1.c
|
| 33 |
+
parse2_SOURCES = parse2.c
|
| 34 |
+
parse3_SOURCES = parse3.c
|
| 35 |
+
parse4_SOURCES = parse4.c
|
| 36 |
+
reader1_SOURCES = reader1.c
|
| 37 |
+
reader2_SOURCES = reader2.c
|
| 38 |
+
reader3_SOURCES = reader3.c
|
| 39 |
+
reader4_SOURCES = reader4.c
|
| 40 |
+
testWriter_SOURCES = testWriter.c
|
| 41 |
+
tree1_SOURCES = tree1.c
|
| 42 |
+
tree2_SOURCES = tree2.c
|
| 43 |
+
xpath1_SOURCES = xpath1.c
|
| 44 |
+
xpath2_SOURCES = xpath2.c
|
local-test-libxml2-delta-02/afc-libxml2/example/gjobread.c
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* gjobread.c : a small test program for gnome jobs XML format
|
| 3 |
+
*
|
| 4 |
+
* See Copyright for the status of this software.
|
| 5 |
+
*
|
| 6 |
+
* Daniel.Veillard@w3.org
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
#include <stdio.h>
|
| 10 |
+
#include <string.h>
|
| 11 |
+
#include <stdlib.h>
|
| 12 |
+
|
| 13 |
+
/*
|
| 14 |
+
* This example should compile and run indifferently with libxml-1.8.8 +
|
| 15 |
+
* and libxml2-2.1.0 +
|
| 16 |
+
* Check the COMPAT comments below
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
/*
|
| 20 |
+
* COMPAT using xml-config --cflags to get the include path this will
|
| 21 |
+
* work with both
|
| 22 |
+
*/
|
| 23 |
+
#include <libxml/xmlmemory.h>
|
| 24 |
+
#include <libxml/parser.h>
|
| 25 |
+
|
| 26 |
+
#define DEBUG(x) printf(x)
|
| 27 |
+
|
| 28 |
+
/*
|
| 29 |
+
* A person record
|
| 30 |
+
* an xmlChar * is really an UTF8 encoded char string (0 terminated)
|
| 31 |
+
*/
|
| 32 |
+
typedef struct person {
|
| 33 |
+
xmlChar *name;
|
| 34 |
+
xmlChar *email;
|
| 35 |
+
xmlChar *company;
|
| 36 |
+
xmlChar *organisation;
|
| 37 |
+
xmlChar *smail;
|
| 38 |
+
xmlChar *webPage;
|
| 39 |
+
xmlChar *phone;
|
| 40 |
+
} person, *personPtr;
|
| 41 |
+
|
| 42 |
+
/*
|
| 43 |
+
* And the code needed to parse it
|
| 44 |
+
*/
|
| 45 |
+
static personPtr
|
| 46 |
+
parsePerson(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
|
| 47 |
+
personPtr ret = NULL;
|
| 48 |
+
|
| 49 |
+
DEBUG("parsePerson\n");
|
| 50 |
+
/*
|
| 51 |
+
* allocate the struct
|
| 52 |
+
*/
|
| 53 |
+
ret = (personPtr) malloc(sizeof(person));
|
| 54 |
+
if (ret == NULL) {
|
| 55 |
+
fprintf(stderr,"out of memory\n");
|
| 56 |
+
return(NULL);
|
| 57 |
+
}
|
| 58 |
+
memset(ret, 0, sizeof(person));
|
| 59 |
+
|
| 60 |
+
/* We don't care what the top level element name is */
|
| 61 |
+
/* COMPAT xmlChildrenNode is a macro unifying libxml1 and libxml2 names */
|
| 62 |
+
cur = cur->xmlChildrenNode;
|
| 63 |
+
while (cur != NULL) {
|
| 64 |
+
if ((!xmlStrcmp(cur->name, (const xmlChar *)"Person")) &&
|
| 65 |
+
(cur->ns == ns))
|
| 66 |
+
ret->name = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
| 67 |
+
if ((!xmlStrcmp(cur->name, (const xmlChar *)"Email")) &&
|
| 68 |
+
(cur->ns == ns))
|
| 69 |
+
ret->email = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
| 70 |
+
cur = cur->next;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
return(ret);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/*
|
| 77 |
+
* and to print it
|
| 78 |
+
*/
|
| 79 |
+
static void
|
| 80 |
+
printPerson(personPtr cur) {
|
| 81 |
+
if (cur == NULL) return;
|
| 82 |
+
printf("------ Person\n");
|
| 83 |
+
if (cur->name) printf(" name: %s\n", cur->name);
|
| 84 |
+
if (cur->email) printf(" email: %s\n", cur->email);
|
| 85 |
+
if (cur->company) printf(" company: %s\n", cur->company);
|
| 86 |
+
if (cur->organisation) printf(" organisation: %s\n", cur->organisation);
|
| 87 |
+
if (cur->smail) printf(" smail: %s\n", cur->smail);
|
| 88 |
+
if (cur->webPage) printf(" Web: %s\n", cur->webPage);
|
| 89 |
+
if (cur->phone) printf(" phone: %s\n", cur->phone);
|
| 90 |
+
printf("------\n");
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/*
|
| 94 |
+
* a Description for a Job
|
| 95 |
+
*/
|
| 96 |
+
typedef struct job {
|
| 97 |
+
xmlChar *projectID;
|
| 98 |
+
xmlChar *application;
|
| 99 |
+
xmlChar *category;
|
| 100 |
+
personPtr contact;
|
| 101 |
+
int nbDevelopers;
|
| 102 |
+
personPtr developers[100]; /* using dynamic alloc is left as an exercise */
|
| 103 |
+
} job, *jobPtr;
|
| 104 |
+
|
| 105 |
+
/*
|
| 106 |
+
* And the code needed to parse it
|
| 107 |
+
*/
|
| 108 |
+
static jobPtr
|
| 109 |
+
parseJob(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
|
| 110 |
+
jobPtr ret = NULL;
|
| 111 |
+
|
| 112 |
+
DEBUG("parseJob\n");
|
| 113 |
+
/*
|
| 114 |
+
* allocate the struct
|
| 115 |
+
*/
|
| 116 |
+
ret = (jobPtr) malloc(sizeof(job));
|
| 117 |
+
if (ret == NULL) {
|
| 118 |
+
fprintf(stderr,"out of memory\n");
|
| 119 |
+
return(NULL);
|
| 120 |
+
}
|
| 121 |
+
memset(ret, 0, sizeof(job));
|
| 122 |
+
|
| 123 |
+
/* We don't care what the top level element name is */
|
| 124 |
+
cur = cur->xmlChildrenNode;
|
| 125 |
+
while (cur != NULL) {
|
| 126 |
+
|
| 127 |
+
if ((!xmlStrcmp(cur->name, (const xmlChar *) "Project")) &&
|
| 128 |
+
(cur->ns == ns)) {
|
| 129 |
+
ret->projectID = xmlGetProp(cur, (const xmlChar *) "ID");
|
| 130 |
+
if (ret->projectID == NULL) {
|
| 131 |
+
fprintf(stderr, "Project has no ID\n");
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
if ((!xmlStrcmp(cur->name, (const xmlChar *) "Application")) &&
|
| 135 |
+
(cur->ns == ns))
|
| 136 |
+
ret->application =
|
| 137 |
+
xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
| 138 |
+
if ((!xmlStrcmp(cur->name, (const xmlChar *) "Category")) &&
|
| 139 |
+
(cur->ns == ns))
|
| 140 |
+
ret->category =
|
| 141 |
+
xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
| 142 |
+
if ((!xmlStrcmp(cur->name, (const xmlChar *) "Contact")) &&
|
| 143 |
+
(cur->ns == ns))
|
| 144 |
+
ret->contact = parsePerson(doc, ns, cur);
|
| 145 |
+
cur = cur->next;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
return(ret);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/*
|
| 152 |
+
* and to print it
|
| 153 |
+
*/
|
| 154 |
+
static void
|
| 155 |
+
printJob(jobPtr cur) {
|
| 156 |
+
int i;
|
| 157 |
+
|
| 158 |
+
if (cur == NULL) return;
|
| 159 |
+
printf("======= Job\n");
|
| 160 |
+
if (cur->projectID != NULL) printf("projectID: %s\n", cur->projectID);
|
| 161 |
+
if (cur->application != NULL) printf("application: %s\n", cur->application);
|
| 162 |
+
if (cur->category != NULL) printf("category: %s\n", cur->category);
|
| 163 |
+
if (cur->contact != NULL) printPerson(cur->contact);
|
| 164 |
+
printf("%d developers\n", cur->nbDevelopers);
|
| 165 |
+
|
| 166 |
+
for (i = 0;i < cur->nbDevelopers;i++) printPerson(cur->developers[i]);
|
| 167 |
+
printf("======= \n");
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
/*
|
| 171 |
+
* A pool of Gnome Jobs
|
| 172 |
+
*/
|
| 173 |
+
typedef struct gjob {
|
| 174 |
+
int nbJobs;
|
| 175 |
+
jobPtr jobs[500]; /* using dynamic alloc is left as an exercise */
|
| 176 |
+
} gJob, *gJobPtr;
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
static gJobPtr
|
| 180 |
+
parseGjobFile(char *filename) {
|
| 181 |
+
xmlDocPtr doc;
|
| 182 |
+
gJobPtr ret;
|
| 183 |
+
jobPtr curjob;
|
| 184 |
+
xmlNsPtr ns;
|
| 185 |
+
xmlNodePtr cur;
|
| 186 |
+
|
| 187 |
+
/*
|
| 188 |
+
* build an XML tree from a the file;
|
| 189 |
+
*/
|
| 190 |
+
doc = xmlReadFile(filename, NULL, XML_PARSE_NOBLANKS);
|
| 191 |
+
if (doc == NULL) return(NULL);
|
| 192 |
+
|
| 193 |
+
/*
|
| 194 |
+
* Check the document is of the right kind
|
| 195 |
+
*/
|
| 196 |
+
|
| 197 |
+
cur = xmlDocGetRootElement(doc);
|
| 198 |
+
if (cur == NULL) {
|
| 199 |
+
fprintf(stderr,"empty document\n");
|
| 200 |
+
xmlFreeDoc(doc);
|
| 201 |
+
return(NULL);
|
| 202 |
+
}
|
| 203 |
+
ns = xmlSearchNsByHref(doc, cur,
|
| 204 |
+
(const xmlChar *) "http://www.gnome.org/some-location");
|
| 205 |
+
if (ns == NULL) {
|
| 206 |
+
fprintf(stderr,
|
| 207 |
+
"document of the wrong type, GJob Namespace not found\n");
|
| 208 |
+
xmlFreeDoc(doc);
|
| 209 |
+
return(NULL);
|
| 210 |
+
}
|
| 211 |
+
if (xmlStrcmp(cur->name, (const xmlChar *) "Helping")) {
|
| 212 |
+
fprintf(stderr,"document of the wrong type, root node != Helping");
|
| 213 |
+
xmlFreeDoc(doc);
|
| 214 |
+
return(NULL);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/*
|
| 218 |
+
* Allocate the structure to be returned.
|
| 219 |
+
*/
|
| 220 |
+
ret = (gJobPtr) malloc(sizeof(gJob));
|
| 221 |
+
if (ret == NULL) {
|
| 222 |
+
fprintf(stderr,"out of memory\n");
|
| 223 |
+
xmlFreeDoc(doc);
|
| 224 |
+
return(NULL);
|
| 225 |
+
}
|
| 226 |
+
memset(ret, 0, sizeof(gJob));
|
| 227 |
+
|
| 228 |
+
/*
|
| 229 |
+
* Now, walk the tree.
|
| 230 |
+
*/
|
| 231 |
+
/* First level we expect just Jobs */
|
| 232 |
+
cur = cur->xmlChildrenNode;
|
| 233 |
+
while ( cur && xmlIsBlankNode ( cur ) ) {
|
| 234 |
+
cur = cur -> next;
|
| 235 |
+
}
|
| 236 |
+
if ( cur == 0 ) {
|
| 237 |
+
xmlFreeDoc(doc);
|
| 238 |
+
free(ret);
|
| 239 |
+
return ( NULL );
|
| 240 |
+
}
|
| 241 |
+
if ((xmlStrcmp(cur->name, (const xmlChar *) "Jobs")) || (cur->ns != ns)) {
|
| 242 |
+
fprintf(stderr,"document of the wrong type, was '%s', Jobs expected",
|
| 243 |
+
cur->name);
|
| 244 |
+
fprintf(stderr,"xmlDocDump follows\n");
|
| 245 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
| 246 |
+
xmlDocDump ( stderr, doc );
|
| 247 |
+
fprintf(stderr,"xmlDocDump finished\n");
|
| 248 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
| 249 |
+
xmlFreeDoc(doc);
|
| 250 |
+
free(ret);
|
| 251 |
+
return(NULL);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
/* Second level is a list of Job, but be laxist */
|
| 255 |
+
cur = cur->xmlChildrenNode;
|
| 256 |
+
while (cur != NULL) {
|
| 257 |
+
if ((!xmlStrcmp(cur->name, (const xmlChar *) "Job")) &&
|
| 258 |
+
(cur->ns == ns)) {
|
| 259 |
+
curjob = parseJob(doc, ns, cur);
|
| 260 |
+
if (curjob != NULL)
|
| 261 |
+
ret->jobs[ret->nbJobs++] = curjob;
|
| 262 |
+
if (ret->nbJobs >= 500) break;
|
| 263 |
+
}
|
| 264 |
+
cur = cur->next;
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
return(ret);
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
static void
|
| 271 |
+
handleGjob(gJobPtr cur) {
|
| 272 |
+
int i;
|
| 273 |
+
|
| 274 |
+
/*
|
| 275 |
+
* Do whatever you want and free the structure.
|
| 276 |
+
*/
|
| 277 |
+
printf("%d Jobs registered\n", cur->nbJobs);
|
| 278 |
+
for (i = 0; i < cur->nbJobs; i++) printJob(cur->jobs[i]);
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
int main(int argc, char **argv) {
|
| 282 |
+
int i;
|
| 283 |
+
gJobPtr cur;
|
| 284 |
+
|
| 285 |
+
/* COMPAT: Do not generate nodes for formatting spaces */
|
| 286 |
+
LIBXML_TEST_VERSION
|
| 287 |
+
|
| 288 |
+
for (i = 1; i < argc ; i++) {
|
| 289 |
+
cur = parseGjobFile(argv[i]);
|
| 290 |
+
if ( cur )
|
| 291 |
+
handleGjob(cur);
|
| 292 |
+
else
|
| 293 |
+
fprintf( stderr, "Error parsing file '%s'\n", argv[i]);
|
| 294 |
+
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
/* Clean up everything else before quitting. */
|
| 298 |
+
xmlCleanupParser();
|
| 299 |
+
|
| 300 |
+
return(0);
|
| 301 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/example/gjobs.xml
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<gjob:Helping xmlns:gjob="http://www.gnome.org/some-location">
|
| 3 |
+
<gjob:Jobs>
|
| 4 |
+
|
| 5 |
+
<gjob:Job>
|
| 6 |
+
<gjob:Project ID="3"/>
|
| 7 |
+
<gjob:Application>GBackup</gjob:Application>
|
| 8 |
+
<gjob:Category>Development</gjob:Category>
|
| 9 |
+
|
| 10 |
+
<gjob:Update>
|
| 11 |
+
<gjob:Status>Open</gjob:Status>
|
| 12 |
+
<gjob:Modified>Mon, 07 Jun 1999 20:27:45 -0400 MET DST</gjob:Modified>
|
| 13 |
+
<gjob:Salary>USD 0.00</gjob:Salary>
|
| 14 |
+
</gjob:Update>
|
| 15 |
+
|
| 16 |
+
<gjob:Developers>
|
| 17 |
+
<gjob:Developer>
|
| 18 |
+
</gjob:Developer>
|
| 19 |
+
</gjob:Developers>
|
| 20 |
+
|
| 21 |
+
<gjob:Contact>
|
| 22 |
+
<gjob:Person>Nathan Clemons</gjob:Person>
|
| 23 |
+
<gjob:Email>nathan@windsofstorm.net</gjob:Email>
|
| 24 |
+
<gjob:Company>
|
| 25 |
+
</gjob:Company>
|
| 26 |
+
<gjob:Organisation>
|
| 27 |
+
</gjob:Organisation>
|
| 28 |
+
<gjob:Webpage>
|
| 29 |
+
</gjob:Webpage>
|
| 30 |
+
<gjob:Snailmail>
|
| 31 |
+
</gjob:Snailmail>
|
| 32 |
+
<gjob:Phone>
|
| 33 |
+
</gjob:Phone>
|
| 34 |
+
</gjob:Contact>
|
| 35 |
+
|
| 36 |
+
<gjob:Requirements>
|
| 37 |
+
The program should be released as free software, under the GPL.
|
| 38 |
+
</gjob:Requirements>
|
| 39 |
+
|
| 40 |
+
<gjob:Skills>
|
| 41 |
+
</gjob:Skills>
|
| 42 |
+
|
| 43 |
+
<gjob:Details>
|
| 44 |
+
A GNOME based system that will allow a superuser to configure
|
| 45 |
+
compressed and uncompressed files and/or file systems to be backed
|
| 46 |
+
up with a supported media in the system. This should be able to
|
| 47 |
+
perform via find commands generating a list of files that are passed
|
| 48 |
+
to tar, dd, cpio, cp, gzip, etc., to be directed to the tape machine
|
| 49 |
+
or via operations performed on the filesystem itself. Email
|
| 50 |
+
notification and GUI status display very important.
|
| 51 |
+
</gjob:Details>
|
| 52 |
+
|
| 53 |
+
</gjob:Job>
|
| 54 |
+
|
| 55 |
+
</gjob:Jobs>
|
| 56 |
+
</gjob:Helping>
|
| 57 |
+
|
local-test-libxml2-delta-02/afc-libxml2/example/io1.c
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* synopsis: Example of custom Input/Output
|
| 4 |
+
* purpose: Demonstrate the use of xmlRegisterInputCallbacks
|
| 5 |
+
* to build a custom I/O layer, this is used in an
|
| 6 |
+
* XInclude method context to show how dynamic document can
|
| 7 |
+
* be built in a clean way.
|
| 8 |
+
* usage: io1
|
| 9 |
+
* test: io1 > io1.tmp && diff io1.tmp $(srcdir)/io1.res
|
| 10 |
+
* author: Daniel Veillard
|
| 11 |
+
* copy: see Copyright for the status of this software.
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
#include <stdio.h>
|
| 15 |
+
#include <stdlib.h>
|
| 16 |
+
#include <string.h>
|
| 17 |
+
#include <libxml/parser.h>
|
| 18 |
+
#include <libxml/tree.h>
|
| 19 |
+
#include <libxml/xinclude.h>
|
| 20 |
+
#include <libxml/xmlIO.h>
|
| 21 |
+
|
| 22 |
+
#ifdef LIBXML_XINCLUDE_ENABLED
|
| 23 |
+
static const char *result = "<list><people>a</people><people>b</people></list>";
|
| 24 |
+
static const char *cur = NULL;
|
| 25 |
+
static int rlen;
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* sqlMatch:
|
| 29 |
+
* @URI: an URI to test
|
| 30 |
+
*
|
| 31 |
+
* Check for an sql: query
|
| 32 |
+
*
|
| 33 |
+
* Returns 1 if yes and 0 if another Input module should be used
|
| 34 |
+
*/
|
| 35 |
+
static int
|
| 36 |
+
sqlMatch(const char * URI) {
|
| 37 |
+
if ((URI != NULL) && (!strncmp(URI, "sql:", 4)))
|
| 38 |
+
return(1);
|
| 39 |
+
return(0);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* sqlOpen:
|
| 44 |
+
* @URI: an URI to test
|
| 45 |
+
*
|
| 46 |
+
* Return a pointer to the sql: query handler, in this example simply
|
| 47 |
+
* the current pointer...
|
| 48 |
+
*
|
| 49 |
+
* Returns an Input context or NULL in case or error
|
| 50 |
+
*/
|
| 51 |
+
static void *
|
| 52 |
+
sqlOpen(const char * URI) {
|
| 53 |
+
if ((URI == NULL) || (strncmp(URI, "sql:", 4)))
|
| 54 |
+
return(NULL);
|
| 55 |
+
cur = result;
|
| 56 |
+
rlen = strlen(result);
|
| 57 |
+
return((void *) cur);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* sqlClose:
|
| 62 |
+
* @context: the read context
|
| 63 |
+
*
|
| 64 |
+
* Close the sql: query handler
|
| 65 |
+
*
|
| 66 |
+
* Returns 0 or -1 in case of error
|
| 67 |
+
*/
|
| 68 |
+
static int
|
| 69 |
+
sqlClose(void * context) {
|
| 70 |
+
if (context == NULL) return(-1);
|
| 71 |
+
cur = NULL;
|
| 72 |
+
rlen = 0;
|
| 73 |
+
return(0);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* sqlRead:
|
| 78 |
+
* @context: the read context
|
| 79 |
+
* @buffer: where to store data
|
| 80 |
+
* @len: number of bytes to read
|
| 81 |
+
*
|
| 82 |
+
* Implement an sql: query read.
|
| 83 |
+
*
|
| 84 |
+
* Returns the number of bytes read or -1 in case of error
|
| 85 |
+
*/
|
| 86 |
+
static int
|
| 87 |
+
sqlRead(void * context, char * buffer, int len) {
|
| 88 |
+
const char *ptr = (const char *) context;
|
| 89 |
+
|
| 90 |
+
if ((context == NULL) || (buffer == NULL) || (len < 0))
|
| 91 |
+
return(-1);
|
| 92 |
+
|
| 93 |
+
if (len > rlen) len = rlen;
|
| 94 |
+
memcpy(buffer, ptr, len);
|
| 95 |
+
rlen -= len;
|
| 96 |
+
return(len);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
const char *include = "<?xml version='1.0'?>\n\
|
| 100 |
+
<document xmlns:xi=\"http://www.w3.org/2003/XInclude\">\n\
|
| 101 |
+
<p>List of people:</p>\n\
|
| 102 |
+
<xi:include href=\"sql:select_name_from_people\"/>\n\
|
| 103 |
+
</document>\n";
|
| 104 |
+
|
| 105 |
+
int main(void) {
|
| 106 |
+
xmlDocPtr doc;
|
| 107 |
+
|
| 108 |
+
/*
|
| 109 |
+
* this initialize the library and check potential ABI mismatches
|
| 110 |
+
* between the version it was compiled for and the actual shared
|
| 111 |
+
* library used.
|
| 112 |
+
*/
|
| 113 |
+
LIBXML_TEST_VERSION
|
| 114 |
+
|
| 115 |
+
/*
|
| 116 |
+
* register the new I/O handlers
|
| 117 |
+
*/
|
| 118 |
+
if (xmlRegisterInputCallbacks(sqlMatch, sqlOpen, sqlRead, sqlClose) < 0) {
|
| 119 |
+
fprintf(stderr, "failed to register SQL handler\n");
|
| 120 |
+
exit(1);
|
| 121 |
+
}
|
| 122 |
+
/*
|
| 123 |
+
* parse include into a document
|
| 124 |
+
*/
|
| 125 |
+
doc = xmlReadMemory(include, strlen(include), "include.xml", NULL, 0);
|
| 126 |
+
if (doc == NULL) {
|
| 127 |
+
fprintf(stderr, "failed to parse the including file\n");
|
| 128 |
+
exit(1);
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/*
|
| 132 |
+
* apply the XInclude process, this should trigger the I/O just
|
| 133 |
+
* registered.
|
| 134 |
+
*/
|
| 135 |
+
if (xmlXIncludeProcess(doc) <= 0) {
|
| 136 |
+
fprintf(stderr, "XInclude processing failed\n");
|
| 137 |
+
exit(1);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
| 141 |
+
/*
|
| 142 |
+
* save the output for checking to stdout
|
| 143 |
+
*/
|
| 144 |
+
xmlDocDump(stdout, doc);
|
| 145 |
+
#endif
|
| 146 |
+
|
| 147 |
+
/*
|
| 148 |
+
* Free the document
|
| 149 |
+
*/
|
| 150 |
+
xmlFreeDoc(doc);
|
| 151 |
+
|
| 152 |
+
return(0);
|
| 153 |
+
}
|
| 154 |
+
#else
|
| 155 |
+
int main(void) {
|
| 156 |
+
fprintf(stderr, "XInclude support not compiled in\n");
|
| 157 |
+
return(0);
|
| 158 |
+
}
|
| 159 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/example/parse1.c
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* section: Parsing
|
| 3 |
+
* synopsis: Parse an XML file to a tree and free it
|
| 4 |
+
* purpose: Demonstrate the use of xmlReadFile() to read an XML file
|
| 5 |
+
* into a tree and xmlFreeDoc() to free the resulting tree
|
| 6 |
+
* usage: parse1 test1.xml
|
| 7 |
+
* test: parse1 test1.xml
|
| 8 |
+
* author: Daniel Veillard
|
| 9 |
+
* copy: see Copyright for the status of this software.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
#include <stdio.h>
|
| 13 |
+
#include <libxml/parser.h>
|
| 14 |
+
#include <libxml/tree.h>
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* example1Func:
|
| 18 |
+
* @filename: a filename or an URL
|
| 19 |
+
*
|
| 20 |
+
* Parse the resource and free the resulting tree
|
| 21 |
+
*/
|
| 22 |
+
static void
|
| 23 |
+
example1Func(const char *filename) {
|
| 24 |
+
xmlDocPtr doc; /* the resulting document tree */
|
| 25 |
+
|
| 26 |
+
doc = xmlReadFile(filename, NULL, 0);
|
| 27 |
+
if (doc == NULL) {
|
| 28 |
+
fprintf(stderr, "Failed to parse %s\n", filename);
|
| 29 |
+
return;
|
| 30 |
+
}
|
| 31 |
+
xmlFreeDoc(doc);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
int main(int argc, char **argv) {
|
| 35 |
+
if (argc != 2)
|
| 36 |
+
return(1);
|
| 37 |
+
|
| 38 |
+
/*
|
| 39 |
+
* this initialize the library and check potential ABI mismatches
|
| 40 |
+
* between the version it was compiled for and the actual shared
|
| 41 |
+
* library used.
|
| 42 |
+
*/
|
| 43 |
+
LIBXML_TEST_VERSION
|
| 44 |
+
|
| 45 |
+
example1Func(argv[1]);
|
| 46 |
+
|
| 47 |
+
return(0);
|
| 48 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/example/parse2.c
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* section: Parsing
|
| 3 |
+
* synopsis: Parse and validate an XML file to a tree and free the result
|
| 4 |
+
* purpose: Create a parser context for an XML file, then parse and validate
|
| 5 |
+
* the file, creating a tree, check the validation result
|
| 6 |
+
* and xmlFreeDoc() to free the resulting tree.
|
| 7 |
+
* usage: parse2 test2.xml
|
| 8 |
+
* test: parse2 test2.xml
|
| 9 |
+
* author: Daniel Veillard
|
| 10 |
+
* copy: see Copyright for the status of this software.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
#include <stdio.h>
|
| 14 |
+
#include <libxml/parser.h>
|
| 15 |
+
#include <libxml/tree.h>
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* exampleFunc:
|
| 19 |
+
* @filename: a filename or an URL
|
| 20 |
+
*
|
| 21 |
+
* Parse and validate the resource and free the resulting tree
|
| 22 |
+
*/
|
| 23 |
+
static void
|
| 24 |
+
exampleFunc(const char *filename) {
|
| 25 |
+
xmlParserCtxtPtr ctxt; /* the parser context */
|
| 26 |
+
xmlDocPtr doc; /* the resulting document tree */
|
| 27 |
+
|
| 28 |
+
/* create a parser context */
|
| 29 |
+
ctxt = xmlNewParserCtxt();
|
| 30 |
+
if (ctxt == NULL) {
|
| 31 |
+
fprintf(stderr, "Failed to allocate parser context\n");
|
| 32 |
+
return;
|
| 33 |
+
}
|
| 34 |
+
/* parse the file, activating the DTD validation option */
|
| 35 |
+
doc = xmlCtxtReadFile(ctxt, filename, NULL, XML_PARSE_DTDVALID);
|
| 36 |
+
/* check if parsing succeeded */
|
| 37 |
+
if (doc == NULL) {
|
| 38 |
+
fprintf(stderr, "Failed to parse %s\n", filename);
|
| 39 |
+
} else {
|
| 40 |
+
/* check if validation succeeded */
|
| 41 |
+
if (ctxt->valid == 0)
|
| 42 |
+
fprintf(stderr, "Failed to validate %s\n", filename);
|
| 43 |
+
/* free up the resulting document */
|
| 44 |
+
xmlFreeDoc(doc);
|
| 45 |
+
}
|
| 46 |
+
/* free up the parser context */
|
| 47 |
+
xmlFreeParserCtxt(ctxt);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
int main(int argc, char **argv) {
|
| 51 |
+
if (argc != 2)
|
| 52 |
+
return(1);
|
| 53 |
+
|
| 54 |
+
/*
|
| 55 |
+
* this initialize the library and check potential ABI mismatches
|
| 56 |
+
* between the version it was compiled for and the actual shared
|
| 57 |
+
* library used.
|
| 58 |
+
*/
|
| 59 |
+
LIBXML_TEST_VERSION
|
| 60 |
+
|
| 61 |
+
exampleFunc(argv[1]);
|
| 62 |
+
|
| 63 |
+
return(0);
|
| 64 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/example/reader1.c
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* section: xmlReader
|
| 3 |
+
* synopsis: Parse an XML file with an xmlReader
|
| 4 |
+
* purpose: Demonstrate the use of xmlReaderForFile() to parse an XML file
|
| 5 |
+
* and dump the information about the nodes found in the process.
|
| 6 |
+
* (Note that the XMLReader functions require libxml2 version later
|
| 7 |
+
* than 2.6.)
|
| 8 |
+
* usage: reader1 <filename>
|
| 9 |
+
* test: reader1 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
|
| 10 |
+
* author: Daniel Veillard
|
| 11 |
+
* copy: see Copyright for the status of this software.
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
#include <stdio.h>
|
| 15 |
+
#include <libxml/xmlreader.h>
|
| 16 |
+
|
| 17 |
+
#ifdef LIBXML_READER_ENABLED
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* processNode:
|
| 21 |
+
* @reader: the xmlReader
|
| 22 |
+
*
|
| 23 |
+
* Dump information about the current node
|
| 24 |
+
*/
|
| 25 |
+
static void
|
| 26 |
+
processNode(xmlTextReaderPtr reader) {
|
| 27 |
+
const xmlChar *name, *value;
|
| 28 |
+
|
| 29 |
+
name = xmlTextReaderConstName(reader);
|
| 30 |
+
if (name == NULL)
|
| 31 |
+
name = BAD_CAST "--";
|
| 32 |
+
|
| 33 |
+
value = xmlTextReaderConstValue(reader);
|
| 34 |
+
|
| 35 |
+
printf("%d %d %s %d %d",
|
| 36 |
+
xmlTextReaderDepth(reader),
|
| 37 |
+
xmlTextReaderNodeType(reader),
|
| 38 |
+
name,
|
| 39 |
+
xmlTextReaderIsEmptyElement(reader),
|
| 40 |
+
xmlTextReaderHasValue(reader));
|
| 41 |
+
if (value == NULL)
|
| 42 |
+
printf("\n");
|
| 43 |
+
else {
|
| 44 |
+
if (xmlStrlen(value) > 40)
|
| 45 |
+
printf(" %.40s...\n", value);
|
| 46 |
+
else
|
| 47 |
+
printf(" %s\n", value);
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* streamFile:
|
| 53 |
+
* @filename: the file name to parse
|
| 54 |
+
*
|
| 55 |
+
* Parse and print information about an XML file.
|
| 56 |
+
*/
|
| 57 |
+
static void
|
| 58 |
+
streamFile(const char *filename) {
|
| 59 |
+
xmlTextReaderPtr reader;
|
| 60 |
+
int ret;
|
| 61 |
+
|
| 62 |
+
reader = xmlReaderForFile(filename, NULL, 0);
|
| 63 |
+
if (reader != NULL) {
|
| 64 |
+
ret = xmlTextReaderRead(reader);
|
| 65 |
+
while (ret == 1) {
|
| 66 |
+
processNode(reader);
|
| 67 |
+
ret = xmlTextReaderRead(reader);
|
| 68 |
+
}
|
| 69 |
+
xmlFreeTextReader(reader);
|
| 70 |
+
if (ret != 0) {
|
| 71 |
+
fprintf(stderr, "%s : failed to parse\n", filename);
|
| 72 |
+
}
|
| 73 |
+
} else {
|
| 74 |
+
fprintf(stderr, "Unable to open %s\n", filename);
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
int main(int argc, char **argv) {
|
| 79 |
+
if (argc != 2)
|
| 80 |
+
return(1);
|
| 81 |
+
|
| 82 |
+
/*
|
| 83 |
+
* this initialize the library and check potential ABI mismatches
|
| 84 |
+
* between the version it was compiled for and the actual shared
|
| 85 |
+
* library used.
|
| 86 |
+
*/
|
| 87 |
+
LIBXML_TEST_VERSION
|
| 88 |
+
|
| 89 |
+
streamFile(argv[1]);
|
| 90 |
+
|
| 91 |
+
return(0);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
#else
|
| 95 |
+
int main(void) {
|
| 96 |
+
fprintf(stderr, "XInclude support not compiled in\n");
|
| 97 |
+
return(0);
|
| 98 |
+
}
|
| 99 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/example/reader2.c
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* section: xmlReader
|
| 3 |
+
* synopsis: Parse and validate an XML file with an xmlReader
|
| 4 |
+
* purpose: Demonstrate the use of xmlReaderForFile() to parse an XML file
|
| 5 |
+
* validating the content in the process and activating options
|
| 6 |
+
* like entities substitution, and DTD attributes defaulting.
|
| 7 |
+
* (Note that the XMLReader functions require libxml2 version later
|
| 8 |
+
* than 2.6.)
|
| 9 |
+
* usage: reader2 <valid_xml_filename>
|
| 10 |
+
* test: reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
|
| 11 |
+
* author: Daniel Veillard
|
| 12 |
+
* copy: see Copyright for the status of this software.
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#include <stdio.h>
|
| 16 |
+
#include <libxml/xmlreader.h>
|
| 17 |
+
#include <libxml/parser.h>
|
| 18 |
+
|
| 19 |
+
#ifdef LIBXML_READER_ENABLED
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* processNode:
|
| 23 |
+
* @reader: the xmlReader
|
| 24 |
+
*
|
| 25 |
+
* Dump information about the current node
|
| 26 |
+
*/
|
| 27 |
+
static void
|
| 28 |
+
processNode(xmlTextReaderPtr reader) {
|
| 29 |
+
const xmlChar *name, *value;
|
| 30 |
+
|
| 31 |
+
name = xmlTextReaderConstName(reader);
|
| 32 |
+
if (name == NULL)
|
| 33 |
+
name = BAD_CAST "--";
|
| 34 |
+
|
| 35 |
+
value = xmlTextReaderConstValue(reader);
|
| 36 |
+
|
| 37 |
+
printf("%d %d %s %d %d",
|
| 38 |
+
xmlTextReaderDepth(reader),
|
| 39 |
+
xmlTextReaderNodeType(reader),
|
| 40 |
+
name,
|
| 41 |
+
xmlTextReaderIsEmptyElement(reader),
|
| 42 |
+
xmlTextReaderHasValue(reader));
|
| 43 |
+
if (value == NULL)
|
| 44 |
+
printf("\n");
|
| 45 |
+
else {
|
| 46 |
+
if (xmlStrlen(value) > 40)
|
| 47 |
+
printf(" %.40s...\n", value);
|
| 48 |
+
else
|
| 49 |
+
printf(" %s\n", value);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* streamFile:
|
| 55 |
+
* @filename: the file name to parse
|
| 56 |
+
*
|
| 57 |
+
* Parse, validate and print information about an XML file.
|
| 58 |
+
*/
|
| 59 |
+
static void
|
| 60 |
+
streamFile(const char *filename) {
|
| 61 |
+
xmlTextReaderPtr reader;
|
| 62 |
+
int ret;
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
/*
|
| 66 |
+
* Pass some special parsing options to activate DTD attribute defaulting,
|
| 67 |
+
* entities substitution and DTD validation
|
| 68 |
+
*/
|
| 69 |
+
reader = xmlReaderForFile(filename, NULL,
|
| 70 |
+
XML_PARSE_DTDATTR | /* default DTD attributes */
|
| 71 |
+
XML_PARSE_NOENT | /* substitute entities */
|
| 72 |
+
XML_PARSE_DTDVALID); /* validate with the DTD */
|
| 73 |
+
if (reader != NULL) {
|
| 74 |
+
ret = xmlTextReaderRead(reader);
|
| 75 |
+
while (ret == 1) {
|
| 76 |
+
processNode(reader);
|
| 77 |
+
ret = xmlTextReaderRead(reader);
|
| 78 |
+
}
|
| 79 |
+
/*
|
| 80 |
+
* Once the document has been fully parsed check the validation results
|
| 81 |
+
*/
|
| 82 |
+
if (xmlTextReaderIsValid(reader) != 1) {
|
| 83 |
+
fprintf(stderr, "Document %s does not validate\n", filename);
|
| 84 |
+
}
|
| 85 |
+
xmlFreeTextReader(reader);
|
| 86 |
+
if (ret != 0) {
|
| 87 |
+
fprintf(stderr, "%s : failed to parse\n", filename);
|
| 88 |
+
}
|
| 89 |
+
} else {
|
| 90 |
+
fprintf(stderr, "Unable to open %s\n", filename);
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
int main(int argc, char **argv) {
|
| 95 |
+
if (argc != 2)
|
| 96 |
+
return(1);
|
| 97 |
+
|
| 98 |
+
/*
|
| 99 |
+
* this initialize the library and check potential ABI mismatches
|
| 100 |
+
* between the version it was compiled for and the actual shared
|
| 101 |
+
* library used.
|
| 102 |
+
*/
|
| 103 |
+
LIBXML_TEST_VERSION
|
| 104 |
+
|
| 105 |
+
streamFile(argv[1]);
|
| 106 |
+
|
| 107 |
+
return(0);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
#else
|
| 111 |
+
int main(void) {
|
| 112 |
+
fprintf(stderr, "XInclude support not compiled in\n");
|
| 113 |
+
return(0);
|
| 114 |
+
}
|
| 115 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/example/reader3.c
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* section: xmlReader
|
| 3 |
+
* synopsis: Show how to extract subdocuments with xmlReader
|
| 4 |
+
* purpose: Demonstrate the use of xmlTextReaderPreservePattern()
|
| 5 |
+
* to parse an XML file with the xmlReader while collecting
|
| 6 |
+
* only some subparts of the document.
|
| 7 |
+
* (Note that the XMLReader functions require libxml2 version later
|
| 8 |
+
* than 2.6.)
|
| 9 |
+
* usage: reader3
|
| 10 |
+
* test: reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res
|
| 11 |
+
* author: Daniel Veillard
|
| 12 |
+
* copy: see Copyright for the status of this software.
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#include <stdio.h>
|
| 16 |
+
#include <libxml/xmlreader.h>
|
| 17 |
+
|
| 18 |
+
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* streamFile:
|
| 23 |
+
* @filename: the file name to parse
|
| 24 |
+
*
|
| 25 |
+
* Parse and print information about an XML file.
|
| 26 |
+
*
|
| 27 |
+
* Returns the resulting doc with just the elements preserved.
|
| 28 |
+
*/
|
| 29 |
+
static xmlDocPtr
|
| 30 |
+
extractFile(const char *filename, const xmlChar *pattern) {
|
| 31 |
+
xmlDocPtr doc;
|
| 32 |
+
xmlTextReaderPtr reader;
|
| 33 |
+
int ret;
|
| 34 |
+
|
| 35 |
+
/*
|
| 36 |
+
* build an xmlReader for that file
|
| 37 |
+
*/
|
| 38 |
+
reader = xmlReaderForFile(filename, NULL, 0);
|
| 39 |
+
if (reader != NULL) {
|
| 40 |
+
/*
|
| 41 |
+
* add the pattern to preserve
|
| 42 |
+
*/
|
| 43 |
+
if (xmlTextReaderPreservePattern(reader, pattern, NULL) < 0) {
|
| 44 |
+
fprintf(stderr, "%s : failed add preserve pattern %s\n",
|
| 45 |
+
filename, (const char *) pattern);
|
| 46 |
+
}
|
| 47 |
+
/*
|
| 48 |
+
* Parse and traverse the tree, collecting the nodes in the process
|
| 49 |
+
*/
|
| 50 |
+
ret = xmlTextReaderRead(reader);
|
| 51 |
+
while (ret == 1) {
|
| 52 |
+
ret = xmlTextReaderRead(reader);
|
| 53 |
+
}
|
| 54 |
+
if (ret != 0) {
|
| 55 |
+
fprintf(stderr, "%s : failed to parse\n", filename);
|
| 56 |
+
xmlFreeTextReader(reader);
|
| 57 |
+
return(NULL);
|
| 58 |
+
}
|
| 59 |
+
/*
|
| 60 |
+
* get the resulting nodes
|
| 61 |
+
*/
|
| 62 |
+
doc = xmlTextReaderCurrentDoc(reader);
|
| 63 |
+
/*
|
| 64 |
+
* Free up the reader
|
| 65 |
+
*/
|
| 66 |
+
xmlFreeTextReader(reader);
|
| 67 |
+
} else {
|
| 68 |
+
fprintf(stderr, "Unable to open %s\n", filename);
|
| 69 |
+
return(NULL);
|
| 70 |
+
}
|
| 71 |
+
return(doc);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
int main(int argc, char **argv) {
|
| 75 |
+
const char *filename = "test3.xml";
|
| 76 |
+
const char *pattern = "preserved";
|
| 77 |
+
xmlDocPtr doc;
|
| 78 |
+
|
| 79 |
+
if (argc == 3) {
|
| 80 |
+
filename = argv[1];
|
| 81 |
+
pattern = argv[2];
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/*
|
| 85 |
+
* this initialize the library and check potential ABI mismatches
|
| 86 |
+
* between the version it was compiled for and the actual shared
|
| 87 |
+
* library used.
|
| 88 |
+
*/
|
| 89 |
+
LIBXML_TEST_VERSION
|
| 90 |
+
|
| 91 |
+
doc = extractFile(filename, (const xmlChar *) pattern);
|
| 92 |
+
if (doc != NULL) {
|
| 93 |
+
/*
|
| 94 |
+
* output the result.
|
| 95 |
+
*/
|
| 96 |
+
xmlDocDump(stdout, doc);
|
| 97 |
+
/*
|
| 98 |
+
* don't forget to free up the doc
|
| 99 |
+
*/
|
| 100 |
+
xmlFreeDoc(doc);
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
return(0);
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
#else
|
| 107 |
+
int main(void) {
|
| 108 |
+
fprintf(stderr, "Reader, Pattern or output support not compiled in\n");
|
| 109 |
+
return(0);
|
| 110 |
+
}
|
| 111 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/example/reader4.c
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* section: xmlReader
|
| 3 |
+
* synopsis: Parse multiple XML files reusing an xmlReader
|
| 4 |
+
* purpose: Demonstrate the use of xmlReaderForFile() and
|
| 5 |
+
* xmlReaderNewFile to parse XML files while reusing the reader object
|
| 6 |
+
* and parser context. (Note that the XMLReader functions require
|
| 7 |
+
* libxml2 version later than 2.6.)
|
| 8 |
+
* usage: reader4 <filename> [ filename ... ]
|
| 9 |
+
* test: reader4 test1.xml test2.xml test3.xml > reader4.tmp && diff reader4.tmp $(srcdir)/reader4.res
|
| 10 |
+
* author: Graham Bennett
|
| 11 |
+
* copy: see Copyright for the status of this software.
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
#include <stdio.h>
|
| 15 |
+
#include <libxml/xmlreader.h>
|
| 16 |
+
|
| 17 |
+
#ifdef LIBXML_READER_ENABLED
|
| 18 |
+
|
| 19 |
+
static void processDoc(xmlTextReaderPtr readerPtr) {
|
| 20 |
+
int ret;
|
| 21 |
+
xmlDocPtr docPtr;
|
| 22 |
+
const xmlChar *URL;
|
| 23 |
+
|
| 24 |
+
ret = xmlTextReaderRead(readerPtr);
|
| 25 |
+
while (ret == 1) {
|
| 26 |
+
ret = xmlTextReaderRead(readerPtr);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/*
|
| 30 |
+
* One can obtain the document pointer to get interesting
|
| 31 |
+
* information about the document like the URL, but one must also
|
| 32 |
+
* be sure to clean it up at the end (see below).
|
| 33 |
+
*/
|
| 34 |
+
docPtr = xmlTextReaderCurrentDoc(readerPtr);
|
| 35 |
+
if (NULL == docPtr) {
|
| 36 |
+
fprintf(stderr, "failed to obtain document\n");
|
| 37 |
+
return;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
URL = docPtr->URL;
|
| 41 |
+
if (NULL == URL) {
|
| 42 |
+
fprintf(stderr, "Failed to obtain URL\n");
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
if (ret != 0) {
|
| 46 |
+
fprintf(stderr, "%s: Failed to parse\n", URL);
|
| 47 |
+
return;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
printf("%s: Processed ok\n", (const char *)URL);
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
int main(int argc, char **argv) {
|
| 54 |
+
xmlTextReaderPtr readerPtr;
|
| 55 |
+
int i;
|
| 56 |
+
xmlDocPtr docPtr;
|
| 57 |
+
|
| 58 |
+
if (argc < 2)
|
| 59 |
+
return(1);
|
| 60 |
+
|
| 61 |
+
/*
|
| 62 |
+
* this initialises the library and check potential ABI mismatches
|
| 63 |
+
* between the version it was compiled for and the actual shared
|
| 64 |
+
* library used.
|
| 65 |
+
*/
|
| 66 |
+
LIBXML_TEST_VERSION
|
| 67 |
+
|
| 68 |
+
/*
|
| 69 |
+
* Create a new reader for the first file and process the
|
| 70 |
+
* document.
|
| 71 |
+
*/
|
| 72 |
+
readerPtr = xmlReaderForFile(argv[1], NULL, 0);
|
| 73 |
+
if (NULL == readerPtr) {
|
| 74 |
+
fprintf(stderr, "%s: failed to create reader\n", argv[1]);
|
| 75 |
+
return(1);
|
| 76 |
+
}
|
| 77 |
+
processDoc(readerPtr);
|
| 78 |
+
|
| 79 |
+
/*
|
| 80 |
+
* The reader can be reused for subsequent files.
|
| 81 |
+
*/
|
| 82 |
+
for (i=2; i < argc; ++i) {
|
| 83 |
+
xmlReaderNewFile(readerPtr, argv[i], NULL, 0);
|
| 84 |
+
if (NULL == readerPtr) {
|
| 85 |
+
fprintf(stderr, "%s: failed to create reader\n", argv[i]);
|
| 86 |
+
return(1);
|
| 87 |
+
}
|
| 88 |
+
processDoc(readerPtr);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/*
|
| 92 |
+
* Since we've called xmlTextReaderCurrentDoc, we now have to
|
| 93 |
+
* clean up after ourselves. We only have to do this the last
|
| 94 |
+
* time, because xmlReaderNewFile calls xmlCtxtReset which takes
|
| 95 |
+
* care of it.
|
| 96 |
+
*/
|
| 97 |
+
docPtr = xmlTextReaderCurrentDoc(readerPtr);
|
| 98 |
+
if (docPtr != NULL)
|
| 99 |
+
xmlFreeDoc(docPtr);
|
| 100 |
+
|
| 101 |
+
/*
|
| 102 |
+
* Clean up the reader.
|
| 103 |
+
*/
|
| 104 |
+
xmlFreeTextReader(readerPtr);
|
| 105 |
+
|
| 106 |
+
return(0);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
#else
|
| 110 |
+
int main(void) {
|
| 111 |
+
fprintf(stderr, "xmlReader support not compiled in\n");
|
| 112 |
+
return(0);
|
| 113 |
+
}
|
| 114 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/example/test1.xml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
<doc/>
|
local-test-libxml2-delta-02/afc-libxml2/example/test2.xml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE doc [
|
| 2 |
+
<!ELEMENT doc (src | dest)*>
|
| 3 |
+
<!ELEMENT src EMPTY>
|
| 4 |
+
<!ELEMENT dest EMPTY>
|
| 5 |
+
<!ATTLIST src ref IDREF #IMPLIED>
|
| 6 |
+
<!ATTLIST dest id ID #IMPLIED>
|
| 7 |
+
]>
|
| 8 |
+
<doc>
|
| 9 |
+
<src ref="foo"/>
|
| 10 |
+
<dest id="foo"/>
|
| 11 |
+
<src ref="foo"/>
|
| 12 |
+
</doc>
|
| 13 |
+
|
local-test-libxml2-delta-02/afc-libxml2/example/test3.xml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<doc>
|
| 2 |
+
<parent>
|
| 3 |
+
<discarded>
|
| 4 |
+
<discarded/>
|
| 5 |
+
</discarded>
|
| 6 |
+
<preserved/>
|
| 7 |
+
This text node must be discarded
|
| 8 |
+
<discarded>
|
| 9 |
+
<discarded/>
|
| 10 |
+
</discarded>
|
| 11 |
+
<preserved>
|
| 12 |
+
content1
|
| 13 |
+
<child1></child1>
|
| 14 |
+
<child2>content2</child2>
|
| 15 |
+
<preserved>too</preserved>
|
| 16 |
+
<child2>content3</child2>
|
| 17 |
+
<preserved></preserved>
|
| 18 |
+
<child2>content4</child2>
|
| 19 |
+
<preserved/>
|
| 20 |
+
<child2>content5</child2>
|
| 21 |
+
content6
|
| 22 |
+
</preserved>
|
| 23 |
+
This text node must be discarded
|
| 24 |
+
<discarded>
|
| 25 |
+
<discarded/>
|
| 26 |
+
</discarded>
|
| 27 |
+
This text node must be discarded
|
| 28 |
+
<preserved></preserved>
|
| 29 |
+
This text node must be discarded
|
| 30 |
+
<preserved/>
|
| 31 |
+
This text node must be discarded
|
| 32 |
+
<discarded>
|
| 33 |
+
<discarded/>
|
| 34 |
+
</discarded>
|
| 35 |
+
This text node must be discarded
|
| 36 |
+
</parent>
|
| 37 |
+
</doc>
|
| 38 |
+
|
| 39 |
+
|
local-test-libxml2-delta-02/afc-libxml2/example/tree1.c
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* section: Tree
|
| 3 |
+
* synopsis: Navigates a tree to print element names
|
| 4 |
+
* purpose: Parse a file to a tree, use xmlDocGetRootElement() to
|
| 5 |
+
* get the root element, then walk the document and print
|
| 6 |
+
* all the element name in document order.
|
| 7 |
+
* usage: tree1 filename_or_URL
|
| 8 |
+
* test: tree1 test2.xml > tree1.tmp && diff tree1.tmp $(srcdir)/tree1.res
|
| 9 |
+
* author: Dodji Seketeli
|
| 10 |
+
* copy: see Copyright for the status of this software.
|
| 11 |
+
*/
|
| 12 |
+
#include <stdio.h>
|
| 13 |
+
#include <libxml/parser.h>
|
| 14 |
+
#include <libxml/tree.h>
|
| 15 |
+
|
| 16 |
+
/*
|
| 17 |
+
*To compile this file using gcc you can type
|
| 18 |
+
*gcc `xml2-config --cflags --libs` -o xmlexample libxml2-example.c
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* print_element_names:
|
| 23 |
+
* @a_node: the initial xml node to consider.
|
| 24 |
+
*
|
| 25 |
+
* Prints the names of the all the xml elements
|
| 26 |
+
* that are siblings or children of a given xml node.
|
| 27 |
+
*/
|
| 28 |
+
static void
|
| 29 |
+
print_element_names(xmlNode * a_node)
|
| 30 |
+
{
|
| 31 |
+
xmlNode *cur_node = NULL;
|
| 32 |
+
|
| 33 |
+
for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
|
| 34 |
+
if (cur_node->type == XML_ELEMENT_NODE) {
|
| 35 |
+
printf("node type: Element, name: %s\n", cur_node->name);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
print_element_names(cur_node->children);
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Simple example to parse a file called "file.xml",
|
| 45 |
+
* walk down the DOM, and print the name of the
|
| 46 |
+
* xml elements nodes.
|
| 47 |
+
*/
|
| 48 |
+
int
|
| 49 |
+
main(int argc, char **argv)
|
| 50 |
+
{
|
| 51 |
+
xmlDoc *doc = NULL;
|
| 52 |
+
xmlNode *root_element = NULL;
|
| 53 |
+
|
| 54 |
+
if (argc != 2)
|
| 55 |
+
return(1);
|
| 56 |
+
|
| 57 |
+
/*
|
| 58 |
+
* this initialize the library and check potential ABI mismatches
|
| 59 |
+
* between the version it was compiled for and the actual shared
|
| 60 |
+
* library used.
|
| 61 |
+
*/
|
| 62 |
+
LIBXML_TEST_VERSION
|
| 63 |
+
|
| 64 |
+
/*parse the file and get the DOM */
|
| 65 |
+
doc = xmlReadFile(argv[1], NULL, 0);
|
| 66 |
+
|
| 67 |
+
if (doc == NULL) {
|
| 68 |
+
printf("error: could not parse file %s\n", argv[1]);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/*Get the root element node */
|
| 72 |
+
root_element = xmlDocGetRootElement(doc);
|
| 73 |
+
|
| 74 |
+
print_element_names(root_element);
|
| 75 |
+
|
| 76 |
+
/*free the document */
|
| 77 |
+
xmlFreeDoc(doc);
|
| 78 |
+
|
| 79 |
+
return 0;
|
| 80 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/include/Makefile.am
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Process this file with automake to produce Makefile.in
|
| 2 |
+
SUBDIRS=libxml private
|
| 3 |
+
|
| 4 |
+
EXTRA_DIST = wsockcompat.h meson.build
|
| 5 |
+
|
local-test-libxml2-delta-02/afc-libxml2/include/meson.build
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
inc_dir = include_directories('.')
|
local-test-libxml2-delta-02/afc-libxml2/include/wsockcompat.h
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* include/wsockcompat.h
|
| 2 |
+
* Windows -> Berkeley Sockets compatibility things.
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
#if !defined __XML_WSOCKCOMPAT_H__
|
| 6 |
+
#define __XML_WSOCKCOMPAT_H__
|
| 7 |
+
|
| 8 |
+
#include <errno.h>
|
| 9 |
+
#include <winsock2.h>
|
| 10 |
+
|
| 11 |
+
/* Fix for old MinGW. */
|
| 12 |
+
#ifndef _WINSOCKAPI_
|
| 13 |
+
#define _WINSOCKAPI_
|
| 14 |
+
#endif
|
| 15 |
+
|
| 16 |
+
/* the following is a workaround a problem for 'inline' keyword in said
|
| 17 |
+
header when compiled with Borland C++ 6 */
|
| 18 |
+
#if defined(__BORLANDC__) && !defined(__cplusplus)
|
| 19 |
+
#define inline __inline
|
| 20 |
+
#define _inline __inline
|
| 21 |
+
#endif
|
| 22 |
+
|
| 23 |
+
#include <ws2tcpip.h>
|
| 24 |
+
|
| 25 |
+
/* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
|
| 26 |
+
#if defined(GetAddrInfo)
|
| 27 |
+
#include <wspiapi.h>
|
| 28 |
+
#ifndef SUPPORT_IP6
|
| 29 |
+
#define SUPPORT_IP6
|
| 30 |
+
#endif
|
| 31 |
+
#endif
|
| 32 |
+
|
| 33 |
+
#ifndef ECONNRESET
|
| 34 |
+
#define ECONNRESET WSAECONNRESET
|
| 35 |
+
#endif
|
| 36 |
+
#ifndef EINPROGRESS
|
| 37 |
+
#define EINPROGRESS WSAEINPROGRESS
|
| 38 |
+
#endif
|
| 39 |
+
#ifndef EINTR
|
| 40 |
+
#define EINTR WSAEINTR
|
| 41 |
+
#endif
|
| 42 |
+
#ifndef ESHUTDOWN
|
| 43 |
+
#define ESHUTDOWN WSAESHUTDOWN
|
| 44 |
+
#endif
|
| 45 |
+
#ifndef EWOULDBLOCK
|
| 46 |
+
#define EWOULDBLOCK WSAEWOULDBLOCK
|
| 47 |
+
#endif
|
| 48 |
+
|
| 49 |
+
#endif /* __XML_WSOCKCOMPAT_H__ */
|
local-test-libxml2-delta-02/afc-libxml2/os400/README400
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Implementation notes:
|
| 3 |
+
|
| 4 |
+
This is a true OS/400 implementation, not a PASE implementation (for PASE,
|
| 5 |
+
use an AIX implementation).
|
| 6 |
+
|
| 7 |
+
The biggest problem with OS/400 is EBCDIC. The current libxml2 implementation
|
| 8 |
+
uses UTF-8 internally. To ease encoding conversion between the calling
|
| 9 |
+
applications and libxml2, supplementary "convert and latch" functions are
|
| 10 |
+
provided (See below). To bind the EBCDIC OS/400 system calls and libxml2,
|
| 11 |
+
an ASCII run-time environment (QADRT) has been used and wrapper functions have
|
| 12 |
+
been designed.
|
| 13 |
+
|
| 14 |
+
Other problems are:
|
| 15 |
+
- Source code line length: to be stored in DB2 members, source files may not
|
| 16 |
+
have lines longer than 100 characters. Some header and documentation files
|
| 17 |
+
have been modified accordingly.
|
| 18 |
+
- va_list dereferencing: the OS/400 implementation of va_list type is an array
|
| 19 |
+
but the compiler forbids explicit array dereferencing. Source files have
|
| 20 |
+
been updated accordingly.
|
| 21 |
+
- Depending on the compilation/execution environment, it is possible that
|
| 22 |
+
stdin/stdout/stderr are not associated with a file descriptor; as a side
|
| 23 |
+
effect, open() may return a file descriptor value 0, 1 or 2 that is NOT
|
| 24 |
+
a C standard file. Thus using such a number may be inaccurate.
|
| 25 |
+
- iconv_open() arguments: OS/400 uses non-standard encoding names and does not
|
| 26 |
+
support standard names. For this reason, a name wrapper has been designed.
|
| 27 |
+
- dlopen() (support for xmodule): the function and its corollaries are not
|
| 28 |
+
provided by the OS/400 library. However a local implementation is provided.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
Compiling on OS/400:
|
| 32 |
+
|
| 33 |
+
_ As a prerequisite, QADRT development environment must be installed.
|
| 34 |
+
_ Install the libxml2 source directory in IFS.
|
| 35 |
+
_ Enter shell (QSH)
|
| 36 |
+
_ Change current directory to the libxml2 installation directory
|
| 37 |
+
_ Change current directory to ./os400
|
| 38 |
+
_ Edit file iniscript.sh. You may want to change tunable configuration
|
| 39 |
+
parameters, like debug info generation, optimisation level, listing option,
|
| 40 |
+
target library, zlib availability, etc.
|
| 41 |
+
_ Copy any file in the current directory to makelog (i.e.:
|
| 42 |
+
cp initscript.sh makelog): this is intended to create the makelog file with
|
| 43 |
+
an ASCII CCSID!
|
| 44 |
+
_ Enter the command "sh make.sh >makelog 2>&1'
|
| 45 |
+
_ Examine the makelog file to check for compilation errors.
|
| 46 |
+
|
| 47 |
+
Leaving file initscript.sh unchanged, this will produce the following
|
| 48 |
+
OS/400 objects:
|
| 49 |
+
_ Library LIBXML2. All other objects will be stored in this library.
|
| 50 |
+
_ Modules for all libxml2 units, with full debug info and no code optimization.
|
| 51 |
+
_ Binding directory LIBXML2_A, to be used at calling program link time for
|
| 52 |
+
statically binding the modules (specify BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)
|
| 53 |
+
when creating a program using LIBXML2_A).
|
| 54 |
+
_ Service program LIBXML2. To be used at calling program run-time
|
| 55 |
+
when this program has dynamically bound libxml2 at link time.
|
| 56 |
+
_ Binding directory LIBXML2. To be used to dynamically bind libxml2 when
|
| 57 |
+
linking a calling program.
|
| 58 |
+
_ Source file LIBXML. It contains all the header members needed to compile a
|
| 59 |
+
C/C++ module using libxml2.
|
| 60 |
+
_ Standard and additional C/C++ libxml2 header members (possibly renamed) in
|
| 61 |
+
file LIBXML.
|
| 62 |
+
_ IFS directory /libxml2 with subdirectory include/libxml containing all
|
| 63 |
+
C/C++ header files for IFS-based compilation.
|
| 64 |
+
_ Source file LIBXMLRPG. It contains all the include members needed to compile a
|
| 65 |
+
ILE/RPG module/program using libxml2 (ILE/RPG binding).
|
| 66 |
+
_ ILE/RPG binding include members (possibly renamed) in file LIBXMLRPG.
|
| 67 |
+
_ IFS subdirectory /libxml2/include/libxmlrpg containing all ILE/RPG include
|
| 68 |
+
files for IFS-based compilation.
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
Renamed header files in DB2 members:
|
| 72 |
+
DB2 member names are limited to 10 characters, thus the following C/C++
|
| 73 |
+
header members are renamed as:
|
| 74 |
+
parserInternals.h --> PARSERINTE
|
| 75 |
+
schemasInternals.h --> SCHEMASINT
|
| 76 |
+
xmlautomata.h --> XMLAUTOMAT
|
| 77 |
+
xmlschemastype.h --> SCHMTYPES
|
| 78 |
+
xpathInternals.h --> XPATHINTER
|
| 79 |
+
IFS header files are NOT renamed.
|
| 80 |
+
ILE/RPG headers are processed likewise.
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
Special programming consideration:
|
| 84 |
+
|
| 85 |
+
QADRT being used, the following points must be considered:
|
| 86 |
+
_ If static binding is used, service program QADRTTS must be linked too.
|
| 87 |
+
_ The EBCDIC CCSID used by QADRT is 37 by default, NOT THE JOB'S CCSID. If
|
| 88 |
+
another EBCDIC CCSID is required, it must be set via a locale through a call
|
| 89 |
+
to setlocale_a (QADRT's setlocale() ASCII wrapper) with category LC_ALL or
|
| 90 |
+
LC_CTYPE, or by setting environment variable QADRT_ENV_LOCALE to the locale
|
| 91 |
+
object path before executing the program.
|
| 92 |
+
_ Always use *IFSIO or *IFS64IO to compile calling programs.
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
Supplementary (non libxml2 standard) support procedures for OS/400.
|
| 97 |
+
|
| 98 |
+
As cited above, there are some procedures to ease encoding conversion of
|
| 99 |
+
libxml2 function arguments and results: the mechanism is based on
|
| 100 |
+
dictionaries. The functions convert a string, latch the result in a dictionary
|
| 101 |
+
to ensure its persistence and return its address. It is the caller's
|
| 102 |
+
responsibility to clean the dictionary when it becomes too big or disappears.
|
| 103 |
+
|
| 104 |
+
The procedures are:
|
| 105 |
+
|
| 106 |
+
#include <libxml/transcode.h>
|
| 107 |
+
|
| 108 |
+
const char * xmlTranscodeResult(const xmlChar * s,
|
| 109 |
+
const char * encoding,
|
| 110 |
+
xmlDictPtr * dict,
|
| 111 |
+
void (*freeproc)(const void *));
|
| 112 |
+
|
| 113 |
+
const xmlChar * xmlTranscodeString(const char * s,
|
| 114 |
+
const char * encoding,
|
| 115 |
+
xmlDictPtr * dict);
|
| 116 |
+
|
| 117 |
+
const xmlChar * xmlTranscodeWString(const char * s,
|
| 118 |
+
const char * encoding,
|
| 119 |
+
xmlDictPtr * dict);
|
| 120 |
+
|
| 121 |
+
const xmlChar * xmlTranscodeWString(const char * s,
|
| 122 |
+
const char * encoding,
|
| 123 |
+
xmlDictPtr * dict);
|
| 124 |
+
|
| 125 |
+
where:
|
| 126 |
+
s is the string to translate.
|
| 127 |
+
encoding is the alternate character encoding. If null, the current job's
|
| 128 |
+
encoding (CCSID) is used.
|
| 129 |
+
dict is the address of the latching directory. If NULL, the procedure
|
| 130 |
+
functions as a simple non-latching encoding converter and
|
| 131 |
+
its result value should be freed by the caller.
|
| 132 |
+
freeproc is a procedure to release the original string, or NULL.
|
| 133 |
+
|
| 134 |
+
xmlTranscodeResult() converts from UTF-8 to the given alternate encoding.
|
| 135 |
+
xmlTranscodeString() converts from the given 8-bit encoding to UTF-8 (note that
|
| 136 |
+
UTF-8 itself is considered as a 8-bit encoding).
|
| 137 |
+
xmlTranscodeWString() converts from the given 16-bit encoding to UTF-8.
|
| 138 |
+
xmlTranscodeHString() converts from the given 32-bit encoding to UTF-8.
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
To shorten statements using these functions, shorthands are defined:
|
| 142 |
+
|
| 143 |
+
xmlTR for xmlTranscodeResult
|
| 144 |
+
xmlTS for xmlTranscodeString
|
| 145 |
+
xmlTW for xmlTranscodeWString
|
| 146 |
+
xmlTH for xmlTranscodeHstring
|
| 147 |
+
|
| 148 |
+
These shorthands may be disabled by defining XML_NO_SHORT_NAMES before
|
| 149 |
+
libxml/transcode.h inclusion.
|
| 150 |
+
|
| 151 |
+
A directory pointer must be preset to NULL before the first call using it to
|
| 152 |
+
one of the above procedure.
|
| 153 |
+
|
| 154 |
+
To release a latching directory, use function
|
| 155 |
+
|
| 156 |
+
void xmlZapDict(xmlDictPtr * dict);
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
Example:
|
| 160 |
+
|
| 161 |
+
#include <libxml/transcode.h>
|
| 162 |
+
#include <libxml/tree.h>
|
| 163 |
+
|
| 164 |
+
xmlDocPtr mySimpleXMLDoc(char * element, char * text)
|
| 165 |
+
{
|
| 166 |
+
xmlDocPtr doc;
|
| 167 |
+
xmlNodePtr node;
|
| 168 |
+
xmlDictPtr dict = NULL;
|
| 169 |
+
|
| 170 |
+
/* element and text are encoded in the current job's encoding. */
|
| 171 |
+
|
| 172 |
+
doc = xmlNewDoc();
|
| 173 |
+
xmlNewTextChild((xmlNodePtr) doc, NULL, xmlTS(element, NULL,
|
| 174 |
+
&dict), xmlTS(text, NULL, &dict));
|
| 175 |
+
xmlZapDict(&dict);
|
| 176 |
+
return doc;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
Additionally, a formatter into latched/dynamic storage is provided:
|
| 181 |
+
|
| 182 |
+
const char * xmlVasprintf(xmlDictPtr * dict,
|
| 183 |
+
const char * encoding,
|
| 184 |
+
const xmlChar * fmt,
|
| 185 |
+
va_list args);
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
xmllint and xmlcatalog programs:
|
| 189 |
+
|
| 190 |
+
These programs are fully implemented at the qshell level, with standard
|
| 191 |
+
command line options. Links to these are installed in sub-directory bin of
|
| 192 |
+
the IFS installation directory.
|
| 193 |
+
CL command interfaces to these programs are also provided with limited
|
| 194 |
+
support. In particular, interactive mode is not supported and argument count
|
| 195 |
+
and lengths are limited by the CL command syntax.
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
ILE/RPG binding:
|
| 199 |
+
|
| 200 |
+
All standard types and procedures are provided. Since ILE/RPG does not
|
| 201 |
+
support macros, they have not been ported. However some of them are emulated
|
| 202 |
+
as functions: these are the more useful ones (xmlXPathNodeSetGetLength,
|
| 203 |
+
xmlXPathNodeSetItem, xmlXPathNodeSetIsEmpty, htmlDefaultSubelement,
|
| 204 |
+
htmlElementAllowedHereDesc, htmlRequiredAttrs) and the global/threaded
|
| 205 |
+
variables access macros. These variables can be read with function
|
| 206 |
+
get_xxx(void), where xxxx is the name of the variable; they may be set by
|
| 207 |
+
calling function set_xxxx(value), where value is of the same type as the
|
| 208 |
+
variable.
|
| 209 |
+
|
| 210 |
+
The C va_list is not implemented as such in ILE/RPG. Functions implementing
|
| 211 |
+
va_list and associated methods are provided:
|
| 212 |
+
|
| 213 |
+
/include "libxmlrpg/xmlstdarg"
|
| 214 |
+
|
| 215 |
+
d xmlVaStart pr
|
| 216 |
+
d list like(xmlVaList)
|
| 217 |
+
d lastargaddr * value
|
| 218 |
+
d lastargsize 10u 0 value
|
| 219 |
+
|
| 220 |
+
d xmlVaArg pr
|
| 221 |
+
d list like(xmlVaList)
|
| 222 |
+
d dest * value
|
| 223 |
+
d argsize 10i 0 value
|
| 224 |
+
|
| 225 |
+
d xmlVaEnd pr
|
| 226 |
+
d list like(xmlVaList)
|
local-test-libxml2-delta-02/afc-libxml2/os400/initscript.sh
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
#
|
| 3 |
+
# Compilation scripts initialization for the OS/400 implementation.
|
| 4 |
+
#
|
| 5 |
+
# See Copyright for the status of this software.
|
| 6 |
+
#
|
| 7 |
+
# Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
case "${SCRIPTDIR}" in
|
| 12 |
+
/*) ;;
|
| 13 |
+
*) SCRIPTDIR="`pwd`/${SCRIPTDIR}"
|
| 14 |
+
esac
|
| 15 |
+
|
| 16 |
+
while true
|
| 17 |
+
do case "${SCRIPTDIR}" in
|
| 18 |
+
*/.) SCRIPTDIR="${SCRIPTDIR%/.}";;
|
| 19 |
+
*) break;;
|
| 20 |
+
esac
|
| 21 |
+
done
|
| 22 |
+
|
| 23 |
+
# The script directory is supposed to be in $TOPDIR/os400.
|
| 24 |
+
|
| 25 |
+
TOPDIR=`dirname "${SCRIPTDIR}"`
|
| 26 |
+
export SCRIPTDIR TOPDIR
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
setenv()
|
| 30 |
+
|
| 31 |
+
{
|
| 32 |
+
# Define and export.
|
| 33 |
+
|
| 34 |
+
eval ${1}="${2}"
|
| 35 |
+
export ${1}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
################################################################################
|
| 40 |
+
#
|
| 41 |
+
# Tunable configuration parameters.
|
| 42 |
+
#
|
| 43 |
+
################################################################################
|
| 44 |
+
|
| 45 |
+
setenv TARGETLIB 'LIBXML2' # Target OS/400 program library.
|
| 46 |
+
setenv STATBNDDIR 'LIBXML2_A' # Static binding directory.
|
| 47 |
+
setenv DYNBNDDIR 'LIBXML2' # Dynamic binding directory.
|
| 48 |
+
setenv SRVPGM "LIBXML2" # Service program.
|
| 49 |
+
setenv TGTCCSID '500' # Target CCSID of objects.
|
| 50 |
+
setenv DEBUG '*ALL' # Debug level.
|
| 51 |
+
setenv OPTIMIZE '10' # Optimisation level.
|
| 52 |
+
setenv OUTPUT '*NONE' # Compilation output option.
|
| 53 |
+
setenv TGTRLS 'V6R1M0' # Target OS release.
|
| 54 |
+
setenv IFSDIR '/libxml2' # Installation IFS directory.
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
################################################################################
|
| 58 |
+
#
|
| 59 |
+
# Conditional compilation parameters.
|
| 60 |
+
#
|
| 61 |
+
################################################################################
|
| 62 |
+
|
| 63 |
+
setenv WITH_TRIO 1 # Configure trio support.
|
| 64 |
+
setenv WITH_THREADS 1 # Configure thread support.
|
| 65 |
+
setenv WITH_THREAD_ALLOC 1 # Whether allocation hooks are per-thread.
|
| 66 |
+
setenv WITH_TREE 1 # Compile DOM tree API.
|
| 67 |
+
setenv WITH_OUTPUT 1 # Compile serialization/saving support.
|
| 68 |
+
setenv WITH_PUSH 1 # Compile push parser.
|
| 69 |
+
setenv WITH_READER 1 # Compile parsing interface.
|
| 70 |
+
setenv WITH_PATTERN 1 # Compile pattern node selection interface.
|
| 71 |
+
setenv WITH_WRITER 1 # Compile saving interface.
|
| 72 |
+
setenv WITH_SAX1 1 # Compile SAX version 1 interface.
|
| 73 |
+
setenv WITH_FTP 1 # Compile FTP support.
|
| 74 |
+
setenv WITH_HTTP 1 # Compile HTTP support.
|
| 75 |
+
setenv WITH_VALID 1 # Compile DTD validation support.
|
| 76 |
+
setenv WITH_HTML 1 # Compile HTML support.
|
| 77 |
+
setenv WITH_LEGACY 1 # Compile deprecated API.
|
| 78 |
+
setenv WITH_C14N 1 # Compile canonicalization support.
|
| 79 |
+
setenv WITH_CATALOG 1 # Compile catalog support.
|
| 80 |
+
setenv WITH_DOCB 1 # Compile SGML Docbook support.
|
| 81 |
+
setenv WITH_XPATH 1 # Compile XPath support.
|
| 82 |
+
setenv WITH_XPTR 1 # Compile XPointer support.
|
| 83 |
+
setenv WITH_XINCLUDE 1 # Compile XInclude support.
|
| 84 |
+
setenv WITH_ICONV 1 # Whether iconv support is available.
|
| 85 |
+
setenv WITH_ICU 0 # Whether icu support is available.
|
| 86 |
+
setenv WITH_ISO8859X 1 # Compile ISO-8859-* support if no iconv.
|
| 87 |
+
setenv WITH_DEBUG 1 # Compile debugging module.
|
| 88 |
+
setenv WITH_MEM_DEBUG 1 # Compile memory debugging module.
|
| 89 |
+
setenv WITH_RUN_DEBUG 1 # Compile runtime debugging.
|
| 90 |
+
setenv WITH_REGEXPS 1 # Compile regular expression interfaces.
|
| 91 |
+
setenv WITH_SCHEMAS 1 # Compile schema validation interface.
|
| 92 |
+
setenv WITH_SCHEMATRON 1 # Compile schematron validation interface.
|
| 93 |
+
setenv WITH_MODULES 1 # Compile module interfaces.
|
| 94 |
+
setenv WITH_ZLIB 0 # Whether zlib is available.
|
| 95 |
+
setenv WITH_LZMA 0 # Whether LZMA is available.
|
| 96 |
+
|
| 97 |
+
# Define ZLIB locations. This is ignored if WITH_ZLIB is 0.
|
| 98 |
+
|
| 99 |
+
setenv ZLIB_INCLUDE '/zlib/include' # ZLIB include IFS directory.
|
| 100 |
+
setenv ZLIB_LIB 'ZLIB' # ZLIB library.
|
| 101 |
+
setenv ZLIB_BNDDIR 'ZLIB_A' # ZLIB binding directory.
|
| 102 |
+
|
| 103 |
+
################################################################################
|
| 104 |
+
#
|
| 105 |
+
# OS/400 specific definitions.
|
| 106 |
+
#
|
| 107 |
+
################################################################################
|
| 108 |
+
|
| 109 |
+
setenv LIBIFSNAME "/QSYS.LIB/${TARGETLIB}.LIB"
|
| 110 |
+
setenv MODULE_EXTENSION '.SRVPGM'
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
################################################################################
|
| 114 |
+
#
|
| 115 |
+
# Extract version information.
|
| 116 |
+
#
|
| 117 |
+
################################################################################
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
# Transitional: get file name of configure script.
|
| 121 |
+
|
| 122 |
+
AUTOCONFSCRIPT="${TOPDIR}/configure.ac"
|
| 123 |
+
|
| 124 |
+
if [ ! -f "${AUTOCONFSCRIPT}" ]
|
| 125 |
+
then AUTOCONFSCRIPT="${TOPDIR}/configure.in"
|
| 126 |
+
fi
|
| 127 |
+
|
| 128 |
+
# Need to get the version definitions.
|
| 129 |
+
|
| 130 |
+
eval "`grep '^LIBXML_[A-Z]*_VERSION=' \"${AUTOCONFSCRIPT}\"`"
|
| 131 |
+
eval "`grep '^LIBXML_MICRO_VERSION_SUFFIX=' \"${AUTOCONFSCRIPT}\"`"
|
| 132 |
+
LIBXML_VERSION="${LIBXML_MAJOR_VERSION}.${LIBXML_MINOR_VERSION}"
|
| 133 |
+
LIBXML_VERSION="${LIBXML_VERSION}.${LIBXML_MICRO_VERSION}"
|
| 134 |
+
LIBXML_VERSION="${LIBXML_VERSION}${LIBXML_MICRO_VERSION_SUFFIX}"
|
| 135 |
+
LIBXML_VERSION_NUMBER=`expr "${LIBXML_MAJOR_VERSION}" \* 10000 + \
|
| 136 |
+
"${LIBXML_MINOR_VERSION}" \* 100 + \
|
| 137 |
+
"${LIBXML_MICRO_VERSION}"`
|
| 138 |
+
export LIBXML_MAJOR_VERSION LIBXML_MINOR_VERSION
|
| 139 |
+
export LIBXML_MICRO_VERSION LIBXML_MICROVERSION_SUFFIX
|
| 140 |
+
export LIBXML_VERSION LIBXML_VERSION_NUMBER
|
| 141 |
+
setenv LIBXML_VERSION_EXTRA ''
|
| 142 |
+
setenv VERSION "${LIBXML_VERSION}"
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
################################################################################
|
| 146 |
+
#
|
| 147 |
+
# Procedures.
|
| 148 |
+
#
|
| 149 |
+
################################################################################
|
| 150 |
+
|
| 151 |
+
# action_needed dest [src]
|
| 152 |
+
#
|
| 153 |
+
# dest is an object to build
|
| 154 |
+
# if specified, src is an object on which dest depends.
|
| 155 |
+
#
|
| 156 |
+
# exit 0 (succeeds) if some action has to be taken, else 1.
|
| 157 |
+
|
| 158 |
+
action_needed()
|
| 159 |
+
|
| 160 |
+
{
|
| 161 |
+
[ ! -e "${1}" ] && return 0
|
| 162 |
+
[ "${2}" ] || return 1
|
| 163 |
+
[ "${1}" -ot "${2}" ] && return 0
|
| 164 |
+
return 1
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
# make_module [option] module_name source_name
|
| 169 |
+
#
|
| 170 |
+
# Compile source name into ASCII module if needed.
|
| 171 |
+
# As side effect, append the module name to variable MODULES.
|
| 172 |
+
# Set LINK to "YES" if the module has been compiled.
|
| 173 |
+
# Options are:
|
| 174 |
+
# --define <additional definitions>
|
| 175 |
+
# --ebcdic
|
| 176 |
+
# --sysiconv
|
| 177 |
+
|
| 178 |
+
make_module()
|
| 179 |
+
|
| 180 |
+
{
|
| 181 |
+
DEFN=
|
| 182 |
+
EBCDIC=
|
| 183 |
+
SYSICONV=
|
| 184 |
+
while true
|
| 185 |
+
do case "${1}" in
|
| 186 |
+
--define)
|
| 187 |
+
DEFN="${2}"
|
| 188 |
+
shift
|
| 189 |
+
;;
|
| 190 |
+
--ebcdic)
|
| 191 |
+
EBCDIC=yes
|
| 192 |
+
;;
|
| 193 |
+
--sysiconv)
|
| 194 |
+
SYSICONV=yes
|
| 195 |
+
;;
|
| 196 |
+
*) break
|
| 197 |
+
esac
|
| 198 |
+
shift
|
| 199 |
+
done
|
| 200 |
+
MODULES="${MODULES} ${1}"
|
| 201 |
+
MODIFSNAME="${LIBIFSNAME}/${1}.MODULE"
|
| 202 |
+
action_needed "${MODIFSNAME}" "${2}" || return 0;
|
| 203 |
+
|
| 204 |
+
# #pragma convert has to be in the source file itself, i.e.
|
| 205 |
+
# putting it in an include file makes it only active
|
| 206 |
+
# for that include file.
|
| 207 |
+
# Thus we build a temporary file with the pragma prepended to
|
| 208 |
+
# the source file and we compile that temporary file.
|
| 209 |
+
|
| 210 |
+
rm -f __tmpsrcf.c
|
| 211 |
+
if [ -z "${EBCDIC}" ]
|
| 212 |
+
then echo "#line 1 \"${2}\"" >> __tmpsrcf.c
|
| 213 |
+
echo "#pragma convert(819)" >> __tmpsrcf.c
|
| 214 |
+
echo '#include "wrappers.h"' >> __tmpsrcf.c
|
| 215 |
+
fi
|
| 216 |
+
echo "#line 1 \"${2}\"" >> __tmpsrcf.c
|
| 217 |
+
cat "${2}" >> __tmpsrcf.c
|
| 218 |
+
CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')"
|
| 219 |
+
# CMD="${CMD} OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
|
| 220 |
+
CMD="${CMD} OPTION(*INCDIRFIRST) FLAG(10)"
|
| 221 |
+
CMD="${CMD} SYSIFCOPT(*IFS64IO) LANGLVL(*EXTENDED) LOCALETYPE(*LOCALE)"
|
| 222 |
+
CMD="${CMD} INCDIR("
|
| 223 |
+
if [ -z "${SYSICONV}" ]
|
| 224 |
+
then CMD="${CMD} '${TOPDIR}/os400/iconv'"
|
| 225 |
+
fi
|
| 226 |
+
if [ -z "${EBCDIC}" ]
|
| 227 |
+
then CMD="${CMD} '/qibm/proddata/qadrt/include'"
|
| 228 |
+
fi
|
| 229 |
+
CMD="${CMD} '${TOPDIR}/os400' '${TOPDIR}/os400/dlfcn'"
|
| 230 |
+
CMD="${CMD} '${IFSDIR}/include/libxml' '${IFSDIR}/include'"
|
| 231 |
+
if [ "${ZLIB_INCLUDE}" ]
|
| 232 |
+
then CMD="${CMD} '${ZLIB_INCLUDE}'"
|
| 233 |
+
fi
|
| 234 |
+
CMD="${CMD} '${TOPDIR}' ${INCLUDES})"
|
| 235 |
+
CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
|
| 236 |
+
CMD="${CMD} OUTPUT(${OUTPUT})"
|
| 237 |
+
CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
|
| 238 |
+
CMD="${CMD} DBGVIEW(${DEBUG})"
|
| 239 |
+
CMD="${CMD} DEFINE('_REENTRANT' 'TRIO_HAVE_CONFIG_H' 'NDEBUG' ${DEFN})"
|
| 240 |
+
|
| 241 |
+
system "${CMD}"
|
| 242 |
+
rm -f __tmpsrcf.c
|
| 243 |
+
LINK=YES
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
# Determine DB2 object name from IFS name.
|
| 248 |
+
|
| 249 |
+
db2_name()
|
| 250 |
+
|
| 251 |
+
{
|
| 252 |
+
if [ "${2}" = 'nomangle' ]
|
| 253 |
+
then basename "${1}" |
|
| 254 |
+
tr 'a-z-' 'A-Z_' |
|
| 255 |
+
sed -e 's/\..*//' \
|
| 256 |
+
-e 's/^\(..........\).*$/\1/'
|
| 257 |
+
else basename "${1}" |
|
| 258 |
+
tr 'a-z-' 'A-Z_' |
|
| 259 |
+
sed -e 's/\..*//' \
|
| 260 |
+
-e 's/^TEST/T/' \
|
| 261 |
+
-e 's/^XML/X/' \
|
| 262 |
+
-e 's/^\(.\).*\(.........\)$/\1\2/'
|
| 263 |
+
fi
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
# Copy IFS file replacing version & configuration info.
|
| 268 |
+
|
| 269 |
+
versioned_copy()
|
| 270 |
+
|
| 271 |
+
{
|
| 272 |
+
sed -e "s/@LIBXML_VERSION@/${LIBXML_VERSION}/g" \
|
| 273 |
+
\
|
| 274 |
+
-e "s#@LIBXML_MAJOR_VERSION@#${LIBXML_MAJOR_VERSION}#g" \
|
| 275 |
+
-e "s#@LIBXML_MINOR_VERSION@#${LIBXML_MINOR_VERSION}#g" \
|
| 276 |
+
-e "s#@LIBXML_MICRO_VERSION@#${LIBXML_MICRO_VERSION}#g" \
|
| 277 |
+
-e "s#@LIBXML_MICRO_VERSION_SUFFIX@#${LIBXML_MICRO_VERSION_SUFFIX}#g" \
|
| 278 |
+
-e "s#@LIBXML_VERSION@#${LIBXML_VERSION}#g" \
|
| 279 |
+
-e "s#@LIBXML_VERSION_NUMBER@#${LIBXML_VERSION_NUMBER}#g" \
|
| 280 |
+
-e "s#@LIBXML_VERSION_EXTRA@#${LIBXML_VERSION_EXTRA}#g" \
|
| 281 |
+
-e "s#@VERSION@#${VERSION}#g" \
|
| 282 |
+
-e "s#@WITH_TRIO@#${WITH_TRIO}#g" \
|
| 283 |
+
-e "s#@WITH_THREADS@#${WITH_THREADS}#g" \
|
| 284 |
+
-e "s#@WITH_THREAD_ALLOC@#${WITH_THREAD_ALLOC}#g" \
|
| 285 |
+
-e "s#@WITH_TREE@#${WITH_TREE}#g" \
|
| 286 |
+
-e "s#@WITH_OUTPUT@#${WITH_OUTPUT}#g" \
|
| 287 |
+
-e "s#@WITH_PUSH@#${WITH_PUSH}#g" \
|
| 288 |
+
-e "s#@WITH_READER@#${WITH_READER}#g" \
|
| 289 |
+
-e "s#@WITH_PATTERN@#${WITH_PATTERN}#g" \
|
| 290 |
+
-e "s#@WITH_WRITER@#${WITH_WRITER}#g" \
|
| 291 |
+
-e "s#@WITH_SAX1@#${WITH_SAX1}#g" \
|
| 292 |
+
-e "s#@WITH_FTP@#${WITH_FTP}#g" \
|
| 293 |
+
-e "s#@WITH_HTTP@#${WITH_HTTP}#g" \
|
| 294 |
+
-e "s#@WITH_VALID@#${WITH_VALID}#g" \
|
| 295 |
+
-e "s#@WITH_HTML@#${WITH_HTML}#g" \
|
| 296 |
+
-e "s#@WITH_LEGACY@#${WITH_LEGACY}#g" \
|
| 297 |
+
-e "s#@WITH_C14N@#${WITH_C14N}#g" \
|
| 298 |
+
-e "s#@WITH_CATALOG@#${WITH_CATALOG}#g" \
|
| 299 |
+
-e "s#@WITH_DOCB@#${WITH_DOCB}#g" \
|
| 300 |
+
-e "s#@WITH_XPATH@#${WITH_XPATH}#g" \
|
| 301 |
+
-e "s#@WITH_XPTR@#${WITH_XPTR}#g" \
|
| 302 |
+
-e "s#@WITH_XINCLUDE@#${WITH_XINCLUDE}#g" \
|
| 303 |
+
-e "s#@WITH_ICONV@#${WITH_ICONV}#g" \
|
| 304 |
+
-e "s#@WITH_ICU@#${WITH_ICU}#g" \
|
| 305 |
+
-e "s#@WITH_ISO8859X@#${WITH_ISO8859X}#g" \
|
| 306 |
+
-e "s#@WITH_DEBUG@#${WITH_DEBUG}#g" \
|
| 307 |
+
-e "s#@WITH_MEM_DEBUG@#${WITH_MEM_DEBUG}#g" \
|
| 308 |
+
-e "s#@WITH_RUN_DEBUG@#${WITH_RUN_DEBUG}#g" \
|
| 309 |
+
-e "s#@WITH_REGEXPS@#${WITH_REGEXPS}#g" \
|
| 310 |
+
-e "s#@WITH_SCHEMAS@#${WITH_SCHEMAS}#g" \
|
| 311 |
+
-e "s#@WITH_SCHEMATRON@#${WITH_SCHEMATRON}#g" \
|
| 312 |
+
-e "s#@WITH_MODULES@#${WITH_MODULES}#g" \
|
| 313 |
+
-e "s#@WITH_ZLIB@#${WITH_ZLIB}#g" \
|
| 314 |
+
-e "s#@WITH_LZMA@#${WITH_LZMA}#g"
|
| 315 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/os400/libxmlmain.c
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** QADRT/QADRTMAIN2 substitution program.
|
| 3 |
+
*** This is needed because the IBM-provided QADRTMAIN2 does not
|
| 4 |
+
*** properly translate arguments by default or if no locale is provided.
|
| 5 |
+
***
|
| 6 |
+
*** See Copyright for the status of this software.
|
| 7 |
+
***
|
| 8 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 9 |
+
**/
|
| 10 |
+
|
| 11 |
+
#include <stdlib.h>
|
| 12 |
+
#include <string.h>
|
| 13 |
+
#include <iconv.h>
|
| 14 |
+
#include <errno.h>
|
| 15 |
+
#include <locale.h>
|
| 16 |
+
|
| 17 |
+
/* Do not use qadrt.h since it defines unneeded static procedures. */
|
| 18 |
+
extern void QadrtInit(void);
|
| 19 |
+
extern int QadrtFreeConversionTable(void);
|
| 20 |
+
extern int QadrtFreeEnviron(void);
|
| 21 |
+
extern char * setlocale_a(int, const char *);
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
/* The ASCII main program. */
|
| 25 |
+
extern int main_a(int argc, char * * argv);
|
| 26 |
+
|
| 27 |
+
/* Global values of original EBCDIC arguments. */
|
| 28 |
+
int ebcdic_argc;
|
| 29 |
+
char * * ebcdic_argv;
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
int
|
| 33 |
+
main(int argc, char * * argv)
|
| 34 |
+
|
| 35 |
+
{
|
| 36 |
+
int i;
|
| 37 |
+
int j;
|
| 38 |
+
iconv_t cd;
|
| 39 |
+
size_t bytecount = 0;
|
| 40 |
+
char * inbuf;
|
| 41 |
+
char * outbuf;
|
| 42 |
+
size_t inbytesleft;
|
| 43 |
+
size_t outbytesleft;
|
| 44 |
+
char dummybuf[128];
|
| 45 |
+
char tocode[32];
|
| 46 |
+
char fromcode[32];
|
| 47 |
+
|
| 48 |
+
ebcdic_argc = argc;
|
| 49 |
+
ebcdic_argv = argv;
|
| 50 |
+
|
| 51 |
+
/* Build the encoding converter. */
|
| 52 |
+
strncpy(tocode, "IBMCCSID01208", sizeof tocode);
|
| 53 |
+
strncpy(fromcode, "IBMCCSID000000000010", sizeof fromcode);
|
| 54 |
+
cd = iconv_open(tocode, fromcode);
|
| 55 |
+
|
| 56 |
+
/* Measure the arguments. */
|
| 57 |
+
for (i = 0; i < argc; i++) {
|
| 58 |
+
inbuf = argv[i];
|
| 59 |
+
do {
|
| 60 |
+
inbytesleft = 0;
|
| 61 |
+
outbuf = dummybuf;
|
| 62 |
+
outbytesleft = sizeof dummybuf;
|
| 63 |
+
j = iconv(cd,
|
| 64 |
+
&inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
| 65 |
+
bytecount += outbuf - dummybuf;
|
| 66 |
+
} while (j == -1 && errno == E2BIG);
|
| 67 |
+
/* Reset the shift state. */
|
| 68 |
+
iconv(cd, NULL, &inbytesleft, &outbuf, &outbytesleft);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/* Allocate memory for the ASCII arguments and vector. */
|
| 72 |
+
argv = (char * *) malloc((argc + 1) * sizeof *argv + bytecount);
|
| 73 |
+
|
| 74 |
+
/* Build the vector and convert argument encoding. */
|
| 75 |
+
outbuf = (char *) (argv + argc + 1);
|
| 76 |
+
outbytesleft = bytecount;
|
| 77 |
+
|
| 78 |
+
for (i = 0; i < argc; i++) {
|
| 79 |
+
argv[i] = outbuf;
|
| 80 |
+
inbuf = ebcdic_argv[i];
|
| 81 |
+
inbytesleft = 0;
|
| 82 |
+
iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
| 83 |
+
iconv(cd, NULL, &inbytesleft, &outbuf, &outbytesleft);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
iconv_close(cd);
|
| 87 |
+
argv[argc] = NULL;
|
| 88 |
+
|
| 89 |
+
/* Try setting the locale regardless of QADRT_ENV_LOCALE. */
|
| 90 |
+
setlocale_a(LC_ALL, "");
|
| 91 |
+
|
| 92 |
+
/* Call the program. */
|
| 93 |
+
i = main_a(argc, argv);
|
| 94 |
+
|
| 95 |
+
/* Clean-up allocated items. */
|
| 96 |
+
free((char *) argv);
|
| 97 |
+
QadrtFreeConversionTable();
|
| 98 |
+
QadrtFreeEnviron();
|
| 99 |
+
|
| 100 |
+
/* Terminate. */
|
| 101 |
+
return i;
|
| 102 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/os400/make-bldcsndfa.sh
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
#
|
| 3 |
+
# Compilation script for the iconv names DFA builer.
|
| 4 |
+
#
|
| 5 |
+
# See Copyright for the status of this software.
|
| 6 |
+
#
|
| 7 |
+
# Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
SCRIPTDIR=`dirname "${0}"`
|
| 11 |
+
. "${SCRIPTDIR}/initscript.sh"
|
| 12 |
+
cd "${TOPDIR}/os400/iconv/bldcsndfa"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# This is for old XML library (bootstrapping).
|
| 16 |
+
#rm -rf xml.h xml
|
| 17 |
+
#ln -s /QSYS.LIB/XML.LIB/H.FILE/XML.MBR xml.h
|
| 18 |
+
#mkdir xml
|
| 19 |
+
#mkdir xml/h
|
| 20 |
+
#ln -s /QSYS.LIB/XML.LIB/H.FILE/UTF8.MBR xml/h/utf8
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# Compile.
|
| 24 |
+
|
| 25 |
+
CMD="CRTCMOD MODULE(${TARGETLIB}/BLDCSNDFA) SRCSTMF('bldcsndfa.c')"
|
| 26 |
+
CMD="${CMD} SYSIFCOPT(*IFS64IO) LANGLVL(*EXTENDED) LOCALETYPE(*LOCALE)"
|
| 27 |
+
CMD="${CMD} INCDIR("
|
| 28 |
+
CMD="${CMD} '${IFSDIR}/include' ${INCLUDES})"
|
| 29 |
+
CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
|
| 30 |
+
CMD="${CMD} OUTPUT(${OUTPUT})"
|
| 31 |
+
CMD="${CMD} OPTIMIZE(10)"
|
| 32 |
+
CMD="${CMD} DBGVIEW(${DEBUG})"
|
| 33 |
+
#CMD="${CMD} DEFINE('OLDXML' 'xmlXPathSetContextNode=xmlXPathSetCurrentNode')"
|
| 34 |
+
|
| 35 |
+
system "${CMD}"
|
| 36 |
+
|
| 37 |
+
# Link
|
| 38 |
+
|
| 39 |
+
CMD="CRTPGM PGM(${TARGETLIB}/BLDCSNDFA) MODULE(${TARGETLIB}/BLDCSNDFA)"
|
| 40 |
+
CMD="${CMD} BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
| 41 |
+
#CMD="${CMD} BNDDIR(XML/XML)"
|
| 42 |
+
CMD="${CMD} TGTRLS(${TGTRLS})"
|
| 43 |
+
system "${CMD}"
|
local-test-libxml2-delta-02/afc-libxml2/os400/make-include.sh
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
#
|
| 3 |
+
# Installation of the C header files in the OS/400 library.
|
| 4 |
+
#
|
| 5 |
+
# See Copyright for the status of this software.
|
| 6 |
+
#
|
| 7 |
+
# Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
SCRIPTDIR=`dirname "${0}"`
|
| 11 |
+
. "${SCRIPTDIR}/initscript.sh"
|
| 12 |
+
cd "${TOPDIR}/include"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# Create the OS/400 source program file for the C header files.
|
| 16 |
+
|
| 17 |
+
SRCPF="${LIBIFSNAME}/LIBXML.FILE"
|
| 18 |
+
|
| 19 |
+
if action_needed "${SRCPF}"
|
| 20 |
+
then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBXML) RCDLEN(112)"
|
| 21 |
+
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: C/C++ header files')"
|
| 22 |
+
system "${CMD}"
|
| 23 |
+
fi
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Create the IFS directory for the C header files.
|
| 27 |
+
|
| 28 |
+
if action_needed "${IFSDIR}/include/libxml"
|
| 29 |
+
then mkdir -p "${IFSDIR}/include/libxml"
|
| 30 |
+
fi
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Enumeration values may be used as va_arg tagfields, so they MUST be
|
| 35 |
+
# integers.
|
| 36 |
+
|
| 37 |
+
copy_hfile()
|
| 38 |
+
|
| 39 |
+
{
|
| 40 |
+
sed -e '1i\
|
| 41 |
+
#pragma enum(int)\
|
| 42 |
+
' "${@}" -e '$a\
|
| 43 |
+
#pragma enum(pop)\
|
| 44 |
+
'
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
# Copy the header files to DB2 library. Link from IFS include directory.
|
| 48 |
+
|
| 49 |
+
for HFILE in "${TOPDIR}/os400/transcode.h" libxml/*.h libxml/*.h.in
|
| 50 |
+
do CMD="cat \"${HFILE}\""
|
| 51 |
+
DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
|
| 52 |
+
|
| 53 |
+
case "`basename \"${HFILE}\"`" in
|
| 54 |
+
|
| 55 |
+
*.in) CMD="${CMD} | versioned_copy";;
|
| 56 |
+
|
| 57 |
+
xmlschemastypes.h) # Special case: rename colliding file.
|
| 58 |
+
DEST="${SRCPF}/SCHMTYPES.MBR";;
|
| 59 |
+
|
| 60 |
+
esac
|
| 61 |
+
|
| 62 |
+
if action_needed "${DEST}" "${HFILE}"
|
| 63 |
+
then eval "${CMD}" | copy_hfile > tmphdrfile
|
| 64 |
+
|
| 65 |
+
# Need to translate to target CCSID.
|
| 66 |
+
|
| 67 |
+
CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DEST}')"
|
| 68 |
+
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
|
| 69 |
+
system "${CMD}"
|
| 70 |
+
fi
|
| 71 |
+
|
| 72 |
+
IFSFILE="${IFSDIR}/include/libxml/`basename \"${HFILE}\" .in`"
|
| 73 |
+
|
| 74 |
+
if action_needed "${IFSFILE}" "${DEST}"
|
| 75 |
+
then rm -f "${IFSFILE}"
|
| 76 |
+
ln -s "${DEST}" "${IFSFILE}"
|
| 77 |
+
fi
|
| 78 |
+
done
|
local-test-libxml2-delta-02/afc-libxml2/os400/make-rpg.sh
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
#
|
| 3 |
+
# Installation of the ILE/RPG header files in the OS/400 library.
|
| 4 |
+
#
|
| 5 |
+
# See Copyright for the status of this software.
|
| 6 |
+
#
|
| 7 |
+
# Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
SCRIPTDIR=`dirname "${0}"`
|
| 11 |
+
. "${SCRIPTDIR}/initscript.sh"
|
| 12 |
+
cd "${TOPDIR}/os400/libxmlrpg"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# Create the OS/400 source program file for the ILE/RPG header files.
|
| 16 |
+
|
| 17 |
+
SRCPF="${LIBIFSNAME}/LIBXMLRPG.FILE"
|
| 18 |
+
|
| 19 |
+
if action_needed "${SRCPF}"
|
| 20 |
+
then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBXMLRPG) RCDLEN(112)"
|
| 21 |
+
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: ILE/RPG header files')"
|
| 22 |
+
system "${CMD}"
|
| 23 |
+
fi
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Map file names to DB2 name syntax.
|
| 27 |
+
|
| 28 |
+
for HFILE in *.rpgle *.rpgle.in
|
| 29 |
+
do NAME="`basename \"${HFILE}\" .in`"
|
| 30 |
+
VAR="`basename \"${NAME}\" .rpgle`"
|
| 31 |
+
VAL="`db2_name \"${NAME}\" nomangle`"
|
| 32 |
+
|
| 33 |
+
if [ "${VAR}" = 'xmlschemastypes' ]
|
| 34 |
+
then VAL=SCHMTYPES
|
| 35 |
+
fi
|
| 36 |
+
|
| 37 |
+
eval "VAR_${VAR}=\"${VAL}\""
|
| 38 |
+
echo "${VAR} s/${VAR}/${VAL}/g"
|
| 39 |
+
done > tmpsubstfile1
|
| 40 |
+
|
| 41 |
+
# Order substitution commands so that a prefix appears after all
|
| 42 |
+
# file names beginning with the prefix.
|
| 43 |
+
|
| 44 |
+
sort -r tmpsubstfile1 | sed 's/^[^ ]*[ ]*//' > tmpsubstfile2
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
change_include()
|
| 48 |
+
|
| 49 |
+
{
|
| 50 |
+
sed -e '\#^....../include *"libxmlrpg/#{' \
|
| 51 |
+
-e 's///' \
|
| 52 |
+
-e 's/".*//' \
|
| 53 |
+
-f tmpsubstfile2 \
|
| 54 |
+
-e 's#.*# /include libxmlrpg,&#' \
|
| 55 |
+
-e '}'
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# Create the IFS directory for the ILE/RPG header files.
|
| 60 |
+
|
| 61 |
+
RPGIFSDIR="${IFSDIR}/include/libxmlrpg"
|
| 62 |
+
|
| 63 |
+
if action_needed "${RPGIFSDIR}"
|
| 64 |
+
then mkdir -p "${RPGIFSDIR}"
|
| 65 |
+
fi
|
| 66 |
+
|
| 67 |
+
# Copy the header files to IFS ILE/RPG include directory.
|
| 68 |
+
# Copy them with include path editing to the DB2 library.
|
| 69 |
+
|
| 70 |
+
for HFILE in *.rpgle *.rpgle.in
|
| 71 |
+
do IFSCMD="cat \"${HFILE}\""
|
| 72 |
+
DB2CMD="change_include < \"${HFILE}\""
|
| 73 |
+
IFSFILE="`basename \"${HFILE}\" .in`"
|
| 74 |
+
|
| 75 |
+
case "${HFILE}" in
|
| 76 |
+
|
| 77 |
+
*.in) IFSCMD="${IFSCMD} | versioned_copy"
|
| 78 |
+
DB2CMD="${DB2CMD} | versioned_copy"
|
| 79 |
+
;;
|
| 80 |
+
esac
|
| 81 |
+
|
| 82 |
+
IFSDEST="${RPGIFSDIR}/${IFSFILE}"
|
| 83 |
+
|
| 84 |
+
if action_needed "${IFSDEST}" "${HFILE}"
|
| 85 |
+
then eval "${IFSCMD}" > "${IFSDEST}"
|
| 86 |
+
fi
|
| 87 |
+
|
| 88 |
+
eval DB2MBR="\"\${VAR_`basename \"${IFSDEST}\" .rpgle`}\""
|
| 89 |
+
DB2DEST="${SRCPF}/${DB2MBR}.MBR"
|
| 90 |
+
|
| 91 |
+
if action_needed "${DB2DEST}" "${HFILE}"
|
| 92 |
+
then eval "${DB2CMD}" | change_include > tmphdrfile
|
| 93 |
+
|
| 94 |
+
# Need to translate to target CCSID.
|
| 95 |
+
|
| 96 |
+
CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DB2DEST}')"
|
| 97 |
+
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
|
| 98 |
+
system "${CMD}"
|
| 99 |
+
fi
|
| 100 |
+
done
|
local-test-libxml2-delta-02/afc-libxml2/os400/make-src.sh
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
#
|
| 3 |
+
# libxml compilation script for the OS/400.
|
| 4 |
+
#
|
| 5 |
+
# See Copyright for the status of this software.
|
| 6 |
+
#
|
| 7 |
+
# Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
SCRIPTDIR=`dirname "${0}"`
|
| 11 |
+
. "${SCRIPTDIR}/initscript.sh"
|
| 12 |
+
cd "${TOPDIR}"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# Create and compile the identification source file.
|
| 16 |
+
|
| 17 |
+
echo '#pragma comment(user, "libxml2 version '"${LIBXML_VERSION}"'")' > os400.c
|
| 18 |
+
echo '#pragma comment(user, __DATE__)' >> os400.c
|
| 19 |
+
echo '#pragma comment(user, __TIME__)' >> os400.c
|
| 20 |
+
echo '#pragma comment(copyright, "Copyright (C) 1998-2017 Daniel Veillard. OS/400 version by P. Monnerat.")' >> os400.c
|
| 21 |
+
make_module OS400 os400.c
|
| 22 |
+
LINK= # No need to rebuild service program yet.
|
| 23 |
+
MODULES=
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Get source list.
|
| 27 |
+
|
| 28 |
+
foldlines()
|
| 29 |
+
|
| 30 |
+
{
|
| 31 |
+
sed -e ':begin' \
|
| 32 |
+
-e '/\\$/{' \
|
| 33 |
+
-e 's/\\$/ /' \
|
| 34 |
+
-e 'N' \
|
| 35 |
+
-e 'bbegin' \
|
| 36 |
+
-e '}' \
|
| 37 |
+
-e 's/\n//g' \
|
| 38 |
+
-e 's/[[:space:]]*$//'
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
get_make_var()
|
| 43 |
+
|
| 44 |
+
{
|
| 45 |
+
foldlines < Makefile.am |
|
| 46 |
+
sed -e "/^${1}[[:space:]]*=[[:space:]]*/{" \
|
| 47 |
+
-e 's///' \
|
| 48 |
+
-e 'q' \
|
| 49 |
+
-e '}' \
|
| 50 |
+
-e 'd'
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
docb_sources=`get_make_var docb_sources`
|
| 55 |
+
trio_sources=`get_make_var trio_sources`
|
| 56 |
+
CSOURCES=`eval echo "\`get_make_var libxml2_la_SOURCES | tr '()' '{}'\`"`
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# Compile the sources into modules.
|
| 60 |
+
|
| 61 |
+
INCLUDES="'`pwd`'"
|
| 62 |
+
|
| 63 |
+
# OS/400 specific modules first.
|
| 64 |
+
|
| 65 |
+
make_module --ebcdic DLFCN "${SCRIPTDIR}/dlfcn/dlfcn.c"
|
| 66 |
+
make_module --ebcdic ICONV "${SCRIPTDIR}/iconv/iconv.c"
|
| 67 |
+
make_module --ebcdic WRAPPERS "${SCRIPTDIR}/wrappers.c"
|
| 68 |
+
make_module TRANSCODE "${SCRIPTDIR}/transcode.c"
|
| 69 |
+
make_module RPGSUPPORT "${SCRIPTDIR}/rpgsupport.c"
|
| 70 |
+
|
| 71 |
+
# Regular libxml2 modules.
|
| 72 |
+
|
| 73 |
+
for SRC in ${CSOURCES}
|
| 74 |
+
do MODULE=`db2_name "${SRC}"`
|
| 75 |
+
make_module "${MODULE}" "${SRC}"
|
| 76 |
+
done
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
# If needed, (re)create the static binding directory.
|
| 80 |
+
|
| 81 |
+
if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
| 82 |
+
then LINK=YES
|
| 83 |
+
fi
|
| 84 |
+
|
| 85 |
+
if [ "${LINK}" ]
|
| 86 |
+
then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
| 87 |
+
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
| 88 |
+
CMD="${CMD} TEXT('libxml2 static binding directory')"
|
| 89 |
+
system "${CMD}"
|
| 90 |
+
|
| 91 |
+
for MODULE in ${MODULES}
|
| 92 |
+
do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
| 93 |
+
CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
|
| 94 |
+
system "${CMD}"
|
| 95 |
+
done
|
| 96 |
+
fi
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
# The exportation file for service program creation must be in a DB2
|
| 100 |
+
# source file, so make sure it exists.
|
| 101 |
+
|
| 102 |
+
if action_needed "${LIBIFSNAME}/TOOLS.FILE"
|
| 103 |
+
then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
|
| 104 |
+
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: build tools')"
|
| 105 |
+
system "${CMD}"
|
| 106 |
+
fi
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
# Generate all exported symbol table versions in a binding source file.
|
| 110 |
+
|
| 111 |
+
BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
|
| 112 |
+
PGMEXPS=
|
| 113 |
+
|
| 114 |
+
OS400SYMS=`cat os400/transcode.h os400/rpgsupport.h |
|
| 115 |
+
sed -e 'H' \
|
| 116 |
+
-e 'g' \
|
| 117 |
+
-e 's/\n/ /' \
|
| 118 |
+
-e 's/\\$/ /' \
|
| 119 |
+
-e 's/.*/& /' \
|
| 120 |
+
-e 's/\/\*.*\*\// /g' \
|
| 121 |
+
-e 'h' \
|
| 122 |
+
-e ':loop' \
|
| 123 |
+
-e 'g' \
|
| 124 |
+
-e '/\/\*/d' \
|
| 125 |
+
-e '/;/!d' \
|
| 126 |
+
-e 's/[^;]*;//' \
|
| 127 |
+
-e 'x' \
|
| 128 |
+
-e 's/[[:space:]]*;.*$//' \
|
| 129 |
+
-e '/XMLPUBFUN/{' \
|
| 130 |
+
-e 's/[[:space:]]*(.*$//' \
|
| 131 |
+
-e 's/.*[[:space:]*]//' \
|
| 132 |
+
-e 'p' \
|
| 133 |
+
-e 'bloop' \
|
| 134 |
+
-e '}' \
|
| 135 |
+
-e '/XMLPUBVAR/!bloop' \
|
| 136 |
+
-e ':loop2' \
|
| 137 |
+
-e '/\[[^][]*\]/{' \
|
| 138 |
+
-e 's///' \
|
| 139 |
+
-e 'bloop2' \
|
| 140 |
+
-e '}' \
|
| 141 |
+
-e 's/[[:space:]]*,[[:space:]]*/,/g' \
|
| 142 |
+
-e 's/[^,]*[[:space:]*]//' \
|
| 143 |
+
-e 's/[^[:alnum:]_,]//g' \
|
| 144 |
+
-e 's/,/\n/g' \
|
| 145 |
+
-e 'p' \
|
| 146 |
+
-e 'bloop'`
|
| 147 |
+
|
| 148 |
+
sed -e 's/#.*//' \
|
| 149 |
+
-e 's/[[:space:]]*$//' \
|
| 150 |
+
-e 's/^[[:space:]]*//' \
|
| 151 |
+
-e '/^*global:$/d' \
|
| 152 |
+
-e '/^$/d' \
|
| 153 |
+
-e '/[[:space:]]*{$/{' \
|
| 154 |
+
-e 's///' \
|
| 155 |
+
-e 'h' \
|
| 156 |
+
-e 's/[^A-Za-z0-9]/_/g' \
|
| 157 |
+
-e 's/^[0-9]/_&/' \
|
| 158 |
+
-e 'x' \
|
| 159 |
+
-e 'G' \
|
| 160 |
+
-e 's/\(.*\)\n\(.*\)/\2_SIGNATURE="\1"/' \
|
| 161 |
+
-e 'p' \
|
| 162 |
+
-e 's/.*//' \
|
| 163 |
+
-e 'x' \
|
| 164 |
+
-e "s/.*/SONAME='&'/" \
|
| 165 |
+
-e 'b' \
|
| 166 |
+
-e '}' \
|
| 167 |
+
-e '/[[:space:]]*;$/!d' \
|
| 168 |
+
-e 's///' \
|
| 169 |
+
-e '/^xmlDllMain$/d' \
|
| 170 |
+
-e '/^}[[:space:]]*/!{' \
|
| 171 |
+
-e 'H' \
|
| 172 |
+
-e 'd' \
|
| 173 |
+
-e '}' \
|
| 174 |
+
-e 's///' \
|
| 175 |
+
-e '/^$/!{' \
|
| 176 |
+
-e 's/[^A-Za-z0-9]/_/g' \
|
| 177 |
+
-e 's/^[0-9]/_&/' \
|
| 178 |
+
-e 's/.*/${&}/' \
|
| 179 |
+
-e 'x' \
|
| 180 |
+
-e 'H' \
|
| 181 |
+
-e 's/.*//' \
|
| 182 |
+
-e '}' \
|
| 183 |
+
-e 'x' \
|
| 184 |
+
-e 's/\n/ /g' \
|
| 185 |
+
-e 's/^[[:space:]]*//' \
|
| 186 |
+
-e 's/.*/declare ${SONAME}="&"/' \
|
| 187 |
+
-e 's/.*/&; PGMEXPS="${SONAME} ${PGMEXPS}"/' \
|
| 188 |
+
< "${TOPDIR}/libxml2.syms" > bndvars
|
| 189 |
+
. ./bndvars
|
| 190 |
+
|
| 191 |
+
PGMLVL=CURRENT
|
| 192 |
+
for PGMEXP in ${PGMEXPS}
|
| 193 |
+
do SIGNATURE=`echo "${PGMEXP}" | sed 's/^LIBXML2_//'`
|
| 194 |
+
eval ENTRIES=\"\${${PGMEXP}}\"
|
| 195 |
+
echo " STRPGMEXP PGMLVL(*${PGMLVL}) SIGNATURE('${SIGNATURE}')"
|
| 196 |
+
for ENTRY in ${ENTRIES} ${OS400SYMS}
|
| 197 |
+
do echo " EXPORT SYMBOL('${ENTRY}')"
|
| 198 |
+
done
|
| 199 |
+
echo ' ENDPGMEXP'
|
| 200 |
+
PGMLVL=PRV
|
| 201 |
+
done > "${BSF}"
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
# Build the service program if needed.
|
| 205 |
+
|
| 206 |
+
if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
|
| 207 |
+
then LINK=YES
|
| 208 |
+
fi
|
| 209 |
+
|
| 210 |
+
if [ "${LINK}" ]
|
| 211 |
+
then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
|
| 212 |
+
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
|
| 213 |
+
CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
|
| 214 |
+
CMD="${CMD} BNDDIR((${TARGETLIB}/${STATBNDDIR})"
|
| 215 |
+
if [ "${WITH_ZLIB}" -ne 0 ]
|
| 216 |
+
then CMD="${CMD} (${ZLIB_LIB}/${ZLIB_BNDDIR})"
|
| 217 |
+
fi
|
| 218 |
+
CMD="${CMD})"
|
| 219 |
+
CMD="${CMD} BNDSRVPGM(QADRTTS)"
|
| 220 |
+
CMD="${CMD} TEXT('libxml2 dynamic library')"
|
| 221 |
+
CMD="${CMD} TGTRLS(${TGTRLS})"
|
| 222 |
+
system "${CMD}"
|
| 223 |
+
LINK=YES
|
| 224 |
+
fi
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
# If needed, (re)create the dynamic binding directory.
|
| 228 |
+
|
| 229 |
+
if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
| 230 |
+
then LINK=YES
|
| 231 |
+
fi
|
| 232 |
+
|
| 233 |
+
if [ "${LINK}" ]
|
| 234 |
+
then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
| 235 |
+
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
| 236 |
+
CMD="${CMD} TEXT('libxml2 dynamic binding directory')"
|
| 237 |
+
system "${CMD}"
|
| 238 |
+
CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
| 239 |
+
CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
|
| 240 |
+
system "${CMD}"
|
| 241 |
+
fi
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
# Compile the ASCII main() stub.
|
| 245 |
+
|
| 246 |
+
make_module --ebcdic --sysiconv LIBXMLMAIN "${SCRIPTDIR}/libxmlmain.c"
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
# Compile and link program xmllint.
|
| 250 |
+
|
| 251 |
+
if action_needed "${LIBIFSNAME}/XMLLINT.PGM" "xmllint.c" ||
|
| 252 |
+
action_needed "${LIBIFSNAME}/XMLLINT.PGM" "${LIBIFSNAME}/${SRVPGM}.SRVPGM" ||
|
| 253 |
+
action_needed "${LIBIFSNAME}/XMLLINT.PGM" "${LIBIFSNAME}/LIBXMLMAIN.MODULE"
|
| 254 |
+
then make_module XMLLINT xmllint.c
|
| 255 |
+
CMD="CRTPGM PGM(${TARGETLIB}/XMLLINT) MODULE(${TARGETLIB}/XMLLINT)"
|
| 256 |
+
CMD="${CMD} ENTMOD(${TARGETLIB}/LIBXMLMAIN)"
|
| 257 |
+
CMD="${CMD} BNDSRVPGM(QADRTTS) BNDDIR((${TARGETLIB}/${STATBNDDIR})"
|
| 258 |
+
if [ "${WITH_ZLIB}" -ne 0 ]
|
| 259 |
+
then CMD="${CMD} (${ZLIB_LIB}/${ZLIB_BNDDIR})"
|
| 260 |
+
fi
|
| 261 |
+
CMD="${CMD}) ACTGRP(*NEW) TEXT('XML tool')"
|
| 262 |
+
CMD="${CMD} TGTRLS(${TGTRLS})"
|
| 263 |
+
system "${CMD}"
|
| 264 |
+
rm -f "${LIBIFSNAME}/XMLLINT.MODULE"
|
| 265 |
+
fi
|
| 266 |
+
|
| 267 |
+
# Install xmllint in IFS.
|
| 268 |
+
|
| 269 |
+
if [ ! -d "${IFSDIR}/bin" ]
|
| 270 |
+
then mkdir -p "${IFSDIR}/bin"
|
| 271 |
+
fi
|
| 272 |
+
rm -f "${IFSDIR}/bin/xmllint"
|
| 273 |
+
ln -s "${LIBIFSNAME}/XMLLINT.PGM" "${IFSDIR}/bin/xmllint"
|
| 274 |
+
|
| 275 |
+
# Prepare the XMLLINT command and its response program.
|
| 276 |
+
|
| 277 |
+
if action_needed "${LIBIFSNAME}/XMLLINTCL.PGM" "${SCRIPTDIR}/xmllintcl.c"
|
| 278 |
+
then make_module --ebcdic XMLLINTCL "${SCRIPTDIR}/xmllintcl.c"
|
| 279 |
+
CMD="CRTPGM PGM(${TARGETLIB}/XMLLINTCL) MODULE(${TARGETLIB}/XMLLINTCL)"
|
| 280 |
+
CMD="${CMD} ACTGRP(*NEW) TEXT('XMLLINT command response')"
|
| 281 |
+
CMD="${CMD} TGTRLS(${TGTRLS})"
|
| 282 |
+
system "${CMD}"
|
| 283 |
+
rm -f "${LIBIFSNAME}/XMLLINTCL.MODULE"
|
| 284 |
+
fi
|
| 285 |
+
|
| 286 |
+
if action_needed "${LIBIFSNAME}/TOOLS.FILE/XMLLINT.MBR" \
|
| 287 |
+
"${SCRIPTDIR}/xmllint.cmd"
|
| 288 |
+
then CMD="CPY OBJ('${SCRIPTDIR}/xmllint.cmd')"
|
| 289 |
+
CMD="${CMD} TOOBJ('${LIBIFSNAME}/TOOLS.FILE/XMLLINT.MBR')"
|
| 290 |
+
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
|
| 291 |
+
system "${CMD}"
|
| 292 |
+
fi
|
| 293 |
+
|
| 294 |
+
if action_needed "${LIBIFSNAME}/XMLLINT.CMD" \
|
| 295 |
+
"${LIBIFSNAME}/TOOLS.FILE/XMLLINT.MBR"
|
| 296 |
+
then CMD="CRTCMD CMD(${TARGETLIB}/XMLLINT) PGM(${TARGETLIB}/XMLLINTCL)"
|
| 297 |
+
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(XMLLINT) THDSAFE(*YES)"
|
| 298 |
+
CMD="${CMD} TEXT('XML tool') REPLACE(*YES)"
|
| 299 |
+
system "${CMD}"
|
| 300 |
+
fi
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
# Compile and link program xmlcatalog.
|
| 304 |
+
|
| 305 |
+
if action_needed "${LIBIFSNAME}/XMLCATALOG.PGM" "xmlcatalog.c" ||
|
| 306 |
+
action_needed "${LIBIFSNAME}/XMLCATALOG.PGM" \
|
| 307 |
+
"${LIBIFSNAME}/${SRVPGM}.SRVPGM" ||
|
| 308 |
+
action_needed "${LIBIFSNAME}/XMLCATALOG.PGM" \
|
| 309 |
+
"${LIBIFSNAME}/LIBXMLMAIN.MODULE"
|
| 310 |
+
then make_module XMLCATALOG xmlcatalog.c
|
| 311 |
+
CMD="CRTPGM PGM(${TARGETLIB}/XMLCATALOG)"
|
| 312 |
+
CMD="${CMD} MODULE(${TARGETLIB}/XMLCATALOG)"
|
| 313 |
+
CMD="${CMD} ENTMOD(${TARGETLIB}/LIBXMLMAIN)"
|
| 314 |
+
CMD="${CMD} BNDSRVPGM(QADRTTS) BNDDIR((${TARGETLIB}/${STATBNDDIR})"
|
| 315 |
+
if [ "${WITH_ZLIB}" -ne 0 ]
|
| 316 |
+
then CMD="${CMD} (${ZLIB_LIB}/${ZLIB_BNDDIR})"
|
| 317 |
+
fi
|
| 318 |
+
CMD="${CMD}) ACTGRP(*NEW) TEXT('XML/SGML catalog tool')"
|
| 319 |
+
CMD="${CMD} TGTRLS(${TGTRLS})"
|
| 320 |
+
system "${CMD}"
|
| 321 |
+
rm -f "${LIBIFSNAME}/XMLCATALOG.MODULE"
|
| 322 |
+
fi
|
| 323 |
+
|
| 324 |
+
# Install xmlcatalog in IFS.
|
| 325 |
+
|
| 326 |
+
rm -f "${IFSDIR}/bin/xmlcatalog"
|
| 327 |
+
ln -s "${LIBIFSNAME}/XMLCATALOG.PGM" "${IFSDIR}/bin/xmlcatalog"
|
| 328 |
+
|
| 329 |
+
# Prepare the XMLCATALOG command and its response program.
|
| 330 |
+
|
| 331 |
+
if action_needed "${LIBIFSNAME}/XMLCATLGCL.PGM" "${SCRIPTDIR}/xmlcatlgcl.c"
|
| 332 |
+
then make_module --ebcdic XMLCATLGCL "${SCRIPTDIR}/xmlcatlgcl.c"
|
| 333 |
+
CMD="CRTPGM PGM(${TARGETLIB}/XMLCATLGCL)"
|
| 334 |
+
CMD="${CMD} MODULE(${TARGETLIB}/XMLCATLGCL)"
|
| 335 |
+
CMD="${CMD} ACTGRP(*NEW) TEXT('XMLCATALOG command response')"
|
| 336 |
+
CMD="${CMD} TGTRLS(${TGTRLS})"
|
| 337 |
+
system "${CMD}"
|
| 338 |
+
rm -f "${LIBIFSNAME}/XMLCATLGCL.MODULE"
|
| 339 |
+
fi
|
| 340 |
+
|
| 341 |
+
if action_needed "${LIBIFSNAME}/TOOLS.FILE/XMLCATALOG.MBR" \
|
| 342 |
+
"${SCRIPTDIR}/xmlcatalog.cmd"
|
| 343 |
+
then CMD="CPY OBJ('${SCRIPTDIR}/xmlcatalog.cmd')"
|
| 344 |
+
CMD="${CMD} TOOBJ('${LIBIFSNAME}/TOOLS.FILE/XMLCATALOG.MBR')"
|
| 345 |
+
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
|
| 346 |
+
system "${CMD}"
|
| 347 |
+
fi
|
| 348 |
+
|
| 349 |
+
if action_needed "${LIBIFSNAME}/XMLCATALOG.CMD" \
|
| 350 |
+
"${LIBIFSNAME}/TOOLS.FILE/XMLCATALOG.MBR"
|
| 351 |
+
then CMD="CRTCMD CMD(${TARGETLIB}/XMLCATALOG) PGM(${TARGETLIB}/XMLCATLGCL)"
|
| 352 |
+
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(XMLCATALOG)"
|
| 353 |
+
CMD="${CMD} THDSAFE(*YES) TEXT('XML/SGML catalog tool') REPLACE(*YES)"
|
| 354 |
+
system "${CMD}"
|
| 355 |
+
fi
|
local-test-libxml2-delta-02/afc-libxml2/os400/make.sh
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
#
|
| 3 |
+
# libxml2 compilation script for the OS/400.
|
| 4 |
+
# This is a shell script since make is not a standard component of OS/400.
|
| 5 |
+
#
|
| 6 |
+
# See Copyright for the status of this software.
|
| 7 |
+
#
|
| 8 |
+
# Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 9 |
+
#
|
| 10 |
+
|
| 11 |
+
SCRIPTDIR=`dirname "${0}"`
|
| 12 |
+
. "${SCRIPTDIR}/initscript.sh"
|
| 13 |
+
cd "${TOPDIR}"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# Create the OS/400 library if it does not exist.
|
| 17 |
+
|
| 18 |
+
if action_needed "${LIBIFSNAME}"
|
| 19 |
+
then CMD="CRTLIB LIB(${TARGETLIB})"
|
| 20 |
+
CMD="${CMD} TEXT('libxml2: XML parser and toolkit API')"
|
| 21 |
+
system "${CMD}"
|
| 22 |
+
fi
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Create the DOCS source file if it does not exist.
|
| 26 |
+
|
| 27 |
+
if action_needed "${LIBIFSNAME}/DOCS.FILE"
|
| 28 |
+
then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)"
|
| 29 |
+
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
|
| 30 |
+
system "${CMD}"
|
| 31 |
+
fi
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Copy some documentation files if needed.
|
| 35 |
+
|
| 36 |
+
for TEXT in "${TOPDIR}/AUTHORS" "${TOPDIR}/ChangeLog" \
|
| 37 |
+
"${TOPDIR}/Copyright" "${TOPDIR}/CONTRIBUTING" "${TOPDIR}/README" \
|
| 38 |
+
"${TOPDIR}/MAINTAINERS" "${TOPDIR}/NEWS" "${TOPDIR}/TODO" \
|
| 39 |
+
"${TOPDIR}/TODO_SCHEMAS" "${TOPDIR}/os400/README400"
|
| 40 |
+
do if [ -f "${TEXT}" ]
|
| 41 |
+
then MEMBER="`basename \"${TEXT}\" .OS400`"
|
| 42 |
+
MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR"
|
| 43 |
+
|
| 44 |
+
if action_needed "${MEMBER}" "${TEXT}"
|
| 45 |
+
then # Sources are in UTF-8.
|
| 46 |
+
rm -f "${TOPDIR}/tmpfile"[12]
|
| 47 |
+
CMD="CPY OBJ('${TEXT}') TOOBJ('${TOPDIR}/tmpfile1')"
|
| 48 |
+
CMD="${CMD} FROMCCSID(1208) TOCCSID(${TGTCCSID})"
|
| 49 |
+
CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
|
| 50 |
+
system "${CMD}"
|
| 51 |
+
# Make sure all lines are < 100 characters.
|
| 52 |
+
sed -e 's/.\{99\}/&\
|
| 53 |
+
/g' -e 's/\n$//' "${TOPDIR}/tmpfile1" > "${TOPDIR}/tmpfile2"
|
| 54 |
+
CMD="CPY OBJ('${TOPDIR}/tmpfile2') TOOBJ('${MEMBER}')"
|
| 55 |
+
CMD="${CMD} TOCCSID(${TGTCCSID})"
|
| 56 |
+
CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
|
| 57 |
+
system "${CMD}"
|
| 58 |
+
fi
|
| 59 |
+
fi
|
| 60 |
+
done
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
# Build files from template.
|
| 64 |
+
|
| 65 |
+
configFile()
|
| 66 |
+
|
| 67 |
+
{
|
| 68 |
+
args=`set | sed -e '/^[A-Za-z_][A-Za-z0-9_]*=/!d' \
|
| 69 |
+
-e 's/[\/\\\\&]/\\\\&/g' \
|
| 70 |
+
-e "s/'/'\\\\\\''/g" \
|
| 71 |
+
-e 's/^\([^=]*\)=\(.*\)$/-e '\''s\/@\1@\/\2\/g'\'/`
|
| 72 |
+
eval sed ${args} < "${1}".in > "${1}"
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
configFile include/libxml/xmlversion.h
|
| 76 |
+
configFile os400/os400config.h
|
| 77 |
+
mv os400/os400config.h config.h
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# Build in each directory.
|
| 81 |
+
|
| 82 |
+
for SUBDIR in include rpg src
|
| 83 |
+
do "${SCRIPTDIR}/make-${SUBDIR}.sh"
|
| 84 |
+
done
|
local-test-libxml2-delta-02/afc-libxml2/os400/os400config.h.in
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** Configuration parameters for the OS/400 implementation.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
| 10 |
+
#define HAVE_ARPA_INET_H 1
|
| 11 |
+
|
| 12 |
+
/* Define to 1 if you have the <arpa/nameser.h> header file. */
|
| 13 |
+
#define HAVE_ARPA_NAMESER_H 1
|
| 14 |
+
|
| 15 |
+
/* Whether struct sockaddr::__ss_family exists */
|
| 16 |
+
#undef HAVE_BROKEN_SS_FAMILY
|
| 17 |
+
|
| 18 |
+
/* Define to 1 if you have the <dlfcn.h> header file. */
|
| 19 |
+
#define HAVE_DLFCN_H 1 /* Locally emulated. */
|
| 20 |
+
|
| 21 |
+
/* Have dlopen based dso */
|
| 22 |
+
#define HAVE_DLOPEN 1 /* Locally emulated. */
|
| 23 |
+
|
| 24 |
+
/* Define to 1 if you have the <dl.h> header file. */
|
| 25 |
+
#undef HAVE_DL_H
|
| 26 |
+
|
| 27 |
+
/* Define to 1 if you have the <fcntl.h> header file. */
|
| 28 |
+
#define HAVE_FCNTL_H 1
|
| 29 |
+
|
| 30 |
+
/* Define to 1 if you have the `ftime' function. */
|
| 31 |
+
#undef HAVE_FTIME
|
| 32 |
+
|
| 33 |
+
/* Define if getaddrinfo is there */
|
| 34 |
+
#define HAVE_GETADDRINFO 1
|
| 35 |
+
|
| 36 |
+
/* Define to 1 if you have the `gettimeofday' function. */
|
| 37 |
+
#undef HAVE_GETTIMEOFDAY
|
| 38 |
+
|
| 39 |
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
| 40 |
+
#define HAVE_INTTYPES_H 1
|
| 41 |
+
|
| 42 |
+
/* Define to 1 if you have the `isascii' function. */
|
| 43 |
+
#define HAVE_ISASCII 1
|
| 44 |
+
|
| 45 |
+
/* Define if history library is there (-lhistory) */
|
| 46 |
+
#undef HAVE_LIBHISTORY
|
| 47 |
+
|
| 48 |
+
/* Define if readline library is there (-lreadline) */
|
| 49 |
+
#undef HAVE_LIBREADLINE
|
| 50 |
+
|
| 51 |
+
/* Define to 1 if you have the `mmap' function. */
|
| 52 |
+
#undef HAVE_MMAP
|
| 53 |
+
|
| 54 |
+
/* Define to 1 if you have the `munmap' function. */
|
| 55 |
+
#undef HAVE_MUNMAP
|
| 56 |
+
|
| 57 |
+
/* mmap() is no good without munmap() */
|
| 58 |
+
#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
|
| 59 |
+
# undef /**/ HAVE_MMAP
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
/* Define to 1 if you have the <netdb.h> header file. */
|
| 63 |
+
#define HAVE_NETDB_H 1
|
| 64 |
+
|
| 65 |
+
/* Define to 1 if you have the <netinet/in.h> header file. */
|
| 66 |
+
#define HAVE_NETINET_IN_H 1
|
| 67 |
+
|
| 68 |
+
/* Define to 1 if you have the <poll.h> header file. */
|
| 69 |
+
#undef HAVE_POLL_H
|
| 70 |
+
|
| 71 |
+
/* Define if <pthread.h> is there */
|
| 72 |
+
#define HAVE_PTHREAD_H 1
|
| 73 |
+
|
| 74 |
+
/* Define to 1 if you have the `putenv' function. */
|
| 75 |
+
#define HAVE_PUTENV 1
|
| 76 |
+
|
| 77 |
+
/* Define to 1 if you have the `rand_r' function. */
|
| 78 |
+
#define HAVE_RAND_R 1
|
| 79 |
+
|
| 80 |
+
/* Define to 1 if you have the <resolv.h> header file. */
|
| 81 |
+
#define HAVE_RESOLV_H 1
|
| 82 |
+
|
| 83 |
+
/* Have shl_load based dso */
|
| 84 |
+
#undef HAVE_SHLLOAD
|
| 85 |
+
|
| 86 |
+
/* Define to 1 if you have the `stat' function. */
|
| 87 |
+
#define HAVE_STAT 1
|
| 88 |
+
|
| 89 |
+
/* Define to 1 if you have the <stdint.h> header file. */
|
| 90 |
+
#define HAVE_STDINT_H 1
|
| 91 |
+
|
| 92 |
+
/* Define to 1 if you have the <sys/mman.h> header file. */
|
| 93 |
+
#define HAVE_SYS_MMAN_H 1
|
| 94 |
+
|
| 95 |
+
/* Define to 1 if you have the <sys/select.h> header file. */
|
| 96 |
+
#undef HAVE_SYS_SELECT_H
|
| 97 |
+
|
| 98 |
+
/* Define to 1 if you have the <sys/socket.h> header file. */
|
| 99 |
+
#define HAVE_SYS_SOCKET_H 1
|
| 100 |
+
|
| 101 |
+
/* Define to 1 if you have the <sys/stat.h> header file. */
|
| 102 |
+
#define HAVE_SYS_STAT_H 1
|
| 103 |
+
|
| 104 |
+
/* Define to 1 if you have the <sys/timeb.h> header file. */
|
| 105 |
+
#define HAVE_SYS_TIMEB_H 1
|
| 106 |
+
|
| 107 |
+
/* Define to 1 if you have the <sys/time.h> header file. */
|
| 108 |
+
#define HAVE_SYS_TIME_H 1
|
| 109 |
+
|
| 110 |
+
/* Define to 1 if you have the <sys/types.h> header file. */
|
| 111 |
+
#define HAVE_SYS_TYPES_H 1
|
| 112 |
+
|
| 113 |
+
/* Define to 1 if you have the <unistd.h> header file. */
|
| 114 |
+
#define HAVE_UNISTD_H 1
|
| 115 |
+
|
| 116 |
+
/* Whether va_copy() is available */
|
| 117 |
+
#undef HAVE_VA_COPY
|
| 118 |
+
|
| 119 |
+
/* Whether __va_copy() is available */
|
| 120 |
+
#undef HAVE___VA_COPY
|
| 121 |
+
|
| 122 |
+
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
| 123 |
+
*/
|
| 124 |
+
#undef LT_OBJDIR
|
| 125 |
+
|
| 126 |
+
/* Name of package */
|
| 127 |
+
#define PACKAGE "libxml2"
|
| 128 |
+
|
| 129 |
+
/* Define to the address where bug reports for this package should be sent. */
|
| 130 |
+
#define PACKAGE_BUGREPORT ""
|
| 131 |
+
|
| 132 |
+
/* Define to the full name of this package. */
|
| 133 |
+
#define PACKAGE_NAME ""
|
| 134 |
+
|
| 135 |
+
/* Define to the full name and version of this package. */
|
| 136 |
+
#define PACKAGE_STRING ""
|
| 137 |
+
|
| 138 |
+
/* Define to the one symbol short name of this package. */
|
| 139 |
+
#define PACKAGE_TARNAME ""
|
| 140 |
+
|
| 141 |
+
/* Define to the home page for this package. */
|
| 142 |
+
#define PACKAGE_URL ""
|
| 143 |
+
|
| 144 |
+
/* Define to the version of this package. */
|
| 145 |
+
#define PACKAGE_VERSION ""
|
| 146 |
+
|
| 147 |
+
/* Support for IPv6 */
|
| 148 |
+
#define SUPPORT_IP6
|
| 149 |
+
|
| 150 |
+
/* Version number of package */
|
| 151 |
+
#define VERSION "@VERSION@"
|
| 152 |
+
|
| 153 |
+
/* Determine what socket length (socklen_t) data type is */
|
| 154 |
+
#define XML_SOCKLEN_T socklen_t
|
| 155 |
+
|
| 156 |
+
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
|
| 157 |
+
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
| 158 |
+
#define below would cause a syntax error. */
|
| 159 |
+
#undef _UINT32_T
|
| 160 |
+
|
| 161 |
+
/* ss_family is not defined here, use __ss_family instead */
|
| 162 |
+
#undef ss_family
|
| 163 |
+
|
| 164 |
+
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
| 165 |
+
such a type exists and the standard includes do not define it. */
|
| 166 |
+
#undef uint32_t
|
| 167 |
+
|
| 168 |
+
/* Type cast for the send() function 2nd arg */
|
| 169 |
+
#define SEND_ARG2_CAST (char *)
|
| 170 |
+
|
| 171 |
+
/* Type cast for the gethostbyname() argument */
|
| 172 |
+
#define GETHOSTBYNAME_ARG_CAST (char *)
|
| 173 |
+
|
| 174 |
+
/* Define if va_list is an array type */
|
| 175 |
+
#define VA_LIST_IS_ARRAY 1
|
local-test-libxml2-delta-02/afc-libxml2/os400/rpgsupport.c
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** Additional procedures for ILE/RPG support.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
#include <sys/types.h>
|
| 10 |
+
|
| 11 |
+
#include <stdarg.h>
|
| 12 |
+
|
| 13 |
+
#include "libxml/xmlmemory.h"
|
| 14 |
+
#include "libxml/xpath.h"
|
| 15 |
+
#include "libxml/parser.h"
|
| 16 |
+
#include "libxml/HTMLparser.h"
|
| 17 |
+
|
| 18 |
+
#include "rpgsupport.h"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
*** ILE/RPG cannot directly dereference a pointer and has no macros.
|
| 23 |
+
*** The following additional procedures supply these functions.
|
| 24 |
+
*** In addition, the following code is adjusted for threads control at
|
| 25 |
+
*** compile time via the C macros.
|
| 26 |
+
**/
|
| 27 |
+
|
| 28 |
+
#define THREADED_VAR(name, type) \
|
| 29 |
+
type __get_##name(void) { return name; } \
|
| 30 |
+
void __set_##name(type arg) { name = arg; }
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
THREADED_VAR(xmlFree, xmlFreeFunc)
|
| 34 |
+
|
| 35 |
+
void
|
| 36 |
+
__call_xmlFree(void * mem)
|
| 37 |
+
|
| 38 |
+
{
|
| 39 |
+
xmlFree(mem);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
THREADED_VAR(xmlMalloc, xmlMallocFunc)
|
| 44 |
+
|
| 45 |
+
void *
|
| 46 |
+
__call_xmlMalloc(size_t size)
|
| 47 |
+
|
| 48 |
+
{
|
| 49 |
+
return xmlMalloc(size);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
THREADED_VAR(xmlMallocAtomic, xmlMallocFunc)
|
| 54 |
+
|
| 55 |
+
void *
|
| 56 |
+
__call_xmlMallocAtomic(size_t size)
|
| 57 |
+
|
| 58 |
+
{
|
| 59 |
+
return xmlMallocAtomic(size);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
THREADED_VAR(xmlRealloc, xmlReallocFunc)
|
| 64 |
+
|
| 65 |
+
void *
|
| 66 |
+
__call_xmlRealloc(void * mem, size_t size)
|
| 67 |
+
|
| 68 |
+
{
|
| 69 |
+
return xmlRealloc(mem, size);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
THREADED_VAR(xmlMemStrdup, xmlStrdupFunc)
|
| 74 |
+
|
| 75 |
+
char *
|
| 76 |
+
__call_xmlMemStrdup(const char * str)
|
| 77 |
+
|
| 78 |
+
{
|
| 79 |
+
return xmlMemStrdup(str);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
#ifdef LIBXML_DOCB_ENABLED
|
| 84 |
+
THREADED_VAR(docbDefaultSAXHandler, xmlSAXHandlerV1)
|
| 85 |
+
#endif
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 89 |
+
THREADED_VAR(htmlDefaultSAXHandler, xmlSAXHandlerV1)
|
| 90 |
+
#endif
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
THREADED_VAR(xmlLastError, xmlError)
|
| 94 |
+
|
| 95 |
+
THREADED_VAR(oldXMLWDcompatibility, int)
|
| 96 |
+
THREADED_VAR(xmlBufferAllocScheme, xmlBufferAllocationScheme)
|
| 97 |
+
THREADED_VAR(xmlDefaultBufferSize, int)
|
| 98 |
+
THREADED_VAR(xmlDefaultSAXHandler, xmlSAXHandlerV1)
|
| 99 |
+
THREADED_VAR(xmlDefaultSAXLocator, xmlSAXLocator)
|
| 100 |
+
THREADED_VAR(xmlDoValidityCheckingDefaultValue, int)
|
| 101 |
+
|
| 102 |
+
/* No caller to xmlGenericError() because the argument list is unknown. */
|
| 103 |
+
THREADED_VAR(xmlGenericError, xmlGenericErrorFunc)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
THREADED_VAR(xmlStructuredError, xmlStructuredErrorFunc)
|
| 107 |
+
|
| 108 |
+
void
|
| 109 |
+
__call_xmlStructuredError(void * userData, xmlErrorPtr error)
|
| 110 |
+
|
| 111 |
+
{
|
| 112 |
+
xmlStructuredError(userData, error);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
THREADED_VAR(xmlGenericErrorContext, void *)
|
| 116 |
+
THREADED_VAR(xmlStructuredErrorContext, void *)
|
| 117 |
+
THREADED_VAR(xmlGetWarningsDefaultValue, int)
|
| 118 |
+
THREADED_VAR(xmlIndentTreeOutput, int)
|
| 119 |
+
THREADED_VAR(xmlTreeIndentString, const char *)
|
| 120 |
+
THREADED_VAR(xmlKeepBlanksDefaultValue, int)
|
| 121 |
+
THREADED_VAR(xmlLineNumbersDefaultValue, int)
|
| 122 |
+
THREADED_VAR(xmlLoadExtDtdDefaultValue, int)
|
| 123 |
+
THREADED_VAR(xmlParserDebugEntities, int)
|
| 124 |
+
THREADED_VAR(xmlParserVersion, const char *)
|
| 125 |
+
THREADED_VAR(xmlPedanticParserDefaultValue, int)
|
| 126 |
+
THREADED_VAR(xmlSaveNoEmptyTags, int)
|
| 127 |
+
THREADED_VAR(xmlSubstituteEntitiesDefaultValue, int)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
THREADED_VAR(xmlRegisterNodeDefaultValue, xmlRegisterNodeFunc)
|
| 131 |
+
|
| 132 |
+
void
|
| 133 |
+
__call_xmlRegisterNodeDefaultValue(xmlNodePtr node)
|
| 134 |
+
|
| 135 |
+
{
|
| 136 |
+
xmlRegisterNodeDefaultValue(node);
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
THREADED_VAR(xmlDeregisterNodeDefaultValue, xmlDeregisterNodeFunc)
|
| 141 |
+
|
| 142 |
+
void
|
| 143 |
+
__call_xmlDeregisterNodeDefaultValue(xmlNodePtr node)
|
| 144 |
+
|
| 145 |
+
{
|
| 146 |
+
xmlDeregisterNodeDefaultValue(node);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
THREADED_VAR(xmlParserInputBufferCreateFilenameValue, xmlParserInputBufferCreateFilenameFunc)
|
| 151 |
+
|
| 152 |
+
xmlParserInputBufferPtr
|
| 153 |
+
__call_xmlParserInputBufferCreateFilenameValue(const char *URI,
|
| 154 |
+
xmlCharEncoding enc)
|
| 155 |
+
|
| 156 |
+
{
|
| 157 |
+
return xmlParserInputBufferCreateFilenameValue(URI, enc);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
THREADED_VAR(xmlOutputBufferCreateFilenameValue, xmlOutputBufferCreateFilenameFunc)
|
| 162 |
+
|
| 163 |
+
xmlOutputBufferPtr
|
| 164 |
+
__call_xmlOutputBufferCreateFilenameValue(const char *URI,
|
| 165 |
+
xmlCharEncodingHandlerPtr encoder, int compression)
|
| 166 |
+
|
| 167 |
+
{
|
| 168 |
+
return xmlOutputBufferCreateFilenameValue(URI, encoder, compression);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
/**
|
| 174 |
+
*** va_list support.
|
| 175 |
+
**/
|
| 176 |
+
|
| 177 |
+
void
|
| 178 |
+
__xmlVaStart(char * * list, char * lastargaddr, size_t lastargsize)
|
| 179 |
+
|
| 180 |
+
{
|
| 181 |
+
list[1] = lastargaddr + lastargsize;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
void *
|
| 186 |
+
__xmlVaArg(char * * list, void * dest, size_t argsize)
|
| 187 |
+
|
| 188 |
+
{
|
| 189 |
+
size_t align;
|
| 190 |
+
|
| 191 |
+
if (!argsize)
|
| 192 |
+
return (void *) NULL;
|
| 193 |
+
|
| 194 |
+
for (align = 16; align > argsize; align >>= 1)
|
| 195 |
+
;
|
| 196 |
+
|
| 197 |
+
align--;
|
| 198 |
+
list[0] = list[1] + (align - (((size_t) list[0] - 1) & align));
|
| 199 |
+
list[1] = list[0] + argsize;
|
| 200 |
+
|
| 201 |
+
if (dest)
|
| 202 |
+
memcpy(dest, list[0], argsize);
|
| 203 |
+
|
| 204 |
+
return (void *) list[0];
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
void
|
| 209 |
+
__xmlVaEnd(char * * list)
|
| 210 |
+
|
| 211 |
+
{
|
| 212 |
+
/* Nothing to do. */
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
#ifdef LIBXML_XPATH_ENABLED
|
| 217 |
+
|
| 218 |
+
int
|
| 219 |
+
__xmlXPathNodeSetGetLength(const xmlNodeSet * ns)
|
| 220 |
+
|
| 221 |
+
{
|
| 222 |
+
return xmlXPathNodeSetGetLength(ns);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
xmlNodePtr
|
| 227 |
+
__xmlXPathNodeSetItem(const xmlNodeSet * ns, int index)
|
| 228 |
+
|
| 229 |
+
{
|
| 230 |
+
return xmlXPathNodeSetItem(ns, index);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
int
|
| 235 |
+
__xmlXPathNodeSetIsEmpty(const xmlNodeSet * ns)
|
| 236 |
+
|
| 237 |
+
{
|
| 238 |
+
return xmlXPathNodeSetIsEmpty(ns);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
#endif
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 245 |
+
|
| 246 |
+
const char *
|
| 247 |
+
__htmlDefaultSubelement(const htmlElemDesc * elt)
|
| 248 |
+
|
| 249 |
+
{
|
| 250 |
+
return htmlDefaultSubelement(elt);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
int
|
| 255 |
+
__htmlElementAllowedHereDesc(const htmlElemDesc * parent,
|
| 256 |
+
const htmlElemDesc * elt)
|
| 257 |
+
|
| 258 |
+
{
|
| 259 |
+
return htmlElementAllowedHereDesc(parent, elt);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
const char * *
|
| 264 |
+
__htmlRequiredAttrs(const htmlElemDesc * elt)
|
| 265 |
+
|
| 266 |
+
{
|
| 267 |
+
return htmlRequiredAttrs(elt);
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/os400/rpgsupport.h
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** Additional declarations for ILE/RPG support.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
#ifndef __RPGSUPPORT_H__
|
| 10 |
+
#define __RPGSUPPORT_H__
|
| 11 |
+
|
| 12 |
+
#include <sys/types.h>
|
| 13 |
+
|
| 14 |
+
#include <libxml/xmlmemory.h>
|
| 15 |
+
#include <libxml/xpath.h>
|
| 16 |
+
#include "libxml/HTMLparser.h"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
XMLPUBFUN xmlFreeFunc __get_xmlFree(void);
|
| 20 |
+
XMLPUBFUN void __set_xmlFree(xmlFreeFunc freefunc);
|
| 21 |
+
XMLPUBFUN void __call_xmlFree(void * mem);
|
| 22 |
+
XMLPUBFUN xmlMallocFunc __get_xmlMalloc(void);
|
| 23 |
+
XMLPUBFUN void __set_xmlMalloc(xmlMallocFunc allocfunc);
|
| 24 |
+
XMLPUBFUN void * __call_xmlMalloc(size_t size);
|
| 25 |
+
XMLPUBFUN xmlMallocFunc __get_xmlMallocAtomic(void);
|
| 26 |
+
XMLPUBFUN void __set_xmlMallocAtomic(xmlMallocFunc allocfunc);
|
| 27 |
+
XMLPUBFUN void * __call_xmlMallocAtomic(size_t size);
|
| 28 |
+
XMLPUBFUN xmlReallocFunc __get_xmlRealloc(void);
|
| 29 |
+
XMLPUBFUN void __set_xmlRealloc(xmlReallocFunc reallocfunc);
|
| 30 |
+
XMLPUBFUN void * __call_xmlRealloc(void * mem, size_t size);
|
| 31 |
+
XMLPUBFUN xmlStrdupFunc __get_xmlMemStrdup(void);
|
| 32 |
+
XMLPUBFUN void __set_xmlMemStrdup(xmlStrdupFunc strdupfunc);
|
| 33 |
+
XMLPUBFUN char * __call_xmlMemStrdup(const char * str);
|
| 34 |
+
|
| 35 |
+
#ifdef LIBXML_DOCB_ENABLED
|
| 36 |
+
XMLPUBFUN xmlSAXHandlerV1 __get_docbDefaultSAXHandler(void);
|
| 37 |
+
XMLPUBFUN void __set_docbDefaultSAXHandler(xmlSAXHandlerV1 hdlr);
|
| 38 |
+
#endif
|
| 39 |
+
|
| 40 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 41 |
+
XMLPUBFUN xmlSAXHandlerV1 __get_htmlDefaultSAXHandler(void);
|
| 42 |
+
XMLPUBFUN void __set_htmlDefaultSAXHandler(xmlSAXHandlerV1 hdlr);
|
| 43 |
+
#endif
|
| 44 |
+
|
| 45 |
+
XMLPUBFUN xmlError __get_xmlLastError(void);
|
| 46 |
+
XMLPUBFUN void __set_xmlLastError(xmlError err);
|
| 47 |
+
|
| 48 |
+
XMLPUBFUN int __get_oldXMLWDcompatibility(void);
|
| 49 |
+
XMLPUBFUN void __set_oldXMLWDcompatibility(int val);
|
| 50 |
+
|
| 51 |
+
XMLPUBFUN xmlBufferAllocationScheme __get_xmlBufferAllocScheme(void);
|
| 52 |
+
XMLPUBFUN void __set_xmlBufferAllocScheme(xmlBufferAllocationScheme val);
|
| 53 |
+
|
| 54 |
+
XMLPUBFUN int __get_xmlDefaultBufferSize(void);
|
| 55 |
+
XMLPUBFUN void __set_xmlDefaultBufferSize(int val);
|
| 56 |
+
|
| 57 |
+
XMLPUBFUN xmlSAXHandlerV1 __get_xmlDefaultSAXHandler(void);
|
| 58 |
+
XMLPUBFUN void __set_xmlDefaultSAXHandler(xmlSAXHandlerV1 val);
|
| 59 |
+
|
| 60 |
+
XMLPUBFUN xmlSAXLocator __get_xmlDefaultSAXLocator(void);
|
| 61 |
+
XMLPUBFUN void __set_xmlDefaultSAXLocator(xmlSAXLocator val);
|
| 62 |
+
|
| 63 |
+
XMLPUBFUN int __get_xmlDoValidityCheckingDefaultValue(void);
|
| 64 |
+
XMLPUBFUN void __set_xmlDoValidityCheckingDefaultValue(int val);
|
| 65 |
+
|
| 66 |
+
XMLPUBFUN xmlGenericErrorFunc __get_xmlGenericError(void);
|
| 67 |
+
XMLPUBFUN void __set_xmlGenericError(xmlGenericErrorFunc val);
|
| 68 |
+
|
| 69 |
+
XMLPUBFUN xmlStructuredErrorFunc __get_xmlStructuredError(void);
|
| 70 |
+
XMLPUBFUN void __set_xmlStructuredError(xmlStructuredErrorFunc val);
|
| 71 |
+
XMLPUBFUN void __call_xmlStructuredError(void *userData, xmlErrorPtr error);
|
| 72 |
+
|
| 73 |
+
XMLPUBFUN void * __get_xmlGenericErrorContext(void);
|
| 74 |
+
XMLPUBFUN void __set_xmlGenericErrorContext(void * val);
|
| 75 |
+
|
| 76 |
+
XMLPUBFUN void * __get_xmlStructuredErrorContext(void);
|
| 77 |
+
XMLPUBFUN void __set_xmlStructuredErrorContext(void * val);
|
| 78 |
+
|
| 79 |
+
XMLPUBFUN int __get_xmlGetWarningsDefaultValue(void);
|
| 80 |
+
XMLPUBFUN void __set_xmlGetWarningsDefaultValue(int val);
|
| 81 |
+
|
| 82 |
+
XMLPUBFUN int __get_xmlIndentTreeOutput(void);
|
| 83 |
+
XMLPUBFUN void __set_xmlIndentTreeOutput(int val);
|
| 84 |
+
|
| 85 |
+
XMLPUBFUN const char * __get_xmlTreeIndentString(void);
|
| 86 |
+
XMLPUBFUN void __set_xmlTreeIndentString(const char * val);
|
| 87 |
+
|
| 88 |
+
XMLPUBFUN int __get_xmlKeepBlanksDefaultValue(void);
|
| 89 |
+
XMLPUBFUN void __set_xmlKeepBlanksDefaultValue(int val);
|
| 90 |
+
|
| 91 |
+
XMLPUBFUN int __get_xmlLineNumbersDefaultValue(void);
|
| 92 |
+
XMLPUBFUN void __set_xmlLineNumbersDefaultValue(int val);
|
| 93 |
+
|
| 94 |
+
XMLPUBFUN int __get_xmlLoadExtDtdDefaultValue(void);
|
| 95 |
+
XMLPUBFUN void __set_xmlLoadExtDtdDefaultValue(int val);
|
| 96 |
+
|
| 97 |
+
XMLPUBFUN int __get_xmlParserDebugEntities(void);
|
| 98 |
+
XMLPUBFUN void __set_xmlParserDebugEntities(int val);
|
| 99 |
+
|
| 100 |
+
XMLPUBFUN const char * __get_xmlParserVersion(void);
|
| 101 |
+
XMLPUBFUN void __set_xmlParserVersion(const char * val);
|
| 102 |
+
|
| 103 |
+
XMLPUBFUN int __get_xmlPedanticParserDefaultValue(void);
|
| 104 |
+
XMLPUBFUN void __set_xmlPedanticParserDefaultValue(int val);
|
| 105 |
+
|
| 106 |
+
XMLPUBFUN int __get_xmlSaveNoEmptyTags(void);
|
| 107 |
+
XMLPUBFUN void __set_xmlSaveNoEmptyTags(int val);
|
| 108 |
+
|
| 109 |
+
XMLPUBFUN int __get_xmlSubstituteEntitiesDefaultValue(void);
|
| 110 |
+
XMLPUBFUN void __set_xmlSubstituteEntitiesDefaultValue(int val);
|
| 111 |
+
|
| 112 |
+
XMLPUBFUN xmlRegisterNodeFunc __get_xmlRegisterNodeDefaultValue(void);
|
| 113 |
+
XMLPUBFUN void __set_xmlRegisterNodeDefaultValue(xmlRegisterNodeFunc val);
|
| 114 |
+
XMLPUBFUN void __call_xmlRegisterNodeDefaultValue(xmlNodePtr node);
|
| 115 |
+
|
| 116 |
+
XMLPUBFUN xmlDeregisterNodeFunc __get_xmlDeregisterNodeDefaultValue(void);
|
| 117 |
+
XMLPUBFUN void __set_xmlDeregisterNodeDefaultValue(xmlDeregisterNodeFunc val);
|
| 118 |
+
XMLPUBFUN void __call_xmlDeregisterNodeDefaultValue(xmlNodePtr node);
|
| 119 |
+
|
| 120 |
+
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
|
| 121 |
+
__get_xmlParserInputBufferCreateFilenameValue(void);
|
| 122 |
+
XMLPUBFUN void __set_xmlParserInputBufferCreateFilenameValue(
|
| 123 |
+
xmlParserInputBufferCreateFilenameFunc val);
|
| 124 |
+
XMLPUBFUN xmlParserInputBufferPtr
|
| 125 |
+
__call_xmlParserInputBufferCreateFilenameValue(const char *URI,
|
| 126 |
+
xmlCharEncoding enc);
|
| 127 |
+
|
| 128 |
+
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
|
| 129 |
+
__get_xmlOutputBufferCreateFilenameValue(void);
|
| 130 |
+
XMLPUBFUN void __set_xmlOutputBufferCreateFilenameValue(
|
| 131 |
+
xmlOutputBufferCreateFilenameFunc val);
|
| 132 |
+
XMLPUBFUN xmlOutputBufferPtr
|
| 133 |
+
__call_xmlOutputBufferCreateFilenameValue(const char *URI,
|
| 134 |
+
xmlCharEncodingHandlerPtr encoder,
|
| 135 |
+
int compression);
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
XMLPUBFUN void __xmlVaStart(char * * list,
|
| 139 |
+
char * lastargaddr, size_t lastargsize);
|
| 140 |
+
XMLPUBFUN void * __xmlVaArg(char * * list, void * dest, size_t argsize);
|
| 141 |
+
XMLPUBFUN void __xmlVaEnd(char * * list);
|
| 142 |
+
|
| 143 |
+
#ifdef LIBXML_XPATH_ENABLED
|
| 144 |
+
XMLPUBFUN int __xmlXPathNodeSetGetLength(xmlNodeSetPtr ns);
|
| 145 |
+
XMLPUBFUN xmlNodePtr __xmlXPathNodeSetItem(xmlNodeSetPtr ns, int index);
|
| 146 |
+
XMLPUBFUN int __xmlXPathNodeSetIsEmpty(xmlNodeSetPtr ns);
|
| 147 |
+
#endif
|
| 148 |
+
|
| 149 |
+
#ifdef LIBXML_HTML_ENABLED
|
| 150 |
+
XMLPUBFUN const char * __htmlDefaultSubelement(const htmlElemDesc * elt);
|
| 151 |
+
XMLPUBFUN int __htmlElementAllowedHereDesc(const htmlElemDesc * parent,
|
| 152 |
+
const htmlElemDesc * elt);
|
| 153 |
+
XMLPUBFUN const char * *
|
| 154 |
+
__htmlRequiredAttrs(const htmlElemDesc * elt);
|
| 155 |
+
#endif
|
| 156 |
+
|
| 157 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/os400/transcode.c
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** Transcoding support and wrappers.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
#define IN_LIBXML
|
| 10 |
+
#include "libxml.h"
|
| 11 |
+
|
| 12 |
+
#include <sys/types.h>
|
| 13 |
+
#include <iconv.h>
|
| 14 |
+
#include "libxml/xmlmemory.h"
|
| 15 |
+
#include "libxml/dict.h"
|
| 16 |
+
#include "transcode.h"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
*** Destroy a dictionary and mark as destroyed.
|
| 21 |
+
**/
|
| 22 |
+
|
| 23 |
+
void
|
| 24 |
+
xmlZapDict(xmlDictPtr * dict)
|
| 25 |
+
|
| 26 |
+
{
|
| 27 |
+
if (dict && *dict) {
|
| 28 |
+
xmlDictFree(*dict);
|
| 29 |
+
*dict = (xmlDictPtr) NULL;
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
*** Support for inline conversion from/to UTF-8.
|
| 36 |
+
*** This is targeted to function parameter encoding conversion.
|
| 37 |
+
*** Method is:
|
| 38 |
+
*** - Convert string from/to UTF-8.
|
| 39 |
+
*** - Keep it in a dictionary.
|
| 40 |
+
*** - Free original string if a release procedure is provided.
|
| 41 |
+
*** Can also be called without dictionary to convert a string from/to UTF-8
|
| 42 |
+
*** into xmlMalloc'ed dynamic storage.
|
| 43 |
+
**/
|
| 44 |
+
|
| 45 |
+
const char *
|
| 46 |
+
xmlTranscodeResult(const xmlChar * s, const char * encoding,
|
| 47 |
+
xmlDictPtr * dict, void (*freeproc)(const void *))
|
| 48 |
+
|
| 49 |
+
{
|
| 50 |
+
size_t l;
|
| 51 |
+
iconv_t cd;
|
| 52 |
+
char * srcp;
|
| 53 |
+
char * dstp;
|
| 54 |
+
size_t srcc;
|
| 55 |
+
size_t dstc;
|
| 56 |
+
char * ts;
|
| 57 |
+
const char * ret;
|
| 58 |
+
int err;
|
| 59 |
+
static const int nullstring[] = { 0 };
|
| 60 |
+
|
| 61 |
+
/* Convert from UTF-8. */
|
| 62 |
+
|
| 63 |
+
if (!s)
|
| 64 |
+
return (const char *) NULL;
|
| 65 |
+
|
| 66 |
+
ret = (const char *) NULL;
|
| 67 |
+
ts = (char *) NULL;
|
| 68 |
+
err = 0;
|
| 69 |
+
l = xmlStrlen(s);
|
| 70 |
+
|
| 71 |
+
if (!l && dict)
|
| 72 |
+
ret = (const char *) nullstring;
|
| 73 |
+
else {
|
| 74 |
+
if (dict && !*dict)
|
| 75 |
+
err = !(*dict = xmlDictCreate());
|
| 76 |
+
|
| 77 |
+
if (!err)
|
| 78 |
+
err = !(ts = xmlMalloc(4 * l + 4));
|
| 79 |
+
|
| 80 |
+
dstp = ts;
|
| 81 |
+
dstc = 4 * l;
|
| 82 |
+
|
| 83 |
+
if (!err && l) {
|
| 84 |
+
if (!encoding)
|
| 85 |
+
encoding = "ibm-0"; /* Job's encoding. */
|
| 86 |
+
|
| 87 |
+
cd = iconv_open(encoding, "UTF-8");
|
| 88 |
+
|
| 89 |
+
if (cd == (iconv_t) -1)
|
| 90 |
+
err = 1;
|
| 91 |
+
else {
|
| 92 |
+
srcp = (char *) s;
|
| 93 |
+
srcc = l;
|
| 94 |
+
srcc = iconv(cd, &srcp, &srcc, &dstp, &dstc);
|
| 95 |
+
iconv_close(cd);
|
| 96 |
+
err = srcc == (size_t) -1;
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
if (!err) {
|
| 101 |
+
dstp[0] = dstp[1] = dstp[2] = dstp[3] = '\0';
|
| 102 |
+
|
| 103 |
+
if (!dict) {
|
| 104 |
+
if (dstc)
|
| 105 |
+
ts = xmlRealloc(ts, (dstp - ts) + 4);
|
| 106 |
+
|
| 107 |
+
ret = (const char *) ts;
|
| 108 |
+
ts = (char *) NULL;
|
| 109 |
+
}
|
| 110 |
+
else
|
| 111 |
+
ret = (char *) xmlDictLookup(*dict,
|
| 112 |
+
(xmlChar *) ts, dstp - ts + 1);
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
if (ts)
|
| 117 |
+
xmlFree(ts);
|
| 118 |
+
|
| 119 |
+
if (freeproc)
|
| 120 |
+
(*freeproc)(s);
|
| 121 |
+
|
| 122 |
+
return ret;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
*** Support for inline conversion to UTF-8.
|
| 128 |
+
*** Method is:
|
| 129 |
+
*** - Convert string to UTF-8.
|
| 130 |
+
*** - Keep it in a dictionary.
|
| 131 |
+
*** Can also be called without dictionary to convert a string to UTF-8 into
|
| 132 |
+
*** xmlMalloc'ed dynamic storage.
|
| 133 |
+
**/
|
| 134 |
+
|
| 135 |
+
static const xmlChar *
|
| 136 |
+
inTranscode(const char * s, size_t l, const char * encoding, xmlDictPtr * dict)
|
| 137 |
+
|
| 138 |
+
{
|
| 139 |
+
iconv_t cd;
|
| 140 |
+
char * srcp;
|
| 141 |
+
char * dstp;
|
| 142 |
+
size_t srcc;
|
| 143 |
+
size_t dstc;
|
| 144 |
+
xmlChar * ts;
|
| 145 |
+
const xmlChar * ret;
|
| 146 |
+
static const xmlChar nullstring[] = { 0 };
|
| 147 |
+
|
| 148 |
+
if (!l && dict)
|
| 149 |
+
return nullstring;
|
| 150 |
+
|
| 151 |
+
if (dict && !*dict)
|
| 152 |
+
if (!(*dict = xmlDictCreate()))
|
| 153 |
+
return (const xmlChar *) NULL;
|
| 154 |
+
|
| 155 |
+
ts = (xmlChar *) xmlMalloc(6 * l + 1);
|
| 156 |
+
|
| 157 |
+
if (!ts)
|
| 158 |
+
return (const xmlChar *) NULL;
|
| 159 |
+
|
| 160 |
+
dstp = (char *) ts;
|
| 161 |
+
dstc = 6 * l;
|
| 162 |
+
|
| 163 |
+
if (l) {
|
| 164 |
+
if (!encoding)
|
| 165 |
+
encoding = "ibm-0"; /* Use job's encoding. */
|
| 166 |
+
|
| 167 |
+
cd = iconv_open("UTF-8", encoding);
|
| 168 |
+
|
| 169 |
+
if (cd == (iconv_t) -1) {
|
| 170 |
+
xmlFree((char *) ts);
|
| 171 |
+
return (const xmlChar *) NULL;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
srcp = (char *) s;
|
| 175 |
+
srcc = l;
|
| 176 |
+
srcc = iconv(cd, &srcp, &srcc, &dstp, &dstc);
|
| 177 |
+
iconv_close(cd);
|
| 178 |
+
|
| 179 |
+
if (srcc == (size_t) -1) {
|
| 180 |
+
xmlFree((char *) ts);
|
| 181 |
+
return (const xmlChar *) NULL;
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
*dstp = '\0';
|
| 186 |
+
|
| 187 |
+
if (!dict) {
|
| 188 |
+
if (dstc)
|
| 189 |
+
ts = xmlRealloc(ts, (dstp - ts) + 1);
|
| 190 |
+
|
| 191 |
+
return ts;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
ret = xmlDictLookup(*dict, ts, dstp - ts + 1);
|
| 195 |
+
xmlFree((char *) ts);
|
| 196 |
+
return ret;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
/**
|
| 201 |
+
*** Input 8-bit character string parameter.
|
| 202 |
+
**/
|
| 203 |
+
|
| 204 |
+
const xmlChar *
|
| 205 |
+
xmlTranscodeString(const char * s, const char * encoding, xmlDictPtr * dict)
|
| 206 |
+
|
| 207 |
+
{
|
| 208 |
+
if (!s)
|
| 209 |
+
return (const xmlChar *) NULL;
|
| 210 |
+
|
| 211 |
+
return inTranscode(s, xmlStrlen(s), encoding, dict);
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
/**
|
| 216 |
+
*** Input 16-bit character string parameter.
|
| 217 |
+
**/
|
| 218 |
+
|
| 219 |
+
const xmlChar *
|
| 220 |
+
xmlTranscodeWString(const char * s, const char * encoding, xmlDictPtr * dict)
|
| 221 |
+
|
| 222 |
+
{
|
| 223 |
+
size_t i;
|
| 224 |
+
|
| 225 |
+
if (!s)
|
| 226 |
+
return (const xmlChar *) NULL;
|
| 227 |
+
|
| 228 |
+
for (i = 0; s[i] && s[i + 1]; i += 2)
|
| 229 |
+
;
|
| 230 |
+
|
| 231 |
+
return inTranscode(s, i, encoding, dict);
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
/**
|
| 236 |
+
*** Input 32-bit character string parameter.
|
| 237 |
+
**/
|
| 238 |
+
|
| 239 |
+
const xmlChar *
|
| 240 |
+
xmlTranscodeHString(const char * s, const char * encoding, xmlDictPtr * dict)
|
| 241 |
+
|
| 242 |
+
{
|
| 243 |
+
size_t i;
|
| 244 |
+
|
| 245 |
+
if (!s)
|
| 246 |
+
return (const xmlChar *) NULL;
|
| 247 |
+
|
| 248 |
+
for (i = 0; s[i] && s[i + 1] && s[i + 2] && s[i + 3]; i += 4)
|
| 249 |
+
;
|
| 250 |
+
|
| 251 |
+
return inTranscode(s, i, encoding, dict);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
/**
|
| 256 |
+
*** vasprintf() implementation with result transcoding.
|
| 257 |
+
**/
|
| 258 |
+
|
| 259 |
+
const char *
|
| 260 |
+
xmlVasprintf(xmlDictPtr * dict, const char * encoding,
|
| 261 |
+
const xmlChar * fmt, va_list args)
|
| 262 |
+
|
| 263 |
+
{
|
| 264 |
+
char * s = NULL;
|
| 265 |
+
|
| 266 |
+
vasprintf(&s, fmt, args);
|
| 267 |
+
return xmlTranscodeResult((const xmlChar *) s, encoding, dict, free);
|
| 268 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/os400/transcode.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** Transcoding support declarations.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
#ifndef _TRANSCODE_H_
|
| 10 |
+
#define _TRANSCODE_H_
|
| 11 |
+
|
| 12 |
+
#include <stdarg.h>
|
| 13 |
+
#include <libxml/dict.h>
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
XMLPUBFUN void xmlZapDict(xmlDictPtr * dict);
|
| 17 |
+
XMLPUBFUN const char * xmlTranscodeResult(const xmlChar * s,
|
| 18 |
+
const char * encoding, xmlDictPtr * dict,
|
| 19 |
+
void (*freeproc)(const void *));
|
| 20 |
+
XMLPUBFUN const xmlChar * xmlTranscodeString(const char * s,
|
| 21 |
+
const char * encoding, xmlDictPtr * dict);
|
| 22 |
+
XMLPUBFUN const xmlChar * xmlTranscodeWString(const char * s,
|
| 23 |
+
const char * encoding, xmlDictPtr * dict);
|
| 24 |
+
XMLPUBFUN const xmlChar * xmlTranscodeHString(const char * s,
|
| 25 |
+
const char * encoding, xmlDictPtr * dict);
|
| 26 |
+
|
| 27 |
+
#ifndef XML_NO_SHORT_NAMES
|
| 28 |
+
/**
|
| 29 |
+
*** Since the above functions are generally called "inline" (i.e.: several
|
| 30 |
+
*** times nested in a single expression), define shorthand names
|
| 31 |
+
*** to minimize calling statement length.
|
| 32 |
+
**/
|
| 33 |
+
|
| 34 |
+
#define xmlTR xmlTranscodeResult
|
| 35 |
+
#define xmlTS xmlTranscodeString
|
| 36 |
+
#define xmlTW xmlTranscodeWString
|
| 37 |
+
#define xmlTH xmlTranscodeHstring
|
| 38 |
+
#endif
|
| 39 |
+
|
| 40 |
+
XMLPUBFUN const char * xmlVasprintf(xmlDictPtr * dict, const char * encoding,
|
| 41 |
+
const xmlChar * fmt, va_list args);
|
| 42 |
+
|
| 43 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/os400/wrappers.c
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** UTF-8/EBCDIC wrappers to system and C library procedures.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
#include <sys/types.h>
|
| 10 |
+
#include <sys/socket.h>
|
| 11 |
+
#include <arpa/inet.h>
|
| 12 |
+
#include <stdlib.h>
|
| 13 |
+
#include <dlfcn.h>
|
| 14 |
+
#include <netdb.h>
|
| 15 |
+
#include <errno.h>
|
| 16 |
+
|
| 17 |
+
#include "config.h"
|
| 18 |
+
|
| 19 |
+
#include "libxml/xmlmemory.h"
|
| 20 |
+
|
| 21 |
+
#include "transcode.h"
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
static const char * lxdles = NULL;
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
int
|
| 28 |
+
_lx_getaddrinfo(const char * node, const char * service,
|
| 29 |
+
const struct addrinfo * hints, struct addrinfo * * res)
|
| 30 |
+
|
| 31 |
+
{
|
| 32 |
+
xmlDictPtr d = NULL;
|
| 33 |
+
int i;
|
| 34 |
+
|
| 35 |
+
i = getaddrinfo(xmlTranscodeResult(node, NULL, &d, NULL),
|
| 36 |
+
xmlTranscodeResult(service, NULL, &d, NULL), hints, res);
|
| 37 |
+
xmlZapDict(&d);
|
| 38 |
+
return i;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
const char *
|
| 43 |
+
_lx_inet_ntop(int af, const void * src, char * dst, socklen_t size)
|
| 44 |
+
|
| 45 |
+
{
|
| 46 |
+
const char * cp1 = inet_ntop(af, src, dst, size);
|
| 47 |
+
char const * cp2;
|
| 48 |
+
int i;
|
| 49 |
+
|
| 50 |
+
if (!cp1)
|
| 51 |
+
return cp1;
|
| 52 |
+
|
| 53 |
+
if (!(cp2 = xmlTranscodeString(cp1, NULL, NULL)))
|
| 54 |
+
return cp2;
|
| 55 |
+
|
| 56 |
+
i = strlen(cp2);
|
| 57 |
+
|
| 58 |
+
if (i >= size) {
|
| 59 |
+
xmlFree((char *) cp2);
|
| 60 |
+
errno = ENOSPC;
|
| 61 |
+
return (const char *) NULL;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
memcpy(dst, cp2, i + 1);
|
| 65 |
+
xmlFree((char *) cp2);
|
| 66 |
+
return dst;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
void *
|
| 71 |
+
_lx_dlopen(const char * filename, int flag)
|
| 72 |
+
|
| 73 |
+
{
|
| 74 |
+
xmlDictPtr d = NULL;
|
| 75 |
+
void * result;
|
| 76 |
+
|
| 77 |
+
result = dlopen(xmlTranscodeResult(filename, NULL, &d, NULL), flag);
|
| 78 |
+
xmlZapDict(&d);
|
| 79 |
+
return result;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
void *
|
| 84 |
+
_lx_dlsym(void * handle, const char * symbol)
|
| 85 |
+
|
| 86 |
+
{
|
| 87 |
+
xmlDictPtr d = NULL;
|
| 88 |
+
void * result;
|
| 89 |
+
|
| 90 |
+
result = dlsym(handle, xmlTranscodeResult(symbol, NULL, &d, NULL));
|
| 91 |
+
xmlZapDict(&d);
|
| 92 |
+
return result;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
char *
|
| 97 |
+
_lx_dlerror(void)
|
| 98 |
+
|
| 99 |
+
{
|
| 100 |
+
char * cp1 = (char *) dlerror();
|
| 101 |
+
|
| 102 |
+
if (!cp1)
|
| 103 |
+
return cp1;
|
| 104 |
+
|
| 105 |
+
if (lxdles)
|
| 106 |
+
xmlFree((char *) lxdles);
|
| 107 |
+
|
| 108 |
+
lxdles = (const char *) xmlTranscodeString(cp1, NULL, NULL);
|
| 109 |
+
return (char *) lxdles;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
#ifdef LIBXML_ZLIB_ENABLED
|
| 114 |
+
#include <zlib.h>
|
| 115 |
+
|
| 116 |
+
gzFile
|
| 117 |
+
_lx_gzopen(const char * path, const char * mode)
|
| 118 |
+
|
| 119 |
+
{
|
| 120 |
+
xmlDictPtr d = NULL;
|
| 121 |
+
gzFile f;
|
| 122 |
+
|
| 123 |
+
f = gzopen(xmlTranscodeResult(path, NULL, &d, NULL),
|
| 124 |
+
xmlTranscodeResult(mode, NULL, &d, NULL));
|
| 125 |
+
xmlZapDict(&d);
|
| 126 |
+
return f;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
gzFile
|
| 131 |
+
_lx_gzdopen(int fd, const char * mode)
|
| 132 |
+
|
| 133 |
+
{
|
| 134 |
+
xmlDictPtr d = NULL;
|
| 135 |
+
gzFile f;
|
| 136 |
+
|
| 137 |
+
f = gzdopen(fd, xmlTranscodeResult(mode, NULL, &d, NULL));
|
| 138 |
+
xmlZapDict(&d);
|
| 139 |
+
return f;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
int
|
| 143 |
+
_lx_inflateInit2_(z_streamp strm, int windowBits,
|
| 144 |
+
const char * version, int stream_size)
|
| 145 |
+
|
| 146 |
+
{
|
| 147 |
+
xmlDictPtr d = NULL;
|
| 148 |
+
int r;
|
| 149 |
+
|
| 150 |
+
r = inflateInit2_(strm, windowBits,
|
| 151 |
+
xmlTranscodeResult(version, NULL, &d, NULL), stream_size);
|
| 152 |
+
xmlZapDict(&d);
|
| 153 |
+
return r;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
int
|
| 157 |
+
_lx_deflateInit2_(z_streamp strm, int level, int method, int windowBits,
|
| 158 |
+
int memLevel, int strategy, const char * version, int stream_size)
|
| 159 |
+
|
| 160 |
+
{
|
| 161 |
+
xmlDictPtr d = NULL;
|
| 162 |
+
int r;
|
| 163 |
+
|
| 164 |
+
r = deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
| 165 |
+
xmlTranscodeResult(version, NULL, &d, NULL), stream_size);
|
| 166 |
+
xmlZapDict(&d);
|
| 167 |
+
return r;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/os400/wrappers.h
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** Replace system/C library calls by EBCDIC wrappers.
|
| 3 |
+
*** This is a layer inserted between libxml2 itself and the EBCDIC
|
| 4 |
+
*** environment.
|
| 5 |
+
***
|
| 6 |
+
*** See Copyright for the status of this software.
|
| 7 |
+
***
|
| 8 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 9 |
+
**/
|
| 10 |
+
|
| 11 |
+
#ifndef __WRAPPERS_H_
|
| 12 |
+
#define __WRAPPERS_H_
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
*** OS/400 specific defines.
|
| 16 |
+
**/
|
| 17 |
+
|
| 18 |
+
#define __cplusplus__strings__
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
*** Force header inclusions before renaming procedures to UTF-8 wrappers.
|
| 22 |
+
**/
|
| 23 |
+
|
| 24 |
+
#include <sys/types.h>
|
| 25 |
+
#include <sys/socket.h>
|
| 26 |
+
#include <arpa/inet.h>
|
| 27 |
+
#include <netdb.h>
|
| 28 |
+
|
| 29 |
+
#include "dlfcn.h"
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
*** UTF-8 wrappers prototypes.
|
| 34 |
+
**/
|
| 35 |
+
|
| 36 |
+
extern int _lx_getaddrinfo(const char * node, const char * service,
|
| 37 |
+
const struct addrinfo * hints, struct addrinfo * * res);
|
| 38 |
+
extern const char *
|
| 39 |
+
_lx_inet_ntop(int af,
|
| 40 |
+
const void * src, char * dst, socklen_t size);
|
| 41 |
+
extern void * _lx_dlopen(const char * filename, int flag);
|
| 42 |
+
extern void * _lx_dlsym(void * handle, const char * symbol);
|
| 43 |
+
extern char * _lx_dlerror(void);
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
#ifdef LIBXML_ZLIB_ENABLED
|
| 47 |
+
|
| 48 |
+
#include <zlib.h>
|
| 49 |
+
|
| 50 |
+
extern gzFile _lx_gzopen(const char * path, const char * mode);
|
| 51 |
+
extern gzFile _lx_gzdopen(int fd, const char * mode);
|
| 52 |
+
|
| 53 |
+
#endif
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
*** Rename data/procedures to UTF-8 wrappers.
|
| 58 |
+
**/
|
| 59 |
+
|
| 60 |
+
#define getaddrinfo _lx_getaddrinfo
|
| 61 |
+
#define inet_ntop _lx_inet_ntop
|
| 62 |
+
#define dlopen _lx_dlopen
|
| 63 |
+
#define dlsym _lx_dlsym
|
| 64 |
+
#define dlerror _lx_dlerror
|
| 65 |
+
#define gzopen _lx_gzopen
|
| 66 |
+
#define gzdopen _lx_gzdopen
|
| 67 |
+
#define inflateInit2_ _lx_inflateInit2_
|
| 68 |
+
#define deflateInit2_ _lx_deflateInit2_
|
| 69 |
+
|
| 70 |
+
#endif
|
local-test-libxml2-delta-02/afc-libxml2/os400/xmlcatalog.cmd
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* XMLCATALOG CL command. */
|
| 2 |
+
/* */
|
| 3 |
+
/* See Copyright for the status of this software. */
|
| 4 |
+
/* */
|
| 5 |
+
/* Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A. */
|
| 6 |
+
|
| 7 |
+
/* Interface to program XMLCATLGCL */
|
| 8 |
+
|
| 9 |
+
CMD PROMPT('XML/SGML catalog tool')
|
| 10 |
+
|
| 11 |
+
/* Catalog file path. */
|
| 12 |
+
|
| 13 |
+
PARM KWD(INSTMF) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 14 |
+
CASE(*MIXED) EXPR(*YES) MIN(1) SPCVAL((*NEW '')) +
|
| 15 |
+
CHOICE('Stream file path') +
|
| 16 |
+
PROMPT('XML/SGML catalog file')
|
| 17 |
+
|
| 18 |
+
/* Catalog kind: XML/SGML. */
|
| 19 |
+
|
| 20 |
+
PARM KWD(KIND) TYPE(*CHAR) LEN(7) VARY(*YES *INT2) +
|
| 21 |
+
EXPR(*YES) RSTD(*YES) DFT(*XML) +
|
| 22 |
+
SPCVAL((*XML '') (*SGML '--sgml')) +
|
| 23 |
+
PROMPT('Catalog kind')
|
| 24 |
+
|
| 25 |
+
/* Output file. */
|
| 26 |
+
|
| 27 |
+
PARM KWD(OUTSTMF) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 28 |
+
CASE(*MIXED) EXPR(*YES) DFT(*STDOUT) +
|
| 29 |
+
SPCVAL((*STDOUT '') (*INSTMF X'00')) +
|
| 30 |
+
CHOICE('*STDOUT, *INSTMF or file path') +
|
| 31 |
+
PROMPT('Output stream file path')
|
| 32 |
+
|
| 33 |
+
/* Convert SGML to XML catalog. */
|
| 34 |
+
|
| 35 |
+
PARM KWD(CONVERT) TYPE(*CHAR) LEN(10) VARY(*YES *INT2) +
|
| 36 |
+
RSTD(*YES) SPCVAL((*YES '--convert') (*NO '')) +
|
| 37 |
+
EXPR(*YES) DFT(*NO) PMTCTL(TYPEXML) +
|
| 38 |
+
PROMPT('Convert SGML to XML catalog')
|
| 39 |
+
|
| 40 |
+
/* SGML super catalog update. */
|
| 41 |
+
|
| 42 |
+
PARM KWD(SUPERUPD) TYPE(*CHAR) LEN(17) VARY(*YES *INT2) +
|
| 43 |
+
SPCVAL((*YES '') (*NO '--no-super-update')) +
|
| 44 |
+
EXPR(*YES) DFT(*YES) RSTD(*YES) PMTCTL(TYPESGML) +
|
| 45 |
+
PROMPT('Update the SGML super catalog')
|
| 46 |
+
|
| 47 |
+
/* Verbose/debug output. */
|
| 48 |
+
|
| 49 |
+
PARM KWD(VERBOSE) TYPE(*CHAR) LEN(4) VARY(*YES *INT2) +
|
| 50 |
+
RSTD(*YES) SPCVAL((*YES '-v') (*NO '')) +
|
| 51 |
+
EXPR(*YES) DFT(*NO) +
|
| 52 |
+
PROMPT('Output debugging information')
|
| 53 |
+
|
| 54 |
+
/* Interactive shell not supported. */
|
| 55 |
+
|
| 56 |
+
/* Values to delete. */
|
| 57 |
+
|
| 58 |
+
PARM KWD(DELETE) TYPE(*PNAME) LEN(256) VARY(*YES *INT2) +
|
| 59 |
+
CASE(*MIXED) MAX(64) EXPR(*YES) +
|
| 60 |
+
CHOICE('Identifier value') +
|
| 61 |
+
PROMPT('Delete System/URI identifier')
|
| 62 |
+
|
| 63 |
+
/* Values to add. */
|
| 64 |
+
|
| 65 |
+
PARM KWD(ADD) TYPE(XMLELEM) MAX(10) PMTCTL(TYPEXML) +
|
| 66 |
+
PROMPT('Add definition')
|
| 67 |
+
XMLELEM: ELEM TYPE(*CHAR) LEN(16) VARY(*YES *INT2) DFT(*PUBLIC) +
|
| 68 |
+
PROMPT('Entry type') +
|
| 69 |
+
EXPR(*YES) RSTD(*YES) SPCVAL( +
|
| 70 |
+
(*PUBLIC 'public') +
|
| 71 |
+
(*SYSTEM 'system') +
|
| 72 |
+
(*URI 'uri') +
|
| 73 |
+
(*REWRITESYSTEM 'rewriteSystem') +
|
| 74 |
+
(*REWRITEURI 'rewriteURI') +
|
| 75 |
+
(*DELEGATEPUBLIC 'delegatePublic') +
|
| 76 |
+
(*DELEGATESYSTEM 'delegateSystem') +
|
| 77 |
+
(*DELEGATEURI 'delegateURI') +
|
| 78 |
+
(*NEXTCATALOG 'nextCatalog') +
|
| 79 |
+
)
|
| 80 |
+
ELEM TYPE(*PNAME) LEN(256) VARY(*YES *INT2) EXPR(*YES) +
|
| 81 |
+
CASE(*MIXED) PROMPT('Original reference/file name')
|
| 82 |
+
ELEM TYPE(*PNAME) LEN(256) VARY(*YES *INT2) EXPR(*YES) +
|
| 83 |
+
CASE(*MIXED) PROMPT('Replacement entity URI')
|
| 84 |
+
|
| 85 |
+
PARM KWD(SGMLADD) TYPE(SGMLELEM) MAX(10) +
|
| 86 |
+
PMTCTL(TYPESGML) PROMPT('Add SGML definition')
|
| 87 |
+
SGMLELEM: ELEM TYPE(*PNAME) LEN(256) VARY(*YES *INT2) EXPR(*YES) +
|
| 88 |
+
CASE(*MIXED) PROMPT('SGML catalog file name')
|
| 89 |
+
ELEM TYPE(*PNAME) LEN(256) VARY(*YES *INT2) EXPR(*YES) +
|
| 90 |
+
CASE(*MIXED) PROMPT('SGML definition')
|
| 91 |
+
|
| 92 |
+
/* Entities to resolve. */
|
| 93 |
+
|
| 94 |
+
PARM KWD(ENTITY) TYPE(*PNAME) LEN(256) VARY(*YES *INT2) +
|
| 95 |
+
CASE(*MIXED) EXPR(*YES) MAX(150) +
|
| 96 |
+
PROMPT('Resolve entity')
|
| 97 |
+
|
| 98 |
+
/* Additional catalog files. */
|
| 99 |
+
|
| 100 |
+
PARM KWD(CATALOG) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 101 |
+
CASE(*MIXED) EXPR(*YES) MAX(150) DFT(*DEFAULT) +
|
| 102 |
+
CHOICE('Catalog stream file path') +
|
| 103 |
+
PROMPT('Additional catalog file') SPCVAL( +
|
| 104 |
+
(*DEFAULT '/etc/xml/catalog') +
|
| 105 |
+
(*NONE '') +
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
/* Conditional prompting. */
|
| 110 |
+
|
| 111 |
+
TYPEXML: PMTCTL CTL(KIND) COND((*EQ ''))
|
| 112 |
+
TYPESGML: PMTCTL CTL(KIND) COND((*NE ''))
|
local-test-libxml2-delta-02/afc-libxml2/os400/xmlcatlgcl.c
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 1 |
+
/**
|
| 2 |
+
*** XMLCATALOG command response program.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
#include <stdio.h>
|
| 10 |
+
#include <stdlib.h>
|
| 11 |
+
#include <string.h>
|
| 12 |
+
#include <qshell.h>
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
/* Variable-length string, with 16-bit length. */
|
| 16 |
+
typedef struct {
|
| 17 |
+
short len;
|
| 18 |
+
char string[5000];
|
| 19 |
+
} vary2;
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
/* Variable-length string, with 32-bit length. */
|
| 23 |
+
typedef struct {
|
| 24 |
+
int len;
|
| 25 |
+
char string[5000];
|
| 26 |
+
} vary4;
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
/* Multiple occurrence parameter list. */
|
| 30 |
+
#define paramlist(itemsize, itemtype) \
|
| 31 |
+
_Packed struct { \
|
| 32 |
+
short len; \
|
| 33 |
+
_Packed union { \
|
| 34 |
+
char _pad[itemsize]; \
|
| 35 |
+
itemtype param; \
|
| 36 |
+
} item[1]; \
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/* Add element list structure. */
|
| 40 |
+
typedef struct {
|
| 41 |
+
short elcount; /* Element count (=3). */
|
| 42 |
+
paramlist(16, char) type; /* vary2(16). */
|
| 43 |
+
paramlist(256, char) origin; /* vary2(256). */
|
| 44 |
+
paramlist(256, char) replace; /* vary2(256). */
|
| 45 |
+
} addelement;
|
| 46 |
+
|
| 47 |
+
/* SGML add element list structure. */
|
| 48 |
+
typedef struct {
|
| 49 |
+
short elcount; /* Element count (=3). */
|
| 50 |
+
paramlist(256, char) catalog; /* vary2(256). */
|
| 51 |
+
paramlist(256, char) ident; /* vary2(256). */
|
| 52 |
+
} sgmladdelement;
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
/* Arguments from CL command. */
|
| 56 |
+
typedef struct {
|
| 57 |
+
char * pgm; /* Program name. */
|
| 58 |
+
vary2 * instmf; /* Input catalog file name. */
|
| 59 |
+
vary2 * kind; /* Catalog kind. */
|
| 60 |
+
vary2 * outstmf; /* Output catalog file name. */
|
| 61 |
+
vary2 * convert; /* Convert SGML to XML. */
|
| 62 |
+
vary2 * superupd; /* --no-super-update. */
|
| 63 |
+
vary2 * verbose; /* Verbose output. */
|
| 64 |
+
paramlist(256 + 2, vary2) * delete; /* Identifiers to delete. */
|
| 65 |
+
paramlist(2, unsigned short) * add; /* Items to add. */
|
| 66 |
+
paramlist(2, unsigned short) * sgmladd; /* SGML items to add. */
|
| 67 |
+
paramlist(256 + 2, vary2) * resolve; /* Identifiers to resolve. */
|
| 68 |
+
paramlist(5000 + 2, vary2) * catalog; /* Additional catalog files. */
|
| 69 |
+
} arguments;
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
/* Definition of QSHELL program. */
|
| 73 |
+
extern void qshell(vary4 * cmd);
|
| 74 |
+
#pragma linkage(qshell, OS)
|
| 75 |
+
#pragma map(qshell, "QSHELL/QZSHQSHC")
|
| 76 |
+
|
| 77 |
+
/* Macro to handle displacements. */
|
| 78 |
+
#define OFFSETBY(t, p, n) ((t *) (((char *) (p)) + (n)))
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
static void
|
| 82 |
+
vary4nappend(vary4 * dst, const char * src, size_t len)
|
| 83 |
+
|
| 84 |
+
{
|
| 85 |
+
if (len > sizeof(dst->string) - dst->len)
|
| 86 |
+
len = sizeof(dst->string) - dst->len;
|
| 87 |
+
|
| 88 |
+
if (len) {
|
| 89 |
+
memcpy(dst->string + dst->len, src, len);
|
| 90 |
+
dst->len += len;
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
static void
|
| 96 |
+
vary4append(vary4 * dst, const char * src)
|
| 97 |
+
|
| 98 |
+
{
|
| 99 |
+
vary4nappend(dst, src, strlen(src));
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
static void
|
| 104 |
+
vary4arg(vary4 * dst, const char * arg)
|
| 105 |
+
|
| 106 |
+
{
|
| 107 |
+
vary4nappend(dst, " ", 1);
|
| 108 |
+
vary4append(dst, arg);
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
static void
|
| 113 |
+
vary4varg(vary4 * dst, vary2 * arg)
|
| 114 |
+
|
| 115 |
+
{
|
| 116 |
+
vary4nappend(dst, " ", 1);
|
| 117 |
+
vary4nappend(dst, arg->string, arg->len);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
static void
|
| 122 |
+
vary4vescape(vary4 * dst, vary2 * arg)
|
| 123 |
+
|
| 124 |
+
{
|
| 125 |
+
int i;
|
| 126 |
+
|
| 127 |
+
for (i = 0; i < arg->len; i++)
|
| 128 |
+
if (arg->string[i] == '\'')
|
| 129 |
+
vary4nappend(dst, "'\"'\"'", 5);
|
| 130 |
+
else
|
| 131 |
+
vary4nappend(dst, arg->string + i, 1);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
static void
|
| 136 |
+
vary4vargquote(vary4 * dst, vary2 * arg)
|
| 137 |
+
|
| 138 |
+
{
|
| 139 |
+
vary4nappend(dst, " '", 2);
|
| 140 |
+
vary4vescape(dst, arg);
|
| 141 |
+
vary4nappend(dst, "'", 1);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
int
|
| 146 |
+
main(int argsc, arguments * args)
|
| 147 |
+
|
| 148 |
+
{
|
| 149 |
+
vary4 cmd;
|
| 150 |
+
int i;
|
| 151 |
+
char c;
|
| 152 |
+
addelement * aelp;
|
| 153 |
+
sgmladdelement * saelp;
|
| 154 |
+
|
| 155 |
+
/* Specify additional catalogs. */
|
| 156 |
+
cmd.len = 0;
|
| 157 |
+
if (args->catalog->len) {
|
| 158 |
+
for (i = 0; i < args->catalog->len &&
|
| 159 |
+
!args->catalog->item[i].param.len; i++)
|
| 160 |
+
;
|
| 161 |
+
|
| 162 |
+
vary4append(&cmd, "XML_CATALOG_FILES=");
|
| 163 |
+
if (i < args->catalog->len) {
|
| 164 |
+
c = '\'';
|
| 165 |
+
for (i = 0; i < args->catalog->len; i++) {
|
| 166 |
+
if (!args->catalog->item[i].param.len)
|
| 167 |
+
continue;
|
| 168 |
+
vary4nappend(&cmd, &c, 1);
|
| 169 |
+
c = ' ';
|
| 170 |
+
vary4vescape(&cmd,
|
| 171 |
+
&args->catalog->item[i].param);
|
| 172 |
+
}
|
| 173 |
+
vary4nappend(&cmd, "'", 1);
|
| 174 |
+
}
|
| 175 |
+
vary4nappend(&cmd, " ", 1);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
/* find length of library name. */
|
| 179 |
+
for (i = 0; i < 10 && args->pgm[i] && args->pgm[i] != '/'; i++)
|
| 180 |
+
;
|
| 181 |
+
|
| 182 |
+
/* Store program name in command buffer. */
|
| 183 |
+
vary4append(&cmd, "/QSYS.LIB/");
|
| 184 |
+
vary4nappend(&cmd, args->pgm, i);
|
| 185 |
+
vary4append(&cmd, ".LIB/XMLCATALOG.PGM");
|
| 186 |
+
|
| 187 |
+
/* Map command arguments to standard xmlcatalog argument vector. */
|
| 188 |
+
if (args->kind && args->kind->len)
|
| 189 |
+
vary4varg(&cmd, args->kind);
|
| 190 |
+
|
| 191 |
+
if (args->verbose && args->verbose->len)
|
| 192 |
+
vary4varg(&cmd, args->verbose);
|
| 193 |
+
|
| 194 |
+
if (args->delete)
|
| 195 |
+
for (i = 0; i < args->delete->len; i++) {
|
| 196 |
+
vary4arg(&cmd, "--del");
|
| 197 |
+
vary4vargquote(&cmd, &args->delete->item[i].param);
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
if (args->kind && args->kind->len) {
|
| 201 |
+
/* Process SGML-specific parameters. */
|
| 202 |
+
if (args->superupd && args->superupd->len)
|
| 203 |
+
vary4varg(&cmd, args->superupd);
|
| 204 |
+
|
| 205 |
+
if (args->sgmladd)
|
| 206 |
+
for (i = 0; i < args->sgmladd->len; i++) {
|
| 207 |
+
saelp = OFFSETBY(sgmladdelement, args->sgmladd,
|
| 208 |
+
args->sgmladd->item[i].param);
|
| 209 |
+
if (!((vary2 *) &saelp->catalog)->len)
|
| 210 |
+
continue;
|
| 211 |
+
vary4arg(&cmd, "--add");
|
| 212 |
+
vary4vargquote(&cmd, (vary2 *) &saelp->catalog);
|
| 213 |
+
vary4vargquote(&cmd, (vary2 *) &saelp->ident);
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
else {
|
| 217 |
+
/* Process XML-specific parameters. */
|
| 218 |
+
if (args->convert && args->convert->len)
|
| 219 |
+
vary4varg(&cmd, args->convert);
|
| 220 |
+
|
| 221 |
+
if (args->add)
|
| 222 |
+
for (i = 0; i < args->add->len; i++) {
|
| 223 |
+
aelp = OFFSETBY(addelement, args->add,
|
| 224 |
+
args->add->item[i].param);
|
| 225 |
+
if (!((vary2 *) &aelp->origin)->len)
|
| 226 |
+
continue;
|
| 227 |
+
vary4arg(&cmd, "--add");
|
| 228 |
+
vary4varg(&cmd, (vary2 *) &aelp->type);
|
| 229 |
+
vary4vargquote(&cmd, (vary2 *) &aelp->origin);
|
| 230 |
+
vary4vargquote(&cmd, (vary2 *) &aelp->replace);
|
| 231 |
+
}
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
/* Avoid INSTMF(*NEW) and OUTSMTF(*INSTMF). */
|
| 235 |
+
if (args->outstmf && args->outstmf->len && !args->outstmf->string[0])
|
| 236 |
+
if (args->instmf && args->instmf->len)
|
| 237 |
+
args->outstmf = args->instmf;
|
| 238 |
+
else
|
| 239 |
+
args->outstmf = NULL;
|
| 240 |
+
|
| 241 |
+
/* If INSTMF(*NEW) and OUTSTMF(somepath), Use --create --noout and
|
| 242 |
+
somepath as (unexisting) input file. */
|
| 243 |
+
if (args->outstmf && args->outstmf->len)
|
| 244 |
+
if (!args->instmf || !args->instmf->len) {
|
| 245 |
+
vary4arg(&cmd, "--create");
|
| 246 |
+
vary4arg(&cmd, "--noout");
|
| 247 |
+
args->instmf = args->outstmf;
|
| 248 |
+
args->outstmf = NULL;
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/* If output to input file, use --noout option. */
|
| 252 |
+
if (args->instmf && args->outstmf && args->instmf->len &&
|
| 253 |
+
args->instmf->len == args->outstmf->len &&
|
| 254 |
+
!strncmp(args->instmf->string, args->outstmf->string,
|
| 255 |
+
args->instmf->len)) {
|
| 256 |
+
vary4arg(&cmd, "--noout");
|
| 257 |
+
args->outstmf = NULL;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/* If no input file create catalog, else specify the input file name. */
|
| 261 |
+
/* Specify the input file name: my be a dummy one. */
|
| 262 |
+
if (!args->instmf || !args->instmf->len) {
|
| 263 |
+
vary4arg(&cmd, "--create -");
|
| 264 |
+
vary4arg(&cmd, ".dmyxmlcatalog");
|
| 265 |
+
}
|
| 266 |
+
else {
|
| 267 |
+
vary4arg(&cmd, "-");
|
| 268 |
+
vary4vargquote(&cmd, args->instmf);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
/* Query entities. */
|
| 272 |
+
|
| 273 |
+
if (args->resolve)
|
| 274 |
+
for (i = 0; i < args->resolve->len; i++)
|
| 275 |
+
vary4vargquote(&cmd, &args->resolve->item[i].param);
|
| 276 |
+
|
| 277 |
+
/* Redirect output if requested. */
|
| 278 |
+
if (args->outstmf && args->outstmf->len) {
|
| 279 |
+
vary4arg(&cmd, ">");
|
| 280 |
+
vary4vargquote(&cmd, args->outstmf);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
/* Execute the shell command. */
|
| 284 |
+
qshell(&cmd);
|
| 285 |
+
|
| 286 |
+
/* Terminate. */
|
| 287 |
+
exit(0);
|
| 288 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/os400/xmllint.cmd
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HERE S.A. */
|
| 6 |
+
|
| 7 |
+
/* Interface to program XMLLINTCL */
|
| 8 |
+
|
| 9 |
+
CMD PROMPT('XML tool')
|
| 10 |
+
|
| 11 |
+
/* XML input file location. */
|
| 12 |
+
|
| 13 |
+
PARM KWD(STMF) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 14 |
+
CASE(*MIXED) EXPR(*YES) MIN(1) +
|
| 15 |
+
CHOICE('Stream file path') +
|
| 16 |
+
PROMPT('XML Stream file')
|
| 17 |
+
|
| 18 |
+
/* DTD location. */
|
| 19 |
+
|
| 20 |
+
PARM KWD(DTD) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 21 |
+
CASE(*MIXED) EXPR(*YES) PASSVAL(*NULL) +
|
| 22 |
+
CHOICE('ID, URL or stream file path') +
|
| 23 |
+
PROMPT('DTD id, URL or file path')
|
| 24 |
+
|
| 25 |
+
PARM KWD(DTDLOCATOR) TYPE(*CHAR) LEN(8) DFT(*DTDURL) +
|
| 26 |
+
SPCVAL(*DTDURL *DTDFPI) EXPR(*YES) RSTD(*YES) +
|
| 27 |
+
PROMPT('DTD locator is URL/FPI')
|
| 28 |
+
|
| 29 |
+
/* Schema location. */
|
| 30 |
+
|
| 31 |
+
PARM KWD(SCHEMA) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 32 |
+
CASE(*MIXED) EXPR(*YES) PASSVAL(*NULL) +
|
| 33 |
+
CHOICE('URL or stream file path') +
|
| 34 |
+
PROMPT('Schema URL or stream file path')
|
| 35 |
+
|
| 36 |
+
PARM KWD(SCHEMAKIND) TYPE(*CHAR) LEN(12) VARY(*YES *INT2) +
|
| 37 |
+
RSTD(*YES) DFT(*XSD) +
|
| 38 |
+
PROMPT('Validating schema kind') +
|
| 39 |
+
CHOICE('Keyword') SPCVAL( +
|
| 40 |
+
(*XSD '--schema') +
|
| 41 |
+
(*RELAXNG '--relaxng') +
|
| 42 |
+
(*SCHEMATRON '--schematron') +
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
/* Output location. */
|
| 46 |
+
|
| 47 |
+
PARM KWD(OUTSTMF) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 48 |
+
CASE(*MIXED) EXPR(*YES) PASSVAL(*NULL) +
|
| 49 |
+
CHOICE('Stream file path') +
|
| 50 |
+
PROMPT('Output stream file path')
|
| 51 |
+
|
| 52 |
+
/* Other parameters with arguments. */
|
| 53 |
+
|
| 54 |
+
PARM KWD(XPATH) TYPE(*CHAR) LEN(5000) VARY(*YES *INT2) +
|
| 55 |
+
CASE(*MIXED) EXPR(*YES) PASSVAL(*NULL) +
|
| 56 |
+
CHOICE('XPath expression') +
|
| 57 |
+
PROMPT('XPath filter')
|
| 58 |
+
|
| 59 |
+
PARM KWD(PATTERN) TYPE(*CHAR) LEN(5000) VARY(*YES *INT2) +
|
| 60 |
+
CASE(*MIXED) EXPR(*YES) PASSVAL(*NULL) +
|
| 61 |
+
CHOICE('Reader pattern') +
|
| 62 |
+
PROMPT('Reader node filter')
|
| 63 |
+
|
| 64 |
+
/* Paths for resources. */
|
| 65 |
+
|
| 66 |
+
PARM KWD(PATH) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
|
| 67 |
+
CASE(*MIXED) EXPR(*YES) MAX(64) +
|
| 68 |
+
CHOICE('IFS directory path') +
|
| 69 |
+
PROMPT('Path for resources')
|
| 70 |
+
|
| 71 |
+
PARM KWD(PRETTY) TYPE(*CHAR) LEN(11) VARY(*YES *INT2) +
|
| 72 |
+
RSTD(*YES) DFT(*NONE) +
|
| 73 |
+
PROMPT('Pretty-print style') +
|
| 74 |
+
CHOICE('Keyword') SPCVAL( +
|
| 75 |
+
(*NONE '0') +
|
| 76 |
+
(*FORMAT '1') +
|
| 77 |
+
(*WHITESPACE '2') +
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
PARM KWD(MAXMEM) TYPE(*UINT4) EXPR(*YES) DFT(0) +
|
| 81 |
+
CHOICE('Number of bytes') +
|
| 82 |
+
PROMPT('Maximum dynamic memory')
|
| 83 |
+
|
| 84 |
+
PARM KWD(ENCODING) TYPE(*CHAR) LEN(32) VARY(*YES *INT2) +
|
| 85 |
+
CASE(*MIXED) EXPR(*YES) PASSVAL(*NULL) +
|
| 86 |
+
PMTCTL(ENCODING) CHOICE('Encoding name') +
|
| 87 |
+
PROMPT('Output character encoding')
|
| 88 |
+
ENCODING: PMTCTL CTL(OUTSTMF) COND(*SPCFD)
|
| 89 |
+
|
| 90 |
+
/* Boolean options. */
|
| 91 |
+
/* --shell is not supported from command mode. */
|
| 92 |
+
|
| 93 |
+
PARM KWD(OPTIONS) TYPE(*CHAR) LEN(20) VARY(*YES *INT2) +
|
| 94 |
+
MAX(50) RSTD(*YES) PROMPT('Options') +
|
| 95 |
+
CHOICE('Keyword') SPCVAL( +
|
| 96 |
+
(*VERSION '--version') +
|
| 97 |
+
(*DEBUG '--debug') +
|
| 98 |
+
(*DEBUGENT '--debugent') +
|
| 99 |
+
(*COPY '--copy') +
|
| 100 |
+
(*RECOVER '--recover') +
|
| 101 |
+
(*HUGE '--huge') +
|
| 102 |
+
(*NOENT '--noent') +
|
| 103 |
+
(*NOENC '--noenc') +
|
| 104 |
+
(*NOOUT '--noout') +
|
| 105 |
+
(*LOADTRACE '--load-trace') +
|
| 106 |
+
(*NONET '--nonet') +
|
| 107 |
+
(*NOCOMPACT '--nocompact') +
|
| 108 |
+
(*HTMLOUT '--htmlout') +
|
| 109 |
+
(*NOWRAP '--nowrap') +
|
| 110 |
+
(*VALID '--valid') +
|
| 111 |
+
(*POSTVALID '--postvalid') +
|
| 112 |
+
(*TIMING '--timing') +
|
| 113 |
+
(*REPEAT '--repeat') +
|
| 114 |
+
(*INSERT '--insert') +
|
| 115 |
+
(*COMPRESS '--compress') +
|
| 116 |
+
(*HTML '--html') +
|
| 117 |
+
(*XMLOUT '--xmlout') +
|
| 118 |
+
(*NODEFDTD '--nodefdtd') +
|
| 119 |
+
(*PUSH '--push') +
|
| 120 |
+
(*PUSHSMALL '--pushsmall') +
|
| 121 |
+
(*MEMORY '--memory') +
|
| 122 |
+
(*NOWARNING '--nowarning') +
|
| 123 |
+
(*NOBLANKS '--noblanks') +
|
| 124 |
+
(*NOCDATA '--nocdata') +
|
| 125 |
+
(*FORMAT '--format') +
|
| 126 |
+
(*DROPDTD '--dropdtd') +
|
| 127 |
+
(*NSCLEAN '--nsclean') +
|
| 128 |
+
(*TESTIO '--testIO') +
|
| 129 |
+
(*CATALOGS '--catalogs') +
|
| 130 |
+
(*NOCATALOGS '--nocatalogs') +
|
| 131 |
+
(*AUTO '--auto') +
|
| 132 |
+
(*XINCLUDE '--xinclude') +
|
| 133 |
+
(*NOXINCLUDENODE '--noxincludenode') +
|
| 134 |
+
(*NOFIXUPBASEURIS '--nofixup-base-uris') +
|
| 135 |
+
(*LOADDTD '--loaddtd') +
|
| 136 |
+
(*DTDATTR '--dtdattr') +
|
| 137 |
+
(*STREAM '--stream') +
|
| 138 |
+
(*WALKER '--walker') +
|
| 139 |
+
(*CHKREGISTER '--chkregister') +
|
| 140 |
+
(*C14N '--c14n') +
|
| 141 |
+
(*C14N11 '--c14n11') +
|
| 142 |
+
(*EXCC14N '--exc-c14n') +
|
| 143 |
+
(*SAX1 '--sax1') +
|
| 144 |
+
(*SAX '--sax') +
|
| 145 |
+
(*OLDXML10 '--oldxml10') +
|
| 146 |
+
)
|
local-test-libxml2-delta-02/afc-libxml2/os400/xmllintcl.c
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*** XMLLINT command response program.
|
| 3 |
+
***
|
| 4 |
+
*** See Copyright for the status of this software.
|
| 5 |
+
***
|
| 6 |
+
*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
|
| 7 |
+
**/
|
| 8 |
+
|
| 9 |
+
#include <stdio.h>
|
| 10 |
+
#include <stdlib.h>
|
| 11 |
+
#include <string.h>
|
| 12 |
+
#include <qshell.h>
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
/* Variable-length string, with 16-bit length. */
|
| 16 |
+
typedef struct {
|
| 17 |
+
short len;
|
| 18 |
+
char string[5000];
|
| 19 |
+
} vary2;
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
/* Variable-length string, with 32-bit length. */
|
| 23 |
+
typedef struct {
|
| 24 |
+
int len;
|
| 25 |
+
char string[5000];
|
| 26 |
+
} vary4;
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
/* Multiple occurrence parameter list. */
|
| 30 |
+
#define paramlist(itemsize, itemtype) \
|
| 31 |
+
_Packed struct { \
|
| 32 |
+
short len; \
|
| 33 |
+
union { \
|
| 34 |
+
char _pad[itemsize]; \
|
| 35 |
+
itemtype param; \
|
| 36 |
+
} item[1]; \
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
/* Arguments from CL command. */
|
| 41 |
+
typedef struct {
|
| 42 |
+
char * pgm; /* Program name. */
|
| 43 |
+
vary2 * stmf; /* XML file name or URL. */
|
| 44 |
+
vary2 * dtd; /* DTD location or public identifier. */
|
| 45 |
+
char * dtdvalid; /* *DTDURL or *DTDFPI. */
|
| 46 |
+
vary2 * schema; /* Schema file name or URL. */
|
| 47 |
+
vary2 * schemakind; /* --schema/--relaxng/--schematron. */
|
| 48 |
+
vary2 * outstmf; /* Output stream file name. */
|
| 49 |
+
vary2 * xpath; /* XPath filter. */
|
| 50 |
+
vary2 * pattern; /* Reader filter pattern. */
|
| 51 |
+
paramlist(5000 + 2, vary2) * path; /* Path for resources. */
|
| 52 |
+
vary2 * pretty; /* Pretty-print style. */
|
| 53 |
+
unsigned long * maxmem; /* Maximum dynamic memory. */
|
| 54 |
+
vary2 * encoding; /* Output encoding. */
|
| 55 |
+
paramlist(20 + 2, vary2) * options; /* Other options. */
|
| 56 |
+
} arguments;
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
/* Definition of QSHELL program. */
|
| 60 |
+
extern void qshell(vary4 * cmd);
|
| 61 |
+
#pragma linkage(qshell, OS)
|
| 62 |
+
#pragma map(qshell, "QSHELL/QZSHQSHC")
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
static void
|
| 66 |
+
vary4nappend(vary4 * dst, const char * src, size_t len)
|
| 67 |
+
|
| 68 |
+
{
|
| 69 |
+
if (len > sizeof(dst->string) - dst->len)
|
| 70 |
+
len = sizeof(dst->string) - dst->len;
|
| 71 |
+
|
| 72 |
+
if (len) {
|
| 73 |
+
memcpy(dst->string + dst->len, src, len);
|
| 74 |
+
dst->len += len;
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
static void
|
| 80 |
+
vary4append(vary4 * dst, const char * src)
|
| 81 |
+
|
| 82 |
+
{
|
| 83 |
+
vary4nappend(dst, src, strlen(src));
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
static void
|
| 88 |
+
vary4arg(vary4 * dst, const char * arg)
|
| 89 |
+
|
| 90 |
+
{
|
| 91 |
+
vary4nappend(dst, " ", 1);
|
| 92 |
+
vary4append(dst, arg);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
static void
|
| 97 |
+
vary4varg(vary4 * dst, vary2 * arg)
|
| 98 |
+
|
| 99 |
+
{
|
| 100 |
+
vary4nappend(dst, " ", 1);
|
| 101 |
+
vary4nappend(dst, arg->string, arg->len);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
static void
|
| 106 |
+
vary4vescape(vary4 * dst, vary2 * arg)
|
| 107 |
+
|
| 108 |
+
{
|
| 109 |
+
int i;
|
| 110 |
+
|
| 111 |
+
for (i = 0; i < arg->len; i++)
|
| 112 |
+
if (arg->string[i] == '\'')
|
| 113 |
+
vary4nappend(dst, "'\"'\"'", 5);
|
| 114 |
+
else
|
| 115 |
+
vary4nappend(dst, arg->string + i, 1);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
static void
|
| 120 |
+
vary4vargquote(vary4 * dst, vary2 * arg)
|
| 121 |
+
|
| 122 |
+
{
|
| 123 |
+
vary4nappend(dst, " '", 2);
|
| 124 |
+
vary4vescape(dst, arg);
|
| 125 |
+
vary4nappend(dst, "'", 1);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
int
|
| 130 |
+
main(int argsc, arguments * args)
|
| 131 |
+
|
| 132 |
+
{
|
| 133 |
+
vary4 cmd;
|
| 134 |
+
int i;
|
| 135 |
+
char textbuf[20];
|
| 136 |
+
char * lang;
|
| 137 |
+
|
| 138 |
+
/* find length of library name. */
|
| 139 |
+
for (i = 0; i < 10 && args->pgm[i] && args->pgm[i] != '/'; i++)
|
| 140 |
+
;
|
| 141 |
+
|
| 142 |
+
/* Store program name in command buffer. */
|
| 143 |
+
cmd.len = 0;
|
| 144 |
+
vary4append(&cmd, "/QSYS.LIB/");
|
| 145 |
+
vary4nappend(&cmd, args->pgm, i);
|
| 146 |
+
vary4append(&cmd, ".LIB/XMLLINT.PGM");
|
| 147 |
+
|
| 148 |
+
/* Map command arguments to standard xmllint argument vector. */
|
| 149 |
+
|
| 150 |
+
if (args->dtd && args->dtd->len) {
|
| 151 |
+
if (args->dtdvalid && args->dtdvalid[4] == 'F')
|
| 152 |
+
vary4arg(&cmd, "--dtdvalidfpi");
|
| 153 |
+
else
|
| 154 |
+
vary4arg(&cmd, "--dtdvalid");
|
| 155 |
+
|
| 156 |
+
vary4vargquote(&cmd, args->dtd);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
if (args->schema && args->schema->len) {
|
| 160 |
+
vary4varg(&cmd, args->schemakind);
|
| 161 |
+
vary4vargquote(&cmd, args->schema);
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
if (args->outstmf && args->outstmf->len) {
|
| 165 |
+
vary4arg(&cmd, "--output");
|
| 166 |
+
vary4vargquote(&cmd, args->outstmf);
|
| 167 |
+
|
| 168 |
+
if (args->encoding && args->encoding->len) {
|
| 169 |
+
vary4arg(&cmd, "--encoding");
|
| 170 |
+
vary4vargquote(&cmd, args->encoding);
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
if (args->xpath && args->xpath->len) {
|
| 175 |
+
vary4arg(&cmd, "--xpath");
|
| 176 |
+
vary4vargquote(&cmd, args->xpath);
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
if (args->pattern && args->pattern->len) {
|
| 180 |
+
vary4arg(&cmd, "--pattern");
|
| 181 |
+
vary4vargquote(&cmd, args->pattern);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
if (args->path && args->path->len) {
|
| 185 |
+
vary4arg(&cmd, "--path '");
|
| 186 |
+
vary4vescape(&cmd, &args->path->item[0].param);
|
| 187 |
+
for (i = 1; i < args->path->len; i++) {
|
| 188 |
+
vary4nappend(&cmd, ":", 1);
|
| 189 |
+
vary4vescape(&cmd, &args->path->item[i].param);
|
| 190 |
+
}
|
| 191 |
+
vary4nappend(&cmd, "'", 1);
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
if (args->pretty && args->pretty->len &&
|
| 195 |
+
args->pretty->string[0] != '0') {
|
| 196 |
+
vary4arg(&cmd, "--pretty");
|
| 197 |
+
vary4varg(&cmd, args->pretty);
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
if (args->maxmem && *args->maxmem) {
|
| 201 |
+
snprintf(textbuf, sizeof textbuf, "%lu", *args->maxmem);
|
| 202 |
+
vary4arg(&cmd, "--maxmem");
|
| 203 |
+
vary4arg(&cmd, textbuf);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
for (i = 0; i < args->options->len; i++)
|
| 207 |
+
vary4varg(&cmd, &args->options->item[i].param);
|
| 208 |
+
|
| 209 |
+
vary4vargquote(&cmd, args->stmf);
|
| 210 |
+
|
| 211 |
+
/* Execute the shell command. */
|
| 212 |
+
qshell(&cmd);
|
| 213 |
+
|
| 214 |
+
/* Terminate. */
|
| 215 |
+
exit(0);
|
| 216 |
+
}
|
local-test-libxml2-delta-02/afc-libxml2/python/.gitignore
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/gen_prog
|
| 2 |
+
/libxml2-export.c
|
| 3 |
+
/libxml2-py.c
|
| 4 |
+
/libxml2-py.h
|
| 5 |
+
/libxml2.py
|
| 6 |
+
/libxml2class.py
|
| 7 |
+
/libxml2class.txt
|
| 8 |
+
/setup.py
|
| 9 |
+
/tests/tmp.xml
|
local-test-libxml2-delta-02/afc-libxml2/python/Makefile.am
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Makefile for libxml2 python library
|
| 2 |
+
|
| 3 |
+
# We use a rule with multiple output files which creates problems with
|
| 4 |
+
# parallel builds.
|
| 5 |
+
.NOTPARALLEL:
|
| 6 |
+
|
| 7 |
+
SUBDIRS = . tests
|
| 8 |
+
|
| 9 |
+
EXTRA_DIST = \
|
| 10 |
+
generator.py \
|
| 11 |
+
libxml.py \
|
| 12 |
+
libxml2-python-api.xml \
|
| 13 |
+
pyproject.toml \
|
| 14 |
+
meson.build
|
| 15 |
+
|
| 16 |
+
if WITH_PYTHON
|
| 17 |
+
AM_CPPFLAGS = \
|
| 18 |
+
-I$(top_builddir)/include \
|
| 19 |
+
-I$(top_srcdir)/include \
|
| 20 |
+
$(PYTHON_CFLAGS)
|
| 21 |
+
|
| 22 |
+
pyexec_LTLIBRARIES = libxml2mod.la
|
| 23 |
+
|
| 24 |
+
libxml2mod_la_SOURCES = libxml.c libxml_wrap.h types.c
|
| 25 |
+
nodist_libxml2mod_la_SOURCES = libxml2-py.h libxml2-py.c
|
| 26 |
+
libxml2mod_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LDFLAGS) -module -avoid-version
|
| 27 |
+
libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(PYTHON_LIBS)
|
| 28 |
+
|
| 29 |
+
BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
|
| 30 |
+
|
| 31 |
+
python_PYTHON = drv_libxml2.py
|
| 32 |
+
nodist_python_PYTHON = libxml2.py
|
| 33 |
+
|
| 34 |
+
API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
|
| 35 |
+
GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
|
| 36 |
+
CLEANFILES = libxml2.py $(GENERATED)
|
| 37 |
+
|
| 38 |
+
all-local: libxml2.py
|
| 39 |
+
|
| 40 |
+
$(GENERATED): $(srcdir)/generator.py $(API_DESC)
|
| 41 |
+
$(PYTHON) $(srcdir)/generator.py $(srcdir)
|
| 42 |
+
|
| 43 |
+
# libxml.c #includes libxml2-export.c
|
| 44 |
+
libxml.$(OBJEXT): libxml2-export.c
|
| 45 |
+
|
| 46 |
+
libxml2.py: $(srcdir)/libxml.py libxml2class.py
|
| 47 |
+
cat $(srcdir)/libxml.py `test -f libxml2class.py || echo $(srcdir)/`libxml2class.py > $@
|
| 48 |
+
|
| 49 |
+
clean-local:
|
| 50 |
+
rm -rf __pycache__ *.pyc
|
| 51 |
+
|
| 52 |
+
endif
|
local-test-libxml2-delta-02/afc-libxml2/python/README
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module libxml2-python
|
| 2 |
+
=====================
|
| 3 |
+
|
| 4 |
+
This is the libxml2 python module, providing access to the
|
| 5 |
+
libxml2 and libxslt (if available) libraries. For general
|
| 6 |
+
informationss on those XML and XSLT libraries check their
|
| 7 |
+
web pages at:
|
| 8 |
+
https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home
|
| 9 |
+
and
|
| 10 |
+
https://gitlab.gnome.org/GNOME/libxslt/-/wikis/home
|
| 11 |
+
|
| 12 |
+
The latest version of the sources for this module and the
|
| 13 |
+
associated libraries can be found at:
|
| 14 |
+
https://gitlab.gnome.org/GNOME/libxml2/-/releases
|
| 15 |
+
|
| 16 |
+
Binaries packages of the libxml2 and libxslt libraries can
|
| 17 |
+
be found either on the FTP site for Linux, from external
|
| 18 |
+
sources linked from the web pages, or as part of your set of
|
| 19 |
+
packages provided with your operating system.
|
| 20 |
+
|
| 21 |
+
NOTE:
|
| 22 |
+
this module distribution is not the primary distribution
|
| 23 |
+
of the libxml2 and libxslt Python binding code, but as
|
| 24 |
+
the Python way of packaging those for non-Linux systems.
|
| 25 |
+
The main sources are the libxml2 and libxslt tar.gz found on
|
| 26 |
+
the site. One side effect is that the official RPM packages for
|
| 27 |
+
those modules are not generated from the libxml2-python
|
| 28 |
+
distributions but as part of the normal RPM packaging of
|
| 29 |
+
those two libraries.
|
| 30 |
+
The RPM packages can be found at:
|
| 31 |
+
http://rpmfind.net/linux/rpm2html/search.php?query=libxml2-python
|
| 32 |
+
http://rpmfind.net/linux/rpm2html/search.php?query=libxslt-python
|
| 33 |
+
|
| 34 |
+
Daniel Veillard
|
local-test-libxml2-delta-02/afc-libxml2/python/drv_libxml2.py
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: iso-8859-1 -*-
|
| 2 |
+
""" A SAX2 driver for libxml2, on top of it's XmlReader API
|
| 3 |
+
|
| 4 |
+
USAGE
|
| 5 |
+
# put this file (drv_libxml2.py) in PYTHONPATH
|
| 6 |
+
import xml.sax
|
| 7 |
+
reader = xml.sax.make_parser(["drv_libxml2"])
|
| 8 |
+
# ...and the rest is standard python sax.
|
| 9 |
+
|
| 10 |
+
CAVEATS
|
| 11 |
+
- Lexical handlers are supported, except for start/endEntity
|
| 12 |
+
(waiting for XmlReader.ResolveEntity) and start/endDTD
|
| 13 |
+
- Error callbacks are not exactly synchronous, they tend
|
| 14 |
+
to be invoked before the corresponding content callback,
|
| 15 |
+
because the underlying reader interface parses
|
| 16 |
+
data by chunks of 512 bytes
|
| 17 |
+
|
| 18 |
+
TODO
|
| 19 |
+
- search for TODO
|
| 20 |
+
- some ErrorHandler events (warning)
|
| 21 |
+
- some ContentHandler events (setDocumentLocator, skippedEntity)
|
| 22 |
+
- EntityResolver (using libxml2.?)
|
| 23 |
+
- DTDHandler (if/when libxml2 exposes such node types)
|
| 24 |
+
- DeclHandler (if/when libxml2 exposes such node types)
|
| 25 |
+
- property_xml_string?
|
| 26 |
+
- feature_string_interning?
|
| 27 |
+
- Incremental parser
|
| 28 |
+
- additional performance tuning:
|
| 29 |
+
- one might cache callbacks to avoid some name lookups
|
| 30 |
+
- one might implement a smarter way to pass attributes to startElement
|
| 31 |
+
(some kind of lazy evaluation?)
|
| 32 |
+
- there might be room for improvement in start/endPrefixMapping
|
| 33 |
+
- other?
|
| 34 |
+
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
__author__ = "St�phane Bidoul <sbi@skynet.be>"
|
| 38 |
+
__version__ = "0.3"
|
| 39 |
+
|
| 40 |
+
import sys
|
| 41 |
+
import codecs
|
| 42 |
+
|
| 43 |
+
if sys.version_info[0] < 3:
|
| 44 |
+
__author__ = codecs.unicode_escape_decode(__author__)[0]
|
| 45 |
+
|
| 46 |
+
StringTypes = (str, unicode)
|
| 47 |
+
# libxml2 returns strings as UTF8
|
| 48 |
+
_decoder = codecs.lookup("utf8")[1]
|
| 49 |
+
def _d(s):
|
| 50 |
+
if s is None:
|
| 51 |
+
return s
|
| 52 |
+
else:
|
| 53 |
+
return _decoder(s)[0]
|
| 54 |
+
else:
|
| 55 |
+
StringTypes = str
|
| 56 |
+
# s is Unicode `str` already
|
| 57 |
+
def _d(s):
|
| 58 |
+
return s
|
| 59 |
+
|
| 60 |
+
from xml.sax._exceptions import *
|
| 61 |
+
from xml.sax import xmlreader, saxutils
|
| 62 |
+
from xml.sax.handler import \
|
| 63 |
+
feature_namespaces, \
|
| 64 |
+
feature_namespace_prefixes, \
|
| 65 |
+
feature_string_interning, \
|
| 66 |
+
feature_validation, \
|
| 67 |
+
feature_external_ges, \
|
| 68 |
+
feature_external_pes, \
|
| 69 |
+
property_lexical_handler, \
|
| 70 |
+
property_declaration_handler, \
|
| 71 |
+
property_dom_node, \
|
| 72 |
+
property_xml_string
|
| 73 |
+
|
| 74 |
+
try:
|
| 75 |
+
import libxml2
|
| 76 |
+
except ImportError:
|
| 77 |
+
raise SAXReaderNotAvailable("libxml2 not available: " \
|
| 78 |
+
"import error was: %s" % sys.exc_info()[1])
|
| 79 |
+
|
| 80 |
+
class Locator(xmlreader.Locator):
|
| 81 |
+
"""SAX Locator adapter for libxml2.xmlTextReaderLocator"""
|
| 82 |
+
|
| 83 |
+
def __init__(self,locator):
|
| 84 |
+
self.__locator = locator
|
| 85 |
+
|
| 86 |
+
def getColumnNumber(self):
|
| 87 |
+
"Return the column number where the current event ends."
|
| 88 |
+
return -1
|
| 89 |
+
|
| 90 |
+
def getLineNumber(self):
|
| 91 |
+
"Return the line number where the current event ends."
|
| 92 |
+
return self.__locator.LineNumber()
|
| 93 |
+
|
| 94 |
+
def getPublicId(self):
|
| 95 |
+
"Return the public identifier for the current event."
|
| 96 |
+
return None
|
| 97 |
+
|
| 98 |
+
def getSystemId(self):
|
| 99 |
+
"Return the system identifier for the current event."
|
| 100 |
+
return self.__locator.BaseURI()
|
| 101 |
+
|
| 102 |
+
class LibXml2Reader(xmlreader.XMLReader):
|
| 103 |
+
|
| 104 |
+
def __init__(self):
|
| 105 |
+
xmlreader.XMLReader.__init__(self)
|
| 106 |
+
# features
|
| 107 |
+
self.__ns = 0
|
| 108 |
+
self.__nspfx = 0
|
| 109 |
+
self.__validate = 0
|
| 110 |
+
self.__extparams = 1
|
| 111 |
+
# parsing flag
|
| 112 |
+
self.__parsing = 0
|
| 113 |
+
# additional handlers
|
| 114 |
+
self.__lex_handler = None
|
| 115 |
+
self.__decl_handler = None
|
| 116 |
+
# error messages accumulator
|
| 117 |
+
self.__errors = None
|
| 118 |
+
|
| 119 |
+
def _errorHandler(self,arg,msg,severity,locator):
|
| 120 |
+
if self.__errors is None:
|
| 121 |
+
self.__errors = []
|
| 122 |
+
self.__errors.append((severity,
|
| 123 |
+
SAXParseException(msg,None,
|
| 124 |
+
Locator(locator))))
|
| 125 |
+
|
| 126 |
+
def _reportErrors(self,fatal):
|
| 127 |
+
for severity,exception in self.__errors:
|
| 128 |
+
if severity in (libxml2.PARSER_SEVERITY_VALIDITY_WARNING,
|
| 129 |
+
libxml2.PARSER_SEVERITY_WARNING):
|
| 130 |
+
self._err_handler.warning(exception)
|
| 131 |
+
else:
|
| 132 |
+
# when fatal is set, the parse will stop;
|
| 133 |
+
# we consider that the last error reported
|
| 134 |
+
# is the fatal one.
|
| 135 |
+
if fatal and exception is self.__errors[-1][1]:
|
| 136 |
+
self._err_handler.fatalError(exception)
|
| 137 |
+
else:
|
| 138 |
+
self._err_handler.error(exception)
|
| 139 |
+
self.__errors = None
|
| 140 |
+
|
| 141 |
+
def parse(self, source):
|
| 142 |
+
self.__parsing = 1
|
| 143 |
+
try:
|
| 144 |
+
# prepare source and create reader
|
| 145 |
+
if isinstance(source, StringTypes):
|
| 146 |
+
reader = libxml2.newTextReaderFilename(source)
|
| 147 |
+
else:
|
| 148 |
+
source = saxutils.prepare_input_source(source)
|
| 149 |
+
stream = source.getCharacterStream()
|
| 150 |
+
if stream is None:
|
| 151 |
+
stream = source.getByteStream()
|
| 152 |
+
input = libxml2.inputBuffer(stream)
|
| 153 |
+
reader = input.newTextReader(source.getSystemId())
|
| 154 |
+
reader.SetErrorHandler(self._errorHandler,None)
|
| 155 |
+
# configure reader
|
| 156 |
+
if self.__extparams:
|
| 157 |
+
reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
|
| 158 |
+
reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
|
| 159 |
+
reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
|
| 160 |
+
reader.SetParserProp(libxml2.PARSER_VALIDATE,self.__validate)
|
| 161 |
+
else:
|
| 162 |
+
reader.SetParserProp(libxml2.PARSER_LOADDTD, 0)
|
| 163 |
+
# we reuse attribute maps (for a slight performance gain)
|
| 164 |
+
if self.__ns:
|
| 165 |
+
attributesNSImpl = xmlreader.AttributesNSImpl({},{})
|
| 166 |
+
else:
|
| 167 |
+
attributesImpl = xmlreader.AttributesImpl({})
|
| 168 |
+
# prefixes to pop (for endPrefixMapping)
|
| 169 |
+
prefixes = []
|
| 170 |
+
# start loop
|
| 171 |
+
self._cont_handler.startDocument()
|
| 172 |
+
while 1:
|
| 173 |
+
r = reader.Read()
|
| 174 |
+
# check for errors
|
| 175 |
+
if r == 1:
|
| 176 |
+
if not self.__errors is None:
|
| 177 |
+
self._reportErrors(0)
|
| 178 |
+
elif r == 0:
|
| 179 |
+
if not self.__errors is None:
|
| 180 |
+
self._reportErrors(0)
|
| 181 |
+
break # end of parse
|
| 182 |
+
else:
|
| 183 |
+
if not self.__errors is None:
|
| 184 |
+
self._reportErrors(1)
|
| 185 |
+
else:
|
| 186 |
+
self._err_handler.fatalError(\
|
| 187 |
+
SAXException("Read failed (no details available)"))
|
| 188 |
+
break # fatal parse error
|
| 189 |
+
# get node type
|
| 190 |
+
nodeType = reader.NodeType()
|
| 191 |
+
# Element
|
| 192 |
+
if nodeType == 1:
|
| 193 |
+
if self.__ns:
|
| 194 |
+
eltName = (_d(reader.NamespaceUri()),\
|
| 195 |
+
_d(reader.LocalName()))
|
| 196 |
+
eltQName = _d(reader.Name())
|
| 197 |
+
attributesNSImpl._attrs = attrs = {}
|
| 198 |
+
attributesNSImpl._qnames = qnames = {}
|
| 199 |
+
newPrefixes = []
|
| 200 |
+
while reader.MoveToNextAttribute():
|
| 201 |
+
qname = _d(reader.Name())
|
| 202 |
+
value = _d(reader.Value())
|
| 203 |
+
if qname.startswith("xmlns"):
|
| 204 |
+
if len(qname) > 5:
|
| 205 |
+
newPrefix = qname[6:]
|
| 206 |
+
else:
|
| 207 |
+
newPrefix = None
|
| 208 |
+
newPrefixes.append(newPrefix)
|
| 209 |
+
self._cont_handler.startPrefixMapping(\
|
| 210 |
+
newPrefix,value)
|
| 211 |
+
if not self.__nspfx:
|
| 212 |
+
continue # don't report xmlns attribute
|
| 213 |
+
attName = (_d(reader.NamespaceUri()),
|
| 214 |
+
_d(reader.LocalName()))
|
| 215 |
+
qnames[attName] = qname
|
| 216 |
+
attrs[attName] = value
|
| 217 |
+
reader.MoveToElement()
|
| 218 |
+
self._cont_handler.startElementNS( \
|
| 219 |
+
eltName,eltQName,attributesNSImpl)
|
| 220 |
+
if reader.IsEmptyElement():
|
| 221 |
+
self._cont_handler.endElementNS(eltName,eltQName)
|
| 222 |
+
for newPrefix in newPrefixes:
|
| 223 |
+
self._cont_handler.endPrefixMapping(newPrefix)
|
| 224 |
+
else:
|
| 225 |
+
prefixes.append(newPrefixes)
|
| 226 |
+
else:
|
| 227 |
+
eltName = _d(reader.Name())
|
| 228 |
+
attributesImpl._attrs = attrs = {}
|
| 229 |
+
while reader.MoveToNextAttribute():
|
| 230 |
+
attName = _d(reader.Name())
|
| 231 |
+
attrs[attName] = _d(reader.Value())
|
| 232 |
+
reader.MoveToElement()
|
| 233 |
+
self._cont_handler.startElement( \
|
| 234 |
+
eltName,attributesImpl)
|
| 235 |
+
if reader.IsEmptyElement():
|
| 236 |
+
self._cont_handler.endElement(eltName)
|
| 237 |
+
# EndElement
|
| 238 |
+
elif nodeType == 15:
|
| 239 |
+
if self.__ns:
|
| 240 |
+
self._cont_handler.endElementNS( \
|
| 241 |
+
(_d(reader.NamespaceUri()),_d(reader.LocalName())),
|
| 242 |
+
_d(reader.Name()))
|
| 243 |
+
for prefix in prefixes.pop():
|
| 244 |
+
self._cont_handler.endPrefixMapping(prefix)
|
| 245 |
+
else:
|
| 246 |
+
self._cont_handler.endElement(_d(reader.Name()))
|
| 247 |
+
# Text
|
| 248 |
+
elif nodeType == 3:
|
| 249 |
+
self._cont_handler.characters(_d(reader.Value()))
|
| 250 |
+
# Whitespace
|
| 251 |
+
elif nodeType == 13:
|
| 252 |
+
self._cont_handler.ignorableWhitespace(_d(reader.Value()))
|
| 253 |
+
# SignificantWhitespace
|
| 254 |
+
elif nodeType == 14:
|
| 255 |
+
self._cont_handler.characters(_d(reader.Value()))
|
| 256 |
+
# CDATA
|
| 257 |
+
elif nodeType == 4:
|
| 258 |
+
if not self.__lex_handler is None:
|
| 259 |
+
self.__lex_handler.startCDATA()
|
| 260 |
+
self._cont_handler.characters(_d(reader.Value()))
|
| 261 |
+
if not self.__lex_handler is None:
|
| 262 |
+
self.__lex_handler.endCDATA()
|
| 263 |
+
# EntityReference
|
| 264 |
+
elif nodeType == 5:
|
| 265 |
+
if not self.__lex_handler is None:
|
| 266 |
+
self.startEntity(_d(reader.Name()))
|
| 267 |
+
reader.ResolveEntity()
|
| 268 |
+
# EndEntity
|
| 269 |
+
elif nodeType == 16:
|
| 270 |
+
if not self.__lex_handler is None:
|
| 271 |
+
self.endEntity(_d(reader.Name()))
|
| 272 |
+
# ProcessingInstruction
|
| 273 |
+
elif nodeType == 7:
|
| 274 |
+
self._cont_handler.processingInstruction( \
|
| 275 |
+
_d(reader.Name()),_d(reader.Value()))
|
| 276 |
+
# Comment
|
| 277 |
+
elif nodeType == 8:
|
| 278 |
+
if not self.__lex_handler is None:
|
| 279 |
+
self.__lex_handler.comment(_d(reader.Value()))
|
| 280 |
+
# DocumentType
|
| 281 |
+
elif nodeType == 10:
|
| 282 |
+
#if not self.__lex_handler is None:
|
| 283 |
+
# self.__lex_handler.startDTD()
|
| 284 |
+
pass # TODO (how to detect endDTD? on first non-dtd event?)
|
| 285 |
+
# XmlDeclaration
|
| 286 |
+
elif nodeType == 17:
|
| 287 |
+
pass # TODO
|
| 288 |
+
# Entity
|
| 289 |
+
elif nodeType == 6:
|
| 290 |
+
pass # TODO (entity decl)
|
| 291 |
+
# Notation (decl)
|
| 292 |
+
elif nodeType == 12:
|
| 293 |
+
pass # TODO
|
| 294 |
+
# Attribute (never in this loop)
|
| 295 |
+
#elif nodeType == 2:
|
| 296 |
+
# pass
|
| 297 |
+
# Document (not exposed)
|
| 298 |
+
#elif nodeType == 9:
|
| 299 |
+
# pass
|
| 300 |
+
# DocumentFragment (never returned by XmlReader)
|
| 301 |
+
#elif nodeType == 11:
|
| 302 |
+
# pass
|
| 303 |
+
# None
|
| 304 |
+
#elif nodeType == 0:
|
| 305 |
+
# pass
|
| 306 |
+
# -
|
| 307 |
+
else:
|
| 308 |
+
raise SAXException("Unexpected node type %d" % nodeType)
|
| 309 |
+
if r == 0:
|
| 310 |
+
self._cont_handler.endDocument()
|
| 311 |
+
reader.Close()
|
| 312 |
+
finally:
|
| 313 |
+
self.__parsing = 0
|
| 314 |
+
|
| 315 |
+
def setDTDHandler(self, handler):
|
| 316 |
+
# TODO (when supported, the inherited method works just fine)
|
| 317 |
+
raise SAXNotSupportedException("DTDHandler not supported")
|
| 318 |
+
|
| 319 |
+
def setEntityResolver(self, resolver):
|
| 320 |
+
# TODO (when supported, the inherited method works just fine)
|
| 321 |
+
raise SAXNotSupportedException("EntityResolver not supported")
|
| 322 |
+
|
| 323 |
+
def getFeature(self, name):
|
| 324 |
+
if name == feature_namespaces:
|
| 325 |
+
return self.__ns
|
| 326 |
+
elif name == feature_namespace_prefixes:
|
| 327 |
+
return self.__nspfx
|
| 328 |
+
elif name == feature_validation:
|
| 329 |
+
return self.__validate
|
| 330 |
+
elif name == feature_external_ges:
|
| 331 |
+
return 1 # TODO (does that relate to PARSER_LOADDTD)?
|
| 332 |
+
elif name == feature_external_pes:
|
| 333 |
+
return self.__extparams
|
| 334 |
+
else:
|
| 335 |
+
raise SAXNotRecognizedException("Feature '%s' not recognized" % \
|
| 336 |
+
name)
|
| 337 |
+
|
| 338 |
+
def setFeature(self, name, state):
|
| 339 |
+
if self.__parsing:
|
| 340 |
+
raise SAXNotSupportedException("Cannot set feature %s " \
|
| 341 |
+
"while parsing" % name)
|
| 342 |
+
if name == feature_namespaces:
|
| 343 |
+
self.__ns = state
|
| 344 |
+
elif name == feature_namespace_prefixes:
|
| 345 |
+
self.__nspfx = state
|
| 346 |
+
elif name == feature_validation:
|
| 347 |
+
self.__validate = state
|
| 348 |
+
elif name == feature_external_ges:
|
| 349 |
+
if state == 0:
|
| 350 |
+
# TODO (does that relate to PARSER_LOADDTD)?
|
| 351 |
+
raise SAXNotSupportedException("Feature '%s' not supported" % \
|
| 352 |
+
name)
|
| 353 |
+
elif name == feature_external_pes:
|
| 354 |
+
self.__extparams = state
|
| 355 |
+
else:
|
| 356 |
+
raise SAXNotRecognizedException("Feature '%s' not recognized" % \
|
| 357 |
+
name)
|
| 358 |
+
|
| 359 |
+
def getProperty(self, name):
|
| 360 |
+
if name == property_lexical_handler:
|
| 361 |
+
return self.__lex_handler
|
| 362 |
+
elif name == property_declaration_handler:
|
| 363 |
+
return self.__decl_handler
|
| 364 |
+
else:
|
| 365 |
+
raise SAXNotRecognizedException("Property '%s' not recognized" % \
|
| 366 |
+
name)
|
| 367 |
+
|
| 368 |
+
def setProperty(self, name, value):
|
| 369 |
+
if name == property_lexical_handler:
|
| 370 |
+
self.__lex_handler = value
|
| 371 |
+
elif name == property_declaration_handler:
|
| 372 |
+
# TODO: remove if/when libxml2 supports dtd events
|
| 373 |
+
raise SAXNotSupportedException("Property '%s' not supported" % \
|
| 374 |
+
name)
|
| 375 |
+
self.__decl_handler = value
|
| 376 |
+
else:
|
| 377 |
+
raise SAXNotRecognizedException("Property '%s' not recognized" % \
|
| 378 |
+
name)
|
| 379 |
+
|
| 380 |
+
def create_parser():
|
| 381 |
+
return LibXml2Reader()
|
| 382 |
+
|
local-test-libxml2-delta-02/afc-libxml2/python/generator.py
ADDED
|
@@ -0,0 +1,1382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
| 7 |
+
enums = {} # { enumType: { enumConstant: enumValue } }
|
| 8 |
+
|
| 9 |
+
import os
|
| 10 |
+
import sys
|
| 11 |
+
import string
|
| 12 |
+
|
| 13 |
+
if __name__ == "__main__":
|
| 14 |
+
# launched as a script
|
| 15 |
+
srcPref = os.path.dirname(sys.argv[0])
|
| 16 |
+
else:
|
| 17 |
+
# imported
|
| 18 |
+
srcPref = os.path.dirname(__file__)
|
| 19 |
+
|
| 20 |
+
#######################################################################
|
| 21 |
+
#
|
| 22 |
+
# That part if purely the API acquisition phase from the
|
| 23 |
+
# XML API description
|
| 24 |
+
#
|
| 25 |
+
#######################################################################
|
| 26 |
+
import os
|
| 27 |
+
import xml.sax
|
| 28 |
+
|
| 29 |
+
debug = 0
|
| 30 |
+
|
| 31 |
+
def getparser():
|
| 32 |
+
# Attach parser to an unmarshalling object. return both objects.
|
| 33 |
+
target = docParser()
|
| 34 |
+
parser = xml.sax.make_parser()
|
| 35 |
+
parser.setContentHandler(target)
|
| 36 |
+
return parser, target
|
| 37 |
+
|
| 38 |
+
class docParser(xml.sax.handler.ContentHandler):
|
| 39 |
+
def __init__(self):
|
| 40 |
+
self._methodname = None
|
| 41 |
+
self._data = []
|
| 42 |
+
self.in_function = 0
|
| 43 |
+
|
| 44 |
+
self.startElement = self.start
|
| 45 |
+
self.endElement = self.end
|
| 46 |
+
self.characters = self.data
|
| 47 |
+
|
| 48 |
+
def close(self):
|
| 49 |
+
if debug:
|
| 50 |
+
print("close")
|
| 51 |
+
|
| 52 |
+
def getmethodname(self):
|
| 53 |
+
return self._methodname
|
| 54 |
+
|
| 55 |
+
def data(self, text):
|
| 56 |
+
if debug:
|
| 57 |
+
print("data %s" % text)
|
| 58 |
+
self._data.append(text)
|
| 59 |
+
|
| 60 |
+
def start(self, tag, attrs):
|
| 61 |
+
if debug:
|
| 62 |
+
print("start %s, %s" % (tag, attrs))
|
| 63 |
+
if tag == 'function':
|
| 64 |
+
self._data = []
|
| 65 |
+
self.in_function = 1
|
| 66 |
+
self.function = None
|
| 67 |
+
self.function_cond = None
|
| 68 |
+
self.function_args = []
|
| 69 |
+
self.function_descr = None
|
| 70 |
+
self.function_return = None
|
| 71 |
+
self.function_file = None
|
| 72 |
+
if 'name' in attrs.keys():
|
| 73 |
+
self.function = attrs['name']
|
| 74 |
+
if 'file' in attrs.keys():
|
| 75 |
+
self.function_file = attrs['file']
|
| 76 |
+
elif tag == 'cond':
|
| 77 |
+
self._data = []
|
| 78 |
+
elif tag == 'info':
|
| 79 |
+
self._data = []
|
| 80 |
+
elif tag == 'arg':
|
| 81 |
+
if self.in_function == 1:
|
| 82 |
+
self.function_arg_name = None
|
| 83 |
+
self.function_arg_type = None
|
| 84 |
+
self.function_arg_info = None
|
| 85 |
+
if 'name' in attrs.keys():
|
| 86 |
+
self.function_arg_name = attrs['name']
|
| 87 |
+
if 'type' in attrs.keys():
|
| 88 |
+
self.function_arg_type = attrs['type']
|
| 89 |
+
if 'info' in attrs.keys():
|
| 90 |
+
self.function_arg_info = attrs['info']
|
| 91 |
+
elif tag == 'return':
|
| 92 |
+
if self.in_function == 1:
|
| 93 |
+
self.function_return_type = None
|
| 94 |
+
self.function_return_info = None
|
| 95 |
+
self.function_return_field = None
|
| 96 |
+
if 'type' in attrs.keys():
|
| 97 |
+
self.function_return_type = attrs['type']
|
| 98 |
+
if 'info' in attrs.keys():
|
| 99 |
+
self.function_return_info = attrs['info']
|
| 100 |
+
if 'field' in attrs.keys():
|
| 101 |
+
self.function_return_field = attrs['field']
|
| 102 |
+
elif tag == 'enum':
|
| 103 |
+
enum(attrs['type'],attrs['name'],attrs['value'])
|
| 104 |
+
|
| 105 |
+
def end(self, tag):
|
| 106 |
+
if debug:
|
| 107 |
+
print("end %s" % tag)
|
| 108 |
+
if tag == 'function':
|
| 109 |
+
if self.function != None:
|
| 110 |
+
function(self.function, self.function_descr,
|
| 111 |
+
self.function_return, self.function_args,
|
| 112 |
+
self.function_file, self.function_cond)
|
| 113 |
+
self.in_function = 0
|
| 114 |
+
elif tag == 'arg':
|
| 115 |
+
if self.in_function == 1:
|
| 116 |
+
self.function_args.append([self.function_arg_name,
|
| 117 |
+
self.function_arg_type,
|
| 118 |
+
self.function_arg_info])
|
| 119 |
+
elif tag == 'return':
|
| 120 |
+
if self.in_function == 1:
|
| 121 |
+
self.function_return = [self.function_return_type,
|
| 122 |
+
self.function_return_info,
|
| 123 |
+
self.function_return_field]
|
| 124 |
+
elif tag == 'info':
|
| 125 |
+
str = ''
|
| 126 |
+
for c in self._data:
|
| 127 |
+
str = str + c
|
| 128 |
+
if self.in_function == 1:
|
| 129 |
+
self.function_descr = str
|
| 130 |
+
elif tag == 'cond':
|
| 131 |
+
str = ''
|
| 132 |
+
for c in self._data:
|
| 133 |
+
str = str + c
|
| 134 |
+
if self.in_function == 1:
|
| 135 |
+
self.function_cond = str
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def function(name, desc, ret, args, file, cond):
|
| 139 |
+
functions[name] = (desc, ret, args, file, cond)
|
| 140 |
+
|
| 141 |
+
def enum(type, name, value):
|
| 142 |
+
if type not in enums:
|
| 143 |
+
enums[type] = {}
|
| 144 |
+
enums[type][name] = value
|
| 145 |
+
|
| 146 |
+
#######################################################################
|
| 147 |
+
#
|
| 148 |
+
# Some filtering rukes to drop functions/types which should not
|
| 149 |
+
# be exposed as-is on the Python interface
|
| 150 |
+
#
|
| 151 |
+
#######################################################################
|
| 152 |
+
|
| 153 |
+
skipped_modules = {
|
| 154 |
+
'xmlmemory': None,
|
| 155 |
+
'SAX': None,
|
| 156 |
+
'hash': None,
|
| 157 |
+
'list': None,
|
| 158 |
+
'threads': None,
|
| 159 |
+
# 'xpointer': None,
|
| 160 |
+
}
|
| 161 |
+
skipped_types = {
|
| 162 |
+
'int *': "usually a return type",
|
| 163 |
+
'xmlSAXHandlerPtr': "not the proper interface for SAX",
|
| 164 |
+
'htmlSAXHandlerPtr': "not the proper interface for SAX",
|
| 165 |
+
'xmlRMutexPtr': "thread specific, skipped",
|
| 166 |
+
'xmlMutexPtr': "thread specific, skipped",
|
| 167 |
+
'xmlGlobalStatePtr': "thread specific, skipped",
|
| 168 |
+
'xmlListPtr': "internal representation not suitable for python",
|
| 169 |
+
'xmlBufferPtr': "internal representation not suitable for python",
|
| 170 |
+
'FILE *': None,
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
#######################################################################
|
| 174 |
+
#
|
| 175 |
+
# Table of remapping to/from the python type or class to the C
|
| 176 |
+
# counterpart.
|
| 177 |
+
#
|
| 178 |
+
#######################################################################
|
| 179 |
+
|
| 180 |
+
py_types = {
|
| 181 |
+
'void': (None, None, None, None),
|
| 182 |
+
'int': ('i', None, "int", "int"),
|
| 183 |
+
'long': ('l', None, "long", "long"),
|
| 184 |
+
'double': ('d', None, "double", "double"),
|
| 185 |
+
'unsigned int': ('i', None, "int", "int"),
|
| 186 |
+
'xmlChar': ('c', None, "int", "int"),
|
| 187 |
+
'unsigned char *': ('z', None, "charPtr", "char *"),
|
| 188 |
+
'char *': ('z', None, "charPtr", "char *"),
|
| 189 |
+
'const char *': ('z', None, "charPtrConst", "const char *"),
|
| 190 |
+
'xmlChar *': ('z', None, "xmlCharPtr", "xmlChar *"),
|
| 191 |
+
'const xmlChar *': ('z', None, "xmlCharPtrConst", "const xmlChar *"),
|
| 192 |
+
'xmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 193 |
+
'const xmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 194 |
+
'xmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 195 |
+
'const xmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 196 |
+
'xmlDtdPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 197 |
+
'const xmlDtdPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 198 |
+
'xmlDtd *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 199 |
+
'const xmlDtd *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 200 |
+
'xmlAttrPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 201 |
+
'const xmlAttrPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 202 |
+
'xmlAttr *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 203 |
+
'const xmlAttr *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 204 |
+
'xmlEntityPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 205 |
+
'const xmlEntityPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 206 |
+
'xmlEntity *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 207 |
+
'const xmlEntity *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 208 |
+
'xmlElementPtr': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
|
| 209 |
+
'const xmlElementPtr': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
|
| 210 |
+
'xmlElement *': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
|
| 211 |
+
'const xmlElement *': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
|
| 212 |
+
'xmlAttributePtr': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
|
| 213 |
+
'const xmlAttributePtr': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
|
| 214 |
+
'xmlAttribute *': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
|
| 215 |
+
'const xmlAttribute *': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
|
| 216 |
+
'xmlNsPtr': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
|
| 217 |
+
'const xmlNsPtr': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
|
| 218 |
+
'xmlNs *': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
|
| 219 |
+
'const xmlNs *': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
|
| 220 |
+
'xmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 221 |
+
'const xmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 222 |
+
'xmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 223 |
+
'const xmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 224 |
+
'htmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 225 |
+
'const htmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 226 |
+
'htmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 227 |
+
'const htmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
|
| 228 |
+
'htmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 229 |
+
'const htmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 230 |
+
'htmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 231 |
+
'const htmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
| 232 |
+
'xmlXPathContextPtr': ('O', "xmlXPathContext", "xmlXPathContextPtr", "xmlXPathContextPtr"),
|
| 233 |
+
'xmlXPathContext *': ('O', "xpathContext", "xmlXPathContextPtr", "xmlXPathContextPtr"),
|
| 234 |
+
'xmlXPathParserContextPtr': ('O', "xmlXPathParserContext", "xmlXPathParserContextPtr", "xmlXPathParserContextPtr"),
|
| 235 |
+
'xmlParserCtxtPtr': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
| 236 |
+
'xmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
| 237 |
+
'htmlParserCtxtPtr': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
| 238 |
+
'htmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
| 239 |
+
'xmlValidCtxtPtr': ('O', "ValidCtxt", "xmlValidCtxtPtr", "xmlValidCtxtPtr"),
|
| 240 |
+
'xmlCatalogPtr': ('O', "catalog", "xmlCatalogPtr", "xmlCatalogPtr"),
|
| 241 |
+
'FILE *': ('O', "File", "FILEPtr", "FILE *"),
|
| 242 |
+
'xmlURIPtr': ('O', "URI", "xmlURIPtr", "xmlURIPtr"),
|
| 243 |
+
'const xmlError *': ('O', "Error", "xmlErrorPtr", "const xmlError *"),
|
| 244 |
+
'xmlErrorPtr': ('O', "Error", "xmlErrorPtr", "xmlErrorPtr"),
|
| 245 |
+
'xmlOutputBufferPtr': ('O', "outputBuffer", "xmlOutputBufferPtr", "xmlOutputBufferPtr"),
|
| 246 |
+
'xmlParserInputBufferPtr': ('O', "inputBuffer", "xmlParserInputBufferPtr", "xmlParserInputBufferPtr"),
|
| 247 |
+
'xmlRegexpPtr': ('O', "xmlReg", "xmlRegexpPtr", "xmlRegexpPtr"),
|
| 248 |
+
'xmlTextReaderLocatorPtr': ('O', "xmlTextReaderLocator", "xmlTextReaderLocatorPtr", "xmlTextReaderLocatorPtr"),
|
| 249 |
+
'xmlTextReaderPtr': ('O', "xmlTextReader", "xmlTextReaderPtr", "xmlTextReaderPtr"),
|
| 250 |
+
'xmlRelaxNGPtr': ('O', "relaxNgSchema", "xmlRelaxNGPtr", "xmlRelaxNGPtr"),
|
| 251 |
+
'xmlRelaxNGParserCtxtPtr': ('O', "relaxNgParserCtxt", "xmlRelaxNGParserCtxtPtr", "xmlRelaxNGParserCtxtPtr"),
|
| 252 |
+
'xmlRelaxNGValidCtxtPtr': ('O', "relaxNgValidCtxt", "xmlRelaxNGValidCtxtPtr", "xmlRelaxNGValidCtxtPtr"),
|
| 253 |
+
'xmlSchemaPtr': ('O', "Schema", "xmlSchemaPtr", "xmlSchemaPtr"),
|
| 254 |
+
'xmlSchemaParserCtxtPtr': ('O', "SchemaParserCtxt", "xmlSchemaParserCtxtPtr", "xmlSchemaParserCtxtPtr"),
|
| 255 |
+
'xmlSchemaValidCtxtPtr': ('O', "SchemaValidCtxt", "xmlSchemaValidCtxtPtr", "xmlSchemaValidCtxtPtr"),
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
py_return_types = {
|
| 259 |
+
'xmlXPathObjectPtr': ('O', "foo", "xmlXPathObjectPtr", "xmlXPathObjectPtr"),
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
unknown_types = {}
|
| 263 |
+
|
| 264 |
+
foreign_encoding_args = (
|
| 265 |
+
'htmlCreateMemoryParserCtxt',
|
| 266 |
+
'htmlCtxtReadMemory',
|
| 267 |
+
'htmlParseChunk',
|
| 268 |
+
'htmlReadMemory',
|
| 269 |
+
'xmlCreateMemoryParserCtxt',
|
| 270 |
+
'xmlCtxtReadMemory',
|
| 271 |
+
'xmlCtxtResetPush',
|
| 272 |
+
'xmlParseChunk',
|
| 273 |
+
'xmlParseMemory',
|
| 274 |
+
'xmlReadMemory',
|
| 275 |
+
'xmlRecoverMemory',
|
| 276 |
+
)
|
| 277 |
+
|
| 278 |
+
#######################################################################
|
| 279 |
+
#
|
| 280 |
+
# This part writes the C <-> Python stubs libxml2-py.[ch] and
|
| 281 |
+
# the table libxml2-export.c to add when registrering the Python module
|
| 282 |
+
#
|
| 283 |
+
#######################################################################
|
| 284 |
+
|
| 285 |
+
# Class methods which are written by hand in libxml.c but the Python-level
|
| 286 |
+
# code is still automatically generated (so they are not in skip_function()).
|
| 287 |
+
skip_impl = (
|
| 288 |
+
'xmlSaveFileTo',
|
| 289 |
+
'xmlSaveFormatFileTo',
|
| 290 |
+
)
|
| 291 |
+
|
| 292 |
+
deprecated_funcs = {
|
| 293 |
+
'htmlAutoCloseTag': True,
|
| 294 |
+
'htmlDefaultSAXHandlerInit': True,
|
| 295 |
+
'htmlHandleOmittedElem': True,
|
| 296 |
+
'htmlInitAutoClose': True,
|
| 297 |
+
'htmlIsAutoClosed': True,
|
| 298 |
+
'htmlIsBooleanAttr': True,
|
| 299 |
+
'htmlParseCharRef': True,
|
| 300 |
+
'htmlParseElement': True,
|
| 301 |
+
'namePop': True,
|
| 302 |
+
'namePush': True,
|
| 303 |
+
'nodePop': True,
|
| 304 |
+
'nodePush': True,
|
| 305 |
+
'xmlByteConsumed': True,
|
| 306 |
+
'xmlCheckFilename': True,
|
| 307 |
+
'xmlCheckLanguageID': True,
|
| 308 |
+
'xmlCleanupCharEncodingHandlers': True,
|
| 309 |
+
'xmlCleanupGlobals': True,
|
| 310 |
+
'xmlCopyChar': True,
|
| 311 |
+
'xmlCopyCharMultiByte': True,
|
| 312 |
+
'xmlCreateEntityParserCtxt': True,
|
| 313 |
+
'xmlDefaultSAXHandlerInit': True,
|
| 314 |
+
'xmlDictCleanup': True,
|
| 315 |
+
'xmlFileMatch': True,
|
| 316 |
+
'xmlGetCompressMode': True,
|
| 317 |
+
'xmlInitCharEncodingHandlers': True,
|
| 318 |
+
'xmlInitGlobals': True,
|
| 319 |
+
'xmlInitializeDict': True,
|
| 320 |
+
'xmlIOFTPMatch': True,
|
| 321 |
+
'xmlIOHTTPMatch': True,
|
| 322 |
+
'xmlIsLetter': True,
|
| 323 |
+
'xmlIsRef': True,
|
| 324 |
+
'xmlKeepBlanksDefault': True,
|
| 325 |
+
'xmlLineNumbersDefault': True,
|
| 326 |
+
'xmlNanoHTTPCleanup': True,
|
| 327 |
+
'xmlNanoHTTPInit': True,
|
| 328 |
+
'xmlNanoHTTPScanProxy': True,
|
| 329 |
+
'xmlNextChar': True,
|
| 330 |
+
'xmlNormalizeWindowsPath': True,
|
| 331 |
+
'xmlParseAttValue': True,
|
| 332 |
+
'xmlParseAttributeListDecl': True,
|
| 333 |
+
'xmlParseCDSect': True,
|
| 334 |
+
'xmlParseCharData': True,
|
| 335 |
+
'xmlParseCharRef': True,
|
| 336 |
+
'xmlParseComment': True,
|
| 337 |
+
'xmlParseDocTypeDecl': True,
|
| 338 |
+
'xmlParseElement': True,
|
| 339 |
+
'xmlParseElementDecl': True,
|
| 340 |
+
'xmlParseEncName': True,
|
| 341 |
+
'xmlParseEncodingDecl': True,
|
| 342 |
+
'xmlParseEndTag': True,
|
| 343 |
+
'xmlParseEntity': True,
|
| 344 |
+
'xmlParseEntityDecl': True,
|
| 345 |
+
'xmlParseEntityRef': True,
|
| 346 |
+
'xmlParseExtParsedEnt': True,
|
| 347 |
+
'xmlParseExternalSubset': True,
|
| 348 |
+
'xmlParseMarkupDecl': True,
|
| 349 |
+
'xmlParseMisc': True,
|
| 350 |
+
'xmlParseName': True,
|
| 351 |
+
'xmlParseNmtoken': True,
|
| 352 |
+
'xmlParseNotationDecl': True,
|
| 353 |
+
'xmlParsePEReference': True,
|
| 354 |
+
'xmlParsePI': True,
|
| 355 |
+
'xmlParsePITarget': True,
|
| 356 |
+
'xmlParsePubidLiteral': True,
|
| 357 |
+
'xmlParseReference': True,
|
| 358 |
+
'xmlParseSDDecl': True,
|
| 359 |
+
'xmlParseStartTag': True,
|
| 360 |
+
'xmlParseSystemLiteral': True,
|
| 361 |
+
'xmlParseTextDecl': True,
|
| 362 |
+
'xmlParseVersionInfo': True,
|
| 363 |
+
'xmlParseVersionNum': True,
|
| 364 |
+
'xmlParseXMLDecl': True,
|
| 365 |
+
'xmlParserHandlePEReference': True,
|
| 366 |
+
'xmlParserInputBufferGrow': True,
|
| 367 |
+
'xmlParserInputBufferPush': True,
|
| 368 |
+
'xmlParserInputBufferRead': True,
|
| 369 |
+
'xmlParserSetLineNumbers': True,
|
| 370 |
+
'xmlParserSetLoadSubset': True,
|
| 371 |
+
'xmlParserSetPedantic': True,
|
| 372 |
+
'xmlParserSetReplaceEntities': True,
|
| 373 |
+
'xmlParserSetValidate': True,
|
| 374 |
+
'xmlPedanticParserDefault': True,
|
| 375 |
+
'xmlPopInput': True,
|
| 376 |
+
'xmlRecoverDoc': True,
|
| 377 |
+
'xmlRecoverFile': True,
|
| 378 |
+
'xmlRecoverMemory': True,
|
| 379 |
+
'xmlRegisterHTTPPostCallbacks': True,
|
| 380 |
+
'xmlRelaxNGCleanupTypes': True,
|
| 381 |
+
'xmlRelaxNGInitTypes': True,
|
| 382 |
+
'xmlRemoveRef': True,
|
| 383 |
+
'xmlSAXDefaultVersion': True,
|
| 384 |
+
'xmlSchemaCleanupTypes': True,
|
| 385 |
+
'xmlSchemaInitTypes': True,
|
| 386 |
+
'xmlSetCompressMode': True,
|
| 387 |
+
'xmlSetupParserForBuffer': True,
|
| 388 |
+
'xmlSkipBlankChars': True,
|
| 389 |
+
'xmlStringDecodeEntities': True,
|
| 390 |
+
'xmlStringLenDecodeEntities': True,
|
| 391 |
+
'xmlSubstituteEntitiesDefault': True,
|
| 392 |
+
'xmlThrDefDefaultBufferSize': True,
|
| 393 |
+
'xmlThrDefDoValidityCheckingDefaultValue': True,
|
| 394 |
+
'xmlThrDefGetWarningsDefaultValue': True,
|
| 395 |
+
'xmlThrDefIndentTreeOutput': True,
|
| 396 |
+
'xmlThrDefKeepBlanksDefaultValue': True,
|
| 397 |
+
'xmlThrDefLineNumbersDefaultValue': True,
|
| 398 |
+
'xmlThrDefLoadExtDtdDefaultValue': True,
|
| 399 |
+
'xmlThrDefParserDebugEntities': True,
|
| 400 |
+
'xmlThrDefPedanticParserDefaultValue': True,
|
| 401 |
+
'xmlThrDefSaveNoEmptyTags': True,
|
| 402 |
+
'xmlThrDefSubstituteEntitiesDefaultValue': True,
|
| 403 |
+
'xmlThrDefTreeIndentString': True,
|
| 404 |
+
'xmlValidCtxtNormalizeAttributeValue': True,
|
| 405 |
+
'xmlValidNormalizeAttributeValue': True,
|
| 406 |
+
'xmlValidateAttributeValue': True,
|
| 407 |
+
'xmlValidateDocumentFinal': True,
|
| 408 |
+
'xmlValidateDtdFinal': True,
|
| 409 |
+
'xmlValidateNotationUse': True,
|
| 410 |
+
'xmlValidateOneAttribute': True,
|
| 411 |
+
'xmlValidateOneElement': True,
|
| 412 |
+
'xmlValidateOneNamespace': True,
|
| 413 |
+
'xmlValidatePopElement': True,
|
| 414 |
+
'xmlValidatePushCData': True,
|
| 415 |
+
'xmlValidatePushElement': True,
|
| 416 |
+
'xmlValidateRoot': True,
|
| 417 |
+
'xmlValidate': True,
|
| 418 |
+
'xmlXPathEvalExpr': True,
|
| 419 |
+
'xmlXPathInit': True,
|
| 420 |
+
'xmlXPtrEvalRangePredicate': True,
|
| 421 |
+
'xmlXPtrNewCollapsedRange': True,
|
| 422 |
+
'xmlXPtrNewContext': True,
|
| 423 |
+
'xmlXPtrNewLocationSetNodes': True,
|
| 424 |
+
'xmlXPtrNewRange': True,
|
| 425 |
+
'xmlXPtrNewRangeNodes': True,
|
| 426 |
+
'xmlXPtrRangeToFunction': True,
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
def skip_function(name):
|
| 430 |
+
if name[0:12] == "xmlXPathWrap":
|
| 431 |
+
return 1
|
| 432 |
+
if name == "xmlFreeParserCtxt":
|
| 433 |
+
return 1
|
| 434 |
+
if name == "xmlCleanupParser":
|
| 435 |
+
return 1
|
| 436 |
+
if name == "xmlFreeTextReader":
|
| 437 |
+
return 1
|
| 438 |
+
# if name[0:11] == "xmlXPathNew":
|
| 439 |
+
# return 1
|
| 440 |
+
# the next function is defined in libxml.c
|
| 441 |
+
if name == "xmlRelaxNGFreeValidCtxt":
|
| 442 |
+
return 1
|
| 443 |
+
if name == "xmlFreeValidCtxt":
|
| 444 |
+
return 1
|
| 445 |
+
if name == "xmlSchemaFreeValidCtxt":
|
| 446 |
+
return 1
|
| 447 |
+
|
| 448 |
+
#
|
| 449 |
+
# Those are skipped because the Const version is used of the bindings
|
| 450 |
+
# instead.
|
| 451 |
+
#
|
| 452 |
+
if name == "xmlTextReaderBaseUri":
|
| 453 |
+
return 1
|
| 454 |
+
if name == "xmlTextReaderLocalName":
|
| 455 |
+
return 1
|
| 456 |
+
if name == "xmlTextReaderName":
|
| 457 |
+
return 1
|
| 458 |
+
if name == "xmlTextReaderNamespaceUri":
|
| 459 |
+
return 1
|
| 460 |
+
if name == "xmlTextReaderPrefix":
|
| 461 |
+
return 1
|
| 462 |
+
if name == "xmlTextReaderXmlLang":
|
| 463 |
+
return 1
|
| 464 |
+
if name == "xmlTextReaderValue":
|
| 465 |
+
return 1
|
| 466 |
+
if name == "xmlOutputBufferClose": # handled by by the superclass
|
| 467 |
+
return 1
|
| 468 |
+
if name == "xmlOutputBufferFlush": # handled by by the superclass
|
| 469 |
+
return 1
|
| 470 |
+
if name == "xmlErrMemory":
|
| 471 |
+
return 1
|
| 472 |
+
|
| 473 |
+
if name == "xmlValidBuildContentModel":
|
| 474 |
+
return 1
|
| 475 |
+
if name == "xmlValidateElementDecl":
|
| 476 |
+
return 1
|
| 477 |
+
if name == "xmlValidateAttributeDecl":
|
| 478 |
+
return 1
|
| 479 |
+
if name == "xmlPopInputCallbacks":
|
| 480 |
+
return 1
|
| 481 |
+
|
| 482 |
+
return 0
|
| 483 |
+
|
| 484 |
+
def print_function_wrapper(name, output, export, include):
|
| 485 |
+
global py_types
|
| 486 |
+
global unknown_types
|
| 487 |
+
global functions
|
| 488 |
+
global skipped_modules
|
| 489 |
+
|
| 490 |
+
try:
|
| 491 |
+
(desc, ret, args, file, cond) = functions[name]
|
| 492 |
+
except:
|
| 493 |
+
print("failed to get function %s infos")
|
| 494 |
+
return
|
| 495 |
+
|
| 496 |
+
if file in skipped_modules:
|
| 497 |
+
return 0
|
| 498 |
+
if skip_function(name) == 1:
|
| 499 |
+
return 0
|
| 500 |
+
if name in skip_impl:
|
| 501 |
+
# Don't delete the function entry in the caller.
|
| 502 |
+
return 1
|
| 503 |
+
|
| 504 |
+
if name.startswith('xmlUCSIs'):
|
| 505 |
+
is_deprecated = name != 'xmlUCSIsBlock' and name != 'xmlUCSIsCat'
|
| 506 |
+
else:
|
| 507 |
+
is_deprecated = name in deprecated_funcs
|
| 508 |
+
|
| 509 |
+
c_call = ""
|
| 510 |
+
format=""
|
| 511 |
+
format_args=""
|
| 512 |
+
c_args=""
|
| 513 |
+
c_return=""
|
| 514 |
+
c_convert=""
|
| 515 |
+
c_release=""
|
| 516 |
+
num_bufs=0
|
| 517 |
+
for arg in args:
|
| 518 |
+
# This should be correct
|
| 519 |
+
if arg[1][0:6] == "const ":
|
| 520 |
+
arg[1] = arg[1][6:]
|
| 521 |
+
c_args = c_args + " %s %s;\n" % (arg[1], arg[0])
|
| 522 |
+
if arg[1] in py_types:
|
| 523 |
+
(f, t, n, c) = py_types[arg[1]]
|
| 524 |
+
if (f == 'z') and (name in foreign_encoding_args) and (num_bufs == 0):
|
| 525 |
+
f = 's#'
|
| 526 |
+
if f != None:
|
| 527 |
+
format = format + f
|
| 528 |
+
if t != None:
|
| 529 |
+
format_args = format_args + ", &pyobj_%s" % (arg[0])
|
| 530 |
+
c_args = c_args + " PyObject *pyobj_%s;\n" % (arg[0])
|
| 531 |
+
c_convert = c_convert + \
|
| 532 |
+
" %s = (%s) Py%s_Get(pyobj_%s);\n" % (arg[0],
|
| 533 |
+
arg[1], t, arg[0])
|
| 534 |
+
else:
|
| 535 |
+
format_args = format_args + ", &%s" % (arg[0])
|
| 536 |
+
if f == 's#':
|
| 537 |
+
format_args = format_args + ", &py_buffsize%d" % num_bufs
|
| 538 |
+
c_args = c_args + " Py_ssize_t py_buffsize%d;\n" % num_bufs
|
| 539 |
+
num_bufs = num_bufs + 1
|
| 540 |
+
if c_call != "":
|
| 541 |
+
c_call = c_call + ", "
|
| 542 |
+
c_call = c_call + "%s" % (arg[0])
|
| 543 |
+
if t == "File":
|
| 544 |
+
c_release = c_release + \
|
| 545 |
+
" PyFile_Release(%s);\n" % (arg[0])
|
| 546 |
+
else:
|
| 547 |
+
if arg[1] in skipped_types:
|
| 548 |
+
return 0
|
| 549 |
+
if arg[1] in unknown_types:
|
| 550 |
+
lst = unknown_types[arg[1]]
|
| 551 |
+
lst.append(name)
|
| 552 |
+
else:
|
| 553 |
+
unknown_types[arg[1]] = [name]
|
| 554 |
+
return -1
|
| 555 |
+
if format != "":
|
| 556 |
+
format = format + ":%s" % (name)
|
| 557 |
+
|
| 558 |
+
if ret[0] == 'void':
|
| 559 |
+
if file == "python_accessor":
|
| 560 |
+
if args[1][1] == "char *" or args[1][1] == "xmlChar *":
|
| 561 |
+
c_call = "\n if (%s->%s != NULL) xmlFree(%s->%s);\n" % (
|
| 562 |
+
args[0][0], args[1][0], args[0][0], args[1][0])
|
| 563 |
+
c_call = c_call + " %s->%s = (%s)xmlStrdup((const xmlChar *)%s);\n" % (args[0][0],
|
| 564 |
+
args[1][0], args[1][1], args[1][0])
|
| 565 |
+
else:
|
| 566 |
+
c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0],
|
| 567 |
+
args[1][0])
|
| 568 |
+
else:
|
| 569 |
+
c_call = "\n %s(%s);\n" % (name, c_call)
|
| 570 |
+
ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n"
|
| 571 |
+
elif ret[0] in py_types:
|
| 572 |
+
(f, t, n, c) = py_types[ret[0]]
|
| 573 |
+
c_return = c_return + " %s c_retval;\n" % (ret[0])
|
| 574 |
+
if file == "python_accessor" and ret[2] != None:
|
| 575 |
+
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
|
| 576 |
+
else:
|
| 577 |
+
c_call = "\n c_retval = %s(%s);\n" % (name, c_call)
|
| 578 |
+
ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c)
|
| 579 |
+
ret_convert = ret_convert + " return(py_retval);\n"
|
| 580 |
+
elif ret[0] in py_return_types:
|
| 581 |
+
(f, t, n, c) = py_return_types[ret[0]]
|
| 582 |
+
c_return = c_return + " %s c_retval;\n" % (ret[0])
|
| 583 |
+
c_call = "\n c_retval = %s(%s);\n" % (name, c_call)
|
| 584 |
+
ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c)
|
| 585 |
+
ret_convert = ret_convert + " return(py_retval);\n"
|
| 586 |
+
else:
|
| 587 |
+
if ret[0] in skipped_types:
|
| 588 |
+
return 0
|
| 589 |
+
if ret[0] in unknown_types:
|
| 590 |
+
lst = unknown_types[ret[0]]
|
| 591 |
+
lst.append(name)
|
| 592 |
+
else:
|
| 593 |
+
unknown_types[ret[0]] = [name]
|
| 594 |
+
return -1
|
| 595 |
+
|
| 596 |
+
if cond != None and cond != "":
|
| 597 |
+
include.write("#if %s\n" % cond)
|
| 598 |
+
export.write("#if %s\n" % cond)
|
| 599 |
+
output.write("#if %s\n" % cond)
|
| 600 |
+
|
| 601 |
+
include.write("PyObject * ")
|
| 602 |
+
include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name))
|
| 603 |
+
|
| 604 |
+
export.write(" { (char *)\"%s\", libxml_%s, METH_VARARGS, NULL },\n" %
|
| 605 |
+
(name, name))
|
| 606 |
+
|
| 607 |
+
if file == "python":
|
| 608 |
+
# Those have been manually generated
|
| 609 |
+
if cond != None and cond != "":
|
| 610 |
+
include.write("#endif\n")
|
| 611 |
+
export.write("#endif\n")
|
| 612 |
+
output.write("#endif\n")
|
| 613 |
+
return 1
|
| 614 |
+
if file == "python_accessor" and ret[0] != "void" and ret[2] is None:
|
| 615 |
+
# Those have been manually generated
|
| 616 |
+
if cond != None and cond != "":
|
| 617 |
+
include.write("#endif\n")
|
| 618 |
+
export.write("#endif\n")
|
| 619 |
+
output.write("#endif\n")
|
| 620 |
+
return 1
|
| 621 |
+
|
| 622 |
+
if is_deprecated:
|
| 623 |
+
output.write("XML_IGNORE_DEPRECATION_WARNINGS\n")
|
| 624 |
+
output.write("PyObject *\n")
|
| 625 |
+
output.write("libxml_%s(PyObject *self ATTRIBUTE_UNUSED," % (name))
|
| 626 |
+
output.write(" PyObject *args")
|
| 627 |
+
if format == "":
|
| 628 |
+
output.write(" ATTRIBUTE_UNUSED")
|
| 629 |
+
output.write(") {\n")
|
| 630 |
+
if ret[0] != 'void':
|
| 631 |
+
output.write(" PyObject *py_retval;\n")
|
| 632 |
+
if c_return != "":
|
| 633 |
+
output.write(c_return)
|
| 634 |
+
if c_args != "":
|
| 635 |
+
output.write(c_args)
|
| 636 |
+
if is_deprecated:
|
| 637 |
+
output.write("\n if (libxml_deprecationWarning(\"%s\") == -1)\n" %
|
| 638 |
+
name)
|
| 639 |
+
output.write(" return(NULL);\n")
|
| 640 |
+
if format != "":
|
| 641 |
+
output.write("\n if (!PyArg_ParseTuple(args, (char *)\"%s\"%s))\n" %
|
| 642 |
+
(format, format_args))
|
| 643 |
+
output.write(" return(NULL);\n")
|
| 644 |
+
if c_convert != "":
|
| 645 |
+
output.write(c_convert)
|
| 646 |
+
|
| 647 |
+
output.write(c_call)
|
| 648 |
+
if c_release != "":
|
| 649 |
+
output.write(c_release)
|
| 650 |
+
output.write(ret_convert)
|
| 651 |
+
output.write("}\n")
|
| 652 |
+
if is_deprecated:
|
| 653 |
+
output.write("XML_POP_WARNINGS\n")
|
| 654 |
+
output.write("\n")
|
| 655 |
+
|
| 656 |
+
if cond != None and cond != "":
|
| 657 |
+
include.write("#endif /* %s */\n" % cond)
|
| 658 |
+
export.write("#endif /* %s */\n" % cond)
|
| 659 |
+
output.write("#endif /* %s */\n" % cond)
|
| 660 |
+
return 1
|
| 661 |
+
|
| 662 |
+
def buildStubs():
|
| 663 |
+
global py_types
|
| 664 |
+
global py_return_types
|
| 665 |
+
global unknown_types
|
| 666 |
+
|
| 667 |
+
try:
|
| 668 |
+
f = open(os.path.join(srcPref,"libxml2-api.xml"))
|
| 669 |
+
data = f.read()
|
| 670 |
+
(parser, target) = getparser()
|
| 671 |
+
parser.feed(data)
|
| 672 |
+
parser.close()
|
| 673 |
+
except IOError as msg:
|
| 674 |
+
try:
|
| 675 |
+
f = open(os.path.join(srcPref,"..","doc","libxml2-api.xml"))
|
| 676 |
+
data = f.read()
|
| 677 |
+
(parser, target) = getparser()
|
| 678 |
+
parser.feed(data)
|
| 679 |
+
parser.close()
|
| 680 |
+
except IOError as msg:
|
| 681 |
+
print(file, ":", msg)
|
| 682 |
+
sys.exit(1)
|
| 683 |
+
|
| 684 |
+
n = len(list(functions.keys()))
|
| 685 |
+
print("Found %d functions in libxml2-api.xml" % (n))
|
| 686 |
+
|
| 687 |
+
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
|
| 688 |
+
try:
|
| 689 |
+
f = open(os.path.join(srcPref,"libxml2-python-api.xml"))
|
| 690 |
+
data = f.read()
|
| 691 |
+
(parser, target) = getparser()
|
| 692 |
+
parser.feed(data)
|
| 693 |
+
parser.close()
|
| 694 |
+
except IOError as msg:
|
| 695 |
+
print(file, ":", msg)
|
| 696 |
+
|
| 697 |
+
|
| 698 |
+
print("Found %d functions in libxml2-python-api.xml" % (
|
| 699 |
+
len(list(functions.keys())) - n))
|
| 700 |
+
nb_wrap = 0
|
| 701 |
+
failed = 0
|
| 702 |
+
skipped = 0
|
| 703 |
+
|
| 704 |
+
include = open("libxml2-py.h", "w")
|
| 705 |
+
include.write("/* Generated */\n\n")
|
| 706 |
+
export = open("libxml2-export.c", "w")
|
| 707 |
+
export.write("/* Generated */\n\n")
|
| 708 |
+
wrapper = open("libxml2-py.c", "w")
|
| 709 |
+
wrapper.write("/* Generated */\n\n")
|
| 710 |
+
wrapper.write("#define PY_SSIZE_T_CLEAN\n")
|
| 711 |
+
wrapper.write("#include <Python.h>\n")
|
| 712 |
+
wrapper.write("#include <libxml/xmlversion.h>\n")
|
| 713 |
+
wrapper.write("#include <libxml/tree.h>\n")
|
| 714 |
+
wrapper.write("#include <libxml/xmlschemastypes.h>\n")
|
| 715 |
+
wrapper.write("#include \"libxml_wrap.h\"\n")
|
| 716 |
+
wrapper.write("#include \"libxml2-py.h\"\n\n")
|
| 717 |
+
for function in sorted(functions.keys()):
|
| 718 |
+
ret = print_function_wrapper(function, wrapper, export, include)
|
| 719 |
+
if ret < 0:
|
| 720 |
+
failed = failed + 1
|
| 721 |
+
del functions[function]
|
| 722 |
+
if ret == 0:
|
| 723 |
+
skipped = skipped + 1
|
| 724 |
+
del functions[function]
|
| 725 |
+
if ret == 1:
|
| 726 |
+
nb_wrap = nb_wrap + 1
|
| 727 |
+
include.close()
|
| 728 |
+
export.close()
|
| 729 |
+
wrapper.close()
|
| 730 |
+
|
| 731 |
+
print("Generated %d wrapper functions, %d failed, %d skipped" % (nb_wrap,
|
| 732 |
+
failed, skipped))
|
| 733 |
+
# print("Missing type converters: ")
|
| 734 |
+
# for type in list(unknown_types.keys()):
|
| 735 |
+
# print("%s:%d " % (type, len(unknown_types[type])))
|
| 736 |
+
# print()
|
| 737 |
+
|
| 738 |
+
#######################################################################
|
| 739 |
+
#
|
| 740 |
+
# This part writes part of the Python front-end classes based on
|
| 741 |
+
# mapping rules between types and classes and also based on function
|
| 742 |
+
# renaming to get consistent function names at the Python level
|
| 743 |
+
#
|
| 744 |
+
#######################################################################
|
| 745 |
+
|
| 746 |
+
#
|
| 747 |
+
# The type automatically remapped to generated classes
|
| 748 |
+
#
|
| 749 |
+
classes_type = {
|
| 750 |
+
"xmlNodePtr": ("._o", "xmlNode(_obj=%s)", "xmlNode"),
|
| 751 |
+
"xmlNode *": ("._o", "xmlNode(_obj=%s)", "xmlNode"),
|
| 752 |
+
"xmlDocPtr": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
|
| 753 |
+
"xmlDoc *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
|
| 754 |
+
"htmlDocPtr": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
|
| 755 |
+
"htmlxmlDocPtr *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
|
| 756 |
+
"xmlAttrPtr": ("._o", "xmlAttr(_obj=%s)", "xmlAttr"),
|
| 757 |
+
"xmlAttr *": ("._o", "xmlAttr(_obj=%s)", "xmlAttr"),
|
| 758 |
+
"xmlNsPtr": ("._o", "xmlNs(_obj=%s)", "xmlNs"),
|
| 759 |
+
"xmlNs *": ("._o", "xmlNs(_obj=%s)", "xmlNs"),
|
| 760 |
+
"xmlDtdPtr": ("._o", "xmlDtd(_obj=%s)", "xmlDtd"),
|
| 761 |
+
"xmlDtd *": ("._o", "xmlDtd(_obj=%s)", "xmlDtd"),
|
| 762 |
+
"xmlEntityPtr": ("._o", "xmlEntity(_obj=%s)", "xmlEntity"),
|
| 763 |
+
"xmlEntity *": ("._o", "xmlEntity(_obj=%s)", "xmlEntity"),
|
| 764 |
+
"xmlElementPtr": ("._o", "xmlElement(_obj=%s)", "xmlElement"),
|
| 765 |
+
"xmlElement *": ("._o", "xmlElement(_obj=%s)", "xmlElement"),
|
| 766 |
+
"xmlAttributePtr": ("._o", "xmlAttribute(_obj=%s)", "xmlAttribute"),
|
| 767 |
+
"xmlAttribute *": ("._o", "xmlAttribute(_obj=%s)", "xmlAttribute"),
|
| 768 |
+
"xmlXPathContextPtr": ("._o", "xpathContext(_obj=%s)", "xpathContext"),
|
| 769 |
+
"xmlXPathContext *": ("._o", "xpathContext(_obj=%s)", "xpathContext"),
|
| 770 |
+
"xmlXPathParserContext *": ("._o", "xpathParserContext(_obj=%s)", "xpathParserContext"),
|
| 771 |
+
"xmlXPathParserContextPtr": ("._o", "xpathParserContext(_obj=%s)", "xpathParserContext"),
|
| 772 |
+
"xmlParserCtxtPtr": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
|
| 773 |
+
"xmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
|
| 774 |
+
"htmlParserCtxtPtr": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
|
| 775 |
+
"htmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
|
| 776 |
+
"xmlValidCtxtPtr": ("._o", "ValidCtxt(_obj=%s)", "ValidCtxt"),
|
| 777 |
+
"xmlCatalogPtr": ("._o", "catalog(_obj=%s)", "catalog"),
|
| 778 |
+
"xmlURIPtr": ("._o", "URI(_obj=%s)", "URI"),
|
| 779 |
+
"const xmlError *": ("._o", "Error(_obj=%s)", "Error"),
|
| 780 |
+
"xmlErrorPtr": ("._o", "Error(_obj=%s)", "Error"),
|
| 781 |
+
"xmlOutputBufferPtr": ("._o", "outputBuffer(_obj=%s)", "outputBuffer"),
|
| 782 |
+
"xmlParserInputBufferPtr": ("._o", "inputBuffer(_obj=%s)", "inputBuffer"),
|
| 783 |
+
"xmlRegexpPtr": ("._o", "xmlReg(_obj=%s)", "xmlReg"),
|
| 784 |
+
"xmlTextReaderLocatorPtr": ("._o", "xmlTextReaderLocator(_obj=%s)", "xmlTextReaderLocator"),
|
| 785 |
+
"xmlTextReaderPtr": ("._o", "xmlTextReader(_obj=%s)", "xmlTextReader"),
|
| 786 |
+
'xmlRelaxNGPtr': ('._o', "relaxNgSchema(_obj=%s)", "relaxNgSchema"),
|
| 787 |
+
'xmlRelaxNGParserCtxtPtr': ('._o', "relaxNgParserCtxt(_obj=%s)", "relaxNgParserCtxt"),
|
| 788 |
+
'xmlRelaxNGValidCtxtPtr': ('._o', "relaxNgValidCtxt(_obj=%s)", "relaxNgValidCtxt"),
|
| 789 |
+
'xmlSchemaPtr': ("._o", "Schema(_obj=%s)", "Schema"),
|
| 790 |
+
'xmlSchemaParserCtxtPtr': ("._o", "SchemaParserCtxt(_obj=%s)", "SchemaParserCtxt"),
|
| 791 |
+
'xmlSchemaValidCtxtPtr': ("._o", "SchemaValidCtxt(_obj=%s)", "SchemaValidCtxt"),
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
converter_type = {
|
| 795 |
+
"xmlXPathObjectPtr": "xpathObjectRet(%s)",
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
primary_classes = ["xmlNode", "xmlDoc"]
|
| 799 |
+
|
| 800 |
+
classes_ancestor = {
|
| 801 |
+
"xmlNode" : "xmlCore",
|
| 802 |
+
"xmlDtd" : "xmlNode",
|
| 803 |
+
"xmlDoc" : "xmlNode",
|
| 804 |
+
"xmlAttr" : "xmlNode",
|
| 805 |
+
"xmlNs" : "xmlNode",
|
| 806 |
+
"xmlEntity" : "xmlNode",
|
| 807 |
+
"xmlElement" : "xmlNode",
|
| 808 |
+
"xmlAttribute" : "xmlNode",
|
| 809 |
+
"outputBuffer": "ioWriteWrapper",
|
| 810 |
+
"inputBuffer": "ioReadWrapper",
|
| 811 |
+
"parserCtxt": "parserCtxtCore",
|
| 812 |
+
"xmlTextReader": "xmlTextReaderCore",
|
| 813 |
+
"ValidCtxt": "ValidCtxtCore",
|
| 814 |
+
"SchemaValidCtxt": "SchemaValidCtxtCore",
|
| 815 |
+
"relaxNgValidCtxt": "relaxNgValidCtxtCore",
|
| 816 |
+
}
|
| 817 |
+
classes_destructors = {
|
| 818 |
+
"parserCtxt": "xmlFreeParserCtxt",
|
| 819 |
+
"catalog": "xmlFreeCatalog",
|
| 820 |
+
"URI": "xmlFreeURI",
|
| 821 |
+
# "outputBuffer": "xmlOutputBufferClose",
|
| 822 |
+
"inputBuffer": "xmlFreeParserInputBuffer",
|
| 823 |
+
"xmlReg": "xmlRegFreeRegexp",
|
| 824 |
+
"xmlTextReader": "xmlFreeTextReader",
|
| 825 |
+
"relaxNgSchema": "xmlRelaxNGFree",
|
| 826 |
+
"relaxNgParserCtxt": "xmlRelaxNGFreeParserCtxt",
|
| 827 |
+
"relaxNgValidCtxt": "xmlRelaxNGFreeValidCtxt",
|
| 828 |
+
"Schema": "xmlSchemaFree",
|
| 829 |
+
"SchemaParserCtxt": "xmlSchemaFreeParserCtxt",
|
| 830 |
+
"SchemaValidCtxt": "xmlSchemaFreeValidCtxt",
|
| 831 |
+
"ValidCtxt": "xmlFreeValidCtxt",
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
functions_noexcept = {
|
| 835 |
+
"xmlHasProp": 1,
|
| 836 |
+
"xmlHasNsProp": 1,
|
| 837 |
+
"xmlDocSetRootElement": 1,
|
| 838 |
+
"xmlNodeGetNs": 1,
|
| 839 |
+
"xmlNodeGetNsDefs": 1,
|
| 840 |
+
"xmlNextElementSibling": 1,
|
| 841 |
+
"xmlPreviousElementSibling": 1,
|
| 842 |
+
"xmlFirstElementChild": 1,
|
| 843 |
+
"xmlLastElementChild": 1,
|
| 844 |
+
}
|
| 845 |
+
|
| 846 |
+
reference_keepers = {
|
| 847 |
+
"xmlTextReader": [('inputBuffer', 'input')],
|
| 848 |
+
"relaxNgValidCtxt": [('relaxNgSchema', 'schema')],
|
| 849 |
+
"SchemaValidCtxt": [('Schema', 'schema')],
|
| 850 |
+
}
|
| 851 |
+
|
| 852 |
+
function_classes = {}
|
| 853 |
+
|
| 854 |
+
function_classes["None"] = []
|
| 855 |
+
|
| 856 |
+
def nameFixup(name, classe, type, file):
|
| 857 |
+
listname = classe + "List"
|
| 858 |
+
ll = len(listname)
|
| 859 |
+
l = len(classe)
|
| 860 |
+
if name[0:l] == listname:
|
| 861 |
+
func = name[l:]
|
| 862 |
+
func = func[0:1].lower() + func[1:]
|
| 863 |
+
elif name[0:12] == "xmlParserGet" and file == "python_accessor":
|
| 864 |
+
func = name[12:]
|
| 865 |
+
func = func[0:1].lower() + func[1:]
|
| 866 |
+
elif name[0:12] == "xmlParserSet" and file == "python_accessor":
|
| 867 |
+
func = name[12:]
|
| 868 |
+
func = func[0:1].lower() + func[1:]
|
| 869 |
+
elif name[0:10] == "xmlNodeGet" and file == "python_accessor":
|
| 870 |
+
func = name[10:]
|
| 871 |
+
func = func[0:1].lower() + func[1:]
|
| 872 |
+
elif name[0:9] == "xmlURIGet" and file == "python_accessor":
|
| 873 |
+
func = name[9:]
|
| 874 |
+
func = func[0:1].lower() + func[1:]
|
| 875 |
+
elif name[0:9] == "xmlURISet" and file == "python_accessor":
|
| 876 |
+
func = name[6:]
|
| 877 |
+
func = func[0:1].lower() + func[1:]
|
| 878 |
+
elif name[0:11] == "xmlErrorGet" and file == "python_accessor":
|
| 879 |
+
func = name[11:]
|
| 880 |
+
func = func[0:1].lower() + func[1:]
|
| 881 |
+
elif name[0:17] == "xmlXPathParserGet" and file == "python_accessor":
|
| 882 |
+
func = name[17:]
|
| 883 |
+
func = func[0:1].lower() + func[1:]
|
| 884 |
+
elif name[0:11] == "xmlXPathGet" and file == "python_accessor":
|
| 885 |
+
func = name[11:]
|
| 886 |
+
func = func[0:1].lower() + func[1:]
|
| 887 |
+
elif name[0:11] == "xmlXPathSet" and file == "python_accessor":
|
| 888 |
+
func = name[8:]
|
| 889 |
+
func = func[0:1].lower() + func[1:]
|
| 890 |
+
elif name[0:15] == "xmlOutputBuffer" and file != "python":
|
| 891 |
+
func = name[15:]
|
| 892 |
+
func = func[0:1].lower() + func[1:]
|
| 893 |
+
elif name[0:20] == "xmlParserInputBuffer" and file != "python":
|
| 894 |
+
func = name[20:]
|
| 895 |
+
func = func[0:1].lower() + func[1:]
|
| 896 |
+
elif name[0:9] == "xmlRegexp" and file == "xmlregexp":
|
| 897 |
+
func = "regexp" + name[9:]
|
| 898 |
+
elif name[0:6] == "xmlReg" and file == "xmlregexp":
|
| 899 |
+
func = "regexp" + name[6:]
|
| 900 |
+
elif name[0:20] == "xmlTextReaderLocator" and file == "xmlreader":
|
| 901 |
+
func = name[20:]
|
| 902 |
+
elif name[0:18] == "xmlTextReaderConst" and file == "xmlreader":
|
| 903 |
+
func = name[18:]
|
| 904 |
+
elif name[0:13] == "xmlTextReader" and file == "xmlreader":
|
| 905 |
+
func = name[13:]
|
| 906 |
+
elif name[0:12] == "xmlReaderNew" and file == "xmlreader":
|
| 907 |
+
func = name[9:]
|
| 908 |
+
elif name[0:11] == "xmlACatalog":
|
| 909 |
+
func = name[11:]
|
| 910 |
+
func = func[0:1].lower() + func[1:]
|
| 911 |
+
elif name[0:l] == classe:
|
| 912 |
+
func = name[l:]
|
| 913 |
+
func = func[0:1].lower() + func[1:]
|
| 914 |
+
elif name[0:7] == "libxml_":
|
| 915 |
+
func = name[7:]
|
| 916 |
+
func = func[0:1].lower() + func[1:]
|
| 917 |
+
elif name[0:6] == "xmlGet":
|
| 918 |
+
func = name[6:]
|
| 919 |
+
func = func[0:1].lower() + func[1:]
|
| 920 |
+
elif name[0:3] == "xml":
|
| 921 |
+
func = name[3:]
|
| 922 |
+
func = func[0:1].lower() + func[1:]
|
| 923 |
+
else:
|
| 924 |
+
func = name
|
| 925 |
+
if func[0:5] == "xPath":
|
| 926 |
+
func = "xpath" + func[5:]
|
| 927 |
+
elif func[0:4] == "xPtr":
|
| 928 |
+
func = "xpointer" + func[4:]
|
| 929 |
+
elif func[0:8] == "xInclude":
|
| 930 |
+
func = "xinclude" + func[8:]
|
| 931 |
+
elif func[0:2] == "iD":
|
| 932 |
+
func = "ID" + func[2:]
|
| 933 |
+
elif func[0:3] == "uRI":
|
| 934 |
+
func = "URI" + func[3:]
|
| 935 |
+
elif func[0:4] == "uTF8":
|
| 936 |
+
func = "UTF8" + func[4:]
|
| 937 |
+
elif func[0:3] == 'sAX':
|
| 938 |
+
func = "SAX" + func[3:]
|
| 939 |
+
return func
|
| 940 |
+
|
| 941 |
+
|
| 942 |
+
def functionCompare(info1, info2):
|
| 943 |
+
(index1, func1, name1, ret1, args1, file1) = info1
|
| 944 |
+
(index2, func2, name2, ret2, args2, file2) = info2
|
| 945 |
+
if file1 == file2:
|
| 946 |
+
if func1 < func2:
|
| 947 |
+
return -1
|
| 948 |
+
if func1 > func2:
|
| 949 |
+
return 1
|
| 950 |
+
if file1 == "python_accessor":
|
| 951 |
+
return -1
|
| 952 |
+
if file2 == "python_accessor":
|
| 953 |
+
return 1
|
| 954 |
+
if file1 < file2:
|
| 955 |
+
return -1
|
| 956 |
+
if file1 > file2:
|
| 957 |
+
return 1
|
| 958 |
+
return 0
|
| 959 |
+
|
| 960 |
+
def cmp_to_key(mycmp):
|
| 961 |
+
'Convert a cmp= function into a key= function'
|
| 962 |
+
class K(object):
|
| 963 |
+
def __init__(self, obj, *args):
|
| 964 |
+
self.obj = obj
|
| 965 |
+
def __lt__(self, other):
|
| 966 |
+
return mycmp(self.obj, other.obj) < 0
|
| 967 |
+
def __gt__(self, other):
|
| 968 |
+
return mycmp(self.obj, other.obj) > 0
|
| 969 |
+
def __eq__(self, other):
|
| 970 |
+
return mycmp(self.obj, other.obj) == 0
|
| 971 |
+
def __le__(self, other):
|
| 972 |
+
return mycmp(self.obj, other.obj) <= 0
|
| 973 |
+
def __ge__(self, other):
|
| 974 |
+
return mycmp(self.obj, other.obj) >= 0
|
| 975 |
+
def __ne__(self, other):
|
| 976 |
+
return mycmp(self.obj, other.obj) != 0
|
| 977 |
+
return K
|
| 978 |
+
def writeDoc(name, args, indent, output):
|
| 979 |
+
if functions[name][0] is None or functions[name][0] == "":
|
| 980 |
+
return
|
| 981 |
+
val = functions[name][0]
|
| 982 |
+
val = val.replace("NULL", "None")
|
| 983 |
+
output.write(indent)
|
| 984 |
+
output.write('"""')
|
| 985 |
+
while len(val) > 60:
|
| 986 |
+
if val[0] == " ":
|
| 987 |
+
val = val[1:]
|
| 988 |
+
continue
|
| 989 |
+
str = val[0:60]
|
| 990 |
+
i = str.rfind(" ")
|
| 991 |
+
if i < 0:
|
| 992 |
+
i = 60
|
| 993 |
+
str = val[0:i]
|
| 994 |
+
val = val[i:]
|
| 995 |
+
output.write(str)
|
| 996 |
+
output.write('\n ')
|
| 997 |
+
output.write(indent)
|
| 998 |
+
output.write(val)
|
| 999 |
+
output.write(' """\n')
|
| 1000 |
+
|
| 1001 |
+
def buildWrappers():
|
| 1002 |
+
global ctypes
|
| 1003 |
+
global py_types
|
| 1004 |
+
global py_return_types
|
| 1005 |
+
global unknown_types
|
| 1006 |
+
global functions
|
| 1007 |
+
global function_classes
|
| 1008 |
+
global classes_type
|
| 1009 |
+
global classes_list
|
| 1010 |
+
global converter_type
|
| 1011 |
+
global primary_classes
|
| 1012 |
+
global converter_type
|
| 1013 |
+
global classes_ancestor
|
| 1014 |
+
global converter_type
|
| 1015 |
+
global primary_classes
|
| 1016 |
+
global classes_ancestor
|
| 1017 |
+
global classes_destructors
|
| 1018 |
+
global functions_noexcept
|
| 1019 |
+
|
| 1020 |
+
for type in classes_type.keys():
|
| 1021 |
+
function_classes[classes_type[type][2]] = []
|
| 1022 |
+
|
| 1023 |
+
#
|
| 1024 |
+
# Build the list of C types to look for ordered to start
|
| 1025 |
+
# with primary classes
|
| 1026 |
+
#
|
| 1027 |
+
ctypes = []
|
| 1028 |
+
classes_list = []
|
| 1029 |
+
ctypes_processed = {}
|
| 1030 |
+
classes_processed = {}
|
| 1031 |
+
for classe in primary_classes:
|
| 1032 |
+
classes_list.append(classe)
|
| 1033 |
+
classes_processed[classe] = ()
|
| 1034 |
+
for type in classes_type.keys():
|
| 1035 |
+
tinfo = classes_type[type]
|
| 1036 |
+
if tinfo[2] == classe:
|
| 1037 |
+
ctypes.append(type)
|
| 1038 |
+
ctypes_processed[type] = ()
|
| 1039 |
+
for type in sorted(classes_type.keys()):
|
| 1040 |
+
if type in ctypes_processed:
|
| 1041 |
+
continue
|
| 1042 |
+
tinfo = classes_type[type]
|
| 1043 |
+
if tinfo[2] not in classes_processed:
|
| 1044 |
+
classes_list.append(tinfo[2])
|
| 1045 |
+
classes_processed[tinfo[2]] = ()
|
| 1046 |
+
|
| 1047 |
+
ctypes.append(type)
|
| 1048 |
+
ctypes_processed[type] = ()
|
| 1049 |
+
|
| 1050 |
+
for name in functions.keys():
|
| 1051 |
+
found = 0
|
| 1052 |
+
(desc, ret, args, file, cond) = functions[name]
|
| 1053 |
+
for type in ctypes:
|
| 1054 |
+
classe = classes_type[type][2]
|
| 1055 |
+
|
| 1056 |
+
if name[0:3] == "xml" and len(args) >= 1 and args[0][1] == type:
|
| 1057 |
+
found = 1
|
| 1058 |
+
func = nameFixup(name, classe, type, file)
|
| 1059 |
+
info = (0, func, name, ret, args, file)
|
| 1060 |
+
function_classes[classe].append(info)
|
| 1061 |
+
elif name[0:3] == "xml" and len(args) >= 2 and args[1][1] == type \
|
| 1062 |
+
and file != "python_accessor":
|
| 1063 |
+
found = 1
|
| 1064 |
+
func = nameFixup(name, classe, type, file)
|
| 1065 |
+
info = (1, func, name, ret, args, file)
|
| 1066 |
+
function_classes[classe].append(info)
|
| 1067 |
+
elif name[0:4] == "html" and len(args) >= 1 and args[0][1] == type:
|
| 1068 |
+
found = 1
|
| 1069 |
+
func = nameFixup(name, classe, type, file)
|
| 1070 |
+
info = (0, func, name, ret, args, file)
|
| 1071 |
+
function_classes[classe].append(info)
|
| 1072 |
+
elif name[0:4] == "html" and len(args) >= 2 and args[1][1] == type \
|
| 1073 |
+
and file != "python_accessor":
|
| 1074 |
+
found = 1
|
| 1075 |
+
func = nameFixup(name, classe, type, file)
|
| 1076 |
+
info = (1, func, name, ret, args, file)
|
| 1077 |
+
function_classes[classe].append(info)
|
| 1078 |
+
if found == 1:
|
| 1079 |
+
continue
|
| 1080 |
+
if name[0:8] == "xmlXPath":
|
| 1081 |
+
continue
|
| 1082 |
+
if name[0:6] == "xmlStr":
|
| 1083 |
+
continue
|
| 1084 |
+
if name[0:10] == "xmlCharStr":
|
| 1085 |
+
continue
|
| 1086 |
+
func = nameFixup(name, "None", file, file)
|
| 1087 |
+
info = (0, func, name, ret, args, file)
|
| 1088 |
+
function_classes['None'].append(info)
|
| 1089 |
+
|
| 1090 |
+
classes = open("libxml2class.py", "w")
|
| 1091 |
+
txt = open("libxml2class.txt", "w")
|
| 1092 |
+
txt.write(" Generated Classes for libxml2-python\n\n")
|
| 1093 |
+
|
| 1094 |
+
txt.write("#\n# Global functions of the module\n#\n\n")
|
| 1095 |
+
if "None" in function_classes:
|
| 1096 |
+
flist = function_classes["None"]
|
| 1097 |
+
flist = sorted(flist, key=cmp_to_key(functionCompare))
|
| 1098 |
+
oldfile = ""
|
| 1099 |
+
for info in flist:
|
| 1100 |
+
(index, func, name, ret, args, file) = info
|
| 1101 |
+
if file != oldfile:
|
| 1102 |
+
classes.write("#\n# Functions from module %s\n#\n\n" % file)
|
| 1103 |
+
txt.write("\n# functions from module %s\n" % file)
|
| 1104 |
+
oldfile = file
|
| 1105 |
+
classes.write("def %s(" % func)
|
| 1106 |
+
txt.write("%s()\n" % func)
|
| 1107 |
+
n = 0
|
| 1108 |
+
for arg in args:
|
| 1109 |
+
if n != 0:
|
| 1110 |
+
classes.write(", ")
|
| 1111 |
+
classes.write("%s" % arg[0])
|
| 1112 |
+
n = n + 1
|
| 1113 |
+
classes.write("):\n")
|
| 1114 |
+
writeDoc(name, args, ' ', classes)
|
| 1115 |
+
|
| 1116 |
+
for arg in args:
|
| 1117 |
+
if arg[1] in classes_type:
|
| 1118 |
+
classes.write(" if %s is None: %s__o = None\n" %
|
| 1119 |
+
(arg[0], arg[0]))
|
| 1120 |
+
classes.write(" else: %s__o = %s%s\n" %
|
| 1121 |
+
(arg[0], arg[0], classes_type[arg[1]][0]))
|
| 1122 |
+
if arg[1] in py_types:
|
| 1123 |
+
(f, t, n, c) = py_types[arg[1]]
|
| 1124 |
+
if t == "File":
|
| 1125 |
+
classes.write(" if %s is not None: %s.flush()\n" % (
|
| 1126 |
+
arg[0], arg[0]))
|
| 1127 |
+
|
| 1128 |
+
if ret[0] != "void":
|
| 1129 |
+
classes.write(" ret = ")
|
| 1130 |
+
else:
|
| 1131 |
+
classes.write(" ")
|
| 1132 |
+
classes.write("libxml2mod.%s(" % name)
|
| 1133 |
+
n = 0
|
| 1134 |
+
for arg in args:
|
| 1135 |
+
if n != 0:
|
| 1136 |
+
classes.write(", ")
|
| 1137 |
+
classes.write("%s" % arg[0])
|
| 1138 |
+
if arg[1] in classes_type:
|
| 1139 |
+
classes.write("__o")
|
| 1140 |
+
n = n + 1
|
| 1141 |
+
classes.write(")\n")
|
| 1142 |
+
|
| 1143 |
+
# This may be needed to reposition the I/O, but likely to cause more harm
|
| 1144 |
+
# than good. Those changes in Python3 really break the model.
|
| 1145 |
+
# for arg in args:
|
| 1146 |
+
# if arg[1] in py_types:
|
| 1147 |
+
# (f, t, n, c) = py_types[arg[1]]
|
| 1148 |
+
# if t == "File":
|
| 1149 |
+
# classes.write(" if %s is not None: %s.seek(0,0)\n"%(
|
| 1150 |
+
# arg[0], arg[0]))
|
| 1151 |
+
|
| 1152 |
+
if ret[0] != "void":
|
| 1153 |
+
if ret[0] in classes_type:
|
| 1154 |
+
#
|
| 1155 |
+
# Raise an exception
|
| 1156 |
+
#
|
| 1157 |
+
if name in functions_noexcept:
|
| 1158 |
+
classes.write(" if ret is None:return None\n")
|
| 1159 |
+
elif name.find("URI") >= 0:
|
| 1160 |
+
classes.write(
|
| 1161 |
+
" if ret is None:raise uriError('%s() failed')\n"
|
| 1162 |
+
% (name))
|
| 1163 |
+
elif name.find("XPath") >= 0:
|
| 1164 |
+
classes.write(
|
| 1165 |
+
" if ret is None:raise xpathError('%s() failed')\n"
|
| 1166 |
+
% (name))
|
| 1167 |
+
elif name.find("Parse") >= 0:
|
| 1168 |
+
classes.write(
|
| 1169 |
+
" if ret is None:raise parserError('%s() failed')\n"
|
| 1170 |
+
% (name))
|
| 1171 |
+
else:
|
| 1172 |
+
classes.write(
|
| 1173 |
+
" if ret is None:raise treeError('%s() failed')\n"
|
| 1174 |
+
% (name))
|
| 1175 |
+
classes.write(" return ")
|
| 1176 |
+
classes.write(classes_type[ret[0]][1] % ("ret"))
|
| 1177 |
+
classes.write("\n")
|
| 1178 |
+
else:
|
| 1179 |
+
classes.write(" return ret\n")
|
| 1180 |
+
classes.write("\n")
|
| 1181 |
+
|
| 1182 |
+
txt.write("\n\n#\n# Set of classes of the module\n#\n\n")
|
| 1183 |
+
for classname in classes_list:
|
| 1184 |
+
if classname == "None":
|
| 1185 |
+
pass
|
| 1186 |
+
else:
|
| 1187 |
+
if classname in classes_ancestor:
|
| 1188 |
+
txt.write("\n\nClass %s(%s)\n" % (classname,
|
| 1189 |
+
classes_ancestor[classname]))
|
| 1190 |
+
classes.write("class %s(%s):\n" % (classname,
|
| 1191 |
+
classes_ancestor[classname]))
|
| 1192 |
+
classes.write(" def __init__(self, _obj=None):\n")
|
| 1193 |
+
if classes_ancestor[classname] == "xmlCore" or \
|
| 1194 |
+
classes_ancestor[classname] == "xmlNode":
|
| 1195 |
+
classes.write(" if checkWrapper(_obj) != 0:")
|
| 1196 |
+
classes.write(" raise TypeError")
|
| 1197 |
+
classes.write("('%s got a wrong wrapper object type')\n" % \
|
| 1198 |
+
classname)
|
| 1199 |
+
if classname in reference_keepers:
|
| 1200 |
+
rlist = reference_keepers[classname]
|
| 1201 |
+
for ref in rlist:
|
| 1202 |
+
classes.write(" self.%s = None\n" % ref[1])
|
| 1203 |
+
classes.write(" self._o = _obj\n")
|
| 1204 |
+
classes.write(" %s.__init__(self, _obj=_obj)\n\n" % (
|
| 1205 |
+
classes_ancestor[classname]))
|
| 1206 |
+
if classes_ancestor[classname] == "xmlCore" or \
|
| 1207 |
+
classes_ancestor[classname] == "xmlNode":
|
| 1208 |
+
classes.write(" def __repr__(self):\n")
|
| 1209 |
+
format = "<%s (%%s) object at 0x%%x>" % (classname)
|
| 1210 |
+
classes.write(" return \"%s\" %% (self.name, int(pos_id (self)))\n\n" % (
|
| 1211 |
+
format))
|
| 1212 |
+
else:
|
| 1213 |
+
txt.write("Class %s()\n" % (classname))
|
| 1214 |
+
classes.write("class %s:\n" % (classname))
|
| 1215 |
+
classes.write(" def __init__(self, _obj=None):\n")
|
| 1216 |
+
if classname in reference_keepers:
|
| 1217 |
+
list = reference_keepers[classname]
|
| 1218 |
+
for ref in list:
|
| 1219 |
+
classes.write(" self.%s = None\n" % ref[1])
|
| 1220 |
+
classes.write(" if _obj != None:self._o = _obj;return\n")
|
| 1221 |
+
classes.write(" self._o = None\n\n")
|
| 1222 |
+
destruct=None
|
| 1223 |
+
if classname in classes_destructors:
|
| 1224 |
+
classes.write(" def __del__(self):\n")
|
| 1225 |
+
classes.write(" if self._o != None:\n")
|
| 1226 |
+
classes.write(" libxml2mod.%s(self._o)\n" %
|
| 1227 |
+
classes_destructors[classname])
|
| 1228 |
+
classes.write(" self._o = None\n\n")
|
| 1229 |
+
destruct=classes_destructors[classname]
|
| 1230 |
+
flist = function_classes[classname]
|
| 1231 |
+
flist = sorted(flist, key=cmp_to_key(functionCompare))
|
| 1232 |
+
oldfile = ""
|
| 1233 |
+
for info in flist:
|
| 1234 |
+
(index, func, name, ret, args, file) = info
|
| 1235 |
+
#
|
| 1236 |
+
# Do not provide as method the destructors for the class
|
| 1237 |
+
# to avoid double free
|
| 1238 |
+
#
|
| 1239 |
+
if name == destruct:
|
| 1240 |
+
continue
|
| 1241 |
+
if file != oldfile:
|
| 1242 |
+
if file == "python_accessor":
|
| 1243 |
+
classes.write(" # accessors for %s\n" % (classname))
|
| 1244 |
+
txt.write(" # accessors\n")
|
| 1245 |
+
else:
|
| 1246 |
+
classes.write(" #\n")
|
| 1247 |
+
classes.write(" # %s functions from module %s\n" % (
|
| 1248 |
+
classname, file))
|
| 1249 |
+
txt.write("\n # functions from module %s\n" % file)
|
| 1250 |
+
classes.write(" #\n\n")
|
| 1251 |
+
oldfile = file
|
| 1252 |
+
classes.write(" def %s(self" % func)
|
| 1253 |
+
txt.write(" %s()\n" % func)
|
| 1254 |
+
n = 0
|
| 1255 |
+
for arg in args:
|
| 1256 |
+
if n != index:
|
| 1257 |
+
classes.write(", %s" % arg[0])
|
| 1258 |
+
n = n + 1
|
| 1259 |
+
classes.write("):\n")
|
| 1260 |
+
writeDoc(name, args, ' ', classes)
|
| 1261 |
+
n = 0
|
| 1262 |
+
for arg in args:
|
| 1263 |
+
if arg[1] in classes_type:
|
| 1264 |
+
if n != index:
|
| 1265 |
+
classes.write(" if %s is None: %s__o = None\n" %
|
| 1266 |
+
(arg[0], arg[0]))
|
| 1267 |
+
classes.write(" else: %s__o = %s%s\n" %
|
| 1268 |
+
(arg[0], arg[0], classes_type[arg[1]][0]))
|
| 1269 |
+
n = n + 1
|
| 1270 |
+
if ret[0] != "void":
|
| 1271 |
+
classes.write(" ret = ")
|
| 1272 |
+
else:
|
| 1273 |
+
classes.write(" ")
|
| 1274 |
+
classes.write("libxml2mod.%s(" % name)
|
| 1275 |
+
n = 0
|
| 1276 |
+
for arg in args:
|
| 1277 |
+
if n != 0:
|
| 1278 |
+
classes.write(", ")
|
| 1279 |
+
if n != index:
|
| 1280 |
+
classes.write("%s" % arg[0])
|
| 1281 |
+
if arg[1] in classes_type:
|
| 1282 |
+
classes.write("__o")
|
| 1283 |
+
else:
|
| 1284 |
+
classes.write("self")
|
| 1285 |
+
if arg[1] in classes_type:
|
| 1286 |
+
classes.write(classes_type[arg[1]][0])
|
| 1287 |
+
n = n + 1
|
| 1288 |
+
classes.write(")\n")
|
| 1289 |
+
if ret[0] != "void":
|
| 1290 |
+
if ret[0] in classes_type:
|
| 1291 |
+
#
|
| 1292 |
+
# Raise an exception
|
| 1293 |
+
#
|
| 1294 |
+
if name in functions_noexcept:
|
| 1295 |
+
classes.write(
|
| 1296 |
+
" if ret is None:return None\n")
|
| 1297 |
+
elif name.find("URI") >= 0:
|
| 1298 |
+
classes.write(
|
| 1299 |
+
" if ret is None:raise uriError('%s() failed')\n"
|
| 1300 |
+
% (name))
|
| 1301 |
+
elif name.find("XPath") >= 0:
|
| 1302 |
+
classes.write(
|
| 1303 |
+
" if ret is None:raise xpathError('%s() failed')\n"
|
| 1304 |
+
% (name))
|
| 1305 |
+
elif name.find("Parse") >= 0:
|
| 1306 |
+
classes.write(
|
| 1307 |
+
" if ret is None:raise parserError('%s() failed')\n"
|
| 1308 |
+
% (name))
|
| 1309 |
+
else:
|
| 1310 |
+
classes.write(
|
| 1311 |
+
" if ret is None:raise treeError('%s() failed')\n"
|
| 1312 |
+
% (name))
|
| 1313 |
+
|
| 1314 |
+
#
|
| 1315 |
+
# generate the returned class wrapper for the object
|
| 1316 |
+
#
|
| 1317 |
+
classes.write(" __tmp = ")
|
| 1318 |
+
classes.write(classes_type[ret[0]][1] % ("ret"))
|
| 1319 |
+
classes.write("\n")
|
| 1320 |
+
|
| 1321 |
+
#
|
| 1322 |
+
# Sometime one need to keep references of the source
|
| 1323 |
+
# class in the returned class object.
|
| 1324 |
+
# See reference_keepers for the list
|
| 1325 |
+
#
|
| 1326 |
+
tclass = classes_type[ret[0]][2]
|
| 1327 |
+
if tclass in reference_keepers:
|
| 1328 |
+
list = reference_keepers[tclass]
|
| 1329 |
+
for pref in list:
|
| 1330 |
+
if pref[0] == classname:
|
| 1331 |
+
classes.write(" __tmp.%s = self\n" %
|
| 1332 |
+
pref[1])
|
| 1333 |
+
#
|
| 1334 |
+
# return the class
|
| 1335 |
+
#
|
| 1336 |
+
classes.write(" return __tmp\n")
|
| 1337 |
+
elif ret[0] in converter_type:
|
| 1338 |
+
#
|
| 1339 |
+
# Raise an exception
|
| 1340 |
+
#
|
| 1341 |
+
if name in functions_noexcept:
|
| 1342 |
+
classes.write(
|
| 1343 |
+
" if ret is None:return None")
|
| 1344 |
+
elif name.find("URI") >= 0:
|
| 1345 |
+
classes.write(
|
| 1346 |
+
" if ret is None:raise uriError('%s() failed')\n"
|
| 1347 |
+
% (name))
|
| 1348 |
+
elif name.find("XPath") >= 0:
|
| 1349 |
+
classes.write(
|
| 1350 |
+
" if ret is None:raise xpathError('%s() failed')\n"
|
| 1351 |
+
% (name))
|
| 1352 |
+
elif name.find("Parse") >= 0:
|
| 1353 |
+
classes.write(
|
| 1354 |
+
" if ret is None:raise parserError('%s() failed')\n"
|
| 1355 |
+
% (name))
|
| 1356 |
+
else:
|
| 1357 |
+
classes.write(
|
| 1358 |
+
" if ret is None:raise treeError('%s() failed')\n"
|
| 1359 |
+
% (name))
|
| 1360 |
+
classes.write(" return ")
|
| 1361 |
+
classes.write(converter_type[ret[0]] % ("ret"))
|
| 1362 |
+
classes.write("\n")
|
| 1363 |
+
else:
|
| 1364 |
+
classes.write(" return ret\n")
|
| 1365 |
+
classes.write("\n")
|
| 1366 |
+
|
| 1367 |
+
#
|
| 1368 |
+
# Generate enum constants
|
| 1369 |
+
#
|
| 1370 |
+
for type,enum in enums.items():
|
| 1371 |
+
classes.write("# %s\n" % type)
|
| 1372 |
+
items = enum.items()
|
| 1373 |
+
items = sorted(items, key=(lambda i: int(i[1])))
|
| 1374 |
+
for name,value in items:
|
| 1375 |
+
classes.write("%s = %s\n" % (name,value))
|
| 1376 |
+
classes.write("\n")
|
| 1377 |
+
|
| 1378 |
+
txt.close()
|
| 1379 |
+
classes.close()
|
| 1380 |
+
|
| 1381 |
+
buildStubs()
|
| 1382 |
+
buildWrappers()
|
local-test-libxml2-delta-02/afc-libxml2/python/libxml.c
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
local-test-libxml2-delta-02/afc-libxml2/python/libxml2-python-api.xml
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
| 2 |
+
<api name='libxml2-python'>
|
| 3 |
+
<symbols>
|
| 4 |
+
<function name='xmlRegisterXPathFunction' file='python'>
|
| 5 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 6 |
+
<info>Register a Python written function to the XPath interpreter</info>
|
| 7 |
+
<return type='int' info="1 in case of success, 0 or -1 in case of error"/>
|
| 8 |
+
<arg name='ctx' type='xmlXPathContextPtr' info='the xpathContext'/>
|
| 9 |
+
<arg name='name' type='xmlChar *' info='the function name'/>
|
| 10 |
+
<arg name='ns_uri' type='xmlChar *' info='the namespace or NULL'/>
|
| 11 |
+
<arg name='f' type='pythonObject' info='the python function'/>
|
| 12 |
+
</function>
|
| 13 |
+
<function name='xmlXPathRegisterVariable' file='python'>
|
| 14 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 15 |
+
<info>Register a variable with the XPath context</info>
|
| 16 |
+
<return type='int' info="1 in case of success, 0 or -1 in case of error"/>
|
| 17 |
+
<arg name='ctx' type='xmlXPathContextPtr' info='the xpathContext'/>
|
| 18 |
+
<arg name='name' type='xmlChar *' info='the variable name'/>
|
| 19 |
+
<arg name='ns_uri' type='xmlChar *' info='the namespace or NULL'/>
|
| 20 |
+
<arg name='value' type='pythonObject' info='the value'/>
|
| 21 |
+
</function>
|
| 22 |
+
<function name='xmlNewNode' file='python'>
|
| 23 |
+
<info>Create a new Node</info>
|
| 24 |
+
<return type='xmlNodePtr' info="A new element node"/>
|
| 25 |
+
<arg name='name' type='xmlChar *' info='the node name'/>
|
| 26 |
+
</function>
|
| 27 |
+
<function name='xmlCreatePushParser' file='python'>
|
| 28 |
+
<info>Create a progressive XML parser context to build either an event flow if the SAX object is not None, or a DOM tree otherwise.</info>
|
| 29 |
+
<return type='xmlParserCtxtPtr' info="the parser context or None in case of error"/>
|
| 30 |
+
<arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
|
| 31 |
+
<arg name='chunk' type='xmlChar *' info='the initial data'/>
|
| 32 |
+
<arg name='size' type='int' info='the size of the initial data'/>
|
| 33 |
+
<arg name='URI' type='xmlChar *' info='The URI used for base computations'/>
|
| 34 |
+
</function>
|
| 35 |
+
<function name='htmlCreatePushParser' file='python'>
|
| 36 |
+
<cond>defined(LIBXML_HTML_ENABLED)</cond>
|
| 37 |
+
<info>Create a progressive HTML parser context to build either an event flow if the SAX object is not None, or a DOM tree otherwise.</info>
|
| 38 |
+
<return type='xmlParserCtxtPtr' info="the parser context or None in case of error"/>
|
| 39 |
+
<arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
|
| 40 |
+
<arg name='chunk' type='xmlChar *' info='the initial data'/>
|
| 41 |
+
<arg name='size' type='int' info='the size of the initial data'/>
|
| 42 |
+
<arg name='URI' type='xmlChar *' info='The URI used for base computations'/>
|
| 43 |
+
</function>
|
| 44 |
+
<function name='xmlSAXParseFile' file='python'>
|
| 45 |
+
<info>Interface to parse an XML file or resource pointed by an URI to build an event flow to the SAX object</info>
|
| 46 |
+
<return type='void'/>
|
| 47 |
+
<arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
|
| 48 |
+
<arg name='URI' type='xmlChar *' info='The URI of the resource'/>
|
| 49 |
+
<arg name='recover' type='int' info='allow recovery in case of error'/>
|
| 50 |
+
</function>
|
| 51 |
+
<function name='htmlSAXParseFile' file='python'>
|
| 52 |
+
<cond>defined(LIBXML_HTML_ENABLED)</cond>
|
| 53 |
+
<info>Interface to parse an HTML file or resource pointed by an URI to build an event flow to the SAX object</info>
|
| 54 |
+
<return type='void'/>
|
| 55 |
+
<arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
|
| 56 |
+
<arg name='URI' type='xmlChar *' info='The URI of the resource'/>
|
| 57 |
+
<arg name='encoding' type='const char *' info='encoding or None'/>
|
| 58 |
+
</function>
|
| 59 |
+
<function name='xmlCreateOutputBuffer' file='python'>
|
| 60 |
+
<info>Create a libxml2 output buffer from a Python file</info>
|
| 61 |
+
<return type='xmlOutputBufferPtr' info="the output buffer"/>
|
| 62 |
+
<arg name='file' type='pythonObject' info='the Python file'/>
|
| 63 |
+
<arg name='encoding' type='xmlChar *' info='an optional encoding'/>
|
| 64 |
+
</function>
|
| 65 |
+
<function name='xmlCreateInputBuffer' file='python'>
|
| 66 |
+
<info>Create a libxml2 input buffer from a Python file</info>
|
| 67 |
+
<return type='xmlParserInputBufferPtr' info="the input buffer"/>
|
| 68 |
+
<arg name='file' type='pythonObject' info='the Python file'/>
|
| 69 |
+
<arg name='encoding' type='xmlChar *' info='an optional encoding'/>
|
| 70 |
+
</function>
|
| 71 |
+
<function name='xmlSetEntityLoader' file='python'>
|
| 72 |
+
<info>Set the entity resolver as a python function</info>
|
| 73 |
+
<return type='int' info="0 in case of success, -1 for error"/>
|
| 74 |
+
<arg name='resolver' type='pythonObject' info='the Python function'/>
|
| 75 |
+
</function>
|
| 76 |
+
<!-- xmlParserCtxtPtr accessors -->
|
| 77 |
+
<function name='xmlParserGetDoc' file='python_accessor'>
|
| 78 |
+
<info>Get the document tree from a parser context.</info>
|
| 79 |
+
<return type='xmlDocPtr' info="the document tree" field="myDoc"/>
|
| 80 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 81 |
+
</function>
|
| 82 |
+
<function name='xmlParserGetWellFormed' file='python_accessor'>
|
| 83 |
+
<info>Get the well formed information from a parser context.</info>
|
| 84 |
+
<return type='int' info="the wellFormed field" field="wellFormed"/>
|
| 85 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 86 |
+
</function>
|
| 87 |
+
<function name='xmlParserGetIsValid' file='python_accessor'>
|
| 88 |
+
<info>Get the validity information from a parser context.</info>
|
| 89 |
+
<return type='int' info="the valid field" field="valid"/>
|
| 90 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 91 |
+
</function>
|
| 92 |
+
<function name='xmlParserSetValidate' file='python_accessor'>
|
| 93 |
+
<info>Switch the parser to validation mode.</info>
|
| 94 |
+
<return type='void'/>
|
| 95 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 96 |
+
<arg name='validate' type='int' info='1 to activate validation'/>
|
| 97 |
+
</function>
|
| 98 |
+
<function name='xmlParserSetReplaceEntities' file='python_accessor'>
|
| 99 |
+
<info>Switch the parser to replace entities.</info>
|
| 100 |
+
<return type='void'/>
|
| 101 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 102 |
+
<arg name='replaceEntities' type='int' info='1 to replace entities'/>
|
| 103 |
+
</function>
|
| 104 |
+
<function name='xmlParserSetPedantic' file='python_accessor'>
|
| 105 |
+
<info>Switch the parser to be pedantic.</info>
|
| 106 |
+
<return type='void'/>
|
| 107 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 108 |
+
<arg name='pedantic' type='int' info='1 to run in pedantic mode'/>
|
| 109 |
+
</function>
|
| 110 |
+
<function name='xmlParserSetLoadSubset' file='python_accessor'>
|
| 111 |
+
<info>Switch the parser to load the DTD without validating.</info>
|
| 112 |
+
<return type='void'/>
|
| 113 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 114 |
+
<arg name='loadsubset' type='int' info='1 to load the DTD'/>
|
| 115 |
+
</function>
|
| 116 |
+
<function name='xmlParserSetLineNumbers' file='python_accessor'>
|
| 117 |
+
<info>Switch on the generation of line number for elements nodes.</info>
|
| 118 |
+
<return type='void'/>
|
| 119 |
+
<arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
|
| 120 |
+
<arg name='linenumbers' type='int' info='1 to save line numbers'/>
|
| 121 |
+
</function>
|
| 122 |
+
<function name='xmlDebugMemory' file='python'>
|
| 123 |
+
<info>Switch on the generation of line number for elements nodes. Also returns the number of bytes allocated and not freed by libxml2 since memory debugging was switched on.</info>
|
| 124 |
+
<return type='int' info="returns the number of bytes allocated and not freed"/>
|
| 125 |
+
<arg name='activate' type='int' info='1 switch on memory debugging 0 switch it off'/>
|
| 126 |
+
</function>
|
| 127 |
+
<!-- xmlNsPtr accessors -->
|
| 128 |
+
<function name='xmlNodeGetNs' file='python_accessor'>
|
| 129 |
+
<info>Get the namespace of a node</info>
|
| 130 |
+
<return type='xmlNsPtr' info="The namespace or None"/>
|
| 131 |
+
<arg name='node' type='xmlNodePtr' info='the node'/>
|
| 132 |
+
</function>
|
| 133 |
+
<function name='xmlNodeGetNsDefs' file='python_accessor'>
|
| 134 |
+
<info>Get the namespace of a node</info>
|
| 135 |
+
<return type='xmlNsPtr' info="The namespace or None"/>
|
| 136 |
+
<arg name='node' type='xmlNodePtr' info='the node'/>
|
| 137 |
+
</function>
|
| 138 |
+
<!-- xmlXPathContextPtr accessors -->
|
| 139 |
+
<function name='xmlXPathParserGetContext' file='python_accessor'>
|
| 140 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 141 |
+
<info>Get the xpathContext from an xpathParserContext</info>
|
| 142 |
+
<return type='xmlXPathContextPtr' info="The XPath context" field="context"/>
|
| 143 |
+
<arg name='ctxt' type='xmlXPathParserContextPtr' info='the XPath parser context'/>
|
| 144 |
+
</function>
|
| 145 |
+
<function name='xmlXPathGetContextDoc' file='python_accessor'>
|
| 146 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 147 |
+
<info>Get the doc from an xpathContext</info>
|
| 148 |
+
<return type='xmlDocPtr' info="The doc context" field="doc"/>
|
| 149 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 150 |
+
</function>
|
| 151 |
+
<function name='xmlXPathGetContextNode' file='python_accessor'>
|
| 152 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 153 |
+
<info>Get the current node from an xpathContext</info>
|
| 154 |
+
<return type='xmlNodePtr' info="The node context" field="node"/>
|
| 155 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 156 |
+
</function>
|
| 157 |
+
<function name='xmlXPathSetContextDoc' file='python_accessor'>
|
| 158 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 159 |
+
<info>Set the doc of an xpathContext</info>
|
| 160 |
+
<return type='void'/>
|
| 161 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 162 |
+
<arg name="doc" type='xmlDocPtr' info="The doc context"/>
|
| 163 |
+
</function>
|
| 164 |
+
<function name='xmlXPathSetContextNode' file='python_accessor'>
|
| 165 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 166 |
+
<info>Set the current node of an xpathContext</info>
|
| 167 |
+
<return type='void'/>
|
| 168 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 169 |
+
<arg name="node" type='xmlNodePtr' info="The node context"/>
|
| 170 |
+
</function>
|
| 171 |
+
<function name='xmlXPathGetContextPosition' file='python_accessor'>
|
| 172 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 173 |
+
<info>Get the current node from an xpathContext</info>
|
| 174 |
+
<return type='int' info="The node context" field="proximityPosition"/>
|
| 175 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 176 |
+
</function>
|
| 177 |
+
<function name='xmlXPathGetContextSize' file='python_accessor'>
|
| 178 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 179 |
+
<info>Get the current node from an xpathContext</info>
|
| 180 |
+
<return type='int' info="The node context" field="contextSize"/>
|
| 181 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 182 |
+
</function>
|
| 183 |
+
<function name='xmlXPathGetFunction' file='python_accessor'>
|
| 184 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 185 |
+
<info>Get the current function name xpathContext</info>
|
| 186 |
+
<return type='const xmlChar *' info="The function name" field="function"/>
|
| 187 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 188 |
+
</function>
|
| 189 |
+
<function name='xmlXPathGetFunctionURI' file='python_accessor'>
|
| 190 |
+
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
|
| 191 |
+
<info>Get the current function name URI xpathContext</info>
|
| 192 |
+
<return type='const xmlChar *' info="The function name URI" field="functionURI"/>
|
| 193 |
+
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
| 194 |
+
</function>
|
| 195 |
+
<!-- xmlURIPtr accessors -->
|
| 196 |
+
<function name='xmlURIGetScheme' file='python_accessor'>
|
| 197 |
+
<info>Get the scheme part from an URI</info>
|
| 198 |
+
<return type='const char *' info="The URI scheme" field="scheme"/>
|
| 199 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 200 |
+
</function>
|
| 201 |
+
<function name='xmlURISetScheme' file='python_accessor'>
|
| 202 |
+
<info>Set the scheme part of an URI.</info>
|
| 203 |
+
<return type='void'/>
|
| 204 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 205 |
+
<arg name='scheme' type='char *' info='The URI scheme part'/>
|
| 206 |
+
</function>
|
| 207 |
+
<function name='xmlURIGetOpaque' file='python_accessor'>
|
| 208 |
+
<info>Get the opaque part from an URI</info>
|
| 209 |
+
<return type='const char *' info="The URI opaque" field="opaque"/>
|
| 210 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 211 |
+
</function>
|
| 212 |
+
<function name='xmlURISetOpaque' file='python_accessor'>
|
| 213 |
+
<info>Set the opaque part of an URI.</info>
|
| 214 |
+
<return type='void'/>
|
| 215 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 216 |
+
<arg name='opaque' type='char *' info='The URI opaque part'/>
|
| 217 |
+
</function>
|
| 218 |
+
<function name='xmlURIGetAuthority' file='python_accessor'>
|
| 219 |
+
<info>Get the authority part from an URI</info>
|
| 220 |
+
<return type='const char *' info="The URI authority" field="authority"/>
|
| 221 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 222 |
+
</function>
|
| 223 |
+
<function name='xmlURISetAuthority' file='python_accessor'>
|
| 224 |
+
<info>Set the authority part of an URI.</info>
|
| 225 |
+
<return type='void'/>
|
| 226 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 227 |
+
<arg name='authority' type='char *' info='The URI authority part'/>
|
| 228 |
+
</function>
|
| 229 |
+
<function name='xmlURIGetServer' file='python_accessor'>
|
| 230 |
+
<info>Get the server part from an URI</info>
|
| 231 |
+
<return type='const char *' info="The URI server" field="server"/>
|
| 232 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 233 |
+
</function>
|
| 234 |
+
<function name='xmlURISetServer' file='python_accessor'>
|
| 235 |
+
<info>Set the server part of an URI.</info>
|
| 236 |
+
<return type='void'/>
|
| 237 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 238 |
+
<arg name='server' type='char *' info='The URI server part'/>
|
| 239 |
+
</function>
|
| 240 |
+
<function name='xmlURIGetUser' file='python_accessor'>
|
| 241 |
+
<info>Get the user part from an URI</info>
|
| 242 |
+
<return type='const char *' info="The URI user" field="user"/>
|
| 243 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 244 |
+
</function>
|
| 245 |
+
<function name='xmlURISetUser' file='python_accessor'>
|
| 246 |
+
<info>Set the user part of an URI.</info>
|
| 247 |
+
<return type='void'/>
|
| 248 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 249 |
+
<arg name='user' type='char *' info='The URI user part'/>
|
| 250 |
+
</function>
|
| 251 |
+
<function name='xmlURIGetPath' file='python_accessor'>
|
| 252 |
+
<info>Get the path part from an URI</info>
|
| 253 |
+
<return type='const char *' info="The URI path" field="path"/>
|
| 254 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 255 |
+
</function>
|
| 256 |
+
<function name='xmlURISetPath' file='python_accessor'>
|
| 257 |
+
<info>Set the path part of an URI.</info>
|
| 258 |
+
<return type='void'/>
|
| 259 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 260 |
+
<arg name='path' type='char *' info='The URI path part'/>
|
| 261 |
+
</function>
|
| 262 |
+
<function name='xmlURIGetQuery' file='python_accessor'>
|
| 263 |
+
<info>Get the query part from an URI</info>
|
| 264 |
+
<return type='const char *' info="The URI query" field="query"/>
|
| 265 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 266 |
+
</function>
|
| 267 |
+
<function name='xmlURISetQuery' file='python_accessor'>
|
| 268 |
+
<info>Set the query part of an URI.</info>
|
| 269 |
+
<return type='void'/>
|
| 270 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 271 |
+
<arg name='query' type='char *' info='The URI query part'/>
|
| 272 |
+
</function>
|
| 273 |
+
<function name='xmlURIGetQueryRaw' file='python_accessor'>
|
| 274 |
+
<info>Get the raw query part from an URI (i.e. the unescaped form).</info>
|
| 275 |
+
<return type='const char *' info="The URI query" field="query_raw"/>
|
| 276 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 277 |
+
</function>
|
| 278 |
+
<function name='xmlURISetQueryRaw' file='python_accessor'>
|
| 279 |
+
<info>Set the raw query part of an URI (i.e. the unescaped form).</info>
|
| 280 |
+
<return type='void'/>
|
| 281 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 282 |
+
<arg name='query_raw' type='char *' info='The raw URI query part'/>
|
| 283 |
+
</function>
|
| 284 |
+
<function name='xmlURIGetFragment' file='python_accessor'>
|
| 285 |
+
<info>Get the fragment part from an URI</info>
|
| 286 |
+
<return type='const char *' info="The URI fragment" field="fragment"/>
|
| 287 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 288 |
+
</function>
|
| 289 |
+
<function name='xmlURISetFragment' file='python_accessor'>
|
| 290 |
+
<info>Set the fragment part of an URI.</info>
|
| 291 |
+
<return type='void'/>
|
| 292 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 293 |
+
<arg name='fragment' type='char *' info='The URI fragment part'/>
|
| 294 |
+
</function>
|
| 295 |
+
<function name='xmlURIGetPort' file='python_accessor'>
|
| 296 |
+
<info>Get the port part from an URI</info>
|
| 297 |
+
<return type='int' info="The URI port" field="port"/>
|
| 298 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 299 |
+
</function>
|
| 300 |
+
<function name='xmlURISetPort' file='python_accessor'>
|
| 301 |
+
<info>Set the port part of an URI.</info>
|
| 302 |
+
<return type='void'/>
|
| 303 |
+
<arg name='URI' type='xmlURIPtr' info='the URI'/>
|
| 304 |
+
<arg name='port' type='int' info='The URI port part'/>
|
| 305 |
+
</function>
|
| 306 |
+
<!-- xmlErrorPtr accessors -->
|
| 307 |
+
<function name='xmlErrorGetDomain' file='python_accessor'>
|
| 308 |
+
<info>What part of the library raised this error</info>
|
| 309 |
+
<return type='int' info="The error domain" field="domain"/>
|
| 310 |
+
<arg name='Error' type='xmlErrorPtr' info='the Error'/>
|
| 311 |
+
</function>
|
| 312 |
+
<function name='xmlErrorGetCode' file='python_accessor'>
|
| 313 |
+
<info>The error code, e.g. an xmlParserError</info>
|
| 314 |
+
<return type='int' info="The error code" field="code"/>
|
| 315 |
+
<arg name='Error' type='xmlErrorPtr' info='the Error'/>
|
| 316 |
+
</function>
|
| 317 |
+
<function name='xmlErrorGetMessage' file='python_accessor'>
|
| 318 |
+
<info>human-readable informative error message</info>
|
| 319 |
+
<return type='const char *' info="The error message" field="message"/>
|
| 320 |
+
<arg name='Error' type='xmlErrorPtr' info='the Error'/>
|
| 321 |
+
</function>
|
| 322 |
+
<function name='xmlErrorGetLevel' file='python_accessor'>
|
| 323 |
+
<info>how consequent is the error</info>
|
| 324 |
+
<return type='int' info="The error level" field="level"/>
|
| 325 |
+
<arg name='Error' type='xmlErrorPtr' info='the Error'/>
|
| 326 |
+
</function>
|
| 327 |
+
<function name='xmlErrorGetFile' file='python_accessor'>
|
| 328 |
+
<info>the filename</info>
|
| 329 |
+
<return type='const char *' info="The error file" field="file"/>
|
| 330 |
+
<arg name='Error' type='xmlErrorPtr' info='the Error'/>
|
| 331 |
+
</function>
|
| 332 |
+
<function name='xmlErrorGetLine' file='python_accessor'>
|
| 333 |
+
<info>the line number if available</info>
|
| 334 |
+
<return type='int' info="The error line" field="line"/>
|
| 335 |
+
<arg name='Error' type='xmlErrorPtr' info='the Error'/>
|
| 336 |
+
</function>
|
| 337 |
+
<function name='xmlPythonCleanupParser' file='python'>
|
| 338 |
+
<info>Cleanup function for the XML library. It tries to reclaim all parsing related global memory allocated for the library processing. It doesn't deallocate any document related memory. Calling this function should not prevent reusing the library but one should call xmlCleanupParser() only when the process has finished using the library or XML document built with it.</info>
|
| 339 |
+
<return type='void'/>
|
| 340 |
+
</function>
|
| 341 |
+
<function name='xmlMemoryUsed' file='python'>
|
| 342 |
+
<info>Returns the total amount of memory allocated by libxml2</info>
|
| 343 |
+
<return type='int' info='number of bytes allocated'/>
|
| 344 |
+
</function>
|
| 345 |
+
</symbols>
|
| 346 |
+
</api>
|
local-test-libxml2-delta-02/afc-libxml2/python/libxml_wrap.h
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include <Python.h>
|
| 2 |
+
#include <libxml/tree.h>
|
| 3 |
+
#include <libxml/parser.h>
|
| 4 |
+
#include <libxml/parserInternals.h>
|
| 5 |
+
#include <libxml/catalog.h>
|
| 6 |
+
#include <libxml/threads.h>
|
| 7 |
+
#include <libxml/nanohttp.h>
|
| 8 |
+
#include <libxml/uri.h>
|
| 9 |
+
#include <libxml/xpath.h>
|
| 10 |
+
#include <libxml/xpathInternals.h>
|
| 11 |
+
#include <libxml/debugXML.h>
|
| 12 |
+
#include <libxml/HTMLparser.h>
|
| 13 |
+
#include <libxml/HTMLtree.h>
|
| 14 |
+
#include <libxml/xinclude.h>
|
| 15 |
+
#include <libxml/xpointer.h>
|
| 16 |
+
#include <libxml/xmlunicode.h>
|
| 17 |
+
#include <libxml/xmlregexp.h>
|
| 18 |
+
#include <libxml/xmlautomata.h>
|
| 19 |
+
#include <libxml/xmlreader.h>
|
| 20 |
+
#include <libxml/globals.h>
|
| 21 |
+
#include <libxml/xmlsave.h>
|
| 22 |
+
#ifdef LIBXML_SCHEMAS_ENABLED
|
| 23 |
+
#include <libxml/relaxng.h>
|
| 24 |
+
#include <libxml/xmlschemas.h>
|
| 25 |
+
#endif
|
| 26 |
+
|
| 27 |
+
/*
|
| 28 |
+
* for older versions of Python, we don't use PyBytes, but keep PyString
|
| 29 |
+
* and don't use Capsule but CObjects
|
| 30 |
+
*/
|
| 31 |
+
#if PY_VERSION_HEX < 0x02070000
|
| 32 |
+
#ifndef PyBytes_Check
|
| 33 |
+
#define PyBytes_Check PyString_Check
|
| 34 |
+
#define PyBytes_Size PyString_Size
|
| 35 |
+
#define PyBytes_AsString PyString_AsString
|
| 36 |
+
#define PyBytes_AS_STRING PyString_AS_STRING
|
| 37 |
+
#define PyBytes_GET_SIZE PyString_GET_SIZE
|
| 38 |
+
#endif
|
| 39 |
+
#ifndef PyCapsule_New
|
| 40 |
+
#define PyCapsule_New PyCObject_FromVoidPtrAndDesc
|
| 41 |
+
#define PyCapsule_CheckExact PyCObject_Check
|
| 42 |
+
#define PyCapsule_GetPointer(o, n) PyCObject_GetDesc((o))
|
| 43 |
+
#endif
|
| 44 |
+
#endif
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* ATTRIBUTE_UNUSED:
|
| 48 |
+
*
|
| 49 |
+
* Macro used to signal to GCC unused function parameters
|
| 50 |
+
* Repeated here since the definition is not available when
|
| 51 |
+
* compiled outside the libxml2 build tree.
|
| 52 |
+
*/
|
| 53 |
+
#if defined(__GNUC__) || defined(__clang__)
|
| 54 |
+
#ifdef ATTRIBUTE_UNUSED
|
| 55 |
+
#undef ATTRIBUTE_UNUSED
|
| 56 |
+
#endif
|
| 57 |
+
#ifndef ATTRIBUTE_UNUSED
|
| 58 |
+
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
| 59 |
+
#endif /* ATTRIBUTE_UNUSED */
|
| 60 |
+
#else
|
| 61 |
+
#define ATTRIBUTE_UNUSED
|
| 62 |
+
#endif
|
| 63 |
+
|
| 64 |
+
/*
|
| 65 |
+
* Macros to ignore deprecation warnings
|
| 66 |
+
*/
|
| 67 |
+
#if defined(__LCC__)
|
| 68 |
+
#define XML_IGNORE_DEPRECATION_WARNINGS \
|
| 69 |
+
_Pragma("diag_suppress 1215")
|
| 70 |
+
#elif defined(__clang__) || \
|
| 71 |
+
(defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406))
|
| 72 |
+
#define XML_IGNORE_DEPRECATION_WARNINGS \
|
| 73 |
+
_Pragma("GCC diagnostic push") \
|
| 74 |
+
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
| 75 |
+
#elif defined (_MSC_VER) && (_MSC_VER >= 1400)
|
| 76 |
+
#define XML_IGNORE_DEPRECATION_WARNINGS \
|
| 77 |
+
__pragma(warning(push)) \
|
| 78 |
+
__pragma(warning(disable : 4996))
|
| 79 |
+
#else
|
| 80 |
+
#define XML_IGNORE_DEPRECATION_WARNINGS
|
| 81 |
+
#endif
|
| 82 |
+
|
| 83 |
+
#define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \
|
| 84 |
+
(((PyxmlNode_Object *)(v))->obj))
|
| 85 |
+
|
| 86 |
+
typedef struct {
|
| 87 |
+
PyObject_HEAD
|
| 88 |
+
xmlNodePtr obj;
|
| 89 |
+
} PyxmlNode_Object;
|
| 90 |
+
|
| 91 |
+
#ifdef LIBXML_XPATH_ENABLED
|
| 92 |
+
#define PyxmlXPathContext_Get(v) (((v) == Py_None) ? NULL : \
|
| 93 |
+
(((PyxmlXPathContext_Object *)(v))->obj))
|
| 94 |
+
|
| 95 |
+
typedef struct {
|
| 96 |
+
PyObject_HEAD
|
| 97 |
+
xmlXPathContextPtr obj;
|
| 98 |
+
} PyxmlXPathContext_Object;
|
| 99 |
+
|
| 100 |
+
#define PyxmlXPathParserContext_Get(v) (((v) == Py_None) ? NULL : \
|
| 101 |
+
(((PyxmlXPathParserContext_Object *)(v))->obj))
|
| 102 |
+
|
| 103 |
+
typedef struct {
|
| 104 |
+
PyObject_HEAD
|
| 105 |
+
xmlXPathParserContextPtr obj;
|
| 106 |
+
} PyxmlXPathParserContext_Object;
|
| 107 |
+
#endif /* LIBXML_XPATH_ENABLED */
|
| 108 |
+
|
| 109 |
+
#define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
| 110 |
+
(((PyparserCtxt_Object *)(v))->obj))
|
| 111 |
+
|
| 112 |
+
typedef struct {
|
| 113 |
+
PyObject_HEAD
|
| 114 |
+
xmlParserCtxtPtr obj;
|
| 115 |
+
} PyparserCtxt_Object;
|
| 116 |
+
|
| 117 |
+
#define PyValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
| 118 |
+
(((PyValidCtxt_Object *)(v))->obj))
|
| 119 |
+
|
| 120 |
+
typedef struct {
|
| 121 |
+
PyObject_HEAD
|
| 122 |
+
xmlValidCtxtPtr obj;
|
| 123 |
+
} PyValidCtxt_Object;
|
| 124 |
+
|
| 125 |
+
#ifdef LIBXML_CATALOG_ENABLED
|
| 126 |
+
#define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \
|
| 127 |
+
(((Pycatalog_Object *)(v))->obj))
|
| 128 |
+
|
| 129 |
+
typedef struct {
|
| 130 |
+
PyObject_HEAD
|
| 131 |
+
xmlCatalogPtr obj;
|
| 132 |
+
} Pycatalog_Object;
|
| 133 |
+
#endif /* LIBXML_CATALOG_ENABLED */
|
| 134 |
+
|
| 135 |
+
#ifdef LIBXML_REGEXP_ENABLED
|
| 136 |
+
#define PyxmlReg_Get(v) (((v) == Py_None) ? NULL : \
|
| 137 |
+
(((PyxmlReg_Object *)(v))->obj))
|
| 138 |
+
|
| 139 |
+
typedef struct {
|
| 140 |
+
PyObject_HEAD
|
| 141 |
+
xmlRegexpPtr obj;
|
| 142 |
+
} PyxmlReg_Object;
|
| 143 |
+
#endif /* LIBXML_REGEXP_ENABLED */
|
| 144 |
+
|
| 145 |
+
#ifdef LIBXML_READER_ENABLED
|
| 146 |
+
#define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \
|
| 147 |
+
(((PyxmlTextReader_Object *)(v))->obj))
|
| 148 |
+
|
| 149 |
+
typedef struct {
|
| 150 |
+
PyObject_HEAD
|
| 151 |
+
xmlTextReaderPtr obj;
|
| 152 |
+
} PyxmlTextReader_Object;
|
| 153 |
+
|
| 154 |
+
#define PyxmlTextReaderLocator_Get(v) (((v) == Py_None) ? NULL : \
|
| 155 |
+
(((PyxmlTextReaderLocator_Object *)(v))->obj))
|
| 156 |
+
|
| 157 |
+
typedef struct {
|
| 158 |
+
PyObject_HEAD
|
| 159 |
+
xmlTextReaderLocatorPtr obj;
|
| 160 |
+
} PyxmlTextReaderLocator_Object;
|
| 161 |
+
#endif
|
| 162 |
+
|
| 163 |
+
#define PyURI_Get(v) (((v) == Py_None) ? NULL : \
|
| 164 |
+
(((PyURI_Object *)(v))->obj))
|
| 165 |
+
|
| 166 |
+
typedef struct {
|
| 167 |
+
PyObject_HEAD
|
| 168 |
+
xmlErrorPtr obj;
|
| 169 |
+
} PyError_Object;
|
| 170 |
+
|
| 171 |
+
#define PyError_Get(v) (((v) == Py_None) ? NULL : \
|
| 172 |
+
(((PyError_Object *)(v))->obj))
|
| 173 |
+
|
| 174 |
+
typedef struct {
|
| 175 |
+
PyObject_HEAD
|
| 176 |
+
xmlOutputBufferPtr obj;
|
| 177 |
+
} PyoutputBuffer_Object;
|
| 178 |
+
|
| 179 |
+
#define PyoutputBuffer_Get(v) (((v) == Py_None) ? NULL : \
|
| 180 |
+
(((PyoutputBuffer_Object *)(v))->obj))
|
| 181 |
+
|
| 182 |
+
typedef struct {
|
| 183 |
+
PyObject_HEAD
|
| 184 |
+
xmlParserInputBufferPtr obj;
|
| 185 |
+
} PyinputBuffer_Object;
|
| 186 |
+
|
| 187 |
+
#define PyinputBuffer_Get(v) (((v) == Py_None) ? NULL : \
|
| 188 |
+
(((PyinputBuffer_Object *)(v))->obj))
|
| 189 |
+
|
| 190 |
+
typedef struct {
|
| 191 |
+
PyObject_HEAD
|
| 192 |
+
xmlURIPtr obj;
|
| 193 |
+
} PyURI_Object;
|
| 194 |
+
|
| 195 |
+
/* FILE * have their own internal representation */
|
| 196 |
+
#if PY_MAJOR_VERSION >= 3
|
| 197 |
+
FILE *libxml_PyFileGet(PyObject *f);
|
| 198 |
+
void libxml_PyFileRelease(FILE *f);
|
| 199 |
+
#define PyFile_Get(v) (((v) == Py_None) ? NULL : libxml_PyFileGet(v))
|
| 200 |
+
#define PyFile_Release(f) libxml_PyFileRelease(f)
|
| 201 |
+
#else
|
| 202 |
+
#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
|
| 203 |
+
(PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
|
| 204 |
+
#define PyFile_Release(f)
|
| 205 |
+
#endif
|
| 206 |
+
|
| 207 |
+
#ifdef LIBXML_SCHEMAS_ENABLED
|
| 208 |
+
typedef struct {
|
| 209 |
+
PyObject_HEAD
|
| 210 |
+
xmlRelaxNGPtr obj;
|
| 211 |
+
} PyrelaxNgSchema_Object;
|
| 212 |
+
|
| 213 |
+
#define PyrelaxNgSchema_Get(v) (((v) == Py_None) ? NULL : \
|
| 214 |
+
(((PyrelaxNgSchema_Object *)(v))->obj))
|
| 215 |
+
|
| 216 |
+
typedef struct {
|
| 217 |
+
PyObject_HEAD
|
| 218 |
+
xmlRelaxNGParserCtxtPtr obj;
|
| 219 |
+
} PyrelaxNgParserCtxt_Object;
|
| 220 |
+
|
| 221 |
+
#define PyrelaxNgParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
| 222 |
+
(((PyrelaxNgParserCtxt_Object *)(v))->obj))
|
| 223 |
+
|
| 224 |
+
typedef struct {
|
| 225 |
+
PyObject_HEAD
|
| 226 |
+
xmlRelaxNGValidCtxtPtr obj;
|
| 227 |
+
} PyrelaxNgValidCtxt_Object;
|
| 228 |
+
|
| 229 |
+
#define PyrelaxNgValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
| 230 |
+
(((PyrelaxNgValidCtxt_Object *)(v))->obj))
|
| 231 |
+
|
| 232 |
+
typedef struct {
|
| 233 |
+
PyObject_HEAD
|
| 234 |
+
xmlSchemaPtr obj;
|
| 235 |
+
} PySchema_Object;
|
| 236 |
+
|
| 237 |
+
#define PySchema_Get(v) (((v) == Py_None) ? NULL : \
|
| 238 |
+
(((PySchema_Object *)(v))->obj))
|
| 239 |
+
|
| 240 |
+
typedef struct {
|
| 241 |
+
PyObject_HEAD
|
| 242 |
+
xmlSchemaParserCtxtPtr obj;
|
| 243 |
+
} PySchemaParserCtxt_Object;
|
| 244 |
+
|
| 245 |
+
#define PySchemaParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
| 246 |
+
(((PySchemaParserCtxt_Object *)(v))->obj))
|
| 247 |
+
|
| 248 |
+
typedef struct {
|
| 249 |
+
PyObject_HEAD
|
| 250 |
+
xmlSchemaValidCtxtPtr obj;
|
| 251 |
+
} PySchemaValidCtxt_Object;
|
| 252 |
+
|
| 253 |
+
#define PySchemaValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
| 254 |
+
(((PySchemaValidCtxt_Object *)(v))->obj))
|
| 255 |
+
|
| 256 |
+
#endif /* LIBXML_SCHEMAS_ENABLED */
|
| 257 |
+
|
| 258 |
+
PyObject * libxml_intWrap(int val);
|
| 259 |
+
PyObject * libxml_longWrap(long val);
|
| 260 |
+
PyObject * libxml_xmlCharPtrWrap(xmlChar *str);
|
| 261 |
+
PyObject * libxml_constxmlCharPtrWrap(const xmlChar *str);
|
| 262 |
+
PyObject * libxml_charPtrWrap(char *str);
|
| 263 |
+
PyObject * libxml_constcharPtrWrap(const char *str);
|
| 264 |
+
PyObject * libxml_charPtrConstWrap(const char *str);
|
| 265 |
+
PyObject * libxml_xmlCharPtrConstWrap(const xmlChar *str);
|
| 266 |
+
PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
|
| 267 |
+
PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
|
| 268 |
+
PyObject * libxml_xmlAttrPtrWrap(xmlAttrPtr attr);
|
| 269 |
+
PyObject * libxml_xmlNsPtrWrap(xmlNsPtr ns);
|
| 270 |
+
PyObject * libxml_xmlAttributePtrWrap(xmlAttributePtr ns);
|
| 271 |
+
PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns);
|
| 272 |
+
PyObject * libxml_doubleWrap(double val);
|
| 273 |
+
PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt);
|
| 274 |
+
#ifdef LIBXML_XPATH_ENABLED
|
| 275 |
+
PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt);
|
| 276 |
+
PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt);
|
| 277 |
+
PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj);
|
| 278 |
+
xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);
|
| 279 |
+
#endif
|
| 280 |
+
PyObject * libxml_xmlValidCtxtPtrWrap(xmlValidCtxtPtr valid);
|
| 281 |
+
#ifdef LIBXML_CATALOG_ENABLED
|
| 282 |
+
PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj);
|
| 283 |
+
#endif
|
| 284 |
+
PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri);
|
| 285 |
+
PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer);
|
| 286 |
+
PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer);
|
| 287 |
+
#ifdef LIBXML_REGEXP_ENABLED
|
| 288 |
+
PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp);
|
| 289 |
+
#endif /* LIBXML_REGEXP_ENABLED */
|
| 290 |
+
#ifdef LIBXML_READER_ENABLED
|
| 291 |
+
PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader);
|
| 292 |
+
PyObject * libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator);
|
| 293 |
+
#endif
|
| 294 |
+
|
| 295 |
+
#ifdef LIBXML_SCHEMAS_ENABLED
|
| 296 |
+
PyObject * libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt);
|
| 297 |
+
PyObject * libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt);
|
| 298 |
+
PyObject * libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid);
|
| 299 |
+
PyObject * libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt);
|
| 300 |
+
PyObject * libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt);
|
| 301 |
+
PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid);
|
| 302 |
+
#endif /* LIBXML_SCHEMAS_ENABLED */
|
| 303 |
+
PyObject * libxml_xmlErrorPtrWrap(const xmlError *error);
|
| 304 |
+
PyObject * libxml_xmlSchemaSetValidErrors(PyObject * self, PyObject * args);
|
| 305 |
+
PyObject * libxml_xmlRegisterInputCallback(PyObject *self, PyObject *args);
|
| 306 |
+
PyObject * libxml_xmlUnregisterInputCallback(PyObject *self, PyObject *args);
|
| 307 |
+
PyObject * libxml_xmlNodeRemoveNsDef(PyObject * self, PyObject * args);
|
| 308 |
+
|
| 309 |
+
int libxml_deprecationWarning(const char *func);
|