Ejemplo n.º 1
0
 private static DataClass ParseEntityListXml(XmlNode node, DataClass previousClass)
 {
     var data = previousClass ?? new DataClass {Name = node.FirstChild.Name};
     foreach (XmlNode entityNode in node.ChildNodes)
     {
         ParseEntityXml(entityNode, data);
         ++data.NodeCount;
     }
     return data;
 }
Ejemplo n.º 2
0
        private static void ParseEntityXml(XmlNode node, DataClass data)
        {
            if (node.InnerText.Length > 0)
                data.HasContent = true;

            if (node.Attributes != null)
            {
                foreach (var attr in node.Attributes.OfType<XmlAttribute>())
                {
                    var key = attr.Name;
                    var value = attr.Value;

                    var field = data.CreateOrGetSimpleField(key);
                    field.Values.Add(value);
                }
            }

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (!(childNode is XmlElement))
                    continue;

                var field = data.CreateOrGetClassField(childNode.FirstChild.Name);
                field.Class = ParseEntityListXml(childNode, field.Class);
                field.Class.OwnedField = field;
            }
        }