lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Le 7 janv. 08 à 16:29, Javier Guerra a écrit :

I'm sure not to be the first to want E4X's clean syntax in Lua

but, here's my first successful attempt at that.  so far, it only
manages the read part, no nice way to modify the XML yet.

what does work:

- get subtags as fields
- get attributes as fields with leading '_'
- convert to XML text
- get content as string
- insert lua code to filter results based on attributes
- a L4X object represents a list of XML nodes, everything above works
with a set as well as a single node
- get number of results with '#' operator, and specific node with '[n]'

todo's:
- iterator for lists
- modify the XML
- handle namespaces (currently you can use ["ns:tag"] )
- move the backing structs from LOM to something more optimised.
- add cacheing or memoizing, but currently you can use local vars to
hold any repeating part of a query

at first i thought of creating a new LuaForge project, but now i think
it might be better to add it to LuaExpat's collection.  it's just 200
lines of lua. (no C code, but uses newproxy() )

any opinions?

The project sounds good :)
I would prefer it outside LuaExpat though.



--
Bertrand Mansion
Mamasam
Work : http://www.mamasam.com
Blog : http://golgote.freeflux.net