我是一名有用的助手,可以为您进行翻译。以下是需要翻译的内容:
"
我有一个大型的XML文件,并希望从中获取定义数量的<Cooperation>
节点。如何处理最佳。
目前,我正在使用以下代码
public string FullCooperationListChunkGet(int part, int chunksize)
{
StringBuilder output_xml = new StringBuilder();
IEnumerable<XElement> childList = from el in xml.Elements("Cooperations").Skip(part * chunksize).Take(chunksize) select el;
foreach (XElement x in childList.Elements())
{
output_xml.Append(x.ToString());
}
return output_xml.ToString();
}
"
Skip(part * chunksize).Take(chunksize)
不起作用(似乎仅适用于Cooperations标记而不是Cooperation标记)
有人可以指导一下吗。
谢谢,
rAyt
编辑:
背景是这样的:我通过一个 Web 服务将这些 XML 部分推送到 Blackberry。不幸的是,Blackberry 企业服务器上的 HTTP 请求大小默认为 256 KB。
XML 文件的一部分:
"<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Cooperations>
<Cooperation>
<CooperationId>xxx</CooperationId>
<CooperationName>xxx</CooperationName>
<LogicalCustomers>
<LogicalCustomer>
<LogicalCustomerId>xxx</LogicalCustomerId>
<LogicalCustomerName>xxx</LogicalCustomerName>
<Customers>
<Customer>
<CustomerId>xxx</CustomerId>
<CustomerName>xxx/CustomerName>
</Customer>
<Customer>
<CustomerId>xxx</CustomerId>
<CustomerName>xxx</CustomerName>
</Customer>
</Customers>
</LogicalCustomer>
<LogicalCustomer>
<LogicalCustomerId>xxx</LogicalCustomerId>
<LogicalCustomerName>xxx</LogicalCustomerName>
<Customers>
<Customer>
<CustomerId>xxx</CustomerId>
<CustomerName>xxx</CustomerName>
</Customer>
<Customer>
<CustomerId>xxx</CustomerId>
<CustomerName>xxx</CustomerName>
</Customer>
</Customers>
</LogicalCustomer>
<LogicalCustomer>
<LogicalCustomerId>xxx</LogicalCustomerId>
<LogicalCustomerName>xxx</LogicalCustomerName>
<Customers>
<Customer>
<CustomerId>xxx</CustomerId>
<CustomerName>xxx</CustomerName>
</Customer>
</Customers>
</LogicalCustomer>
</LogicalCustomers>
</Cooperation>
<Cooperation>
...