You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by lingan <sa...@gmail.com> on 2007/08/10 21:51:16 UTC

Betwixt Reading Problem - Returns Object but no value

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.