Here is what it might look like:
QName dcAuthorQName = QName.get("dc:author","urlyyy"); String author = doc.elementText(dcAuthorQName);
There are several different ways to get the QName. This was just one example. It depends on your needs. This will be faster than doing an XPath select.
Enjoy! Dave
Terry Steichen wrote:
I know a variant of this question has come up before, but I couldn't find it in a search of the archives. Assume I have a file structured something like this:
<doc xmlns:xx="urlxx" xmlns:dc="urlyyy" xmlns="urlns">
<title>My Book</title>
<date>My Date</date>
<dc:author>My Author</dc:author>
</doc>
If I convert it to a DOM, I can operate on it easily:
String title = doc.elementText("title");
String date = doc.elementText("date");
However, when I get to the author element, the only way I can make work is:
String author = doc.selectSingleNode("*[local-name() = 'author']").getText();
--
+------------------------------------------------------------+ | David Lucas mailto:[EMAIL PROTECTED] | | Lucas Software Engineering, Inc. (740) 964-6248 Voice | | Unix,Java,C++,CORBA,XML,EJB (614) 668-4020 Mobile | | Middleware,Frameworks (888) 866-4728 Fax/Msg | +------------------------------------------------------------+ | GPS Location: 40.0150 deg Lat, -82.6378 deg Long | | IMHC: "Jesus Christ is the way, the truth, and the life." | | IMHC: "I know where I am; I know where I'm going." <>< | +------------------------------------------------------------+
Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt IMHO="in my humble opinion" IMHC="in my humble conviction" All trademarks above are those of their respective owners.
------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user