protected SiteDocumentBase(XmlNode xmlNode) { this.Name = xmlNode.Attributes["name"].Value; this.Id = xmlNode.Attributes["id"].Value; //Note: [2015-10-28] Datasources presently don't return this information // this.ContentUrl = xmlNode.Attributes["contentUrl"].Value; //Namespace for XPath queries var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline"); //Get the project attributes var projectNode = xmlNode.SelectSingleNode("iwsOnline:project", nsManager); this.ProjectId = projectNode.Attributes["id"].Value; this.ProjectName = projectNode.Attributes["name"].Value; //Get the owner attributes var ownerNode = xmlNode.SelectSingleNode("iwsOnline:owner", nsManager); this.OwnerId = ownerNode.Attributes["id"].Value; //See if there are tags var tagsNode = xmlNode.SelectSingleNode("iwsOnline:tags", nsManager); if (tagsNode != null) { this.TagsSet = new SiteTagsSet(tagsNode); } }
protected SiteDocumentBase(XmlNode xmlNode) { this.Name = xmlNode.Attributes["name"].Value; this.Id = xmlNode.Attributes["id"].Value; //Note: [2015-10-28] Datasources presently don't return this information // this.ContentUrl = xmlNode.Attributes["contentUrl"].Value; //Namespace for XPath queries var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline"); //Get the project attributes var projectNode = xmlNode.SelectSingleNode("iwsOnline:project", nsManager); this.ProjectId = projectNode.Attributes["id"].Value; //Some responses do not have the project name var attrProjectName = projectNode.Attributes["name"]; if (attrProjectName != null) { this.ProjectName = attrProjectName.Value; } //Get the owner attributes var ownerNode = xmlNode.SelectSingleNode("iwsOnline:owner", nsManager); this.OwnerId = ownerNode.Attributes["id"].Value; this.OwnerName = XmlHelper.GetAttributeIfExists(ownerNode, "name"); //Web Page URL this.WebPageUrl = XmlHelper.GetAttributeIfExists(xmlNode, "webpageUrl"); //Updated time this.UpdatedAt = XmlHelper.GetAttributeDateTimeIfExists(xmlNode, "updatedAt"); //See if there are tags var tagsNode = xmlNode.SelectSingleNode("iwsOnline:tags", nsManager); if (tagsNode != null) { this.TagsSet = new SiteTagsSet(tagsNode); } }
protected SiteDocumentBase(XmlNode xmlNode, string xmlNamespace) { this.Name = xmlNode.Attributes["name"].Value; this.Id = xmlNode.Attributes["id"].Value; //Note: [2015-10-28] Datasources presently don't return this information // this.ContentUrl = xmlNode.Attributes["contentUrl"].Value; //Namespace for XPath queries //var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline"); var xElement = xmlNode.ToXElement(); //Get the project attributes var projectElement = xElement.Descendants(XName.Get("project", xmlNamespace)).First(); var projectNode = projectElement.ToXmlNode(); this.ProjectId = projectNode.Attributes["id"].Value; //Some responses do not have the project name var attrProjectName = projectNode.Attributes["name"]; if (attrProjectName != null) { this.ProjectName = attrProjectName.Value; } //Get the owner attributes var ownerElement = xElement.Descendants(XName.Get("owner", xmlNamespace)).First(); var ownerNode = ownerElement.ToXmlNode(); this.OwnerId = ownerNode.Attributes["id"].Value; //See if there are tags var tagsElement = xElement.Descendants(XName.Get("tags", xmlNamespace)).First(); var tagsNode = tagsElement.ToXmlNode(); if (tagsNode != null) { this.TagsSet = new SiteTagsSet(tagsNode, xmlNamespace); } }