[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: BadgerFish
- From: rszwarc <petite_abeille@...>
- Date: Sun, 9 Dec 2007 15:33:42 +0100
Hi,
On Dec 9, 2007, at 1:39 PM, peterhickman wrote:
I did a little test with '<root>some text<nested>text</nested>some
more text</root>' and all I got back was { root={ ["$"]="some more
text", nested={ ["$"]="text" } } }. The problem is the any xml
element can have multiple elements of the same name/type.
As per BadgerFish's "What's broken and/or left to do?":
1. BadgerFish throws away the text content of elements if the text
content is entirely whitespace. It also doesn't provide a way to get
the different text bits in an element whose content is a mix of text
and children (e.g. <p>Some text <strong>is important</strong>.</p>).
Perhaps those different text bits should be made available in $1, $2,
etc.
Also '<root><name>Tom</name><name>Dick</name><name>harry</name></
root>' seems to return some unexpected results,
{ root={ name={ { ["$"]="Tom" }, { ["$"]="Dick" },
{ ["$"]="harry" } } } }.
That looks reasonable. What where you expecting instead?
Am I trying to use this code beyond what it was designed for?
Perhaps... But aside from the "mix of text and children" issue noted
above, it works rather alright for simple XML. Also, note that CDATA
are not handled presently.
Here is a different mapping technic:
"Converting Between XML and JSON"
http://www.xml.com/lpt/a/1658
Cheers,
PA.