doc/us/manual.html

Wed, 01 Jun 2011 22:14:25 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 01 Jun 2011 22:14:25 +0100
changeset 0
24d141cb2d1e
child 5
4570d6616c99
permissions
-rw-r--r--

Initial commit of LuaExpat 1.1.0

0
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 <html>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 <head>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 <title>LuaExpat: XML Expat parsing for the Lua programming language</title>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 </head>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 <body>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 <div id="container">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 <div id="product">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 <div id="product_logo"><a href="http://www.keplerproject.org">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 <img alt="LuaExpat logo" src="luaexpat.png"/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 </a></div>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 <div id="product_name"><big><strong>LuaExpat</strong></big></div>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 <div id="product_description">XML Expat parsing for the Lua programming language</div>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 </div> <!-- id="product" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 <div id="main">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 <div id="navigation">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24 <h1>LuaExpat</h1>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 <ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26 <li><a href="index.html">Home</a>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 <ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
28 <li><a href="index.html#overview">Overview</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29 <li><a href="index.html#status">Status</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 <li><a href="index.html#download">Download</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31 <li><a href="index.html#history">History</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 <li><a href="index.html#references">References</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33 <li><a href="index.html#credits">Credits</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34 <li><a href="index.html#contact">Contact</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
35 </ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
36 </li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37 <li><strong>Manual</strong>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38 <ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
39 <li><a href="manual.html#introduction">Introduction</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40 <li><a href="manual.html#installation">Installation</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
41 <li><a href="manual.html#parser">Parser Objects</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
42 </ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
43 </li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
44 <li><a href="examples.html">Examples</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
45 <li><a href="lom.html">Lua Object Model</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
46 <li><a href="http://luaforge.net/projects/luaexpat/">Project</a>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
47 <ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
48 <li><a href="http://luaforge.net/tracker/?group_id=13">Bug Tracker</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
49 <li><a href="http://luaforge.net/scm/?group_id=13">CVS</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
50 </ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
51 </li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
52 <li><a href="license.html">License</a></li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
53 </ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
54 </div> <!-- id="navigation" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
55
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
56 <div id="content">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
57
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
58 <h2><a name="introduction"></a>Introduction</h2>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
59
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
60 <p>LuaExpat is a <a href="http://www.saxproject.org/">SAX</a> XML
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
61 parser based on the <a href="http://www.libexpat.org/">Expat</a> library.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
62 SAX is the <em>Simple API for XML</em> and allows programs to:
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
63 </p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
64
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
65 <ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
66 <li>process a XML document incrementally, thus being able to handle
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
67 huge documents without memory penalties;</li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
68
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
69 <li>register handler functions which are called by the parser during
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
70 the processing of the document, handling the document elements or
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
71 text.</li>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
72 </ul>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
73
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
74 <p>With an event-based API like SAX the XML document can be fed to
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
75 the parser in chunks, and the parsing begins as soon as the parser
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
76 receives the first document chunk. LuaExpat reports parsing events
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
77 (such as the start and end of elements) directly to the application
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
78 through callbacks. The parsing of huge documents can benefit from
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
79 this piecemeal operation.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
80
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
81 <p>LuaExpat is distributed as a library and a file <code>lom.lua</code> that
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
82 implements the <a href="lom.html">Lua Object Model</a>.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
83
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
84
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
85 <h2><a name="building"></a>Building</h2>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
86
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
87 <p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
88 LuaExpat could be built to Lua 5.0 or to Lua 5.1.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
89 In both cases,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
90 the language library and headers files for the desired version
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
91 must be installed properly.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
92 LuaExpat also depends on Expat 2.0.0 which should also be installed.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
93 </p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
94 <p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
95 LuaExpat offers a Makefile and a separate configuration file,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
96 <code>config</code>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
97 which should be edited to suit the particularities of the target platform
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
98 before running
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
99 <code>make</code>.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
100 The file has some definitions like paths to the external libraries,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
101 compiler options and the like.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
102 One important definition is the version of Lua language,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
103 which is not obtained from the installed software.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
104 </p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
105
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
106
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
107 <h2><a name="installation"></a>Installation</h2>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
108
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
109 <p>The compiled binary file should be copied to a directory in your
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
110 <a href="http://www.lua.org/manual/5.1/manual.html#pdf-package.cpath">C path</a>.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
111 Lua 5.0 users should also install
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
112 <a href="http://www.keplerproject.org/compat">Compat-5.1</a>.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
113
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
114 <p>Windows users can use the binary version of LuaExpat (<code>lxp.dll</code>, compatible with
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
115 <a href="http://luabinaries.luaforge.net">LuaBinaries</a>) available at
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
116 <a href="http://luaforge.net/projects/luaexpat/files">LuaForge</a>.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
117
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
118 <p>The file <code>lom.lua</code> should be copied to a directory in your
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
119 <a href="http://www.lua.org/manual/5.1/manual.html#pdf-package.path">Lua path</a>.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
120
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
121 <h2><a name="parser"></a>Parser objects</h2>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
122
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
123 <p>Usually SAX implementations base all operations on the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
124 concept of a parser that allows the registration of callback
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
125 functions. LuaExpat offers the same functionality but uses a
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
126 different registration method, based on a table of callbacks. This
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
127 table contains references to the callback functions which are
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
128 responsible for the handling of the document parts. The parser will
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
129 assume no behaviour for any undeclared callbacks.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
130
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
131 <h4>Constructor</h4>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
132
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
133 <dl class="reference">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
134 <dt><strong>lxp.new(<em>callbacks [, separator]</em>)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
135 <dd>The parser is created by a call to the function <strong>lxp.new</strong>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
136 which returns the created parser or raises a Lua error. It
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
137 receives the callbacks table and optionally the parser <a href="#separator">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
138 separator character</a> used in the namespace expanded element names.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
139 </dl>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
140
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
141 <h4>Methods</h4>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
142
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
143 <dl class="reference">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
144 <dt><strong>parser:close()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
145 <dd>Closes the parser, freeing all memory used by it. A call to
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
146 parser:close() without a previous call to parser:parse() could
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
147 result in an error.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
148
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
149 <dt><strong>parser:getbase()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
150 <dd>Returns the base for resolving relative URIs.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
151
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
152 <dt><strong>parser:getcallbacks()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
153 <dd>Returns the callbacks table.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
154
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
155 <dt><strong>parser:parse(s)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
156 <dd>Parse some more of the document. The string <em>s</em> contains
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
157 part (or perhaps all) of the document. When called without
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
158 arguments the document is closed (but the parser still has to be
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
159 closed).<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
160 The function returns a non nil value when the parser has been
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
161 succesfull, and when the parser finds an error it returns five
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
162 results: nil, <em>msg</em>, <em>line</em>, <em>col</em>, and
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
163 <em>pos</em>, which are the error message, the line number,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
164 column number and absolute position of the error in the XML document.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
165
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
166 <dt><strong>parser:pos()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
167 <dd>Returns three results: the current parsing line, column, and
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
168 absolute position.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
169
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
170 <dt><strong>parser:setbase(base)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
171 <dd>Sets the <em>base</em> to be used for resolving relative URIs in
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
172 system identifiers.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
173
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
174 <dt><strong>parser:setencoding(encoding)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
175 <dd>Set the encoding to be used by the parser. There are four
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
176 built-in encodings, passed as strings: "US-ASCII",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
177 "UTF-8", "UTF-16", and "ISO-8859-1".</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
178 </dl>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
179
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
180 <h4>Callbacks</h4>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
181
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
182 <p>The Lua callbacks define the handlers of the parser events. The
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
183 use of a table in the parser constructor has some advantages over
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
184 the registration of callbacks, since there is no need for for the API
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
185 to provide a way to manipulate callbacks.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
186
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
187 <p>Another difference lies in the behaviour of the callbacks during
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
188 the parsing itself. The callback table contains references to the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
189 functions that can be redefined at will. The only restriction is
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
190 that only the callbacks present in the table at creation time
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
191 will be called.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
192
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
193 <p>The callbacks table indices are named after the equivalent Expat
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
194 callbacks:<br />
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
195 <em>CharacterData</em>, <em>Comment</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
196 <em>Default</em>, <em>DefaultExpand</em>, <em>EndCDataSection</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
197 <em>EndElement</em>, <em>EndNamespaceDecl</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
198 <em>ExternalEntityRef</em>, <em>NotStandalone</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
199 <em>NotationDecl</em>, <em>ProcessingInstruction</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
200 <em>StartCDataSection</em>, <em>StartElement</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
201 <em>StartNamespaceDecl</em>, and <em>UnparsedEntityDecl</em>.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
202
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
203 <p>These indices can be references to functions with
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
204 specific signatures, as seen below. The parser constructor also
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
205 checks the presence of a field called <em>_nonstrict</em> in the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
206 callbacks table. If <em>_nonstrict</em> is absent, only valid
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
207 callback names are accepted as indices in the table
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
208 (Defaultexpanded would be considered an error for example). If
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
209 <em>_nonstrict</em> is defined, any other fieldnames can be
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
210 used (even if not called at all).</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
211
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
212 <p>The callbacks can optionally be defined as <code>false</code>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
213 acting thus as placeholders for future assignment of functions.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
214
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
215 <p>Every callback function receives as the first parameter the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
216 calling parser itself, thus allowing the same functions to be used
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
217 for more than one parser for example.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
218
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
219 <dl class="reference">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
220 <dt><strong>callbacks.CharacterData = function(parser, string)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
221 <dd>Called when the <em>parser</em> recognizes an XML CDATA <em>string</em>.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
222
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
223 <dt><strong>callbacks.Comment = function(parser, string)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
224 <dd>Called when the <em>parser</em> recognizes an XML comment
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
225 <em>string</em>.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
226
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
227 <dt><strong>callbacks.Default = function(parser, string)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
228 <dd>Called when the <em>parser</em> has a <em>string</em>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
229 corresponding to any characters in the document which wouldn't
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
230 otherwise be handled. Using this handler has the side effect of
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
231 turning off expansion of references to internally defined general
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
232 entities. Instead these references are passed to the default
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
233 handler.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
234
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
235 <dt><strong>callbacks.DefaultExpand = function(parser, string)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
236 <dd>Called when the <em>parser</em> has a <em>string</em>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
237 corresponding to any characters in the document which wouldn't
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
238 otherwise be handled. Using this handler doesn't affect expansion
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
239 of internal entity references.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
240
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
241 <dt><strong>callbacks.EndCdataSection = function(parser)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
242 <dd>Called when the <em>parser</em> detects the end of a CDATA
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
243 section.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
244
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
245 <dt><strong>callbacks.EndElement = function(parser, elementName)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
246 <dd>Called when the <em>parser</em> detects the ending of an XML
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
247 element with <em>elementName</em>.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
248
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
249 <dt><strong>callbacks.EndNamespaceDecl = function(parser, namespaceName)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
250 <dd>Called when the <em>parser</em> detects the ending of an XML
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
251 namespace with <em>namespaceName</em>. The handling of the end
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
252 namespace is done after the handling of the end tag for the element
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
253 the namespace is associated with.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
254
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
255 <dt><strong>callbacks.ExternalEntityRef = function(parser, subparser, base, systemId, publicId)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
256 <dd>Called when the <em>parser</em> detects an external entity
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
257 reference.<br/><br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
258 The <em>subparser</em> is a LuaExpat parser created with the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
259 same callbacks and Expat context as the <em>parser</em> and should
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
260 be used to parse the external entity.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
261 The <em>base</em> parameter is the base to use for relative
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
262 system identifiers. It is set by parser:setbase and may be nil.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
263 The <em>systemId</em> parameter is the system identifier
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
264 specified in the entity declaration and is never nil.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
265 The <em>publicId</em> parameter is the public id given in the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
266 entity declaration and may be nil.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
267
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
268 <dt><strong>callbacks.NotStandalone = function(parser)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
269 <dd>Called when the <em>parser</em> detects that the document is not
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
270 "standalone". This happens when there is an external subset or a
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
271 reference to a parameter entity, but the document does not have standalone set
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
272 to "yes" in an XML declaration.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
273
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
274 <dt><strong>callbacks.NotationDecl = function(parser, notationName, base, systemId, publicId)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
275 <dd>Called when the <em>parser</em> detects XML notation
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
276 declarations with <em>notationName</em><br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
277 The <em>base</em> parameter is the base to use for relative
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
278 system identifiers. It is set by parser:setbase and may be nil.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
279 The <em>systemId</em> parameter is the system identifier
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
280 specified in the entity declaration and is never nil.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
281 The <em>publicId</em> parameter is the public id given in the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
282 entity declaration and may be nil.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
283
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
284 <dt><strong>callbacks.ProcessingInstruction = function(parser, target, data)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
285 <dd>Called when the <em>parser</em> detects XML processing
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
286 instructions. The <em>target</em> is the first word in the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
287 processing instruction. The <em>data</em> is the rest of the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
288 characters in it after skipping all whitespace after the initial
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
289 word.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
290
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
291 <dt><strong>callbacks.StartCdataSection = function(parser)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
292 <dd>Called when the <em>parser</em> detects the begining of an XML
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
293 CDATA section.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
294
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
295 <dt><strong>callbacks.StartElement = function(parser, elementName, attributes)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
296 <dd>Called when the <em>parser</em> detects the begining of an XML
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
297 element with <em>elementName</em>.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
298 The <em>attributes</em> parameter is a Lua table with all the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
299 element attribute names and values. The table contains an entry for
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
300 every attribute in the element start tag and entries for the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
301 default attributes for that element.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
302 The attributes are listed by name (including the inherited ones)
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
303 and by position (inherited attributes are not considered in the
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
304 position list).<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
305 As an example if the <em>book</em> element has attributes
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
306 <em>author</em>, <em>title</em> and an optional <em>format</em>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
307 attribute (with "printed" as default value),
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
308 <pre class="example">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
309 &lt;book author="Ierusalimschy, Roberto" title="Programming in Lua"&gt;
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
310 </pre>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
311 would be represented as<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
312 <pre class="example">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
313 {[1] = "Ierusalimschy, Roberto",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
314 [2] = "Programming in Lua",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
315 author = "Ierusalimschy, Roberto",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
316 format = "printed",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
317 title = "Programming in Lua"}
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
318 </pre></dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
319
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
320 <dt><strong>callbacks.StartNamespaceDecl = function(parser, namespaceName)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
321 <dd>Called when the <em>parser</em> detects an XML namespace
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
322 declaration with <em>namespaceName</em>. Namespace declarations
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
323 occur inside start tags, but the StartNamespaceDecl handler is
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
324 called before the StartElement handler for each namespace declared
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
325 in that start tag.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
326
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
327 <dt><strong>callbacks.UnparsedEntityDecl = function(parser, entityName, base, systemId, publicId, notationName)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
328 <dd>Called when the <em>parser</em> receives declarations of
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
329 unparsed entities. These are entity declarations that have a
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
330 notation (NDATA) field.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
331 As an example, in the chunk
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
332 <pre class="example">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
333 &lt;!ENTITY logo SYSTEM "images/logo.gif" NDATA gif&gt;
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
334 </pre>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
335 <em>entityName</em> would be "logo", <em>systemId</em> would be
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
336 "images/logo.gif" and <em>notationName</em> would be "gif".
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
337 For this example the <em>publicId</em> parameter would be nil.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
338 The <em>base</em> parameter would be whatever has been set with
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
339 <code>parser:setbase</code>. If not set, it would be nil.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
340 </dl>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
341
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
342 <h4><a name="separator"></a>The separator character</h4>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
343
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
344 <p>The optional separator character in the parser constructor
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
345 defines the character used in the namespace expanded element names.
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
346 The separator character is optional (if not defined the parser will
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
347 not handle namespaces) but if defined it must be different from
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
348 the character '\0'.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
349
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
350 </div> <!-- id="content" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
351
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
352 </div> <!-- id="main" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
353
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
354 <div id="about">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
355 <p><a href="http://validator.w3.org/check?uri=referer">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
356 <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
357 <p><small>$Id: manual.html,v 1.27 2007/06/05 20:03:12 carregal Exp $</small></p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
358 </div> <!-- id="about" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
359
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
360 </div> <!-- id="container" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
361
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
362 </body>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
363 </html>

mercurial