Re: Working with nested xmlBeans does not work for me

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Wednesday, July 30, 2008, 2:41:34 PM, liorpf wrote:

> I have a XmlBean from the following XML:
>         <lib:TextBox ID="String">
>                                         <lib:Size height="0" width="0"/>
>                                         <lib:Style>Square</lib:Style>
>                                         <lib:TextLines>
>                                                 <lib:FreeText
> ColorBoxID="0" ID="String" LineOrder="0">
>                                                         <lib:Size height="0" width="0"/>
>                                                        
> <lib:LayerOrder>0</lib:LayerOrder>                                  
>                                                        
> <lib:TextColor ColorUnit="RGB">black</lib:TextColor>            
>                                                        
> <lib:LetterCase>Upper</lib:LetterCase>                              
>                                                        
> <lib:SpaceToNextLine>0</lib:SpaceToNextLine>
>                                                 </lib:FreeText>
>                                                 <lib:FreeText
> ColorBoxID="0" ID="String" LineOrder="0">
>                                                         <lib:Size height="0" width="0"/>
>                                                        
> <lib:LayerOrder>0</lib:LayerOrder>                                  
>                                                        
> <lib:TextColor ColorUnit="RGB">black</lib:TextColor>
>                                                        
> <lib:LetterCase>Upper</lib:LetterCase>
>                                                        
> <lib:Indent>0</lib:Indent>                                          
>                                                 </lib:FreeText>
>                                         </lib:TextLines>
> </lib:TextBox>
> I'm trying to drill down to the inner list
> This works for me using Apache
> BeanUtils.getPropertyValue(bean,"textLines.freeTextArray[1].size.width"),
> but doesn't in the ftl:
> ${component.textLines.freeTextArray[1].size.width} (component is the bean
> used as the java model)
> Please advise

I don't understand people... really. Why on the earth they don't give
the error messages? Usually it helps a lot to find out where the
mistake is in your stuff, for those who would like to help.

Anyway, IF you wrapped the XML itself, it should be
${component.TextLines.FreeText[1].Size.@width}. I.e., not
FreeText*Array*, and XML is case-sensitive, and attributes are
referred with an initial @. And the default xmlns has to be setup
properly in the #ftl directive.

-- 
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.