获取XML信息
public ArrayList getXML(string path)
{
try
{
XmlDocument doc1 = new XmlDocument();
doc1.Load(Server.MapPath(path));
XmlNodeList node = doc1.DocumentElement.ChildNodes;
ArrayList al = new ArrayList();
foreach (XmlNode n1 in node)
{
Table t = new Table();
XmlNodeList node1 = n1.ChildNodes;
foreach (XmlNode nodeChild in node1)
{
bool a = nodeChild.HasChildNodes;//垃圾属性
if (nodeChild.Name == "tableName")
{
XmlElement xe = (XmlElement)nodeChild;
t.TableName = xe.InnerText.ToString();
}
if (nodeChild.Name == "KEYWORD")
{
XmlElement xe = (XmlElement)nodeChild;
//if(xe.Name=="niandu")
t.KEYWORD += xe.InnerText.ToString()+"," ;
}
if (nodeChild.Name == "column")
{
XmlNodeList nodeColumn = nodeChild.ChildNodes;
Column column = new Column();
foreach (XmlNode child in nodeColumn)
{
XmlElement xeChild = (XmlElement)child;
if (child.Name == "columnName")
{
column.columnName = xeChild.InnerText.ToString();
}
if (child.Name.Length > 6 && child.Name.Substring(0, 6) == "Column")
{
column.allColumn.Add(xeChild.InnerText.ToString());
}
if (child.Name == "cnName")
{
column.cnName = xeChild.InnerText.ToString();
}
if (child.Name == "Method")
{
column.method = xeChild.InnerText.ToString();
}
if (child.Name == "type")
{
column.type = xeChild.InnerText.ToString();
}
}
t.alColumn.Add(column);
}
}
al.Add(t);
}
return al;
}
catch { return null; }
}
//hashtable
foreach (object key in ht.Keys)
{
Response.Write(ht[key] + "<br>");
Response.Write(key.ToString() + "<br>");
}