-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Error parsing XML---while mapping
PostPosted: Thu Dec 01, 2005 2:48 am 
Newbie

Joined: Thu Dec 01, 2005 2:31 am
Posts: 3
Hi,

i got the follwing error and i could not proceed.



11:50:14,185 INFO Configuration:332 - Mapping resource: persistance/MyCompany.h
bm.xml
11:50:14,216 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(2) The proc
essing instruction target matching "[xX][mM][lL]" is not allowed.
11:50:14,216 ERROR Configuration:296 - Could not configure datastore from input
stream
org.dom4j.DocumentException: Error on line 2 of document : The processing instr
uction target matching "[xX][mM][lL]" is not allowed. Nested exception: The proc
essing instruction target matching "[xX][mM][lL]" is not allowed.
at org.dom4j.io.SAXReader.read(SAXReader.java:355)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
287)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:337
)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:102
7)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:983
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:911)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
at HibernatePOJO.update(HibernatePOJO.java:163)
at HibernatePOJO.main(HibernatePOJO.java:204)
Nested exception:
org.xml.sax.SAXParseException: The processing instruction target matching "[xX][
mM][lL]" is not allowed.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:339)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
287)




Any Idea?

regards,
Basha


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 01, 2005 3:24 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
make sure you don't have a messed up processing instruction at the top of persistance/MyCompany.hbm.xml ... and it would help if you'd post the contents of persistance/MyCompany.hbm.xml .


Top
 Profile  
 
 Post subject: Bean mapping XML file
PostPosted: Thu Dec 01, 2005 9:13 am 
Newbie

Joined: Thu Dec 01, 2005 2:31 am
Posts: 3
Hi,
thanks for the reply

the following is the XML file i am using :


<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">


<hibernate-mapping>

<class name="MyCompany" table="Company">
<property column="companyid" name="companyid" type="java.lang.String"/>
<property column="companyname" name="companyname" type="java.lang.String"/>
<property column="location" name="location" type="java.lang.String"/>
<property column="owner" name="owner" type="java.lang.String"/>
</class>

</hibernate-mapping>

i took it from a book and modyfied according to my class.

any other changes i need to do?
regards
Basha


Top
 Profile  
 
 Post subject: Your mapping refers the wrong dtd
PostPosted: Thu Dec 01, 2005 10:36 am 
Newbie

Joined: Thu Dec 01, 2005 8:42 am
Posts: 7
Location: Paris
Your mapping refers the wrong dtd. Use the following header for your mapping :
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


The dtd you are using is the one to configure the Hibernate Factory.


Top
 Profile  
 
 Post subject: Check for white spaces at the beginning of the file
PostPosted: Thu Dec 01, 2005 10:48 am 
Newbie

Joined: Thu Dec 01, 2005 8:42 am
Posts: 7
Location: Paris
This XML parsing error often occur when you have white spaces between the beginning of the file and the processing instruction (<?xml ...?>).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.