| The code is as follows |
Copy Code |
|
<?xml version= "1.0" encoding= "Utf-8"?>
<rool value= "Audit reports and consolidated financial statements" >
<chapter value= "Audit Report and consolidated financial statements b0001a" ></chapter>
<chapter value= "Audit report b0101a" ></chapter>
<chapter value= "financial statement b0102a" >
<node value= "(i) Consolidated balance sheet b0201c" ></node>
<node value= "(ii) Balance sheet b0202c" ></node>
<node value= "(iv) PROFIT statement b0204c" ></node>
<node value= "(v) consolidated cash Flow b0205c" ></node>
<node value= "(vi) Cash flow statement b0206c" ></node>
<node value= "(vii) Statement of changes in the merger owner's equity b0207c" ></node>
<node value= "(eight) statement of changes in owners ' equity b0208c" ></node>
</chapter>
<chapter value= "notes to financial statements b0103a" >
<node value= "First, company basic situation b0201c" ></node>
<node value= "Second, the company's main accounting policies, accounting estimates and early error correction b0202a" >
<knobble value= "(i) basis for the preparation of financial statements b0301c" ></knobble>
<knobble value= "(ii) Follow the statement of corporate accounting Standards b0302c" ></knobble>
<knobble value= "(iii) Approval of financial report b0303c" ></knobble>
<knobble value= "(iv) Accounting period b0304c" ></knobble>
<knobble value= "(v) Bookkeeping standard currency b0305c" ></knobble>
<knobble value= "(vi) accounting treatment of enterprises merging under the same control and under non-identical control b0306a" ></knobble>
<knobble value= "(vii) methodology for the preparation of consolidated financial statements b0307a" ></knobble>
<knobble value= "(eight) standard for the determination of cash and cash equivalents b0308c" ></knobble>
<knobble value= "(ix) Translation of foreign currency business and foreign currency statements b0309a" ></knobble>
</node>
</chapter>
</root> |
Then in the background to read XML nodes recursively, generate HTML to display the page can be implemented as follows:
| The code is as follows |
Copy Code |
|
protected void Page_Load (object sender, EventArgs e)
{
& nbsp; //xdocument doc = xdocument.load (Server.MapPath ("Html5reader/readerdata.xml"));
StringBuilder sb = new StringBuilder ();
xmldocument dc = new XmlDocument ();
String path = Server.MapPath ("~/html5reader/readerdata.xml");
DC. Load (path);
XmlNodeList xnl = DC. SelectNodes ("Section/chapter");
sb. Append ("<ul>");
ReadXml (XNL, SB);
sb. Append ("</ul>");
this.html.InnerHtml = sb. ToString ();
}
private void ReadXml (XmlNodeList xmlnl,stringbuilder sb_)
{
foreach (XmlNode xl in XMLNL)
{
if (XL. Childnodes.count = 0)
{
Sb_. Append ("<li><a>" + XL.) attributes["Value"]. Value + "</a></li>");
}
Else
{
Sb_. Append ("<li><a>" + XL.) attributes["Value"]. Value + "</a><ul>");
ReadXml (XL. ChildNodes, sb_);
Sb_. Append ("</ul></li>");
}
}
} |
The front page is very good:
| The code is as follows |
Copy Code |
<title></title>
<body>
<form id= "Form1" runat= "Server" >
<div id= "HTML" runat= "Server" >
</div>
</form>
</body>
|
After running