class Write {
static Contributor [] list;
+ static public XmlNamespaceManager nsmgr;
static void Main (string [] args)
{
XmlDocument document = new XmlDocument ();
document.Load (input);
- XmlNodeList contributors = document.SelectNodes ("/contributors/contributor");
+ nsmgr = new XmlNamespaceManager (document.NameTable);
+ nsmgr.AddNamespace ("t", "http://go-mono.org/team.xsd");
+ XmlNodeList contributors = document.SelectNodes ("/t:contributors/t:contributor", nsmgr);
list = new Contributor [contributors.Count];
Page p = new Page ();
{
public int Compare (object x, object y)
{
- return String.Compare (x as string , y as string);
+ return String.Compare (x.ToString (), y.ToString ());
}
}
{
name = GetName (node);
- image = GetField (node, "image");
- email = GetField (node, "e-mail");
- location = GetField (node, "location");
- organization = GetField (node, "organization");
- description = GetField (node, "description");
+ image = GetImage (node);
+ email = GetField (node, "t:e-mail");
+ location = GetField (node, "t:location");
+ organization = GetField (node, "t:organization");
+ description = GetField (node, "t:description");
tasks = GetTasks (node);
this.document = document;
return name.ToString ();
}
+ public static string GetImage (XmlNode node)
+ {
+ string result = GetField (node, "t:image");
+
+ if (result == String.Empty)
+ return "none.png";
+
+ else
+ return result;
+ }
+
public static string GetField (XmlNode node, string selector)
{
- XmlNode result = node.SelectSingleNode (selector);
+ XmlNode result = node.SelectSingleNode (selector, Write.nsmgr);
if (result == null)
return String.Empty;
public static Name GetName (XmlNode node)
{
- string first_name = GetField (node, "name/first-name");
- string last_name = GetField (node, "name/last-name");
+ string first_name = GetField (node, "t:name/t:first-name");
+ string last_name = GetField (node, "t:name/t:last-name");
return new Name (first_name, last_name);
}
public static string [] GetTasks (XmlNode node)
{
- XmlNodeList nodes = node.SelectNodes ("tasks/task");
+ XmlNodeList nodes = node.SelectNodes ("t:tasks/t:task", Write.nsmgr);
string [] result = new string [nodes.Count];
public XmlElement RenderHtml ()
{
- XmlElement root = document.CreateElement ("TD");
- XmlElement table = document.CreateElement ("TABLE");
- table.SetAttribute ("width", "100%");
- XmlElement tr = document.CreateElement ("TR");
- XmlElement td = document.CreateElement ("TD");
+ XmlElement root = document.CreateElement ("td");
+ XmlElement table = document.CreateElement ("table");
+ table.SetAttribute ("cellPadding", "0");
+ table.SetAttribute ("border", "0");
+ XmlElement tr = document.CreateElement ("tr");
+ XmlElement td = document.CreateElement ("td");
td.SetAttribute ("bgcolor", "#c3cda7");
td.SetAttribute ("valign", "top");
+ td.SetAttribute ("width", "1%");
tr.AppendChild (td);
table.AppendChild (tr);
root.AppendChild (table);
- XmlElement img = document.CreateElement ("IMG");
+ XmlElement img = document.CreateElement ("img");
img.SetAttribute ("align", "top");
img.SetAttribute ("border", "0");
img.SetAttribute ("height", "48");
img.SetAttribute ("width", "48");
- img.SetAttribute ("src", image);
+ img.SetAttribute ("src", "team/" + image);
td.AppendChild (img);
td = document.CreateElement ("TD");
td.SetAttribute ("bgcolor", "#c3cda7");
td.SetAttribute ("valign", "bottom");
+ td.SetAttribute ("width", "100%");
tr.AppendChild (td);
td.AppendChild (name.ToXml (document));
- td.AppendChild (document.CreateElement ("BR"));
+ td.AppendChild (document.CreateElement ("br"));
td.AppendChild (RenderEmail ());
- tr = document.CreateElement ("TR");
+ tr = document.CreateElement ("tr");
table.AppendChild (tr);
- td = document.CreateElement ("TD");
+ td = document.CreateElement ("td");
td.SetAttribute ("bgcolor", "#f5f8e4");
td.SetAttribute ("valign", "top");
tr.AppendChild (td);
td.AppendChild (RenderLabel ("Location: "));
- td = document.CreateElement ("TD");
+ td = document.CreateElement ("td");
td.SetAttribute ("bgcolor", "#f5f8e4");
td.SetAttribute ("valign", "top");
tr.AppendChild (td);
td.AppendChild (document.CreateTextNode (location));
- tr = document.CreateElement ("TR");
+ tr = document.CreateElement ("tr");
table.AppendChild (tr);
- td = document.CreateElement ("TD");
+ td = document.CreateElement ("td");
td.SetAttribute ("bgcolor", "#f5f8e4");
td.SetAttribute ("valign", "top");
tr.AppendChild (td);
td.AppendChild (RenderLabel ("Description: "));
- td = document.CreateElement ("TD");
+ td = document.CreateElement ("td");
td.SetAttribute ("bgcolor", "#f5f8e4");
td.SetAttribute ("valign", "top");
tr.AppendChild (td);
td.AppendChild (document.CreateTextNode (description));
- tr = document.CreateElement ("TR");
+ tr = document.CreateElement ("tr");
table.AppendChild (tr);
- td = document.CreateElement ("TD");
+ td = document.CreateElement ("td");
td.SetAttribute ("bgcolor", "#f5f8e4");
td.SetAttribute ("valign", "top");
tr.AppendChild (td);
td.AppendChild (RenderLabel ("Tasks: "));
- td = document.CreateElement ("TD");
+ td = document.CreateElement ("td");
td.SetAttribute ("bgcolor", "#f5f8e4");
td.SetAttribute ("valign", "top");
tr.AppendChild (td);
public XmlNode RenderTasks ()
{
- XmlElement element = document.CreateElement ("OL");
+ XmlElement element = document.CreateElement ("ol");
element.SetAttribute ("type", "I");
foreach (string task in tasks) {
- XmlElement li = document.CreateElement ("LI");
+ XmlElement li = document.CreateElement ("li");
li.AppendChild (document.CreateTextNode (task));
element.AppendChild (li);
}
public XmlNode RenderEmail ()
{
- XmlElement a = document.CreateElement ("A");
+ XmlElement a = document.CreateElement ("a");
a.SetAttribute ("href", "mailto:" + email);
- XmlElement font = document.CreateElement ("FONT");
+ XmlElement font = document.CreateElement ("font");
font.SetAttribute ("size", "3");
XmlText t = document.CreateTextNode (email);
a.AppendChild (font);
public XmlNode RenderLabel (string label)
{
string text = String.Format ("{0}: ", label);
- XmlElement element = document.CreateElement ("B");
+ XmlElement element = document.CreateElement ("b");
XmlText t = document.CreateTextNode (label );
element.AppendChild (t);
public Page ()
{
document = new XmlDocument ();
- XmlElement html = document.CreateElement ("HTML");
- document.AppendChild (html);
-
- XmlElement head = document.CreateElement ("HEAD");
- html.AppendChild (head);
-
- XmlElement body = document.CreateElement ("BODY");
- html.AppendChild (body);
- XmlElement table = document.CreateElement ("TABLE");
- body.AppendChild (table);
+ XmlElement table = document.CreateElement ("table");
+ document.AppendChild (table);
- tbody = document.CreateElement ("TBODY");
+ tbody = document.CreateElement ("tbody");
table.AppendChild (tbody);
}
if (left == null && right == null)
return;
- XmlElement tr = document.CreateElement ("TR");
+ XmlElement tr = document.CreateElement ("tr");
tbody.AppendChild (tr);
tr.AppendChild (left);
if (right == null)
- tr.AppendChild (document.CreateElement ("TD"));
+ tr.AppendChild (document.CreateElement ("td"));
else {
tr.SetAttribute ("valign", "top");
tr.AppendChild (right);
public XmlNode ToXml (XmlDocument document)
{
- XmlElement element = document.CreateElement ("FONT");
+ XmlElement element = document.CreateElement ("font");
element.SetAttribute ("size", "3");
XmlElement b = document.CreateElement ("B");
XmlText t = document.CreateTextNode (ToString ());