Member 8102739
Вот решение: он был в формате Atom,поэтому я был немного смущен, чтобы разобрать его.
static List<DocumentationEntity> ParseAtom(string url, string username, string password)
{
try
{
var _xDocument = new XDocument();
var _Request = WebRequest.Create(url) as HttpWebRequest;
_Request.Method = "GET";
_Request.Credentials = new NetworkCredential(username, password);
using (HttpWebResponse response = _Request.GetResponse() as HttpWebResponse)
{
using (Stream stream = response.GetResponseStream())
{
_xDocument = XDocument.Load(stream);
}
}
var entries = from root in _xDocument.Root.Elements().Where(i => i.Name.LocalName == "entry")
from entry in root.Elements().Where(i => i.Name.LocalName == "properties")
select new DocumentationEntity
{
ContentTypeID = entry.Elements().First(i => i.Name.LocalName == "ContentTypeID").Value,
Name = entry.Elements().First(i => i.Name.LocalName == "Name").Value,
Description = entry.Elements().First(i => i.Name.LocalName == "Description").Value,
PictureWidth = entry.Elements().First(i => i.Name.LocalName == "PictureWidth").Value,
StageValue = entry.Elements().First(i => i.Name.LocalName == "StageValue").Value,
ScriptReview = entry.Elements().First(i => i.Name.LocalName == "ScriptReview").Value,
ScriptReview0 = entry.Elements().First(i => i.Name.LocalName == "ScriptReview0").Value,
ScriptCompleted = entry.Elements().First(i => i.Name.LocalName == "ScriptCompleted").Value,
Id = entry.Elements().First(i => i.Name.LocalName == "Id").Value,
ContentType = entry.Elements().First(i => i.Name.LocalName == "ContentType").Value,
Created = entry.Elements().First(i => i.Name.LocalName == "Created").Value,
CreatedById = entry.Elements().First(i => i.Name.LocalName == "CreatedById").Value,
Modified = entry.Elements().First(i => i.Name.LocalName == "Modified").Value,
ModifiedById = entry.Elements().First(i => i.Name.LocalName == "ModifiedById").Value,
CopySource = entry.Elements().First(i => i.Name.LocalName == "CopySource").Value,
ApprovalStatus = entry.Elements().First(i => i.Name.LocalName == "ApprovalStatus").Value,
Path = entry.Elements().First(i => i.Name.LocalName == "Path").Value,
CheckedOutToId = entry.Elements().First(i => i.Name.LocalName == "CheckedOutToId").Value,
VirusStatus = entry.Elements().First(i => i.Name.LocalName == "VirusStatus").Value,
IsCurrentVersion = entry.Elements().First(i => i.Name.LocalName == "IsCurrentVersion").Value,
Owshiddenversion = entry.Elements().First(i => i.Name.LocalName == "Owshiddenversion").Value,
Version = entry.Elements().First(i => i.Name.LocalName == "Version").Value
};
return entries.ToList();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
}