Share

dom4j: flexible XML framework for Java

Tracker: Bugs

5 Selecting nodes from default namespace - ID: 638829
Last Update: Comment added ( maartenc )

Here is an XML document

<?xml version="1.0" encoding="latin1"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee">
<tlib-version>0.1.1</tlib-version>
<jsp-version>1.2</jsp-version>
</taglib>

I try selecting the taglib node:

xmlDoc.getRootElement().selectSingleNode("/taglib");

But all I get is null.

If I use prefixes I can get the taglib

SOURCE XML
<?xml version="1.0" encoding="latin1"?>
<tld:taglib xmlns:tld="http://java.sun.com/xml/ns/j2ee">
<tld:tlib-version>0.1.1</tld:tlib-version>
<tld:jsp-version>1.2</tld:jsp-version>
</tld:taglib>

CODE
xmlDoc.getRootElement().selectSingleNode("/tld:taglib");

With Xalan I can use /:taglib to get the taglib in the first
scenario (We already talked about it in previous posting)

It was not standard compliant syntax but my question is
how can I select the taglib in according to the standard.

I tried /taglib[not(contains(name(), ':'))] but that also
returns null.


Rami Ojares ( rojares ) - 2002-11-15 09:06

5

Closed

Invalid

Maarten Coene

None

None

Public


Comments ( 2 )

Date: 2003-06-10 20:54
Sender: maartencProject AdminAccepting Donations

Logged In: YES
user_id=178745

Not a bug.


Date: 2002-11-15 09:56
Sender: slehmann

Logged In: YES
user_id=371284

Use /*[local-name()='taglib']. This is not a bug, please use
the discussion lists instead of opening a new bug report.


Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2003-06-10 20:54 maartenc
resolution_id None 2003-06-10 20:54 maartenc
assigned_to nobody 2003-06-10 20:54 maartenc
close_date - 2003-06-10 20:54 maartenc