Do you use TreeView control instead of XML control?
  v3.0 Posted at 20/10/2010 7:56 PM by System Account

Both controls can represent XML hierarchical data and support Extensible Stylesheet Language (XSL) templates, which can be used to transform an XML file into a the correct format and structure. While TreeView can apply Styles more easily, provide special properties that simplify the customization of the appearance of elements based on their current state.
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="siteMapDataSource"
ImageSet="Faq" SkipLinkText =""> 
<ParentNodeStyle Font-Bold="False" /> 
<HoverNodeStyle Font-Underline="True" ForeColor="Purple" />   
<SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px"
VerticalPadding="0px" /> 
<NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="DarkBlue"
HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
<asp:SiteMapDataSource ID="siteMapDataSource"  runat="server" />                    
Figure: Good Code - Use TreeView to represent XML hierarchical data
<asp:Xml ID="Xml1" runat="server" DocumentSource="~/Web.xml"
Figure: Bad Code - Use XML to represent XML document using XSL Transformations

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: