有没有办法获取如下所示的 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<spMyStoredProc xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo">
<StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>1</Item>
<Property>something</property>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>2</Item>
<Property>something</property>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>3</Item>
<Property>something</property>
<Group>1</Group>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>4</Item>
<Property>something</property>
<Group>1</Group>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>5</Item>
<Property>something</property>
<Group>2</Group>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>6</Item>
<Property>something</property>
<Group>2</Group>
</StoredProcedureResultSet0>
</StoredProcedureResultSet0>
<ReturnValue>0</ReturnValue>
</spMyStoredProc>
以这种格式出来:
<MyRequests>
<Request>
<Item ID="1" Property="Something" />
</Request>
<Request>
<Item ID="2" Property="Something" />
</Request>
<Request GroupID="1">
<Item ID="3" Property="Something" />
<Item ID="4" Property="Something" />
</Request>
<Request GroupID="2">
<Item ID="5" Property="Something" />
<Item ID="6" Property="Something" />
</Request>
</MyRequests>
我只使用从源模式到目标的直接映射就很接近了,但它不会将具有相同组 ID 的项目组合在一起。
基本上,没有functoids我能得到的是:
<MyRequests>
<Request>
<Item ID="1" Property="Something" />
</Request>
<Request>
<Item ID="2" Property="Something" />
</Request>
<Request GroupID="1">
<Item ID="3" Property="Something" />
</Request>
<Request GroupID="1">
<Item ID="4" Property="Something" />
</Request>
<Request GroupID="2">
<Item ID="5" Property="Something" />
</Request>
<Request GroupID="2">
<Item ID="6" Property="Something" />
</Request>
</MyRequests>