ANN: xml-object.r 1.0.3
[1/1] from: gavin::mckenzie::sympatico::ca at: 22-Sep-2001 16:42
Folks,
There was a nasty bug in xml-object.r that I've fixed (thanks to 'mike' for
finding it).
There were also some typos in the examples of the accompanying
documentation. I've re-run all the examples in my docs to make sure that
they work.
You can find v 1.0.3 of xml-object and accompanying docs at:
http://www3.sympatico.ca/gavin.mckenzie/
FYI:
The problem was that xml-object got confused when faced with an XML element
that contained a mixture of repeating and unique sub-elements. Such as:
<possessions>
<tv>jvc</tv>
<car>mazda</car>
<car>ford</car>
<stereo>yamaha</stereo>
</possessions>
Processing this exposed a bug in my code as a result of <car> occurring
twice amidst the other unique elements of <tv> and <stereo>.
The (incorrect) result was:
>> probe obj-tree: make object! xml-to-object parse-xml {<possessions>
{ <tv>jvc</tv>
{ <car>mazda</car>
{ <car>ford</car>
{ <stereo>yamaha</stereo>
{ </possessions>}
make object! [
document:
make object! [
possessions:
make object! [
tv: [
make object! [
value?: "jvc"
]
make object! [
value?: "ford"
]]
car:
make object! [
value?: "mazda"
]
stereo:
make object! [
value?: "yamaha"
]
]
]
]
>>
Note how the car of "ford" ended up being a child value of "tv". I end up
with one car instead of two, and it looks like there was two tv's, one made
by Ford (?!)
With the fix, the result of processing this example is:
>> probe obj-tree: make object! xml-to-object parse-xml {<possessions>
{ <tv>jvc</tv>
{ <car>mazda</car>
{ <car>ford</car>
{ <stereo>yamaha</stereo>
{ </possessions>}
make object! [
document:
make object! [
possessions:
make object! [
tv:
make object! [
value?: "jvc"
]
car: [
make object! [
value?: "mazda"
]
make object! [
value?: "ford"
]]
stereo:
make object! [
value?: "yamaha"
]
]
]
]
>>
Much better.
Best Regards,
Gavin.