blob: 9a1e2fd16fee615676f5ed74000351a0dc127efb [file] [log] [blame]
Daniel Veillardaf743792000-07-01 11:49:28 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
2 "http://www.w3.org/TR/REC-html40/loose.dtd">
3<html>
4<head>
5 <title>Libxml Frequently asqued Questions</title>
6 <meta name="GENERATOR" content="amaya V2.1">
7 <meta http-equiv="Content-Type" content="text/html">
8</head>
9
10<body bgcolor="#ffffff">
11<h1 align="center">Libxml Frequently Asqued Questions</h1>
12
13<p>Location: <a
14href="http://xmlsoft.org/FAQ.html">http://xmlsoft.org/FAQ.html</a></p>
15
16<p>Libxml home page: <a href="http://xmlsoft.org/">http://xmlsoft.org/</a></p>
17
18<p>Mailing-list archive: <a
19href="http://xmlsoft.org/messages/">http://xmlsoft.org/messages/</a></p>
20
21<p>Version: $Version$</p>
22
23<p>Table of Content:</p>
24<ul>
25 <li><a href="#Licence">Licence(s)</a></li>
26 <li><a href="#Installati">Installation</a></li>
27 <li><a href="#Compilatio">Compilation</a></li>
28 <li><a href="#Developper">Developper corner</a></li>
29</ul>
30
31<h2><a name="Licence">Licence</a>(s)</h2>
32<ol>
33 <li><em>Licensing Terms for libxml</em>
34 <p>libxml is released under 2 (compatible) licences:</p>
35 <ul>
36 <li>the <a href="http://www.gnu.org/copyleft/lgpl.html">LGPL</a>: GNU
37 Library General Public License</li>
38 <li>the <a
39 href="http://www.w3.org/Consortium/Legal/copyright-software-19980720.html">W3C
40 IPR</a>: very similar to the XWindow licence</li>
41 </ul>
42 </li>
43 <li><em>Can I embed libxml in a proprietary application ?</em>
44 <p>Yes. The W3C IPR allows you to also keep proprietary the changes you
45 made to libxml, but it would be graceful to provide back bugfixes and
46 improvements as patches for possible incorporation in the main
47 developement tree</p>
48 </li>
49</ol>
50
51<h2><a name="Installati">Installation</a></h2>
52<ol>
53 <li><em>Where can I get libxml</em> ?
54 <p>The original distribution comes from <a
55 href="ftp://rpmfind.net/pub/libxml/">rpmfind.net</a> or <a
56 href="ftp://ftp.gnome.org/pub/GNOME/stable/sources/libxml/">gnome.org</a></p>
57 <p>Most linux and Bsd distribution includes libxml, this is probably the
58 safer way for end-users</p>
59 <p>David Doolin provides precompiled Windows versions at <a
60 href="http://www.ce.berkeley.edu/~doolin/code/libxmlwin32/
61 ">http://www.ce.berkeley.edu/~doolin/code/libxmlwin32/</a></p>
62 </li>
63 <li><em>I see libxml and libxml2 releases, which one should I install ?</em>
64 <ul>
65 <li>If you are not concerned by any existing backward compatibility with
66 existing application, install libxml2 only</li>
67 <li>If you are not doing development, you can safely install both.
68 usually the packages <a
69 href="http://rpmfind.net/linux/RPM/libxml.html">libxml</a> and <a
70 href="http://rpmfind.net/linux/RPM/libxml2.html">libxml2</a> are
71 compatible (this is not the case for development packages)</li>
72 <li>If you are a developper and your system provides separate packaging
73 for shared libraries and the development components, it is possible to
74 install libxml and libxml2, and depending on your development needs
75 have either <a
76 href="http://rpmfind.net/linux/RPM/libxml-devel.html">libxml-devel</a>
77 or <a
78 href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml2-devel</a>
79 too</li>
80 <li>If you are developping a new application, please develop against
81 libxml2(-devel)</li>
82 </ul>
83 </li>
84 <li><em>I can't install the libxml package it conflicts with libxml0</em>
85 <p>You probably have an old libxml0 package used to provide the shared
86 library for libxml.so.0, you can probably safely remove it. Anyway the
87 libxml packages provided on <a
88 href="ftp://rpmfind.net/pub/libxml/">rpmfind.net</a> provides
89 libxml.so.0</p>
90 </li>
91</ol>
92
93<h2><a name="Compilatio">Compilation</a></h2>
94<ol>
95 <li><em>What is the process to compile libxml ?</em>
96 <p>As most UNIX libraries libxml follows the "standard":</p>
97 <p><code>gunzip -c xxx.tar.gz | tar xvf -</code></p>
98 <p><code>cd libxml-xxxx</code></p>
99 <p><code>./configure --help</code></p>
100 <p>to see the options, then the compilation/installation proper</p>
101 <p><code>./configure [possible options]</code></p>
102 <p><code>make</code></p>
103 <p><code>make install</code></p>
104 <p>At that point you may have to rerun ldconfig or similar utility to
105 update your list of installed shared libs.</p>
106 </li>
107 <li><em>What other libraries are needed to compile/install libxml ?</em>
108 <p>Libxml does not requires any other library, the normal C ANSI API
109 should be sufficient (please report any violation to this rule you may
110 find).</p>
111 <p>However if found at configuration time libxml will deect and use the
112 following libs:</p>
113 <ul>
114 <li><a href="http://www.info-zip.org/pub/infozip/zlib/">libz</a>: a
115 highly portable and available widely compression library</li>
116 <li>iconv: a powerful character encoding conversion library. It's
117 included by default on recent glibc libraries, so it doesn't need to
118 be installed specifically on linux. It seems it's now <a
119 href="http://www.opennc.org/onlinepubs/7908799/xsh/iconv.html">part of
120 the official UNIX</a> specification, though I could not find a home
121 page for the project.</li>
122 </ul>
123 </li>
124 <li><em>The Makefile for the example gjobread is not generated</em>
125 <p>This is due to a circular dependancy in automake. No solution found so
126 far (if you know how to fix this the patch will be very welcome), that
127 failure won't affect the actually building of the xml library. You can
128 later go in and create the example Makefile by hand or reuse the
129 following:</p>
130 <pre>CC=gcc
131 CFLAGS=`xml-config --cflags`
132 LDFLAGS=`xml-config --libs`
133
134 all: gjobread
135
136 clean:
137 &lt;TAB>@(rm -f gjobread gjobread.o)
138
139 gjobread.o : gjobread.c
140 &lt;TAB>$(CC) $(CFLAGS) -c gjobread.c
141
142 gjobread: gjobread.o
143 &lt;TAB>$(CC) -o gjobread gjobread.o $(LDFLAGS)</pre>
144 </li>
145 <li><em>libxml does not compile with HP-UX's optional ANSI-C compiler</em>
146 <p>this is due to macro limitations. Try to add " -Wp,-H16800 -Ae" to the
147 CFLAGS</p>
148 <p>you can also install and use gcc instead or use a precompiled version
149 of libxml, both available from the <a
150 href="http://hpux.cae.wisc.edu/hppd/auto/summary_all.html">HP-UX Porting
151 and Archive Centre</a></p>
152 </li>
153 <li><em>make check fails on some platforms</em>
154 <p>Sometime the regression tests results don't completely match the value
155 produced by the parser, and the makefile uses diff to print the delta. On
156 some platforms the diff return breaks the compilation process, if the diff
157 is small this is probably not a serious problem</p>
158 </li>
159</ol>
160
161<h2><a name="Developper">Developper</a> corner</h2>
162<ol>
163 <li><em>I get compilation errors of existing code like when accessing
164 <strong>root</strong> or <strong>childs fields</strong> of nodes</em>
165 <p>You are compiling code developped for libxml version 1 and using a
166 libxml2 developement environment. Either switch back to libxml v1 devel or
167 even better fix the code to compile with libxml2 (or both) by <a
168 href="upgrade.html">following the instructions</a>.</p>
169 </li>
170 <li><em>I get compilation errors about non existing
171 <strong>xmlRootNode</strong> or <strong>xmlChildrenNode</strong>
172 fields</em>
173 <p>The source code you are using has been <a
174 href="upgrade.html">upgraded</a> to be able to compile with both libxml
175 and libxml2, but you need to install a more recent version: libxml(-devel)
176 >= 1.8.8 or libxml2(-devel) >= 2.1.0</p>
177 </li>
178 <li><em>XPath implementation looks seriously broken</em>
179 <p>True, it's incomplete and the version released in 2.0.0 was nearly
180 unusable. A set of patches from <a href="http://www.picdar.co.uk/">Picdar
181 Technology</a> have been integrated in 2.1.0 fixing the most nasty bugs.
182 But there is still bugs and its incomplete. Patches and bug reports are
183 welcome. This will be worked out, XPath implementation is not abandonned,
184 just a momentary lack of time.</p>
185 </li>
186 <li><em>The example provided in the web page does not compile</em>
187 <p>It's hard to maintain the documentation in sync with the code
188 &lt;grin/> ...</p>
189 <p>Check the previous points 1/ and 2/ raised before, and send
190 patches.</p>
191 </li>
192 <li><em>Where can I get more examples and informations than in the web
193 page</em>
194 <p>Ideally a libxml book would be nice. I have no such plan ... But you
195 can:</p>
196 <ul>
197 <li>check more deeply the <a href="libxml.html">existing generated
198 doc</a></li>
199 <li>looks for examples of use for libxml function using the Gnome code
200 for example the following will query the full Gnome CVs base for the
201 use of the <strong>xmlAddChild()</strong> function:
202 <p><a
203 href="http://cvs.gnome.org/lxr/search?string=xmlAddChild">http://cvs.gnome.org/lxr/search?string=xmlAddChild</a></p>
204 <p>This may be slow, a large hardware donation to the gnome project
205 could cure this :-)</p>
206 </li>
207 <li><a
208 href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&dir=gnome-xml">Browse
209 the libxml source</a>, I try to write code as clean and documented as
210 possible, so looking at it may be helpful</li>
211 </ul>
212 </li>
213 <li>What about C++ ?
214 <p>libxml is written in pure C in order to allow easy reuse on a number of
215 platforms, including embedded systems. I don't intend to convert to
216 C++.</p>
217 <p>There is however a C++ wrapper provided by Ari Johnson
218 &lt;ari@btigate.com> which may fullfill your needs:</p>
219 <p>Website: <a
220 href="http://lusis.org/~ari/xml++/">http://lusis.org/~ari/xml++/</a></p>
221 <p>Download: <a
222 href="http://lusis.org/~ari/xml++/libxml++.tar.gz">http://lusis.org/~ari/xml++/libxml++.tar.gz</a></p>
223 </li>
224 <li>How to validate a document a posteriori ?
225 <p>It is possible to validate documents which had not been validated at
226 initial parsing time or documents who have been built from scratch using
227 the API. Use the <a
228 href="http://xmlsoft.org/gnome-xml-valid.html#XMLVALIDATEDTD">xmlValidateDtd()</a>
229 function. It is also possible to simply add a Dtd to an existing
230 document:</p>
231 <pre>xmlDocPtr doc; /* your existing document */
232 xmlDtdPtr dtd = xmlParseDTD(NULL, filename_of_dtd); /* parse the DTD */
233 dtd->name = xmlStrDup((xmlChar*)"root_name"); /* use the given root */
234
235 doc->intSubset = dtd;
236 if (doc->children == NULL) xmlAddChild((xmlNodePtr)doc, (xmlNodePtr)dtd);
237 else xmlAddPrevSibling(doc->children, (xmlNodePtr)dtd);
238 </pre>
239 </li>
240 <li>etc ...</li>
241</ol>
242
243<p><a href="mailto:Daniel.Veillard@w3.org">Daniel Veillard</a></p>
244
245<p>$Id$</p>
246</body>
247</html>