資源簡介
用于lua的XML文件解析
LuaXML provides a minimal set of functions for the processing of XML data in Lua.

代碼片段和文件信息
/**
Luaxml?License
Luaxml?is?licensed?under?the?terms?of?the?MIT?license?reproduced?below
the?same?as?Lua?itself.?This?means?that?Luaxml?is?free?software?and?can?be
used?for?both?academic?and?commercial?purposes?at?absolutely?no?cost.
Copyright?(C)?2007-2010?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.
*/
#if?defined?__WIN32__?||?defined?WIN32
#?include?
#?define?_EXPORT?__declspec(dllexport)
#else
#?define?_EXPORT
#endif
#include?
#include?
#include?
#include?
#include?
#include?
#include?
static?const?char?ESC=27;
static?const?char?OPN=28;
static?const?char?CLS=29;
//---?auxliary?functions?-------------------------------------------
static?const?char*?char2code(unsigned?char?ch?char?buf[8])?{
unsigned?char?i=0;
buf[i++]=‘&‘;?
buf[i++]=‘#‘;
if(ch>99)?buf[i++]=ch/100+48;
if(ch>9)?buf[i++]=(ch%100)/10+48;
buf[i++]=ch%10+48;
buf[i++]=‘;‘;
buf[i]=0;
return?buf;
}
static?size_t?find(const?char*?s?const?char*?pattern?size_t?start)?{
const?char*?found?=strstr(s+start?pattern);
return?found???found-s?:?strlen(s);
}
//---?internal?tokenizer?-------------------------------------------
typedef?struct?Tokenizer_s??{
///?stores?string?to?be?tokenized
const?char*?s;
///?stores?size?of?string?to?be?tokenized
size_t?s_size;
///?stores?current?read?position
size_t?i;
///?stores?current?read?context
int?tagMode;
///?stores?next?token?if?already?determined
const?char*?m_next;
///?size?of?next?token
size_t?m_next_size;
///?pointer?to?current?token
char*?m_token;
///?size?of?current?token
size_t?m_token_size;
///?capacity?of?current?token
size_t?m_token_capacity;
}?Tokenizer;
Tokenizer*?Tokenizer_new(const?char*?str?size_t?str_size)?{
Tokenizer?*tok?=?(Tokenizer*)malloc(sizeof(Tokenizer));
memset(tok?0?sizeof(Tokenizer));
tok->s_size?=?str_size;
tok->s?=?str;
return?tok;
}
void?Tokenizer_delete(Tok
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????65376??2008-09-11?07:30??lua51.dll
?????文件???????11264??2008-09-11?07:30??lua.exe
?????文件???????13700??2007-07-02?21:36??Luaxm
?????文件???????12989??2010-10-12?20:59??Luaxm
?????文件???????27195??2010-10-12?20:53??Luaxm
?????文件???????16979??2010-10-12?20:59??Luaxm
?????文件????????3810??2008-12-29?17:05??Luaxm
?????文件????????3476??2007-07-02?21:39??Luaxm
?????文件????????1058??2009-09-06?10:03??Makefile
?????文件????????6857??2010-10-12?21:05??readme.txt
?????文件?????????455??2009-09-06?10:00??test.lua
?????文件????????5586??2010-10-12?19:45??test.xm
評論
共有 條評論