Practical tips for XML volumes (5): structure tree

Source: Internet
Author: User
Tags xml xsl
At first, I remembered that binary tree was created because a company structure was required. In the past, image software was used to draw an image. It looks nice, but every time there is a change, you need to redraw a new one. On the other hand, the display of lines on the web page

At first, I remembered that binary tree was created because a company structure was required. In the past, image software was used to draw an image. It looks nice, but every time there is a change, you need to redraw a new one. On the other hand, the display and layout of lines on the web page are quite limited. The layout and positioning based on the dynamic natural data are quite difficult, and they are also elegant. After a variety of attempts, I decided to use xml xsl for data operations; I used VML to beautify the lines and used JAVASCRIPT to locate the objects.

Materials:

Structure tree of XML volumes

There are two files: flow2.xml and flow2.xsl.

Explanation:

Binary Tree ideas (1)

Reference content is as follows:



...

These are the basic VML patterns. I will not explain them in detail.

XML is a tree structure. to read each data, we need to traverse the XML data tree. The return operation is one of the advantages of XSL. I decided to apply XSL only when I failed to perform the traversal operation using other methods.

Reference content is as follows:


Binary tree-structure diagram
Sailflying
Sailflying@163.net

1
First node


2
Second node
...
...




3
Third node
...
...



Logically, the current node (1) has two subnodes (2, 3 ). You only need to locate node 2 and Node 3 in the lower left and lower right of node 1. Here, the connection lines of the left and right nodes are distinguished in green and red to facilitate display.

As we mentioned above, we have discussed the progressive return function of XSL. to better understand each specific display step, just add an alert statement following the code below.

Reference content is as follows:


...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.