commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lingan <sathya78.g...@gmail.com>
Subject Betwixt Reading Problem - Returns Object but no value
Date Fri, 10 Aug 2007 19:51:16 GMT

Hi  , 
I ma using betwixt.7
I am converting a  xml file into java object.
I get the Object but all the properties are set to null.
This is my code .


try{
			BufferedReader stream = new BufferedReader(new FileReader("sample.xml"));
			String line = null;
			StringBuffer buf = new StringBuffer();
			while((line = stream.readLine()) != null){
				buf.append(line.trim());
			}
			String xmlInput = buf.toString();
			System.out.println(xmlInput);
			stream.close();
			StringReader xmlReader = new StringReader(xmlInput);
		        BeanReader beanReader  = new BeanReader();
		
beanReader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false);
			beanReader.getBindingConfiguration().setMapIDs(false);
			beanReader.registerBeanClass("Person", Person.class);
			Person person = (Person) beanReader.parse(xmlReader);
			xmlReader.close();
			System.out.println("obj :"+ contract);
			System.out.println("Persons'name: " + person.getName());
		}catch(Exception e ){
			e.printStackTrace();
		}



any input is appreciated.

thanks.
-- 
View this message in context: http://www.nabble.com/Betwixt-Reading-Problem---Returns-Object-but-no-value-tf4250744.html#a12097971
Sent from the Commons - User mailing list archive at Nabble.com.

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