---++!! !commonlib.LuaXML %TOC{title="Contents:"}% %STARTINCLUDE% ---++ Lua XML | *Title* | Lua XML | | *Author(s)* | http://lua-users.org/wiki/XmlTree modified by LiXizhi to meet our specification | | *Date* | 2007/9/22 | | *File* | script/ide/LuaXML.lua | ---+++ Description Specifications: A tree is a Lua table representation of an element and its contents. The table must have a name key, giving the element name. The tree may have a attr key, which gives a table of all of the attributes of the element. Only string keys are relevant. If the element is not empty, each child node is contained in tree[1], tree[2], etc. Child nodes may be either strings, denoting character data content, or other trees. Spec by example lz = commonlib.XML2Lua("<paragraph justify='centered'>first child<b>bold</b>second child</paragraph>") lz ={ { "first child", { "bold", attr={ }, n=1, name="b" }, "second child", attr={ justify="centered" }, n=3, name="paragraph" }, n=1 } %T% __Sample Code__ <verbatim> NPL.load("(gl)script/ide/LuaXML.lua"); local xmlRoot = commonlib.XML2Lua("<paragraph justify='centered'>first child<b>bold</b>second child</paragraph>") log(commonlib.Lua2XmlString(xmlRoot)); </verbatim> ---+++ Member Functions ---++++ !commonlib.Lua2XmlString implemented by LiXizhi, 2008.10.20 converting lua table to xml file. Please note the lua table must be in the format returned by commonlib.XML2Lua(); * _param_ __bBeautify__ : if true, it will use indentations. __syntax__ <verbatim>function commonlib.Lua2XmlString(input, bBeautify)</verbatim> __parameters__ | *input* | | | *bBeautify* | if true, it will use indentations. | %STOPINCLUDE%
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2008-02-29
-
LiXizhi
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback