aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "DTD & Namespace" Watch "DTD & Namespace" New topic
Author

DTD & Namespace

Madhu VN
Greenhorn

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">
]>
<test:firstname>Content</test:firstname>

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

Joined: Dec 24, 2000
Posts: 6
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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: http://aspose.com/file-tools
 
subject: DTD & Namespace