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?