aspose file tools*
The moose likes Object Relational Mapping and the fly likes hibernate schema export SAXParser error 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 » Databases » Object Relational Mapping
Bookmark "hibernate schema export SAXParser error" Watch "hibernate schema export SAXParser error" New topic
Author

hibernate schema export SAXParser error

santosh kulkarni
Greenhorn

Joined: Jul 21, 2004
Posts: 18
I am getting the following error while running the schema export ant task.
Hibernate version 2.03. If anybody has any idea about this please post a reply. It appears as if the parser is complaining that the xml file isn't conforming to the DTD but I am puzzled why. Some other vital information is at the end of the stack trace. I am willing to send any more information if someone would like to help me.

please scroll down a little for complete stacktrace
SEVERE: Error parsing XML: D:\<path shortened>\AccountInformationTypeImpl.hbm.xml(32)
org.xml.sax.SAXParseException: Attribute "access" must be declare
d for element type "property".



The .hbm.xml file was generated by XDoclet 1.2.1.
here is an excerpt from the .hbm.xml file.


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="com.package.AccountInformationTypeImpl"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="id"
type="string"
length="36"
unsaved-value="any"
>
<generator class="assigned">
</generator>
</id>

<property
name="externalAccountNumber"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="externalAccountNumber"
/>




Complete stacktrace
SEVERE: Error parsing XML: D:\<path shortened>\AccountInformationTypeImpl.hbm.xml(32)
org.xml.sax.SAXParseException: Attribute "access" must be declare
d for element type "property".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExce
ption(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Sour
ce)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown S
ource)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown S
ource)
at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrs
AndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement
(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElem
ent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragmen
tContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDoc
ument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown So
urce)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown So
urce)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Sou
rce)
at org.dom4j.io.SAXReader.read(SAXReader.java:339)
at org.dom4j.io.SAXReader.read(SAXReader.java:219)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java
:155)
at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfigurati
on(SchemaExportTask.java:184)
at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(Schema
ExportTask.java:128)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)

at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Jul 21, 2004 10:04:20 AM net.sf.hibernate.util.XMLHelper$ErrorLog
ger error

-----------------------------------------------------------------------------------
ANT task for schema export

<schemaexport
properties="${hibernate.properties}"
quiet="yes"
text="yes"
drop="no"
delimiter=";"
output="${database}/schema.sql">
<fileset dir="${hibernate.mapping}">
<include name="**/Account*.hbm.xml"/>
</fileset>
</schemaexport>
-----------------------------------------------------------------------------------
hibernate.properties relevant section

## HypersonicSQL

hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.username sa
hibernate.connection.password
hibernate.connection.url jdbc:hsqldb atabase/hsql/test


Impossible is not a fact its an opinion
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Now that is wierd. hibernate-mapping-2.0.dtd does define an implied attribute of the PROPERTY element calles ACCESS. And the hibernate docs state that one of the anticipated values is "property". I can't say why this is happening, but the obvious way round it is to delete the access attribute. I'd post this on the forum at hibernate's site - see if one of the developers can explain. Let us know what you find out.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
santosh kulkarni
Greenhorn

Joined: Jul 21, 2004
Posts: 18
Thanks Paul for the reply. One of my colleagues had the same suggestion of removing the access tags, it does work. I have not seen any reply to my post on the hibernate forum yet. Now I am stuck at hyperjaxb not creating hibernate xdoclet tags for public static classes , but that goes into another post:-)
Santosh
Aleksei Valikov
Greenhorn

Joined: Aug 12, 2004
Posts: 1
Originally posted by santosh kulkarni:
Now I am stuck at hyperjaxb not creating hibernate xdoclet tags for public static classes , but that goes into another post:-)


If you really mean HyperJAXB, would you please provide more details?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hibernate schema export SAXParser error