commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lance Semmens <lance.semm...@essential.com.au>
Subject RE: [betwixt] No rules found
Date Mon, 18 Apr 2005 02:06:27 GMT
I resolved this issue by upgrading digester from 1.5 to 1.6

-----Original Message-----
From: Lance Semmens [mailto:lance.semmens@essential.com.au]
Sent: Monday, 18 April 2005 11:15 AM
To: Jakarta Commons Users List
Subject: [betwixt] No rules found
Importance: Low


I am trying to use betwixt to parse an XML file into a bean.
BeanReader.parse() is returning null... when i inspect the log i see the
following

  New match='configuration'
  No rules found matching 'configuration'.
:
:
  New match='configuration/graphConfiguration'
  No rules found matching 'configuration/graphConfiguration'.

It seems that the digester rules have not been added as I expect.
I would have thought that the line
	beanReader.registerBeanClass("configuration", Configuration.class);
would have added some form of objectCreateRule to the <configuration>
element in my XML.
I'm sure that it's my fault and I don't quite understand betwixt's intended
use.

Thanx in advance.
Lance.

------------------------------------------------
XML:
------------------------------------------------
<?xml version="1.0" ?>
<configuration>
	<graphConfiguration>
		:
		:
	</graphConfiguration>
</configuration>

------------------------------------------------
Bean:
------------------------------------------------
public class Configuration {
	private GraphConfiguration graphConfiguration;
	
	public GraphConfiguration getGraphConfiguration() {
		return graphConfiguration;
	}
	
	public void setGraphConfiguration(GraphConfiguration
graphConfiguration) {
		this.graphConfiguration = graphConfiguration;
	}
}
------------------------------------------------
Parsing logic:
------------------------------------------------
InputStream configFile = ...; 
BeanReader beanReader = new BeanReader();
beanReader.getXMLIntrospector().getConfiguration().setAttributesForPrimitive
s(false);
beanReader.getBindingConfiguration().setMapIDs(false);
beanReader.registerBeanClass("configuration", Configuration.class);
Configuration config = (Configuration) beanReader.parse(configFile);
------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message