@@ -85,11 +85,11 @@ <h2><a name="introduction"></a>Introduction</h2>
85
85
< h2 > < a name ="building "> </ a > Building</ h2 >
86
86
87
87
< p >
88
- LuaExpat could be built to Lua 5.0 or to Lua 5.1 .
88
+ LuaExpat could be built to Lua 5.1 or to Lua 5.2 .
89
89
In both cases,
90
90
the language library and headers files for the desired version
91
91
must be installed properly.
92
- LuaExpat also depends on Expat 2.0.0 which should also be installed.
92
+ LuaExpat also depends on Expat 2.0.0+ which should also be installed.
93
93
</ p >
94
94
< p >
95
95
LuaExpat offers a Makefile and a separate configuration file,
@@ -131,11 +131,13 @@ <h2><a name="parser"></a>Parser objects</h2>
131
131
< h4 > Constructor</ h4 >
132
132
133
133
< dl class ="reference ">
134
- < dt > < strong > lxp.new(< em > callbacks [, separator]</ em > )</ strong > </ dt >
134
+ < dt > < strong > lxp.new(< em > callbacks [, separator[, merge_character_data] ]</ em > )</ strong > </ dt >
135
135
< dd > The parser is created by a call to the function < strong > lxp.new</ strong > ,
136
136
which returns the created parser or raises a Lua error. It
137
137
receives the callbacks table and optionally the parser < a href ="#separator ">
138
- separator character</ a > used in the namespace expanded element names.</ dd >
138
+ separator character</ a > used in the namespace expanded element names.
139
+ If < em > merge_character_data</ em > is false then LuaExpat will not combine multiple
140
+ CharacterData calls into one. For more info on this behaviour see CharacterData below.</ dd >
139
141
</ dl >
140
142
141
143
< h4 > Methods</ h4 >
@@ -167,6 +169,12 @@ <h4>Methods</h4>
167
169
< dd > Returns three results: the current parsing line, column, and
168
170
absolute position.</ dd >
169
171
172
+ < dt > < strong > parser:getcurrentbytecount()</ strong > </ dt >
173
+ < dd > Return the number of bytes of input corresponding to the current
174
+ event. This function can only be called inside a handler, in other
175
+ contexts it will return 0. Do not use inside a CharacterData handler
176
+ unless CharacterData merging has been disabled (see lxp.new).</ dd >
177
+
170
178
< dt > < strong > parser:setbase(base)</ strong > </ dt >
171
179
< dd > Sets the < em > base</ em > to be used for resolving relative URIs in
172
180
system identifiers.</ dd >
@@ -205,8 +213,8 @@ <h4>Callbacks</h4>
205
213
< em > ExternalEntityRef</ em > , < em > NotStandalone</ em > ,
206
214
< em > NotationDecl</ em > , < em > ProcessingInstruction</ em > ,
207
215
< em > StartCDataSection</ em > , < em > StartElement</ em > ,
208
- < em > StartNamespaceDecl</ em > , < em > UnparsedEntityDecl</ em >
209
- and < em > StartDoctypeDecl</ em > .</ p >
216
+ < em > StartNamespaceDecl</ em > , < em > UnparsedEntityDecl</ em > ,
217
+ < em > XmlDecl </ em > and < em > StartDoctypeDecl</ em > .</ p >
210
218
211
219
< p > These indices can be references to functions with
212
220
specific signatures, as seen below. The parser constructor also
@@ -226,7 +234,10 @@ <h4>Callbacks</h4>
226
234
227
235
< dl class ="reference ">
228
236
< dt > < strong > callbacks.CharacterData = function(parser, string)</ strong > </ dt >
229
- < dd > Called when the < em > parser</ em > recognizes an XML CDATA < em > string</ em > .</ dd >
237
+ < dd > Called when the < em > parser</ em > recognizes an XML CDATA < em > string</ em > .
238
+ Note that LuaExpat automatically combines multiple CharacterData events
239
+ from Expat into a single call to this handler, unless < em > merge_character_data</ em >
240
+ is set to false when calling lxp.new().</ dd >
230
241
231
242
< dt > < strong > callbacks.Comment = function(parser, string)</ strong > </ dt >
232
243
< dd > Called when the < em > parser</ em > recognizes an XML comment
@@ -300,6 +311,11 @@ <h4>Callbacks</h4>
300
311
< dd > Called when the < em > parser</ em > detects the begining of an XML
301
312
CDATA section.</ dd >
302
313
314
+ < dt > < strong > callbacks.XmlDecl = function(parser, version, encoding)</ strong > </ dt >
315
+ < dd > Called when the < em > parser</ em > encounters an XML document declaration (these are
316
+ optional, and valid only at the start of the document). The callback receives
317
+ the declared XML < em > version</ em > and document < em > encoding</ em > .</ dd >
318
+
303
319
< dt > < strong > callbacks.StartElement = function(parser, elementName, attributes)</ strong > </ dt >
304
320
< dd > Called when the < em > parser</ em > detects the begining of an XML
305
321
element with < em > elementName</ em > .< br />
@@ -371,7 +387,6 @@ <h4><a name="separator"></a>The separator character</h4>
371
387
< div id ="about ">
372
388
< p > < a href ="http://validator.w3.org/check?uri=referer ">
373
389
< img src ="http://www.w3.org/Icons/valid-xhtml10 " alt ="Valid XHTML 1.0! " height ="31 " width ="88 " /> </ a > </ p >
374
- < p > < small > $Id: manual.html,v 1.27 2007/06/05 20:03:12 carregal Exp $</ small > </ p >
375
390
</ div > <!-- id="about" -->
376
391
377
392
</ div > <!-- id="container" -->
0 commit comments