-->
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.  [ 6 posts ] 
Author Message
 Post subject: How to get The DOM Tree for the Mapping XMLs
PostPosted: Wed Mar 24, 2004 3:06 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
Hi,

I want to retrieve the DOM tree from the mapping XMLs.

Let's say, I have a class A and its corresponding mapping XML

A.hbm.xml. What needs to be done to get the DOM tree out of this XML?

I tried something like the following



Configuration cfg = new Configuration();
for (int i = 0; i < classes.length; i++) {
cfg = cfg.addClass(classes[i]);
}

SessionFactory factory = cfg.buildSessionFactory();

XMLDatabinder databinder = (XMLDatabinder) factory.openDatabinder();

//... databinder.bind(???)

Document domTree = databinder.toDOM();


Thannks in advance for any help that could be extended.


~Santosh Banerjee


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 3:32 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
i don't know if this can help you:
http://www.hibernate.org/186.html

this is used to export results to xml or dom...

Anthony


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 3:57 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
DocumentBuilderFactory
builderFactory = DocumentBuilderFactory.newInstance();

DocumentBuilder
builder = builderFactory.newDocumentBuilder();

InputSource
is = new InputSource(
myClass.getResourceAsStream( myClass.getName()
+ ".hbm.xml" )
);


Document
document = builder.parse (is);


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 4:36 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
baliukas wrote:
DocumentBuilderFactory
builderFactory = DocumentBuilderFactory.newInstance();

DocumentBuilder
builder = builderFactory.newDocumentBuilder();

InputSource
is = new InputSource(
myClass.getResourceAsStream( myClass.getName()
+ ".hbm.xml" )
);


Document
document = builder.parse (is);


Hi,
Thanks for the info.
Actually I thought Hibernate itself exposes some API which can make the XML DOM retrieval possible.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 4:54 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
delpouve wrote:
i don't know if this can help you:
http://www.hibernate.org/186.html

this is used to export results to xml or dom...

Anthony


Hi Anthony,

Actually this Data Binder generates an XML representation of the queried results. But what I want is actually a DOM corresponding to the metadata xml

thanks
Santosh


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 10:01 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
baliukas,
can i (or you) add your piece of code in the http://www.hibernate.org/186.html wiki ?

thanks,
Anthony


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.