This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes DTD & Namespace 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 "DTD & Namespace" Watch "DTD & Namespace" New topic

DTD & Namespace

Madhu VN

Joined: Jul 13, 2004
Posts: 2
The following code throws an error : Reference to undeclared namespace prefix:test

<?xml version="1.0"?>
<!DOCTYPE test:firstname [
<!ELEMENT test:firstname (#PCDATA) >
<!ATTLIST test:firstname xmlns:test CDATA "namespace">

Could anyone let me know why this code is throwing the error?
akshaya bhatt

Joined: Dec 24, 2000
Posts: 6
The error is with namespace declaration. Try to provide xslns, the general namespace from w3c, and also tyr to put "test:firstname"(try this)
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
DTD doesn't support namespaces. You should use the W3C XML Schema instead (here's a nice tutorial).

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: DTD & Namespace
It's not a secret anymore!