|
Overview Child elements and text content are represented as array data having numerical keys, with a string at index 0 representing the name of an element's tag. Attributes are represented as array data having string keys, i.e. name/value pairs. LuaXML is published under the same liberal licensing conditions as Lua itself. This means that LuaXML is free software and can be freely used for both academic and commercial purposes. Download Installation 1. Download the LuaXML module and extract it to a temporary location. 2. Copy the LuaXml.lua and LuaXML_lib.dll files to your project's Scripts folder. 3. Add the following require to your project, e.g. in Global Functions: Usage The LuaXML module works off native Lua data and represents XML as a table where: - the tag for an element is stored at index 0 - child elements/content are numerically indexed beginning at index 1 - attributes are represented by name/value pairs For example, this bit of XML: <items> ...would be represented by the following table: tb = {[0]="items",This makes modifying the XML very easy; you can modify any part of the XML just by changing the table. Examples function print (...) Note that the LuaXML module isn't limited to table data and can convert any Lua variable to XML using xml.str(), xml.save(), etc. For example, myString = "Hello World"; ...produces this output: <string> Hello World </string> A table containing a list of numerically indexed items, with nothing at index 0, like this: tb = {"apple","orange","peach","lemon","kiwi","watermelon"}...produces this output: <table> Name/value pairs inside a table become attributes, so: tb = {...produces this output: <table watermelon="red" peach="peach" kiwi="green" apple="green" orange="orange" lemon="yellow" /> Note that if you don't specify the tag at index 0 or as a parameter in the xml.str() call, the tag name for the outer element is based on the data type, e.g. "string" and "table" above. License Copyright (C) 2007-2009 Gerald Franz, www.viremo.de Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
| Keywords | LUA Modules LuaXML |
| Category | LUA Modules |
| Download (External) | http://viremo.eludi.net/LuaXML/LuaXML_101012.zip |
| Date Submitted | Jun 2, 2010 |
| Contact Name | Indigo Rose Software |
| send email to Indigo Rose Software | |
| More Info | http://viremo.eludi.net/LuaXML/index.html |
Write a Review
Report Broken Link
|
|