This is a migrated thread and some comments may be shown as answers.

Tree not rendering correctly when "<" followed by non-numeric character

1 Answer 38 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Darryl
Top achievements
Rank 1
Darryl asked on 05 Feb 2009, 07:03 AM
Hi,

I am using LoadOnDemand and an XML file to load a RadTree. When I expand a particular node only the first two of six children are rendered. 

This is the offending piece of XML ...

<Member Name="Long Service Lve - Cash Equivalent" Value="[FTE Type].[FTE Type].&amp;[LSVCEQ]" Level="4">
            <Member Name="LSL Corp Off LS &gt;150893" Value="[FTE Type].[FTE Type].&amp;[324]" Level="5" />
            <Member Name="LSL Corp Off LS 'B'&lt;Aug78" Value="[FTE Type].[FTE Type].&amp;[322]" Level="5" />
            <Member Name="LSL Corp Off LS'A'&lt;160893" Value="[FTE Type].[FTE Type].&amp;[323]" Level="5" />
            <Member Name="LSL Lump Sum 'A' &lt;160893" Value="[FTE Type].[FTE Type].&amp;[311]" Level="5" />
            <Member Name="LSL Lump Sum 'B' &lt;Aug78" Value="[FTE Type].[FTE Type].&amp;[310]" Level="5" />
            <Member Name="LSL Lump Sum &gt;150893" Value="[FTE Type].[FTE Type].&amp;[312]" Level="5" />
          </Member>

After some fiddling I noticed the problem disapeared when I added a space between '&lt;' and 'Aug78' in the Name attribute value. When I did this to the second child then I got five children rendered. When I also did it to the fifth child then all children were rendered.

So the problem seems to be '&lt;' immediately followed by a letter. If it is followed by a number then there is no problem.

Seems this is all valid XML so maybe it's a problem with the way the tree renders?

Any advice appreciated.

Thanks.

Darryl 

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 09 Feb 2009, 04:48 PM
Hi Darryl Stratford,

I was unable to reproduce the error you are describing however I observed another - the Texts of the second and fifth Nodes, after 'B' are trimmed.

This happens because as the Texts are read from the xml file, they are unescaped and all &lt; (&gt;, etc.) are converted to < (>, etc.) respectively. However when the controls are finally rendered to the client such strings as <Text are ignored as they form invalid HTML tags.

In order to resolve this issue, I suggest you double-escape such patterns in the xml:

<Member Name="Long Service Lve - Cash Equivalent" Value="[FTE Type].[FTE Type].&amp;[LSVCEQ]" Level="4">  
    <Member Name="LSL Corp Off LS &gt;150893" Value="[FTE Type].[FTE Type].&amp;[324]" Level="5" /> 
    <Member Name="LSL Corp Off LS 'B'&amp;lt;Aug78" Value="[FTE Type].[FTE Type].&amp;[322]" Level="5" /> 
    <Member Name="LSL Corp Off LS'A'&lt;160893" Value="[FTE Type].[FTE Type].&amp;[323]" Level="5" /> 
    <Member Name="LSL Lump Sum 'A' &lt;160893" Value="[FTE Type].[FTE Type].&amp;[311]" Level="5" /> 
    <Member Name="LSL Lump Sum 'B' &amp;lt;Aug78" Value="[FTE Type].[FTE Type].&amp;[310]" Level="5" /> 
    <Member Name="LSL Lump Sum &gt;150893" Value="[FTE Type].[FTE Type].&amp;[312]" Level="5" /> 
  </Member> 

So, after the xml is parsed all &amp;lt; become &lt; and finally '<' is what is rendered at the client. Please let me know whether this workaround fixes your issue, too.

Greetings,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Darryl
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or