-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
ByNamespace.cs
executable file
·55 lines (43 loc) · 1.28 KB
/
ByNamespace.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// ByNamespace.cs
//
// Author:
// Sean MacIsaac (sean@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
using System;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
namespace Mono.StatusReporter {
public class ByMaintainer {
static int Main (string[] args) {
XslTransform xslt = new XslTransform ();
xslt.Load ("ByNamespace.xsl");
//StreamWriter sw = new StreamWriter ("bn/index");
XPathDocument doc = new XPathDocument ("class.xml");
XmlDocument classxml = new XmlDocument ();
classxml.Load ("class.xml");
ArrayList nsList = new ArrayList ();
XmlNodeList classes = classxml.GetElementsByTagName ("class");
foreach (XmlNode node in classes) {
string name = node.Attributes.GetNamedItem ("name").Value;
string ns = name.Substring(0, name.LastIndexOf ("."));
if (!nsList.Contains (ns)) nsList.Add (ns);
}
foreach (string str in nsList) {
//sw.WriteLine ("<li><a href=\"" + str + ".html\">" + str + "</a>");
XmlWriter writer = new XmlTextWriter ("src/" + str, null);
XsltArgumentList xslArg = new XsltArgumentList ();
xslArg.AddParam ("ns", "", str);
xslt.Transform (doc, xslArg, writer);
writer.Close ();
}
//sw.Close ();
return 0;
}
}
}