Пример #1
0
        /// <summary>
        /// Recursively gets the dynamic properties.
        /// </summary>
        /// <param name="node">
        /// A XML node containing the dynamic properties.
        /// </param>
        /// <param name="path">
        /// The path to the node value.
        /// </param>
        /// <remarks>
        /// If the namespace of the property is not defined it will be assigned to
        /// the default namespace.
        /// </remarks>
        void GetProperties(XmlNode node, string path)
        {
            if (node != null && node.ChildNodes.Count > 0)
            {
                foreach (XmlNode inner_node in node.ChildNodes)
                {
                    if (inner_node.NodeType == XmlNodeType.Element)
                    {
                        if (inner_node.ChildNodes.Count > 0)
                        {
                            GetProperties(inner_node, path + "." + inner_node.Name);
                        }
                        else
                        {
                            XmlAttributeCollection properties = inner_node.Attributes;
                            if (properties.Count == 0)
                            {
                                return;
                            }

                            DictionaryValue keys = new DictionaryValue();
                            foreach (XmlAttribute property in properties)
                            {
                                keys.SetString(property.Name, property.Value);
                            }
                            properties_[path] = keys;
                        }
                    }
                }
            }
        }
Пример #2
0
    /// <summary>
    /// Recursively gets the dynamic properties.
    /// </summary>
    /// <param name="node">
    /// A XML node containing the dynamic properties.
    /// </param>
    /// <param name="path">
    /// The path to the node value.
    /// </param>
    /// <remarks>
    /// If the namespace of the property is not defined it will be assigned to
    /// the default namespace.
    /// </remarks>
    void GetProperties(XmlNode node, string path) {
      if (node != null && node.ChildNodes.Count > 0) {
        foreach (XmlNode inner_node in node.ChildNodes) {
          if (inner_node.NodeType == XmlNodeType.Element) {
            if (inner_node.ChildNodes.Count > 0) {
              GetProperties(inner_node, path + "." + inner_node.Name);
            } else {
              XmlAttributeCollection properties = inner_node.Attributes;
              if (properties.Count == 0)
                return;

              DictionaryValue keys = new DictionaryValue();
              foreach (XmlAttribute property in properties) {
                keys.SetString(property.Name, property.Value);
              }
              properties_[path] = keys;
            }
          }
        }
      }
    }