示例#1
0
        public HElement(HName name, params object[] content)
        {
            this.Name = name;

            var attributes = new List <HAttribute>();
            var nodes      = new List <HObject>();

            foreach (var node in HObject.HObjects(content))
            {
                if (node is HAttribute)
                {
                    attributes.Add(node as HAttribute);
                }
                else
                {
                    nodes.Add(node);
                }
            }
            this.Attributes = attributes.ToArray();
            this.Nodes      = nodes.ToArray();
        }
示例#2
0
 public static HElement Element(this HBuilder h, HName name, params object[] content)
 {
     return(new HElement(name, content));
 }
示例#3
0
 public static HAttribute Attribute(this HBuilder h, HName name, object value)
 {
     return(new HAttribute(name, value));
 }
示例#4
0
 public HAttribute(HName name, object value)
 {
     this.Name  = name;
     this.Value = value.ToString_Fair();
 }
示例#5
0
 public HElement Element(HName name)
 {
     return(Elements(name).FirstOrDefault());
 }
示例#6
0
 public IEnumerable <HElement> Elements(HName name)
 {
     return(Elements().Where(element => element.Name.LocalName == name.LocalName && element.Name.Namespace == name.Namespace));
 }