File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Why Document.isDefaultNamespace() is false? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Why Document.isDefaultNamespace() is false?" Watch "Why Document.isDefaultNamespace() is false?" New topic

Why Document.isDefaultNamespace() is false?

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 776

I have an XML instance with a declared default namespace.

When I parse it with the DocumentBuilder, it returns me a Document reference. And calling Document.isDeclaredNamespace() always returns false; which is wrong. Why ?


Paul Clapham

Joined: Oct 14, 2005
Posts: 19896

I'm confused. Are you asking about the org.w3c.dom.Document class? Because I don't see an isDeclaredNamespace() method in the documentation. There is an isDefaultNamespace() method, but it takes a String as a parameter and tells you whether that String is the URI of the default namespace. You didn't mention anything about passing a String to the method, and it does matter what String you pass it.
I agree. Here's the link:
subject: Why Document.isDefaultNamespace() is false?
jQuery in Action, 3rd edition