我无法加载 Xdocument.Load 我无法加载 Xdocument.Load我无法加载 Xdocument.Load我无法加载 Xdocument.Load我无法加载 Xdocument.Load我无法加载 Xdocument.Load我无法加载 Xdocument。加载我无法加载 Xdocument.Load我无法加载 Xdocument.Load
public void AuthorNames(string Uri)
{
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(
new Uri("https://www.RESTWEBSERVICESSITE.com"),
"Basic",
new NetworkCredential("USERID", "PWD"));
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Uri);
request.AllowAutoRedirect = true;
request.PreAuthenticate = true;
request.Credentials = credentialCache;
request.AutomaticDecompression = DecompressionMethods.GZip;
try
{
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
XmlReader responseReader = XmlReader.Create(response.GetResponseStream());
//XmlDocument doc = new XmlDocument();
**XDocument docs = XDocument.Load();**
// responseReader.Read();
//XDocument docs = XDocument.Load(response.GetResponseStream());
List<string> books = docs.Descendants("INTEL")
// Not really necessary, but makes it simpler
.Select(x => new {
Title = (string) x.Element("TITLE"),
Author = x.Element("INTEL_AUTH")
})
.Select(x => new {
Title = x.Title,
FirstName = (string) x.Author.Element("FNAME"),
MiddleInitial = (string) x.Author.Element("MNAME"),
LastName = (string) x.Author.Element("LNAME"),
})
.Select(x => string.Format("{0}: {1} {2} {3}",
x.Title,
x.FirstName, x.MiddleInitial, x.LastName))
.ToList();
for (int i = 0; i < books.Count; i++)
{
for (int j = 0; j < books.Count; j++)
{
Response.Write("--" + books[i] + "---" + books[j]);
}
}
}
}
catch (Exception ex)
{
Response.Write("Remote server Returned an Error.");
}
}
我无法使用 XML 提要加载 xdocument.Load。