Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 13230 invoked from network); 8 Jul 2004 09:16:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Jul 2004 09:16:14 -0000 Received: (qmail 25066 invoked by uid 500); 8 Jul 2004 09:16:04 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 25021 invoked by uid 500); 8 Jul 2004 09:16:04 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 25007 invoked by uid 99); 8 Jul 2004 09:16:04 -0000 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST X-Spam-Check-By: apache.org Received: from [194.67.23.121] (HELO mx1.mail.ru) (194.67.23.121) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 08 Jul 2004 02:16:02 -0700 Received: from [213.186.195.29] (port=62034 helo=peter.antanta) by mx1.mail.ru with esmtp id 1BiV0Z-000E5F-00 for users@cocoon.apache.org; Thu, 08 Jul 2004 13:15:59 +0400 Date: Thu, 8 Jul 2004 12:17:38 +0300 From: Peter Velychko X-Mailer: The Bat! (v1.60c) Business Reply-To: Peter Velychko X-Priority: 3 (Normal) Message-ID: <816298671.20040708121738@mail.ru> To: users@cocoon.apache.org Subject: Re: Reading XML data from flowscript In-Reply-To: <955315390.20040708120114@mail.ru> References: <955315390.20040708120114@mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello Peter, Some corrections. I looked at mail of Leszek Gawron and uderstand that I forgotten to release components used. Taking into account the message of Leszek it sould be: var uri = cocoon.parameters.myUri; try { var resolver = cocoon.getComponent(Packages.org.apache.excalibur.source.SourceResolver.ROLE); var parser = cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE); var xpathProcessor = cocoon.getComponent(Packages.org.apache.excalibur.xml.xpath.XPathProcessor.ROLE); var source = resolver.resolveURI(uri); var document = Packages.org.apache.cocoon.components.source.SourceUtil.toDOM(source); var result = xpathProcessor.evaluateAsString(document,'/config/lang'); } finally { resolver.release(source); cocoon.releaseComponent(resolver); cocoon.releaseComponent(parser); cocoon.releaseComponent(xpathProcessor); } Thursday, July 8, 2004, 12:01:14 PM, you wrote: PV> Hello Derek, PV> Try to use the following PV> function testPage() { PV> var uri = cocoon.parameters.myUri; PV> var resolver = cocoon.getComponent(Packages.org.apache.excalibur.source.SourceResolver.ROLE); PV> var parser = cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE); PV> var xpathProcessor = cocoon.getComponent(Packages.org.apache.excalibur.xml.xpath.XPathProcessor.ROLE); PV> var source = resolver.resolveURI(uri); PV> var is = Packages.org.apache.cocoon.components.source.SourceUtil.getInputSource(source); PV> var document = parser.parseDocument(is); PV> print("res="+xpathProcessor.evaluateAsString(document,'/config/lang')) PV> } PV> Thursday, July 8, 2004, 10:41:04 AM, you wrote: DH>> Is there is a simple function in flow script that DH>> will allow me to: DH>> - access a specified XML file (say, passed as a DH>> request/sitemap parameter) DH>> - read in one or nodes from the file and store DH>> these as flowscript variables. DH>> Thanks DH>> Derek -- Best regards, Peter velychko_peter@mail.ru --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org