lua-users home
lua-l archive

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


Andy Stark wrote:

Scott Morgan:-


1) What happens if you have xml like <item _tag_="PITA">, not likely , but possible.



I agree that this kind of "inband signalling" is not perfect. An easy
alternative would be


xmlRoot = {["?tag"] = "person"... }

Of course it doesn't have to be a question mark; any character that is
invalid in XML names will do. Feature request for Lua: allow an extra
character (such as "?") as a valid character in identifiers:-

?tag = "person"


This seems over kill to my mind as its much simpler to push all the attribute key/values into their own sub table.

2) Getting at the value held by the table is a bit difficult, in the 'name' and 'occupation' nodes it's at [1], but in the 'person' node it's at [3]... Idealy all values stored should not be assumed to be of type string.



The value stored need not be a string, but I don't think we can do much about the variable position of the text data. XML allows you to have more than one area of text separated by other elements:-

<div>
Hello<br/>
and goodbye
</div>


Ah, you're quiet right here. It'd probaly be best to maintain document structure. Mayeb we'd have to make a scarifice and say that values can not be tables.

Scott Morgan