---
title: "Could not parse mapping document from resource Event.hbm.xml原因"
author: "503718696"
date: "2011-05-03T17:03:13Z"
tags: [".net", "C", "C++", "Hibernate", "XML"]
categories: ["企业架构"]
slug: "could-not-parse-mapping-document-from-resource-event-hbm-xml"
draft: false
lastmod: "2011-05-03T17:03:13Z"
id: 1027609
url: "https://503718696.iteye.com/blog/1027609"
---

错误原因：主要是我们拷贝配置头文件的时候，我们大意了，没有区别他们。

注意：一个是配置文件的头文件，一个是映射文件的头文件。如下红色部分各自配置就不会报错了。

hibernate.cfg.xml：  
&lt;?xml version="1.0" encoding="UTF-8" ?&gt;  
&lt;!DOCTYPE hibernate-configuration PUBLIC  
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"  
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;

 

 

 

 

Event.hbm.xml：  
&lt;?xml version="1.0"?&gt;  
&lt;!DOCTYPE hibernate-mapping PUBLIC  
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"  
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt;