As you suggested me , I am trying to use NodeIterator to provide an
arranged list of relevant nodes for zooming ... It seems to be exactly
what I need ...
(http://www.cafeconleche.org/books/xmljava/chapters/ch12.html). But I
got an empty (null) iterator. Am I doing something wrong ?
<quoted>
function filteringRelevantNodes (node) {
dump ("have been here ...\n");
return NodeFilter.FILTER_ACCEPT;
}
function createArrangedList (rootNode) {
var doc; // main document
var iterator; // our NodeIterator
try {
doc = rootNode.getOwnerDocument ();
// checking if the Traversal module is supported by the DOM
implementation available ...
if (!doc.implementation.hasFeature("Traversal", 2.0) ) {
dump ( "A DOM implementation that supports traversal is
required.");
return;
}
iterator = doc.createNodeIterator(rootNode, NodeFilter.SHOW_ALL,
filteringRelevantNodes, true);
} catch (e) {}
// walking through the arranged list created by the iterator
if (iterator != null) {
var auxNode = iterator.nextNode();
for ( ; auxNode != null ; auxNode = iterator.nextNode());
dump (auxNode.getNodeName() + "\n");
} else dump ("it is null\n");
}
</quoted>
Actually, I am able to lauch the xpcom component created by me to
provide such functionality, however just the "it is null" message
(above) is "dumped". I mean, even the "have been here ...\n" message ,
that should be printed from the filter_method, is not !
Probably, I got the empty iterator because the filter method is not
being called properly, I wonder you tell my why ?
thanks again.
regards
--Antonio Gomes
Nokia Technology Institute
_______________________________________________
mozilla-layout mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-layout