commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lorenzo Cavina <lcav...@noemalife.com>
Subject [configuration] XMLConfiguration.getDocument
Date Tue, 23 Feb 2010 10:57:31 GMT
Hi all,
I'm using XMLConfiguration and in my opinion there's something wrong 
with the getDocument() method.
Let me explain. I'm creating a brand new void XMLConfiguration as follows:

XMLConfiguration config = new XMLConfiguration();

and the i add some properties as follows:

config.addProperty("frame.width", "100");
config.addProperty("frame.height", "100");

Now what i would like to do is extract the Document object representig 
current state of the configuration object and so i execute

Document configDocument = config.getDocument();

But configDocument is NULL!
I really couldn't figure it out why it doesn't create the Document. So i 
tryed and tryed again and finally i discovered that if i execute

config.save(System.out);

BEFORE getting the Document, then the Document is filled and not NULL 
anymore!
So i had a little look to the source code and i saw that there's a 
protected method called createDocument() that seems to be called on save.

Now i'm asking myself:
- why getDocument returns NULL even if i added some contet?
- why i have to save the configuration to get the Document, event if i 
really don't need to save it?
- is there a way to force Document creation?

Thank you very much.

Lorenzo

-- 
Ing. Lorenzo Cavina
Analyst \ Emr Development

NoemaLife S.p.A
Via Gobetti, 52
40129 Bologna - ITALY
T +39 051 70.98.247
F +39 051 70.98.200
lcavina@noemalife.com

www.noemalife.com


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message