doc/us/manual.html

Thu, 03 Apr 2014 14:30:36 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 03 Apr 2014 14:30:36 +0100
changeset 24
0d7de9d0878b
parent 20
1506d4582d44
permissions
-rw-r--r--

Update HTML to reference a local doc.css, and remove W3C-hosted images (a potential privacy leak)

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>
24
0d7de9d0878b Update HTML to reference a local doc.css, and remove W3C-hosted images (a potential privacy leak)
Matthew Wild <mwild1@gmail.com>
parents: 20
diff changeset
6 <link rel="stylesheet" href="../doc.css" type="text/css"/>
0
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>
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
88 LuaExpat could be built to Lua 5.1 or to Lua 5.2.
0
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.
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
92 LuaExpat also depends on Expat 2.0.0+ which should also be installed.
0
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">
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
134 <dt><strong>lxp.new(<em>callbacks [, separator[, merge_character_data]]</em>)</strong></dt>
0
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">
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
138 separator character</a> used in the namespace expanded element names.
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
139 If <em>merge_character_data</em> is false then LuaExpat will not combine multiple
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
140 CharacterData calls into one. For more info on this behaviour see CharacterData below.</dd>
0
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
141 </dl>
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 <h4>Methods</h4>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
144
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
145 <dl class="reference">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
146 <dt><strong>parser:close()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
147 <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
148 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
149 result in an error.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
150
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
151 <dt><strong>parser:getbase()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
152 <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
153
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
154 <dt><strong>parser:getcallbacks()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
155 <dd>Returns the callbacks table.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
156
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
157 <dt><strong>parser:parse(s)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
158 <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
159 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
160 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
161 closed).<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
162 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
163 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
164 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
165 <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
166 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
167
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
168 <dt><strong>parser:pos()</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
169 <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
170 absolute position.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
171
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
172 <dt><strong>parser:getcurrentbytecount()</strong></dt>
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
173 <dd>Return the number of bytes of input corresponding to the current
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
174 event. This function can only be called inside a handler, in other
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
175 contexts it will return 0. Do not use inside a CharacterData handler
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
176 unless CharacterData merging has been disabled (see lxp.new).</dd>
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
177
0
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
178 <dt><strong>parser:setbase(base)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
179 <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
180 system identifiers.</dd>
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 <dt><strong>parser:setencoding(encoding)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
183 <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
184 built-in encodings, passed as strings: "US-ASCII",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
185 "UTF-8", "UTF-16", and "ISO-8859-1".</dd>
5
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
186
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
187 <dt><strong>parser:stop()</strong></dt>
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
188 <dd>Abort the parser and prevent it from parsing any further
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
189 through the data it was last passed. Use to halt parsing the
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
190 document when an error is discovered inside a callback, for
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
191 example. The parser object cannot accept more data after
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
192 this call.</dd>
0
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
193 </dl>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
194
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
195 <h4>Callbacks</h4>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
196
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
197 <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
198 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
199 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
200 to provide a way to manipulate callbacks.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
201
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
202 <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
203 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
204 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
205 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
206 will be called.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
207
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
208 <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
209 callbacks:<br />
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
210 <em>CharacterData</em>, <em>Comment</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
211 <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
212 <em>EndElement</em>, <em>EndNamespaceDecl</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
213 <em>ExternalEntityRef</em>, <em>NotStandalone</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
214 <em>NotationDecl</em>, <em>ProcessingInstruction</em>,
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
215 <em>StartCDataSection</em>, <em>StartElement</em>,
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
216 <em>StartNamespaceDecl</em>, <em>UnparsedEntityDecl</em>,
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
217 <em>XmlDecl</em> and <em>StartDoctypeDecl</em>.</p>
0
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 <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
220 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
221 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
222 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
223 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
224 (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
225 <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
226 used (even if not called at all).</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
227
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
228 <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
229 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
230
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
231 <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
232 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
233 for more than one parser for example.</p>
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 <dl class="reference">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
236 <dt><strong>callbacks.CharacterData = function(parser, string)</strong></dt>
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
237 <dd>Called when the <em>parser</em> recognizes an XML CDATA <em>string</em>.
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
238 Note that LuaExpat automatically combines multiple CharacterData events
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
239 from Expat into a single call to this handler, unless <em>merge_character_data</em>
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
240 is set to false when calling lxp.new().</dd>
0
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
241
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
242 <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
243 <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
244 <em>string</em>.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
245
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
246 <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
247 <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
248 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
249 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
250 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
251 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
252 handler.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
253
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
254 <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
255 <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
256 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
257 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
258 of internal entity references.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
259
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
260 <dt><strong>callbacks.EndCdataSection = function(parser)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
261 <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
262 section.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
263
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
264 <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
265 <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
266 element with <em>elementName</em>.</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.EndNamespaceDecl = function(parser, namespaceName)</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 the ending of an XML
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
270 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
271 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
272 the namespace is associated with.</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.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
275 <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
276 reference.<br/><br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
277 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
278 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
279 be used to parse the external entity.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
280 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
281 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
282 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
283 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
284 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
285 entity declaration and may be nil.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
286
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
287 <dt><strong>callbacks.NotStandalone = function(parser)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
288 <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
289 "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
290 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
291 to "yes" in an XML declaration.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
292
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
293 <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
294 <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
295 declarations with <em>notationName</em><br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
296 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
297 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
298 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
299 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
300 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
301 entity declaration and may be nil.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
302
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
303 <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
304 <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
305 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
306 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
307 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
308 word.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
309
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
310 <dt><strong>callbacks.StartCdataSection = function(parser)</strong></dt>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
311 <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
312 CDATA section.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
313
20
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
314 <dt><strong>callbacks.XmlDecl = function(parser, version, encoding)</strong></dt>
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
315 <dd>Called when the <em>parser</em> encounters an XML document declaration (these are
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
316 optional, and valid only at the start of the document). The callback receives
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
317 the declared XML <em>version</em> and document <em>encoding</em>.</dd>
1506d4582d44 Update _VERSION, makefile, README and documentation to 1.3.0
Matthew Wild <mwild1@gmail.com>
parents: 5
diff changeset
318
0
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
319 <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
320 <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
321 element with <em>elementName</em>.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
322 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
323 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
324 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
325 default attributes for that element.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
326 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
327 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
328 position list).<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
329 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
330 <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
331 attribute (with "printed" as default value),
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;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
334 </pre>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
335 would be represented as<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
336 <pre class="example">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
337 {[1] = "Ierusalimschy, Roberto",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
338 [2] = "Programming in Lua",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
339 author = "Ierusalimschy, Roberto",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
340 format = "printed",
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
341 title = "Programming in Lua"}
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
342 </pre></dd>
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 <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
345 <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
346 declaration with <em>namespaceName</em>. Namespace declarations
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
347 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
348 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
349 in that start tag.</dd>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
350
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
351 <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
352 <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
353 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
354 notation (NDATA) field.<br/>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
355 As an example, in the chunk
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
356 <pre class="example">
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
357 &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
358 </pre>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
359 <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
360 "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
361 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
362 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
363 <code>parser:setbase</code>. If not set, it would be nil.</dd>
5
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
364
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
365 <dt><strong>callbacks.StartDoctypeDecl = function(parser, name, sysid, pubid, has_internal_subset)</strong></dt>
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
366 <dd>Called when the <em>parser</em> detects the beginning of an XML
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
367 DTD (DOCTYPE) section. These precede the XML root element and take
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
368 the form:
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
369 <pre class="example">
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
370 &lt;!DOCTYPE root_elem PUBLIC "example"&gt;
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
371 </pre>
4570d6616c99 Update docs and README for 1.1.1 release
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
372 </dd>
0
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
373 </dl>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
374
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
375 <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
376
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
377 <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
378 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
379 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
380 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
381 the character '\0'.</p>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
382
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
383 </div> <!-- id="content" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
384
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
385 </div> <!-- id="main" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
386
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
387 </div> <!-- id="container" -->
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
388
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
389 </body>
24d141cb2d1e Initial commit of LuaExpat 1.1.0
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
390 </html>

mercurial