示例#1
0
        private XmlNode DefineMainElement(IXmlDocument xml)
        {
            XmlNode n = xml.CreateElement(NodeMainName);
            XmlNode i = xml.CreateElement(NodeInfo);

            if (n == null || i == null)
            {
                return(null);
            }

            XmlNode v = xml.CreateElementWithText(NodeInfoVersion, CurrentVersion);
            XmlNode g = xml.CreateElementWithText(NodeInfoGenerator, GeneratorName);
            XmlNode f = xml.CreateElementWithText(NodeInfoProcessedFile, InputFilePath);
            XmlNode d = xml.CreateElementWithText(NodeInfoGenerationDate,
                                                  DateTime.Now.ToString());

            if (v != null)
            {
                i.AppendChild(v);
            }
            if (g != null)
            {
                i.AppendChild(g);
            }
            if (f != null)
            {
                i.AppendChild(f);
            }
            if (d != null)
            {
                i.AppendChild(d);
            }

            n.AppendChild(i);
            return(n);
        }