internal void ParseXml(XPathNavigator commonNav) { XPathNavigator sourceNav = commonNav.SelectSingleNode("source"); if (sourceNav != null) { Source = sourceNav.Value; } XPathNavigator noteNav = commonNav.SelectSingleNode("note"); if (noteNav != null) { Note = noteNav.Value; } // Please leave this code until the data-xml/common/tags gets removed. XPathNavigator tagsNav = commonNav.SelectSingleNode("tags"); if (tagsNav != null) { #pragma warning disable CS0618 // Type or member is obsolete Tags = tagsNav.Value; #pragma warning restore CS0618 // Type or member is obsolete } XPathNodeIterator extensionIterator = commonNav.Select("extension"); foreach (XPathNavigator extensionNav in extensionIterator) { ThingExtension extension = DeserializeExtension(extensionNav); if (extension != null) { Extensions.Add(extension); } } XPathNodeIterator relationshipIterator = commonNav.Select("related-thing[./thing-id != '' or ./client-thing-id != '']"); foreach (XPathNavigator relationshipNav in relationshipIterator) { ThingRelationship relationship = new ThingRelationship(); relationship.ParseXml(relationshipNav); RelatedItems.Add(relationship); } XPathNavigator clientIdNav = commonNav.SelectSingleNode("client-thing-id"); if (clientIdNav != null) { ClientId = clientIdNav.Value; } }
internal void ParseRelatedAttribute(string value) { if (!string.IsNullOrEmpty(value)) { var relThings = value.Split(';'); foreach (var relThing in relThings) { Guid thingId; if (Guid.TryParse(relThing.Split(',')[0], out thingId)) { RelatedItems.Add(new ThingRelationship(thingId)); } } } }