commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Aust <christ...@wilde-welt.de>
Subject Re: [betwixt] How can I make betwixt accept any attribute "id" as an element id?
Date Mon, 10 Jan 2005 09:31:02 GMT
Hi Jason,

Jason Wood schrieb:
> or if you don't want to make all primitive values attribute as the above
> will do ... in a .betwixt file write ...
> 
> <?xml version='1.0' encoding='UTF-8' ?>
> <info>
> <element name='YourElementName'>
>   <attribute name='id' property='Id'/>
>   <addDefaults/>
> </element>
> </info>
> 
> There ways to do this by code but, not familar with that approach.

I've created .betwixt text files and placed them in the directory 
containing the .class files. Each .betwixt is named like the 
corresponding class. This is what a file "Link.betwixt" looks like:

<?xml version='1.0' encoding='UTF-8' ?>
<info>
<element name='Link'>
   <attribute name='id' property='Id'/>
   <addDefaults/>
</element>
</info>

It's used for a class com.test.Link and is placed in directory com/test.

Unfortunately, I get a NPE each time I try to write a bean.
java.lang.NullPointerException
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:289)
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.java:155)
at org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:190)
[...]

The line where the NPE occurs is

Object exp = idAttribute.getTextExpression().evaluate( context );

getTextExpression() returns null, thus the NPE. What do I have to do in 
order to solve this? Best regards,

-  Christian

---------------------------------------------------------------------
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