cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Salvetti <m...@notremanou.net>
Subject Re: How to evaluate an xpath expression against a dom tree in flow ?
Date Tue, 13 Sep 2005 09:22:17 GMT
Thx for the pointer Tony,
the use of the sessionManager is very interesting.

Best regards,

Marc

Tony Edwards a écrit :

> Hey Marc,
> Glad I could help. What I find when I'm developing with flowscript is 
> that it gives you the tremendous ability to 'think outside the square' 
> because flowscript can allow you to instanciate and use nearly every 
> java object that's lying around.
> I don't know how I stumbled across this but I had the same problem as 
> you in that I was sifting through the DOM nodes just using dom methods 
> and getting quite frustrated.
> I've stuck an entry on the Wiki some time ago which included my 
> general purpose flow script for DOM manipulation.
> Check it out at http://wiki.apache.org/cocoon/FlowBasedXMLEditor
>
> Regards,
> Tony
>
> Marc Salvetti wrote:
>
>> Yes! thx a lot Tony, exactly what i needed !
>> btw is this referenced anywhere in the cocoon docs, because i've been 
>> looking for a while for some docs with this kind of practice or tips 
>> in flowscript, but never found anything consistant ?
>>
>> Marc
>>
>> Tony Edwards a écrit :
>>
>>> Hi Marc,
>>> I use the XPathAPI to navigate a DOM.
>>> eg:
>>> importClass(org.apache.xpath.XPathAPI);  nl = 
>>> XPathAPI.selectNodeList(document, sXpath);
>>> where sXpath could be something like xPath = 
>>> "//authorityLink[linkNumber='" + linkNum + "']";
>>>
>>> I don't know if this is what you're after but I hope it helps!!
>>>
>>> Regards
>>> Tony
>>>
>>> Marc Salvetti wrote:
>>>
>>>> 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
>>>>
>>>>
>>>
>>> This email is from Civica Pty Limited and it, together with any 
>>> attachments, is confidential to the intended recipient(s) and the 
>>> contents may be legally privileged or contain proprietary and 
>>> private information. It is intended solely for the person to whom it 
>>> is addressed. If you are not an intended recipient, you may not 
>>> review, copy or distribute this email. If received in error, please 
>>> notify the sender and delete the message from your system 
>>> immediately. Any views or opinions expressed in this email and any 
>>> files transmitted with it are those of the author only and may not 
>>> necessarily reflect the views of Civica and do not create any 
>>> legally binding rights or obligations whatsoever. Unless otherwise 
>>> pre-agreed by exchange of hard copy documents signed by duly 
>>> authorised representatives, contracts may not be concluded on behalf 
>>> of Civica by email. Please note that neither Civica nor the sender 
>>> accepts any responsibility for any viruses and it is your 
>>> responsibility to scan the email and the attachments (if any). All 
>>> email received and sent by Civica may be monitored to protect the 
>>> business interests of Civica.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
> This email is from Civica Pty Limited and it, together with any 
> attachments, is confidential to the intended recipient(s) and the 
> contents may be legally privileged or contain proprietary and private 
> information. It is intended solely for the person to whom it is 
> addressed. If you are not an intended recipient, you may not review, 
> copy or distribute this email. If received in error, please notify the 
> sender and delete the message from your system immediately. Any views 
> or opinions expressed in this email and any files transmitted with it 
> are those of the author only and may not necessarily reflect the views 
> of Civica and do not create any legally binding rights or obligations 
> whatsoever. Unless otherwise pre-agreed by exchange of hard copy 
> documents signed by duly authorised representatives, contracts may not 
> be concluded on behalf of Civica by email. Please note that neither 
> Civica nor the sender accepts any responsibility for any viruses and 
> it is your responsibility to scan the email and the attachments (if 
> any). All email received and sent by Civica may be monitored to 
> protect the business interests of Civica.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>

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


Mime
View raw message