Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DTD & Namespace

 
Madhu VN
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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">
]>
<test:firstname>Content</test:firstname>

Could anyone let me know why this code is throwing the error?
 
akshaya bhatt
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
The error is with namespace declaration. Try to provide xslns, the general namespace from w3c, and also tyr to put "test:firstname"(try this)
regards
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DTD doesn't support namespaces. You should use the W3C XML Schema instead (here's a nice tutorial).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic