开发者

Help with XML Structure

I am building a report viewer. The viewer will contain a tree control that displays to the user all possible reports to choose from. I'm using a tree control because the reports could be grouped several levels deep. The tree could like this:

- North America
   + North Territory
   + South Territory
   + West Territory
      - Units Manufactured
      - Units Shipped
   + East Territory
+ South America

At the lowest level of each group (e.g., 'Units Manufactured' and 'Units Shipped' for North America, West Territory), I want to store information about the report that will be used to render the report (e.g., information required to display the North America, West Territory, Units Manufactured report).

For example, I would want to include the name of the report (string), connection information (string) and available sites (single string). What would be the best way to represent this in XML? I'm not particularly fluent in XML, so I could use some help. One further requirement is that there really is no limit as to how many levels deep the grouping could go, but I expect it would never be more than three or four. I'll then use the XML to build my tree control dynamically at runtime, and then use the information stored at each lowest level to displ开发者_JS百科ay the report when it is selected by the user.

Thanks very much


Use a simple structure like this, where the tree element contains 1 to unlimited branches, each of which can include other branches or leaves (which are endpoints).

<tree>
    <branch name="North America">
       <branch name="North Territory"> ... </branch>
       <branch name="South Territory"> ... </branch>
       <branch name="West Territory"> 
          <leaf name="Units Manufactured" />
          <leaf name="Units Shipped" />
       </branch>
       <branch name="East Territory"> ... </branch>
    <branch name="South America"> ... </branch>
</tree>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜