public SXNode(SXNode parent, string name, string value) { this.Initialize(parent); this.name = name; this.value = value; }
protected SXNode(XmlReader reader, SXNode parent) { this.Initialize(reader, parent); }
protected void Initialize(SXNode parent_node) { this.parent = parent_node; }
protected bool Initialize(XmlReader reader, SXNode parent_node) { if (!reader.IsStartElement()) return false; this.parent = parent_node; this.prefix = reader.Prefix; this.name = reader.LocalName; bool empty_element = reader.IsEmptyElement; while (reader.MoveToNextAttribute()) this.attributes.Add(new SXAttribute(reader)); if (!empty_element) while (reader.Read()) { if (reader.IsStartElement()) this.nodes.Add(new SXNode(reader, this)); else if (reader.NodeType == XmlNodeType.Text) this.value = reader.Value; else if (reader.NodeType == XmlNodeType.EndElement) break; } return true; }
public SXNode AddNode(string name, string value) { SXNode node = new SXNode(this, name, value); this.Nodes.Add(node); return node; }