julian_lp
04-16-2006, 12:54 AM
given this dataset
<dataset name="dst_comments">
<root_comment_ganador>
<comment left="100" top="0" width="100" height="100">bla bla bla</comment>
<comment left="250" top="150" width="100" height="100">bla bla bla</comment>
</root_comment_ganador>
</dataset>
this code works quite fine
var comments = dst_comments.getFirstChild().getElementsByTagName("comment");
for(var i=0; i < comments.length; i++){
Debug.write('left: ' + comments[i].getAttr("left") + ' top: ' + comments[i].getAttr("top") + ' width: ' + comments[i].getAttr("width"));
}
But whenever I change the dataset structure, I can't be able to make it work again
<dataset name="dst_comments">
<root_comment_ganador>
<comment_ganador>
<comment left="100" top="0" width="100" height="100">bla bla bla</comment>
<comment left="250" top="150" width="100" height="100">bla bla bla</comment>
</comment_ganador>
</root_comment_ganador>
</dataset>
var comments = dst_comments.getFirstChild().getElementsByTagName("comment_ganador").getElementsByTagName("comment"); //this seems to be the correct "intuitive" way
for(var i=0; i < comments.length; i++){
Debug.write('left: ' + comments[i].getAttr("left") + ' top: ' + comments[i].getAttr("top") + ' width: ' + comments[i].getAttr("width"));
}
I also tried with
var comments = dst_comments.getElementsByTagName("comment");
var comments = dst_comments.getFirstChild().getElementsByTagName("comment_ganador/comment")
Any advice would be apreciated
regards - julian
<dataset name="dst_comments">
<root_comment_ganador>
<comment left="100" top="0" width="100" height="100">bla bla bla</comment>
<comment left="250" top="150" width="100" height="100">bla bla bla</comment>
</root_comment_ganador>
</dataset>
this code works quite fine
var comments = dst_comments.getFirstChild().getElementsByTagName("comment");
for(var i=0; i < comments.length; i++){
Debug.write('left: ' + comments[i].getAttr("left") + ' top: ' + comments[i].getAttr("top") + ' width: ' + comments[i].getAttr("width"));
}
But whenever I change the dataset structure, I can't be able to make it work again
<dataset name="dst_comments">
<root_comment_ganador>
<comment_ganador>
<comment left="100" top="0" width="100" height="100">bla bla bla</comment>
<comment left="250" top="150" width="100" height="100">bla bla bla</comment>
</comment_ganador>
</root_comment_ganador>
</dataset>
var comments = dst_comments.getFirstChild().getElementsByTagName("comment_ganador").getElementsByTagName("comment"); //this seems to be the correct "intuitive" way
for(var i=0; i < comments.length; i++){
Debug.write('left: ' + comments[i].getAttr("left") + ' top: ' + comments[i].getAttr("top") + ' width: ' + comments[i].getAttr("width"));
}
I also tried with
var comments = dst_comments.getElementsByTagName("comment");
var comments = dst_comments.getFirstChild().getElementsByTagName("comment_ganador/comment")
Any advice would be apreciated
regards - julian