File tree 7 files changed +21
-36
lines changed 7 files changed +21
-36
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,6 @@ interactive Digital Television (DTV) [Ginga NCL applications](http://gingancl.or
10
10
11
11
The original parser was written by Paul Chakravarti and is available on [ LuaUsers] ( http://lua-users.org/wiki/LuaXml ) .
12
12
13
- The code (and documentation) is not complete yet, however it is usable and this release is intended to avoid potential duplication between efforts and get early feedback.
14
-
15
- The API is relatively stable however there may be some detailed changes.
16
-
17
13
# Installation
18
14
If you clone this repository, you are download all the module source code and can run the examples directly.
19
15
However, if you want to use the module inside your own project, the best way is to download it using
Original file line number Diff line number Diff line change 1
- --- @module Class to parse XML
1
+ --- @module Class providing the actual XML parser.
2
+ -- Available options are:
3
+ -- * stripWS
4
+ -- Strip non-significant whitespace (leading/trailing)
5
+ -- and do not generate events for empty text elements
6
+ --
7
+ -- * expandEntities
8
+ -- Expand entities (standard entities + single char
9
+ -- numeric entities only currently - could be extended
10
+ -- at runtime if suitable DTD parser added elements
11
+ -- to table (see obj._ENTITIES). May also be possible
12
+ -- to expand multibyre entities for UTF-8 only
13
+ --
14
+ -- * errorHandler
15
+ -- Custom error handler function
16
+ --
17
+ -- NOTE: Boolean options must be set to 'nil' not '0'
2
18
local XmlParser = {
3
- -- Available options are -
4
- --
5
- -- * stripWS
6
- --
7
- -- Strip non-significant whitespace (leading/trailing)
8
- -- and do not generate events for empty text elements
9
- --
10
- -- * expandEntities
11
- --
12
- -- Expand entities (standard entities + single char
13
- -- numeric entities only currently - could be extended
14
- -- at runtime if suitable DTD parser added elements
15
- -- to table (see obj._ENTITIES). May also be possible
16
- -- to expand multibyre entities for UTF-8 only
17
- --
18
- -- * errorHandler
19
- --
20
- -- Custom error handler function
21
- --
22
- -- NOTE: Boolean options must be set to 'nil' not '0'
23
19
options = {},
24
20
handler = {},
25
21
Original file line number Diff line number Diff line change 3
3
--- Simple command line test parser - applies handler[s] specified
4
4
-- to XML file (or STDIN) and dumps results<br/>
5
5
--
6
- -- $Id: testxml.lua,v 1.1.1.1 2001/11/28 06:11:33 paulc Exp $<br/>
7
- --
8
- -- $Log: testxml.lua,v $<br/>
9
- -- Revision 1.1.1.1 2001/11/28 06:11:33 paulc<br/>
10
- -- Initial Import
11
- --
12
6
13
7
require (" xml2lua" )
14
8
local treeHandler = require (" xmlhandler/tree" )
Original file line number Diff line number Diff line change 1
- --- @module This module provides a non-validating XML stream parser in Lua.
1
+ --- @module Module providing a non-validating XML stream parser in Lua.
2
2
--
3
3
-- Features:
4
4
-- =========
37
37
-- callbacks for each XML element processed (if a suitable handler
38
38
-- function is defined). The API is conceptually similar to the
39
39
-- SAX API but implemented differently.
40
- --
41
40
--
42
41
-- XML data is passed to the parser instance through the 'parse'
43
42
-- method (Note: must be passed a single string currently)
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ There are currently 3 available handlers:
7
7
- dom: generates a DOM-like node tree structure with a single ROOT node parent.
8
8
9
9
# Usage
10
- To get a handler instance you must call, for instance, ` handler = require("xmlhandler/ tree") ` .
10
+ To get a handler instance you must call, for instance, ` handler = require("xmlhandler. tree") ` .
11
11
Then, you have to use one the handler instance when getting an instance of the XML parser using ` parser = xml2lua.parser(handler) ` .
12
12
Notice the module ` xml2lua ` should have been loaded before using ` require("xml2lua") ` .
13
13
This way, the handler is called internally when the ` parser:parse(xml) ` function is called.
Original file line number Diff line number Diff line change 8
8
-- _parent = <Parent Node>
9
9
-- _children = { List of child nodes - ROOT/NODE only }
10
10
-- }
11
- -- where PI stands for XML processing instructions
11
+ -- where PI stands for XML processing instructions.
12
12
--
13
13
-- The dom structure is capable of representing any valid XML document
14
14
--
Original file line number Diff line number Diff line change 1
1
2
2
--- @module XML Tree Handler.
3
- -- Generate a lua table from an XML content string.
3
+ -- Generates a lua table from an XML content string.
4
4
-- It is a simplified handler which attempts
5
5
-- to generate a more 'natural' table based structure which
6
6
-- supports many common XML formats.
You can’t perform that action at this time.
0 commit comments