Today, I saw an XSL generate a Cross Tree Structure Using a recursive template for an XML file.
I want to use C # To write the same thing. Unfortunately, I didn't learn any data structures, so I don't know exactly how to do it?
There is no way. I spent one afternoon reading the materials. I wrote a website with more details. It was CERNET. Unfortunately, I didn't remember the website when I wrote something.
According to your own understanding, I wrote a very junk recursive program,
Using system;
Class myclass {
Public static string [] slist;
Public static void digui (string ID)
{
For (INT I = 0; I <slist. length; I ++)
{
If (ID = slist [I]) system. Console. Write ("<div>" + ID + "\ n ");
Int J = ID. length;
If (Id. Length <= slist [I]. length)
If (slist [I]. substring (0, id. Length) = ID) & (slist [I]. Length-id.Length = 2 ))
{
// System. Console. Write ("Checkpoint \ n ");
Digui (slist [I]);
System. Console. Write ("</div> ");
}
}
}
Public static void main (string [] ARGs ){
Slist = new string [8];
Slist [0] = "01 ";
Slist [1] = "0101 ";
Slist [2] = "010101 ";
Slist [3] = "0102 ";
Slist [4] = "010102 ";
Slist [5] = "01010101 ";
Slist [6] = "010201 ";
Slist [7] = "01020102 ";
Digui ("01 ");
}
}
The result is generated in the same way as the recursive template.
However, I think the number of steps I use is 8 × 8. It seems that I can write less.
Wait and check again.