Cycorax12
Cycorax12

Reputation: 31

what is use of DOCTYPE tag in hibernate mapping files?

I am new to hibernate and i am using it with java. I have made hibernate mapping file for my Entity and tested it on local machine and it worked fine. However when I was running on server I got error as "InvalidMappingException"

But after putting following tag:

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

it got solved.

What was problem which got resolved after putting this <!DOCTYPE...> tag in hbm file ?

Upvotes: 0

Views: 1638

Answers (2)

Lakshmi
Lakshmi

Reputation: 2294

The <!DOCTYPE...> attribute is the first line of any xml file. It basically gives the structure of an XML file and how that particular XML can be parsed. Any XML file without a <!DOCTYPE...> will not compile as the structure becomes undefined. Check this for references:

http://www.w3schools.com/dtd/dtd_intro.asp

What is the meaning of DOCTYPE in xml file?

Upvotes: 0

Suresh Atta
Suresh Atta

Reputation: 122006

The DocType attribute not only belongs to hibernate mapping file.

Its common for all files like html ,css,js ,xml..etc

The XML document type declaration contains or points to markup declarations that provide a grammar for a class of documents. This grammar is known as a document type definition, or DTD

http://www.w3.org/TR/xml/#dt-doctype

Upvotes: 1

Related Questions