Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] xpath with default namespace

florianwendland@freenet.de

2007-04-30


hi all,
i have a problem by creating an xpath expression with an default namespace.
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
From jdom-interest-bounces@(protected)
Return-Path: <jdom-interest-bounces@(protected)>
Delivery-Date: Mon, 30 Apr 2007 07:59:21 -0400
Received-SPF: none (mxus6: 65.212.180.182 is neither permitted nor denied by domain of jdom.org) client-ip=65.212.180.182; envelope-from=jdom-interest-bounces@(protected);
Received: from [65.212.180.182] (helo=servlets.kattare.com)
 by mx.perfora.net (node=mxus6) with ESMTP (Nemesis),
 id 0MKorw-1HiUXI2h8j-0000sV for java@(protected)
Received: from servlets.kattare.com (localhost [127.0.0.1])
 by servlets.kattare.com (8.12.10/8.12.11) with ESMTP id l3UBmKOc021065;
 Mon, 30 Apr 2007 04:48:21 -0700
Received: from mout0.freenet.de (mout0.freenet.de [194.97.50.131])
 by servlets.kattare.com (8.12.10/8.12.11) with ESMTP id l3UBmELM019876
 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
 for <jdom-interest@(protected)
Received: from [194.97.55.190] (helo=mx6.freenet.de)
 by mout0.freenet.de with esmtpa (Exim 4.68)
 (envelope-from <florianwendland@(protected)
 for jdom-interest@(protected)
Received: from dslb-088-073-032-217.pools.arcor-ip.net ([88.73.32.217]:3838
 helo=[192.168.1.2])
 by mx6.freenet.de with esmtpa (ID florianwendland@(protected))
 (Exim 4.68 #1) id 1HiUMX-0005PR-7P
 for jdom-interest@(protected)
Message-ID: <4635D78D.2010203@(protected)>
Date: Mon, 30 Apr 2007 13:48:29 +0200
From: "florianwendland@(protected)>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
To: jdom-interest@(protected)
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Subject: [jdom-interest] again xpath with default namespace
X-BeenThere: jdom-interest@(protected)
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: JDOM Mailing List for General Issues and Updates
 <jdom-interest.jdom.org>
List-Unsubscribe: <http://www.jdom.org/mailman/listinfo/jdom-interest>,
 <mailto:jdom-interest-request@(protected)>
List-Archive: <http://www.jdom.org/pipermail/jdom-interest>
List-Post: <mailto:jdom-interest@(protected)>
List-Help: <mailto:jdom-interest-request@(protected)>
List-Subscribe: <http://www.jdom.org/mailman/listinfo/jdom-interest>,
 <mailto:jdom-interest-request@(protected)>
Sender: jdom-interest-bounces@(protected)
Errors-To: jdom-interest-bounces@(protected)
Envelope-To: java@(protected)

hi all,

i have a problem by creating an xpath expression with an default
namespace. The xpath expression didn't select the nodes, although i have
added the namespace to the xpath by calling
xp.addNamespace("http://www.test.de");

My document looks like:

<test xmlns="http://www.test.de">
 <node>
 </node>
</test>

The source:

XPath xp = XPath.newInstance("/test/node");
xp.addNamespace(ExiilConstants.NS);
xp.selectNodes(document);

Result of the list is allways 0.

Thy very much.
mfw
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.