Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 50690 invoked from network); 4 Jan 2005 10:42:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 4 Jan 2005 10:42:41 -0000 Received: (qmail 41671 invoked by uid 500); 4 Jan 2005 10:42:15 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 41497 invoked by uid 500); 4 Jan 2005 10:42:13 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 41386 invoked by uid 99); 4 Jan 2005 10:42:09 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=FROM_ENDS_IN_NUMS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mail.inf.tu-dresden.de (HELO mail.inf.tu-dresden.de) (141.76.2.1) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 04 Jan 2005 02:42:02 -0800 Received: from localhost (localhost [127.0.0.1]) by mail.inf.tu-dresden.de (8.12.10/8.12.10) with ESMTP id j04AfvtV020342 for ; Tue, 4 Jan 2005 11:41:57 +0100 (CET) Received: from mail.inf.tu-dresden.de ([127.0.0.1]) by localhost (mail.inf.tu-dresden.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 19208-07 for ; Tue, 4 Jan 2005 11:41:57 +0100 (CET) Received: from blackdragon4 (213-172-120-115.dsl.aktivanet.de [213.172.120.115]) (authenticated bits=0) by mail.inf.tu-dresden.de (8.12.10/8.12.10) with ESMTP id j04AfqPJ020319 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Tue, 4 Jan 2005 11:41:53 +0100 (CET) Message-Id: <200501041041.j04AfqPJ020319@mail.inf.tu-dresden.de> From: "Stefan Pietschmann" To: Subject: AW: getElementById in request does not work Date: Tue, 4 Jan 2005 11:42:21 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.6353 In-Reply-To: <41DA616C.1010603@bitflux.ch> Thread-Index: AcTySYKM040ER+l2S7m1d+8UuXhKFQAAEjkw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at inf.tu-dresden.de X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Thanx, I was expecting something like that, but I thought there'd be an = easy way to somehow specify the ID attribute at document generation.=20 Since I generate the requests I'm gonna try it with xml:id - hopefully = this will work. Cheers, Stefan -----Urspr=FCngliche Nachricht----- Von: Christian Stocker [mailto:chregu@bitflux.ch]=20 Gesendet: Dienstag, 4. Januar 2005 10:27 An: dev@cocoon.apache.org Cc: cocoon-dev@apache.org Betreff: Re: getElementById in request does not work Hi On 4.1.2005 9:25 Uhr, Stefan Pietschmann wrote: > Hi there, >=20 > I'm writing my custom action, and this is my problem with it: >=20 > I fetch a parameter from the request (which is sent with a form). It > contains an small rdf snippet. I thought I'd be able to read it out = with > getelementbyid, but it doesn't work. The request parameter looks like this: Maybe this helps a little bit: http://blog4.bitflux.ch/wiki/GetElementById_Pitfalls (It's written for PHP, but the problem applies to other languages as=20 well...) chrgeu >=20 > > > > . > > > . > > > . > > > . > > > > =09 > And my code looks like this (shortened): >=20 > ###################################### >=20 > // requestParameterID is the name of the request parameter >=20 > // get the request > Request request =3D ObjectModelHelper.getRequest(objectModel); >=20 > // now build a document from the rdf in the request=20 > factory =3D DocumentBuilderFactory.newInstance(); > // requestParam should now be the xml from above > requestParam =3D factory.newDocumentBuilder().parse( > new InputSource(new > StringReader(request.getParameter(requestParameterID)))); >=20 > // now I should be able to do something like this, right? > requestParam.getElementsById("UserInteraction"); >=20 > ####################################### >=20 > --> this returns null. Why? >=20 > If I iterate through all Elements, I find it though (like this:) >=20 > ####################################### >=20 > NodeList descriptions =3D = requestParam.getElementsByTagName("Description"); > String thisID; > for (int a =3D 0; a < descriptions.getLength(); a++) { > if ((thisID =3D > = descriptions.item(a).getAttributes().getNamedItem("id").getNodeValue()) = !=3D > null) { > if (thisID.equals("UserInteraction")) {=20 > System.out.println("found userinteraction"); > } > } > } > ######################################## >=20 > So I do find the right element and it does exist, but why can't I use > getElementById instead of going through all elements? >=20 > Thanx, > Stefan >=20 --=20 christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECB