我正在尝试解析此文档。这是其中的一部分:
<JobPortalPositionList>
<CustomerAlias>Frogn</CustomerAlias>
<CustomerName>Frogn kommune</CustomerName>
<TransactionStatus>
<Description>The operation completed successfully.</Description>
<StatusCode>Success</StatusCode>
</TransactionStatus>
<Items>
<JobPortalPosition>
<CustomerAlias>Frogn</CustomerAlias>
<CustomerName>Frogn kommune</CustomerName>
<TransactionStatus>
网址: http
://api.hr-manager.net/JobPortal.svc/frogn/positionlist/xml/
我尝试使用 Linq:
string uri="http://api.hr-manager.net/JobPortal.svc/frogn/positionlist/xml/";
XElement xmlJobTree = XElement.Load(uri);
var listOfJobpositions =
(from jobpositions in xmlJobTree.Elements("JobPortalPositionList")
.Elements("Items")
.Elements("JobPortalPosition")
select jobpositions).ToList();
我得到一个空列表。我究竟做错了什么?