// [DebuggerHidden] public override void deserializeFromXmlTree(XmlElement nodeNode) { this.Name = nodeNode.Attributes[MocaTreeUtil.NameAttributeName].InnerXml; XmlAttribute indexAttribute = XmlUtil.getXMLAttributeWithName(nodeNode, MocaTreeUtil.IndexAttributeName); if (indexAttribute != null) { Index = int.Parse(indexAttribute.InnerXml) | 0; } foreach (XmlElement child in nodeNode.ChildNodes) { if (child.Name == MocaTreeUtil.AttributeNodeDefaultName) { MocaAttribute newAttribute = new MocaAttribute(); newAttribute.deserializeFromXmlTree(child); this.Attributes.Add(newAttribute); newAttribute.Parent = this; } else if (child.Name == MocaNode.ChildNodeDefaultName) { MocaNode newChild = new MocaNode(); newChild.deserializeFromXmlTree(child); this.Children.Add(newChild); newChild.Parent = this; } } }
public MocaAttribute appendChildAttribute(String attributeName, String attributeValue) { MocaAttribute mocaAttribute = null; if (attributeValue == null) { attributeValue = ""; } MocaAttribute existingAttribute = this.getAttribute(attributeName); if (existingAttribute != null) { mocaAttribute = existingAttribute; mocaAttribute.Value = attributeValue; } else { mocaAttribute = new MocaAttribute(); mocaAttribute.Name = attributeName; mocaAttribute.Parent = this; mocaAttribute.Value = attributeValue; this.Attributes.Add(mocaAttribute); mocaAttribute.Index = this.Attributes.IndexOf(mocaAttribute); } return(mocaAttribute); }
public MocaAttribute getAttributeOrCreate(String attributeName) { MocaAttribute attribute = getAttribute(attributeName); if (attribute == null) { attribute = this.appendChildAttribute(attributeName, ""); } return(attribute); }
public MocaAttribute getAttribute(String attributeName) { MocaAttribute attribute = null; foreach (MocaAttribute mocaAttribute in this.Attributes) { if (mocaAttribute.Name == attributeName) { attribute = mocaAttribute; } } return(attribute); }
public MocaAttribute appendChildAttribute(MocaAttribute attribute) { return(appendChildAttribute(attribute.Name, attribute.Value)); }