Hi,

On Tue, 2004-04-13 at 17:33, [EMAIL PROTECTED] wrote:
> I am trying to set up the parse rules for an xml entry of the following 
> type: 
> <Root> 
>   <subSection> 
>     <id>7</id>         
>       <Item Name="forProperty" Type="String">This is the 
> Content</Item>  
>       <Item Name="forAnotherProperty" Type="String">More 
> Content</Item>  
>   </subSection> 
> </Root> 
> I want to achieve the equivalent of SubSection.setForProperty 
> with the value  "This is the Content" and 
> SubSection.setAnotherProperty with "More  Content". 
> How do I do this? 

I believe you'll have to write your own rule. What you need is a variant
of the SetPropertyRule.

SetPropertyRule is very similar to what you want, except that it takes
data like this:
  <Item Name="forProperty" Value="This is the context"/>

If you can change your input xml to be like SetPropertyRule expects,
that would probably be a good idea.

Or the SetNestedPropertiesRule (which is currently only available in
nightly builds) can be used to do this:
  <forProperty Value="This is the context"/>

Note that neither take a "type" parameter; they try to automatically
convert the input string to the appropriate type for the target bean
property.

If you are determined to use the format you describe in your email, then
it isn't that big a deal to write your own Rule class. I can provide you
with some hints on that if you need them.

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to