ByNamespace.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // ByNamespace.cs
  3. //
  4. // Author:
  5. // Sean MacIsaac ([email protected])
  6. //
  7. // (C) Ximian, Inc. http://www.ximian.com
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.IO;
  12. using System.Xml;
  13. using System.Xml.Xsl;
  14. using System.Xml.XPath;
  15. namespace Mono.StatusReporter {
  16. public class ByMaintainer {
  17. static int Main (string[] args) {
  18. XslTransform xslt = new XslTransform ();
  19. xslt.Load ("ByNamespace.xsl");
  20. //StreamWriter sw = new StreamWriter ("bn/index");
  21. XPathDocument doc = new XPathDocument ("class.xml");
  22. XmlDocument classxml = new XmlDocument ();
  23. classxml.Load ("class.xml");
  24. ArrayList nsList = new ArrayList ();
  25. XmlNodeList classes = classxml.GetElementsByTagName ("class");
  26. foreach (XmlNode node in classes) {
  27. string name = node.Attributes.GetNamedItem ("name").Value;
  28. string ns = name.Substring(0, name.LastIndexOf ("."));
  29. if (!nsList.Contains (ns)) nsList.Add (ns);
  30. }
  31. foreach (string str in nsList) {
  32. //sw.WriteLine ("<li><a href=\"" + str + ".html\">" + str + "</a>");
  33. XmlWriter writer = new XmlTextWriter ("bn/" + str, null);
  34. XsltArgumentList xslArg = new XsltArgumentList ();
  35. xslArg.AddParam ("ns", "", str);
  36. xslt.Transform (doc, xslArg, writer);
  37. writer.Close ();
  38. }
  39. //sw.Close ();
  40. return 0;
  41. }
  42. }
  43. }