private void Create_Atoms(ReadDescriptiveXML descriptive, string type, string tagName) { XmlNodeList xmlNodeList = descriptive.XmlDoc.DocumentElement.GetElementsByTagName(tagName); Assert.NotNull(xmlNodeList); // for each element in xmlNodeList foreach (XmlNode node in xmlNodeList) { // create the atom with all its attribute Atom atom = entity.AddAtom(node.Attributes["id"].Value); atom.AddAttribute("type", type); // create the attributes of the atom foreach (XmlAttribute atr in node.Attributes) { // get the name of the attribute and its value string key = atr.Name; string value = atr.Value; // if the attribute is the ref we skip it since it is the name previously stored if (key == "id") // || value.Length == 0) { continue; } // store the attribute atom.AddAttribute(key, value); Assert.Equal(atom.Attributes[key], value); } entity.AddChildren(atom); } }
private void Create_Definitions(XmlDocument XmlDoc, TypeDefinitions typeDefinition, string tagName, ref PreferenceDataStructureEntity entity) { XmlNodeList xmlNodeList = XmlDoc.DocumentElement.GetElementsByTagName(tagName); // for each element in xmlNodeList foreach (XmlNode node in xmlNodeList) { // create the atom with all its attribute Atom atom = entity.AddAtomDefinition(node.Attributes[KEY_XML_REF].Value, typeDefinition); // create the attributes of the atom foreach (XmlAttribute atr in node.Attributes) { // get the name of the attribute and its value string key = atr.Name; string value = atr.Value; // if the attribute is the ref we skip it since it is the name previously stored if (key == KEY_XML_REF) // || value.Length == 0) { continue; } if (key.Equals("type")) { key = "Type"; } // store the attribute atom.AddAttribute(key, value); } } }
private void Create_Atoms(XmlDocument XmlDoc, string type, string tagName, ref PreferenceDataStructureEntity entity, string id = "id") { XmlNodeList xmlNodeList = XmlDoc.DocumentElement.GetElementsByTagName(tagName); // for each element in xmlNodeList foreach (XmlNode node in xmlNodeList) { // create the atom with all its attribute Atom atom = entity.AddAtom(node.Attributes[id].Value); atom.AddAttribute(KEY_XML_TYPE_ATOM, type); // create the attributes of the atom foreach (XmlAttribute atr in node.Attributes) { // get the name of the attribute and its value string key = atr.Name; string value = atr.Value; // if the attribute is the ref we skip it since it is the name previously stored if (key == id) // || value.Length == 0) { continue; } if (key.Equals("type")) { key = "Type"; } // store the attribute atom.AddAttribute(key, value); } entity.AddChildren(atom); } }