mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-19 14:50:07 +03:00
Added docs for 2.4.1 and 2.4.2 releases, Daniel
This commit is contained in:
parent
9a0b3d63c1
commit
3d6ae1ce19
297
doc/xml.html
297
doc/xml.html
@ -3,7 +3,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>The XML C library for Gnome</title>
|
||||
<meta name="GENERATOR" content="amaya V4.1">
|
||||
<meta name="GENERATOR" content="amaya V5.0">
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
</head>
|
||||
|
||||
@ -117,7 +117,8 @@ libxml2</p>
|
||||
internationalization support</a></li>
|
||||
<li>This page provides a global overview and <a href="#real">some
|
||||
examples</a> on how to use libxml.</li>
|
||||
<li><a href="mailto:james@daa.com.au">James Henstridge</a> wrote <a
|
||||
<li><a href="mailto:james@daa.com.au">James Henstridge</a>
|
||||
wrote <a
|
||||
href="http://www.daa.com.au/~james/gnome/xml-sax/xml-sax.html">some nice
|
||||
documentation</a> explaining how to use the libxml SAX interface.</li>
|
||||
<li>George Lebl wrote <a
|
||||
@ -134,22 +135,24 @@ libxml2</p>
|
||||
|
||||
<h2><a name="Reporting">Reporting bugs and getting help</a></h2>
|
||||
|
||||
<p>Well, bugs or missing features are always possible, and I will make a point
|
||||
of fixing them in a timely fashion. The best way to report a bug is to use the
|
||||
<a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml">Gnome bug
|
||||
tracking database</a> (make sure to use the "libxml" module name). I look at
|
||||
reports there regularly and it's good to have a reminder when a bug is still
|
||||
open. Check the <a
|
||||
href="http://bugzilla.gnome.org/bugwritinghelp.html">instructions on reporting
|
||||
bugs</a> and be sure to specify that the bug is for the package libxml.</p>
|
||||
<p>Well, bugs or missing features are always possible, and I will make a
|
||||
point of fixing them in a timely fashion. The best way to report a bug is to
|
||||
use the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml">Gnome
|
||||
bug tracking database</a> (make sure to use the "libxml" module name). I look
|
||||
at reports there regularly and it's good to have a reminder when a bug is
|
||||
still open. Check the <a
|
||||
href="http://bugzilla.gnome.org/bugwritinghelp.html">instructions on
|
||||
reporting bugs</a> and be sure to specify that the bug is for the package
|
||||
libxml.</p>
|
||||
|
||||
<p>There is also a mailing-list <a
|
||||
href="mailto:xml@gnome.org">xml@gnome.org</a> for libxml, with an <a
|
||||
href="http://mail.gnome.org/archives/xml/">on-line archive</a> (<a
|
||||
href="http://xmlsoft.org/messages">old</a>). To subscribe to this list, please
|
||||
visit the <a href="http://mail.gnome.org/mailman/listinfo/xml">associated
|
||||
Web</a> page and follow the instructions. <strong>Do not send code, I won't
|
||||
debug it</strong> (but patches are really appreciated!).</p>
|
||||
href="http://xmlsoft.org/messages">old</a>). To subscribe to this list,
|
||||
please visit the <a
|
||||
href="http://mail.gnome.org/mailman/listinfo/xml">associated Web</a> page and
|
||||
follow the instructions. <strong>Do not send code, I won't debug it</strong>
|
||||
(but patches are really appreciated!).</p>
|
||||
|
||||
<p>Check the following too before posting:</p>
|
||||
<ul>
|
||||
@ -157,8 +160,8 @@ debug it</strong> (but patches are really appreciated!).</p>
|
||||
version</a>, and that the problem still shows up in those</li>
|
||||
<li>check the <a href="http://mail.gnome.org/archives/xml/">list
|
||||
archives</a> to see if the problem was reported already, in this case
|
||||
there is probably a fix available, similary check the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&product=libxslt&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=NEEDINFO&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&email1=&emailtype1=substring&emailassigned_to1=1&emailreporter1=1&emailcc1=1&emaillongdesc1=1&email2=&emailtype2=substring&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emaillongdesc2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&status_whiteboard=&status_whiteboard_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">registered open
|
||||
bugs</a></li>
|
||||
there is probably a fix available, similary check the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&product=libxslt&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=NEEDINFO&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&email1=&emailtype1=substring&emailassigned_to1=1&emailreporter1=1&emailcc1=1&emaillongdesc1=1&email2=&emailtype2=substring&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emaillongdesc2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&status_whiteboard=&status_whiteboard_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">registered
|
||||
open bugs</a></li>
|
||||
<li>make sure you can reproduce the bug with xmllint or one of the test
|
||||
programs found in source in the distribution</li>
|
||||
<li>Please send the command showing the error as well as the input (as an
|
||||
@ -167,9 +170,10 @@ debug it</strong> (but patches are really appreciated!).</p>
|
||||
|
||||
<p>Alternatively, you can just send the bug to the <a
|
||||
href="mailto:xml@gnome.org">xml@gnome.org</a> list; if it's really libxml
|
||||
related I will approve it.. Please do not send me mail directly especially for
|
||||
portability problem, it makes things really harder to track and in some cases
|
||||
I'm not the best person to answer a given question, ask the list instead.</p>
|
||||
related I will approve it.. Please do not send me mail directly especially
|
||||
for portability problem, it makes things really harder to track and in some
|
||||
cases I'm not the best person to answer a given question, ask the list
|
||||
instead.</p>
|
||||
|
||||
<p>Of course, bugs reported with a suggested patch for fixing them will
|
||||
probably be processed faster.</p>
|
||||
@ -219,8 +223,8 @@ href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml(2)-devel</a>
|
||||
packages installed to compile applications using libxml.) <a
|
||||
href="mailto:izlatkovic@daenet.de">Igor Zlatkovic</a> is now the maintainer
|
||||
of the Windows port, <a
|
||||
href="http://www.fh-frankfurt.de/~igor/projects/libxml/index.html">he provides
|
||||
binaries</a></p>
|
||||
href="http://www.fh-frankfurt.de/~igor/projects/libxml/index.html">he
|
||||
provides binaries</a></p>
|
||||
|
||||
<p><a name="Snapshot">Snapshot:</a></p>
|
||||
<ul>
|
||||
@ -241,8 +245,8 @@ platform, get in touch with me to upload the package. I will keep them in the
|
||||
<li><p>The <a
|
||||
href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&dir=gnome-xml">Gnome
|
||||
CVS base</a>. Check the <a
|
||||
href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a> page;
|
||||
the CVS module is <b>gnome-xml</b>.</p>
|
||||
href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a>
|
||||
page; the CVS module is <b>gnome-xml</b>.</p>
|
||||
</li>
|
||||
<li>The <strong>libxslt</strong> module is also present there</li>
|
||||
</ul>
|
||||
@ -256,12 +260,31 @@ for a really accurate description</h3>
|
||||
<p>Items floating around but not actively worked on, get in touch with me if
|
||||
you want to test those</p>
|
||||
<ul>
|
||||
<li>Implementing <a href="http://xmlsoft.org/XSLT">XSLT</a>, this is done as
|
||||
a separate C library on top of libxml called libxslt</li>
|
||||
<li>Implementing <a href="http://xmlsoft.org/XSLT">XSLT</a>, this is done
|
||||
as a separate C library on top of libxml called libxslt</li>
|
||||
<li>Finishing up <a href="http://www.w3.org/TR/xptr">XPointer</a> and <a
|
||||
href="http://www.w3.org/TR/xinclude">XInclude</a></li>
|
||||
<li>(seeems working but delayed from release) parsing/import of Docbook SGML
|
||||
docs</li>
|
||||
<li>(seeems working but delayed from release) parsing/import of Docbook
|
||||
SGML docs</li>
|
||||
</ul>
|
||||
|
||||
<h3>2.4.2: Aug 15 2001</h3>
|
||||
<ul>
|
||||
<li>adds xmlLineNumbersDefault() to control line number generation</li>
|
||||
<li>lot of bug fixes</li>
|
||||
<li>the Microsoft MSC projects files shuld now be up to date</li>
|
||||
<li>inheritance of namespaces from DTD defaulted attributes</li>
|
||||
<li>fixes a serious potential security bug</li>
|
||||
<li>added a --format option to xmllint</li>
|
||||
</ul>
|
||||
|
||||
<h3>2.4.1: July 24 2001</h3>
|
||||
<ul>
|
||||
<li>possibility to keep line numbers in the tree</li>
|
||||
<li>some computation NaN fixes</li>
|
||||
<li>extension of the XPath API</li>
|
||||
<li>cleanup for alpha and ia64 targets</li>
|
||||
<li>patch to allow saving through HTTP PUT or POST</li>
|
||||
</ul>
|
||||
|
||||
<h3>2.4.0: July 10 2001</h3>
|
||||
@ -274,8 +297,8 @@ you want to test those</p>
|
||||
|
||||
<h3>2.3.14: July 5 2001</h3>
|
||||
<ul>
|
||||
<li>fixed some entities problems and reduce mem requirement when substituing
|
||||
them</li>
|
||||
<li>fixed some entities problems and reduce mem requirement when
|
||||
substituing them</li>
|
||||
<li>lots of improvements in the XPath queries interpreter can be
|
||||
substancially faster</li>
|
||||
<li>Makefiles and configure cleanups</li>
|
||||
@ -332,8 +355,8 @@ you want to test those</p>
|
||||
<h3>2.3.10: June 1 2001</h3>
|
||||
<ul>
|
||||
<li>fixed the SGML catalog support</li>
|
||||
<li>a number of reported bugs got fixed, in XPath, iconv detection, XInclude
|
||||
processing</li>
|
||||
<li>a number of reported bugs got fixed, in XPath, iconv detection,
|
||||
XInclude processing</li>
|
||||
<li>XPath string function should now handle unicode correctly</li>
|
||||
</ul>
|
||||
|
||||
@ -368,8 +391,8 @@ you want to test those</p>
|
||||
<li>Fixed a few things in the HTML parser</li>
|
||||
<li>Fixed some XPath bugs raised by XSLT use, tried to fix the floating
|
||||
point portability issue</li>
|
||||
<li>Speed improvement (8M/s for SAX, 3M/s for DOM, 1.5M/s for DOM+validation
|
||||
using the XML REC as input and a 700MHz celeron).</li>
|
||||
<li>Speed improvement (8M/s for SAX, 3M/s for DOM, 1.5M/s for
|
||||
DOM+validation using the XML REC as input and a 700MHz celeron).</li>
|
||||
<li>incorporated more Windows cleanup</li>
|
||||
<li>added xmlSaveFormatFile()</li>
|
||||
<li>fixed problems in copying nodes with entities references (gdome)</li>
|
||||
@ -398,9 +421,9 @@ you want to test those</p>
|
||||
<li>cleaned up the user of some of the string formatting function. used the
|
||||
trio library code to provide the one needed when the platform is missing
|
||||
them</li>
|
||||
<li>xpath: removed a memory leak and fixed the predicate evaluation problem,
|
||||
extended the testsuite and cleaned up the result. XPointer seems broken
|
||||
...</li>
|
||||
<li>xpath: removed a memory leak and fixed the predicate evaluation
|
||||
problem, extended the testsuite and cleaned up the result. XPointer seems
|
||||
broken ...</li>
|
||||
</ul>
|
||||
|
||||
<h3>2.3.5: Mar 23 2001</h3>
|
||||
@ -530,8 +553,8 @@ you want to test those</p>
|
||||
<li>XPointer implementation and testsuite</li>
|
||||
<li>Lot of XPath fixes, added variable and functions registration, more
|
||||
tests</li>
|
||||
<li>Portability fixes, lots of enhancements toward an easy Windows build and
|
||||
release</li>
|
||||
<li>Portability fixes, lots of enhancements toward an easy Windows build
|
||||
and release</li>
|
||||
<li>Late validation fixes</li>
|
||||
<li>Integrated a lot of contributed patches</li>
|
||||
<li>added memory management docs</li>
|
||||
@ -571,8 +594,8 @@ you want to test those</p>
|
||||
<li>a purely bug fixes release</li>
|
||||
<li>fixed an encoding support problem when parsing from a memory block</li>
|
||||
<li>fixed a DOCTYPE parsing problem</li>
|
||||
<li>removed a bug in the function allowing to override the memory allocation
|
||||
routines</li>
|
||||
<li>removed a bug in the function allowing to override the memory
|
||||
allocation routines</li>
|
||||
</ul>
|
||||
|
||||
<h3>2.2.0: July 14 2000</h3>
|
||||
@ -645,8 +668,8 @@ you want to test those</p>
|
||||
parser context using xmlCreateIOParserCtxt()</li>
|
||||
<li>there is a C preprocessor macro LIBXML_VERSION providing the version
|
||||
number of the libxml module in use</li>
|
||||
<li>a number of optional features of libxml can now be excluded at configure
|
||||
time (FTP/HTTP/HTML/XPath/Debug)</li>
|
||||
<li>a number of optional features of libxml can now be excluded at
|
||||
configure time (FTP/HTTP/HTML/XPath/Debug)</li>
|
||||
</ul>
|
||||
|
||||
<h3>2.0.0beta: Mar 14 2000</h3>
|
||||
@ -665,8 +688,8 @@ you want to test those</p>
|
||||
<ul>
|
||||
<li>fix I18N support. ISO-Latin-x/UTF-8/UTF-16 (nearly) seems correctly
|
||||
handled now</li>
|
||||
<li>Better handling of entities, especially well formedness checking and
|
||||
proper PEref extensions in external subsets</li>
|
||||
<li>Better handling of entities, especially well formedness checking
|
||||
and proper PEref extensions in external subsets</li>
|
||||
<li>DTD conditional sections</li>
|
||||
<li>Validation now correcly handle entities content</li>
|
||||
<li><a href="http://rpmfind.net/tools/gdome/messages/0039.html">change
|
||||
@ -685,9 +708,9 @@ you want to test those</p>
|
||||
<li>This is a bug fix release:</li>
|
||||
<li>It is possible to disable the ignorable blanks heuristic used by
|
||||
libxml-1.x, a new function xmlKeepBlanksDefault(0) will allow this. Note
|
||||
that for adherence to XML spec, this behaviour will be disabled by default
|
||||
in 2.x . The same function will allow to keep compatibility for old
|
||||
code.</li>
|
||||
that for adherence to XML spec, this behaviour will be disabled by
|
||||
default in 2.x . The same function will allow to keep compatibility for
|
||||
old code.</li>
|
||||
<li>Blanks in <a> </a> constructs are not ignored anymore,
|
||||
avoiding heuristic is really the Right Way :-\</li>
|
||||
<li>The unchecked use of snprintf which was breaking libxml-1.8.6
|
||||
@ -706,8 +729,8 @@ you want to test those</p>
|
||||
<h3>1.8.5: Jan 21 2000</h3>
|
||||
<ul>
|
||||
<li>adding APIs to parse a well balanced chunk of XML (production <a
|
||||
href="http://www.w3.org/TR/REC-xml#NT-content">[43] content</a> of the XML
|
||||
spec)</li>
|
||||
href="http://www.w3.org/TR/REC-xml#NT-content">[43] content</a> of the
|
||||
XML spec)</li>
|
||||
<li>fixed a hideous bug in xmlGetProp pointed by Rune.Djurhuus@fast.no</li>
|
||||
<li>Jody Goldberg <jgoldberg@home.com> provided another patch trying
|
||||
to solve the zlib checks problems</li>
|
||||
@ -791,8 +814,8 @@ you want to test those</p>
|
||||
<ul>
|
||||
<li>The basic type for strings manipulated by libxml has been renamed in
|
||||
1.7.1 from <strong>CHAR</strong> to <strong>xmlChar</strong>. The reason
|
||||
is that CHAR was conflicting with a predefined type on Windows. However on
|
||||
non WIN32 environment, compatibility is provided by the way of a
|
||||
is that CHAR was conflicting with a predefined type on Windows. However
|
||||
on non WIN32 environment, compatibility is provided by the way of a
|
||||
<strong>#define </strong>.</li>
|
||||
<li>Changed another error : the use of a structure field called errno, and
|
||||
leading to troubles on platforms where it's a macro</li>
|
||||
@ -834,14 +857,14 @@ document</a>:</p>
|
||||
information about its encoding. Then the document is a text format whose
|
||||
structure is specified by tags between brackets. <strong>Each tag opened has
|
||||
to be closed</strong>. XML is pedantic about this. However, if a tag is empty
|
||||
(no content), a single tag can serve as both the opening and closing tag if it
|
||||
ends with <code>/></code> rather than with <code>></code>. Note that,
|
||||
for example, the image tag has no content (just an attribute) and is closed by
|
||||
ending the tag with <code>/></code>.</p>
|
||||
(no content), a single tag can serve as both the opening and closing tag if
|
||||
it ends with <code>/></code> rather than with <code>></code>. Note
|
||||
that, for example, the image tag has no content (just an attribute) and is
|
||||
closed by ending the tag with <code>/></code>.</p>
|
||||
|
||||
<p>XML can be applied sucessfully to a wide range of uses, from long term
|
||||
structured document maintenance (where it follows the steps of SGML) to simple
|
||||
data encoding mechanisms like configuration file formatting (glade),
|
||||
structured document maintenance (where it follows the steps of SGML) to
|
||||
simple data encoding mechanisms like configuration file formatting (glade),
|
||||
spreadsheets (gnumeric), or even shorter lived documents such as WebDAV where
|
||||
it is used to encode remote calls between a client and a server.</p>
|
||||
|
||||
@ -849,16 +872,16 @@ it is used to encode remote calls between a client and a server.</p>
|
||||
|
||||
<p>Check <a href="http://xmlsoft.org/XSLT">the separate libxslt page</a></p>
|
||||
|
||||
<p><a href="http://www.w3.org/TR/xslt">XSL Transformations</a>, is a language
|
||||
for transforming XML documents into other XML documents (or HTML/textual
|
||||
output).</p>
|
||||
<p><a href="http://www.w3.org/TR/xslt">XSL Transformations</a>, is a
|
||||
language for transforming XML documents into other XML documents (or
|
||||
HTML/textual output).</p>
|
||||
|
||||
<p>A separate library called libxslt is being built on top of libxml2. This
|
||||
module "libxslt" can be found in the Gnome CVS base too.</p>
|
||||
|
||||
<p>You can check the <a
|
||||
href="http://cvs.gnome.org/lxr/source/libxslt/FEATURES">features</a> supported
|
||||
and the progresses on the <a
|
||||
href="http://cvs.gnome.org/lxr/source/libxslt/FEATURES">features</a>
|
||||
supported and the progresses on the <a
|
||||
href="http://cvs.gnome.org/lxr/source/libxslt/ChangeLog">Changelog</a></p>
|
||||
|
||||
<h2>An overview of libxml architecture</h2>
|
||||
@ -946,10 +969,10 @@ standalone=true
|
||||
|
||||
<p>Sometimes the DOM tree output is just too large to fit reasonably into
|
||||
memory. In that case (and if you don't expect to save back the XML document
|
||||
loaded using libxml), it's better to use the SAX interface of libxml. SAX is a
|
||||
<strong>callback-based interface</strong> to the parser. Before parsing, the
|
||||
application layer registers a customized set of callbacks which are called by
|
||||
the library as it progresses through the XML input.</p>
|
||||
loaded using libxml), it's better to use the SAX interface of libxml. SAX is
|
||||
a <strong>callback-based interface</strong> to the parser. Before parsing,
|
||||
the application layer registers a customized set of callbacks which are
|
||||
called by the library as it progresses through the XML input.</p>
|
||||
|
||||
<p>To get more detailed step-by-step guidance on using the SAX interface of
|
||||
libxml, see the <a
|
||||
@ -1006,11 +1029,12 @@ interface.</p>
|
||||
<h2><a name="library">The XML library interfaces</a></h2>
|
||||
|
||||
<p>This section is directly intended to help programmers getting bootstrapped
|
||||
using the XML library from the C language. It is not intended to be extensive.
|
||||
I hope the automatically generated documents will provide the completeness
|
||||
required, but as a separate set of documents. The interfaces of the XML
|
||||
library are by principle low level, there is nearly zero abstraction. Those
|
||||
interested in a higher level API should <a href="#DOM">look at DOM</a>.</p>
|
||||
using the XML library from the C language. It is not intended to be
|
||||
extensive. I hope the automatically generated documents will provide the
|
||||
completeness required, but as a separate set of documents. The interfaces of
|
||||
the XML library are by principle low level, there is nearly zero abstraction.
|
||||
Those interested in a higher level API should <a href="#DOM">look at
|
||||
DOM</a>.</p>
|
||||
|
||||
<p>The <a href="html/libxml-parser.html">parser interfaces for XML</a> are
|
||||
separated from the <a href="html/libxml-htmlparser.html">HTML parser
|
||||
@ -1038,8 +1062,8 @@ failure).</p>
|
||||
|
||||
<h3 id="Invoking1">Invoking the parser: the push method</h3>
|
||||
|
||||
<p>In order for the application to keep the control when the document is being
|
||||
fetched (which is common for GUI based programs) libxml provides a push
|
||||
<p>In order for the application to keep the control when the document is
|
||||
being fetched (which is common for GUI based programs) libxml provides a push
|
||||
interface, too, as of version 1.8.3. Here are the interface functions:</p>
|
||||
<pre>xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
|
||||
void *user_data,
|
||||
@ -1090,8 +1114,8 @@ limited to SAX: just use the two first arguments of
|
||||
|
||||
<p>The other way to get an XML tree in memory is by building it. Basically
|
||||
there is a set of functions dedicated to building new elements. (These are
|
||||
also described in <libxml/tree.h>.) For example, here is a piece of code
|
||||
that produces the XML document used in the previous examples:</p>
|
||||
also described in <libxml/tree.h>.) For example, here is a piece of
|
||||
code that produces the XML document used in the previous examples:</p>
|
||||
<pre> #include <libxml/tree.h>
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr tree, subtree;
|
||||
@ -1113,8 +1137,8 @@ that produces the XML document used in the previous examples:</p>
|
||||
<h3><a name="Traversing">Traversing the tree</a></h3>
|
||||
|
||||
<p>Basically by <a href="html/libxml-tree.html">including "tree.h"</a> your
|
||||
code has access to the internal structure of all the elements of the tree. The
|
||||
names should be somewhat simple like <strong>parent</strong>,
|
||||
code has access to the internal structure of all the elements of the tree.
|
||||
The names should be somewhat simple like <strong>parent</strong>,
|
||||
<strong>children</strong>, <strong>next</strong>, <strong>prev</strong>,
|
||||
<strong>properties</strong>, etc... For example, still with the previous
|
||||
example:</p>
|
||||
@ -1138,8 +1162,8 @@ is an excerpt from the <a href="html/libxml-tree.html">tree API</a>:</p>
|
||||
<dl>
|
||||
<dt><code>xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar *name, const
|
||||
xmlChar *value);</code></dt>
|
||||
<dd><p>This sets (or changes) an attribute carried by an ELEMENT node. The
|
||||
value can be NULL.</p>
|
||||
<dd><p>This sets (or changes) an attribute carried by an ELEMENT node.
|
||||
The value can be NULL.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
@ -1150,8 +1174,8 @@ is an excerpt from the <a href="html/libxml-tree.html">tree API</a>:</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p>Two functions are provided for reading and writing the text associated with
|
||||
elements:</p>
|
||||
<p>Two functions are provided for reading and writing the text associated
|
||||
with elements:</p>
|
||||
<dl>
|
||||
<dt><code>xmlNodePtr xmlStringGetNodeList(xmlDocPtr doc, const xmlChar
|
||||
*value);</code></dt>
|
||||
@ -1251,9 +1275,9 @@ for the character '>', <strong>&apos;</strong> for the character ''',
|
||||
substitute an entity's content so that you can see the replacement text in
|
||||
your application. Or you may prefer to keep entity references as such in the
|
||||
content to be able to save the document back without losing this usually
|
||||
precious information (if the user went through the pain of explicitly defining
|
||||
entities, he may have a a rather negative attitude if you blindly susbtitute
|
||||
them as saving time). The <a
|
||||
precious information (if the user went through the pain of explicitly
|
||||
defining entities, he may have a a rather negative attitude if you blindly
|
||||
susbtitute them as saving time). The <a
|
||||
href="html/libxml-parser.html#XMLSUBSTITUTEENTITIESDEFAULT">xmlSubstituteEntitiesDefault()</a>
|
||||
function allows you to check and change the behaviour, which is to not
|
||||
substitute entities by default.</p>
|
||||
@ -1347,8 +1371,9 @@ so even if you plan to use or currently are using validation I strongly
|
||||
suggest adding namespaces to your document. A default namespace scheme
|
||||
<code>xmlns="http://...."</code> should not break validity even on less
|
||||
flexible parsers. Using namespaces to mix and differentiate content coming
|
||||
from multiple DTDs will certainly break current validation schemes. I will try
|
||||
to provide ways to do this, but this may not be portable or standardized.</p>
|
||||
from multiple DTDs will certainly break current validation schemes. I will
|
||||
try to provide ways to do this, but this may not be portable or
|
||||
standardized.</p>
|
||||
|
||||
<h2><a name="Validation">Validation, or are you afraid of DTDs ?</a></h2>
|
||||
|
||||
@ -1360,25 +1385,25 @@ a set of rules.</p>
|
||||
|
||||
<p>The validation process and building DTDs are the two most difficult parts
|
||||
of the XML life cycle. Briefly a DTD defines all the possibles element to be
|
||||
found within your document, what is the formal shape of your document tree (by
|
||||
defining the allowed content of an element, either text, a regular expression
|
||||
for the allowed list of children, or mixed content i.e. both text and
|
||||
children). The DTD also defines the allowed attributes for all elements and
|
||||
the types of the attributes. For more detailed information, I suggest that you
|
||||
read the related parts of the XML specification, the examples found under
|
||||
gnome-xml/test/valid/dtd and any of the large number of books available on
|
||||
XML. The dia example in gnome-xml/test/valid should be both simple and
|
||||
found within your document, what is the formal shape of your document tree
|
||||
(by defining the allowed content of an element, either text, a regular
|
||||
expression for the allowed list of children, or mixed content i.e. both text
|
||||
and children). The DTD also defines the allowed attributes for all elements
|
||||
and the types of the attributes. For more detailed information, I suggest
|
||||
that you read the related parts of the XML specification, the examples found
|
||||
under gnome-xml/test/valid/dtd and any of the large number of books available
|
||||
on XML. The dia example in gnome-xml/test/valid should be both simple and
|
||||
complete enough to allow you to build your own.</p>
|
||||
|
||||
<p>A word of warning, building a good DTD which will fit the needs of your
|
||||
application in the long-term is far from trivial; however, the extra level of
|
||||
quality it can ensure is well worth the price for some sets of applications or
|
||||
if you already have already a DTD defined for your application field.</p>
|
||||
quality it can ensure is well worth the price for some sets of applications
|
||||
or if you already have already a DTD defined for your application field.</p>
|
||||
|
||||
<p>The validation is not completely finished but in a (very IMHO) usable
|
||||
state. Until a real validation interface is defined the way to do it is to
|
||||
define and set the <strong>xmlDoValidityCheckingDefaultValue</strong> external
|
||||
variable to 1, this will of course be changed at some point:</p>
|
||||
define and set the <strong>xmlDoValidityCheckingDefaultValue</strong>
|
||||
external variable to 1, this will of course be changed at some point:</p>
|
||||
|
||||
<p>extern int xmlDoValidityCheckingDefaultValue;</p>
|
||||
|
||||
@ -1397,11 +1422,12 @@ core.</p>
|
||||
|
||||
<h2><a name="DOM"></a><a name="Principles">DOM Principles</a></h2>
|
||||
|
||||
<p><a href="http://www.w3.org/DOM/">DOM</a> stands for the <em>Document Object
|
||||
Model</em>; this is an API for accessing XML or HTML structured documents.
|
||||
Native support for DOM in Gnome is on the way (module gnome-dom), and will be
|
||||
based on gnome-xml. This will be a far cleaner interface to manipulate XML
|
||||
files within Gnome since it won't expose the internal structure.</p>
|
||||
<p><a href="http://www.w3.org/DOM/">DOM</a> stands for the <em>Document
|
||||
Object Model</em>; this is an API for accessing XML or HTML structured
|
||||
documents. Native support for DOM in Gnome is on the way (module gnome-dom),
|
||||
and will be based on gnome-xml. This will be a far cleaner interface to
|
||||
manipulate XML files within Gnome since it won't expose the internal
|
||||
structure.</p>
|
||||
|
||||
<p>The current DOM implementation on top of libxml is the <a
|
||||
href="http://cvs.gnome.org/lxr/source/gdome2/">gdome2 Gnome module</a>, this
|
||||
@ -1473,13 +1499,13 @@ base</a>:</p>
|
||||
</gjob:Jobs>
|
||||
</gjob:Helping></pre>
|
||||
|
||||
<p>While loading the XML file into an internal DOM tree is a matter of calling
|
||||
only a couple of functions, browsing the tree to gather the ata and generate
|
||||
the internal structures is harder, and more error prone.</p>
|
||||
<p>While loading the XML file into an internal DOM tree is a matter of
|
||||
calling only a couple of functions, browsing the tree to gather the ata and
|
||||
generate the internal structures is harder, and more error prone.</p>
|
||||
|
||||
<p>The suggested principle is to be tolerant with respect to the input
|
||||
structure. For example, the ordering of the attributes is not significant, the
|
||||
XML specification is clear about it. It's also usually a good idea not to
|
||||
structure. For example, the ordering of the attributes is not significant,
|
||||
the XML specification is clear about it. It's also usually a good idea not to
|
||||
depend on the order of the children of a given node, unless it really makes
|
||||
things harder. Here is some code to parse the information for a person:</p>
|
||||
<pre>/*
|
||||
@ -1530,13 +1556,13 @@ DEBUG("parsePerson\n");
|
||||
<li>Usually a recursive parsing style is the more convenient one: XML data
|
||||
is by nature subject to repetitive constructs and usually exibits highly
|
||||
stuctured patterns.</li>
|
||||
<li>The two arguments of type <em>xmlDocPtr</em> and <em>xmlNsPtr</em>, i.e.
|
||||
the pointer to the global XML document and the namespace reserved to the
|
||||
application. Document wide information are needed for example to decode
|
||||
entities and it's a good coding practice to define a namespace for your
|
||||
application set of data and test that the element and attributes you're
|
||||
analyzing actually pertains to your application space. This is done by a
|
||||
simple equality test (cur->ns == ns).</li>
|
||||
<li>The two arguments of type <em>xmlDocPtr</em> and <em>xmlNsPtr</em>,
|
||||
i.e. the pointer to the global XML document and the namespace reserved to
|
||||
the application. Document wide information are needed for example to
|
||||
decode entities and it's a good coding practice to define a namespace for
|
||||
your application set of data and test that the element and attributes
|
||||
you're analyzing actually pertains to your application space. This is
|
||||
done by a simple equality test (cur->ns == ns).</li>
|
||||
<li>To retrieve text and attributes value, you can use the function
|
||||
<em>xmlNodeListGetString</em> to gather all the text and entity reference
|
||||
nodes generated by the DOM output and produce an single text string.</li>
|
||||
@ -1597,10 +1623,10 @@ DEBUG("parseJob\n");
|
||||
}</pre>
|
||||
|
||||
<p>Once you are used to it, writing this kind of code is quite simple, but
|
||||
boring. Ultimately, it could be possble to write stubbers taking either C data
|
||||
structure definitions, a set of XML examples or an XML DTD and produce the
|
||||
code needed to import and export the content between C data and XML storage.
|
||||
This is left as an exercise to the reader :-)</p>
|
||||
boring. Ultimately, it could be possble to write stubbers taking either C
|
||||
data structure definitions, a set of XML examples or an XML DTD and produce
|
||||
the code needed to import and export the content between C data and XML
|
||||
storage. This is left as an exercise to the reader :-)</p>
|
||||
|
||||
<p>Feel free to use <a href="example/gjobread.c">the code for the full C
|
||||
parsing example</a> as a template, it is also available with Makefile in the
|
||||
@ -1608,41 +1634,42 @@ Gnome CVS base under gnome-xml/example</p>
|
||||
|
||||
<h2><a name="Contributi">Contributions</a></h2>
|
||||
<ul>
|
||||
<li><a href="mailto:ari@lusis.org">Ari Johnson</a> provides a C++ wrapper
|
||||
for libxml:
|
||||
<li><a href="mailto:ari@lusis.org">Ari Johnson</a>
|
||||
provides a C++ wrapper for libxml:
|
||||
<p>Website: <a
|
||||
href="http://lusis.org/~ari/xml++/">http://lusis.org/~ari/xml++/</a></p>
|
||||
<p>Download: <a
|
||||
href="http://lusis.org/~ari/xml++/libxml++.tar.gz">http://lusis.org/~ari/xml++/libxml++.tar.gz</a></p>
|
||||
</li>
|
||||
<li><a href="mailto:izlatkovic@daenet.de">Igor Zlatkovic</a> is now the
|
||||
maintainer of the Windows port, <a
|
||||
<li><a href="mailto:izlatkovic@daenet.de">Igor Zlatkovic</a>
|
||||
is now the maintainer of the Windows port, <a
|
||||
href="http://www.fh-frankfurt.de/~igor/projects/libxml/index.html">he
|
||||
provides binaries</a></li>
|
||||
<li><a
|
||||
href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">Matt
|
||||
Sergeant</a> developped <a
|
||||
href="http://axkit.org/download/">XML::LibXSLT</a>, a perl wrapper for
|
||||
libxml2/libxslt as part of the <a href="http://axkit.com/">AxKit XML
|
||||
application server</a></li>
|
||||
<li><a href="mailto:fnatter@gmx.net">Felix Natter</a> and <a
|
||||
href="mailto:geertk@ai.rug.nl">Geert Kloosterman</a> provide <a
|
||||
Sergeant</a>
|
||||
developped <a href="http://axkit.org/download/">XML::LibXSLT</a>, a perl
|
||||
wrapper for libxml2/libxslt as part of the <a
|
||||
href="http://axkit.com/">AxKit XML application server</a></li>
|
||||
<li><a href="mailto:fnatter@gmx.net">Felix Natter</a>
|
||||
and <a href="mailto:geertk@ai.rug.nl">Geert Kloosterman</a> provide <a
|
||||
href="libxml-doc.el">an emacs module</a> to lookup libxml(2) functions
|
||||
documentation</li>
|
||||
<li><a href="mailto:sherwin@nlm.nih.gov">Ziying Sherwin</a> provided <a
|
||||
href="http://xmlsoft.org/messages/0488.html">man pages</a></li>
|
||||
<li><a href="mailto:sherwin@nlm.nih.gov">Ziying Sherwin</a>
|
||||
provided <a href="http://xmlsoft.org/messages/0488.html">man
|
||||
pages</a></li>
|
||||
<li>there is a module for <a
|
||||
href="http://acs-misc.sourceforge.net/nsxml.html">libxml/libxslt support
|
||||
in OpenNSD/AOLServer</a></li>
|
||||
<li><a href="mailto:dkuhlman@cutter.rexx.com">Dave Kuhlman</a> provides
|
||||
libxml/libxslt <a href="http://www.rexx.com/~dkuhlman">wrappers for
|
||||
Python</a></li>
|
||||
<li><a href="mailto:dkuhlman@cutter.rexx.com">Dave Kuhlman</a>
|
||||
provides libxml/libxslt <a href="http://www.rexx.com/~dkuhlman">wrappers
|
||||
for Python</a></li>
|
||||
</ul>
|
||||
|
||||
<p></p>
|
||||
|
||||
<p><a href="mailto:Daniel.Veillard@imag.fr">Daniel Veillard</a></p>
|
||||
|
||||
<p>$Id: xml.html,v 1.103 2001/07/26 18:30:26 veillard Exp $</p>
|
||||
<p>$Id: xml.html,v 1.104 2001/07/27 18:56:57 veillard Exp $</p>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user