コード例 #1
0
 public void GetAllMembers(Dictionary <string, XmlType> allMembers)
 {
     if (arrayElement != null)
     {
         arrayElement.GetAllMembers(allMembers);
         return;
     }
     if (allMembers == null)
     {
         return;
     }
     allMembers.Clear();
     foreach (KeyValuePair <string, XmlType> temp in dicMembers)
     {
         allMembers[temp.Key] = temp.Value;
     }
 }
コード例 #2
0
            public string Check(XmlType xmlType, IgnoreNode ignoreNodeRoot, bool checkExtraField = false)
            {
                if (xmlType == null || ignoreNodeRoot == null)
                {
                    return(string.Empty);
                }
                string error = string.Empty;

                if (xmlType.name != name)
                {
                    if (checkExtraField && !ignoreNodeRoot.IsIgnored(xmlType))
                    {
                        error += "<color=yellow>  XML多填了:  " + GetPathName() + GetPosition() + "</color>\n";
                    }
                }
                else
                {
                    Dictionary <string, XmlType> dicChildren = new Dictionary <string, XmlType>();
                    xmlType.GetAllMembers(dicChildren);
                    for (int i = 0; i < listChildren.Count; ++i)
                    {
                        Node    child        = listChildren[i];
                        XmlType childXmlType = xmlType.GetMember(child.name);
                        if (childXmlType == null)
                        {
                            if (checkExtraField && !ignoreNodeRoot.IsIgnored(xmlType, child.name))
                            {
                                error += "<color=yellow>  XML多填了:   " + child.GetPathName() + child.GetPosition() + "</color>\n";
                            }
                            continue;
                        }
                        dicChildren.Remove(child.name);
                        error += child.Check(childXmlType, ignoreNodeRoot, checkExtraField);
                    }
                    foreach (KeyValuePair <string, XmlType> temp in dicChildren)
                    {
                        if (!temp.Value.IsArray() && !ignoreNodeRoot.IsIgnored(temp.Value))
                        {
                            error += "<color=red>  XML少填了:   " + GetPathName() + "/" + temp.Value.name + GetPosition() + "</color>\n";
                        }
                    }
                }
                return(error);
            }