[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Representing XML in tables
- From: Scott Morgan <blumf@...>
- Date: Thu, 03 Jul 2003 18:03:31 +0100
Has there been any standerd way of representing a XML document in a lua
table structure defined yet?
I'm thinking about the actual structure of the document rather than
things like Unicode issues and parsing.
i.e. XML like this:
<person id="1234">
<name>
<first>John</first>
<last>Smith</last>
</name>
</person>
would become a lua table structure like this:
xml = {
[0] = {
["name"] = "person",
["attributes"] = {
["id"] = "1234"
}
["nodes"] = {
[0] = {
["name"] = "name",
["nodes"] = {
[0] = {
["name"] = "first",
["value"] = "John"
}
[1] = {
["name"] = "last",
["value"] = "Smith"
}
}
}
}
}
}
Which is the best way I've come up with so far. With some helper
functions this could be quite useful. But is it the best way of doing
this and am I covering old ground?
Scott Morgan