cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Salvetti <m...@notremanou.net>
Subject How to evaluate an xpath expression against a dom tree in flow ?
Date Sat, 10 Sep 2005 02:39:02 GMT
Hello,

I've been using flow with cforms for a while and the framework is great, 
but one thing that i found really uneasy is navigating in the dom tree 
with the dom api.

For exemple, i often do things like :
users = 
document.getDocumentElement().getElementsByTagName("users").item(0).getElementsByTagName("user");
and then i have to iterate all nodes to find the one i want :
for(var i=0; i < users.getLength(); i++){
    //Test each node against a property eg : id to find the node i want
   if(users.item(i).getAttribute('id').equals("foo")){
      //The node is finally found...
  }
}

Now i would like to know if there is a class somewhere in the cocoon 
distribution that allows to use the much more convenient xpath syntax to 
navigate in the dom.

Hopefully, sth like user = Utils.evalSax(document, 
"authentication/users/user[@id='foo']");

Does something similar to this exist ?

Thanks,

Marc

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message