Ross Bamford wrote:
>
>
> From my point of view, I'm behind with docs as it is and have plenty to do
> on the code, so it's probably not the right time to do that. Once we get
> the next round of releases out the way, and things are calmer, it would
> probably be a great idea :).
>
> [1]:
> http://rubyforge.org/pipermail/libxml-devel/attachments/20051230/778cd254/libxml-x.obj
>
I like the file you posted, it shows the beauty of ruby and how easily and
cleanly extendable things are.
In regards to your comment on XML::Node::Set, the other day I was thinking that
it would be nice to know if you had the same
object twice. Example doc:
<Root>
<Container>
<Item>1</Item>
<Item>2</Item>
<Item>3</Item>
</Container>
<Container>
<Item>4</Item>
<Item>5</Item>
<Item>6</Item>
</Container>
</Root>
If you are iterating over Container/Item each time you call item_node.parent
you will get a new ruby object each time. In total
you will get 6 different ruby XML::Node's representing the Containers. In
reality you know there are only two Container objects.
It may not be desirable to cache ruby XML::Node objects, but perhaps it would
be helpful (maybe there is already a way) to
accurately compare to parents to see if they actually point to the same node in
the xml document?
Currently
-----------
irb(main):010:0> node.parent.object_id
=> -606893658
irb(main):011:0> node.parent.object_id
=> -606901738
irb(main):012:0> node.parent.object_id
=> -606908328
irb(main):013:0> p1 = node.parent
[snip]
irb(main):014:0> p2 = node.parent
[snip]
irb(main):015:0> p1 == p2
=> false
irb(main):016:0> p1 === p2
=> false
irb(main):017:0> p1.eql? p2
=> false
Perhaps add on a libxml_id or xml_id so we can use that and comparing p1 === p2
will return true. Just thinking outloud at this
point.
Zach
_______________________________________________
libxml-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/libxml-devel