我的结果中有xmls列表,所有xml都是在循环时生成的。
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-5-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-34086-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-11-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-13896-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-16913-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-29396-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-29397-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-19-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-360-2" Managed="10682" />
<?xml version="1.0" ?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-29451-2" Managed="10682" />
正如您所看到的,有许多具有相同内部类型节点的xml。现在我想在所有循环完成后将所有这些数据合并到单个xml中,这样我的输出将如下所示:
<?xml version="1.0" ?>
<root>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-5-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-34086-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-11-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-13896-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-16913-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-29396-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-29397-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-19-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-360-2" Managed="10682" />
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:229-29451-2" Managed="10682" />
</root>
C#代码:
foreach (XmlNode nav in xnl)
{
Folder folder1 = objTom.GetFolder(nav.Attributes["ID"].Value, publication);
XmlDocument _xdocChild = new XmlDocument();
string _data=folder1.GetListItems(ListColumnFilter.XMLListExtended, rowFilter1).ToString();
_xdocChild.LoadXml(_data.Replace("<?xml version=\"1.0\"?>",""));
sb.AppendLine(_xdocChild.InnerXml);
}
上面的c#代码正在做这一切,但我没有得到正确的xml。 请建议!!