1
我有下面的xml,我正在使用VBSript來生成它。如何使用vbscript在現有的xml中添加屬性
<?xml version="1.0"?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:481-86880-2" Managed="10682">
<tcm:Item ID="tcm:481-594051"/>
<tcm:Item ID="tcm:481-594088"/>
<tcm:Item ID="tcm:481-594089"/>
<tcm:Item ID="tcm:481-594090"/>
<tcm:Item ID="tcm:481-594343"/>
<tcm:Item ID="tcm:481-594344"/>
<tcm:Item ID="tcm:481-594578"/>
</tcm:ListItems>
現在我有一個PAGEURL(/english/destinations_offers/destinations/asiapacific/maldives.aspx),這將匹配ID例如低於僞
從以上XML ID將是後顯示匹配,然後我們將在上面的xml中添加屬性。所以輸出會如下:
<?xml version="1.0"?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:481-86880-2" Managed="10682">
<tcm:Item ID="tcm:481-594051"/>
<tcm:Item ID="tcm:481-594088"/>
<tcm:Item ID="tcm:481-594089"/>
<tcm:Item ID="tcm:481-594090"/>
<tcm:Item ID="tcm:481-594343" pageURL="/english/destinations_offers/destinations/asiapacific/maldives.aspx"/>
<tcm:Item ID="tcm:481-594344"/>
<tcm:Item ID="tcm:481-594578"/>
</tcm:ListItems>
請建議使用VBScript
感謝。
非常感謝Garett,我在itemNode.attributes.setNamedItem(pageUrl)上得到了對象所需的錯誤,請你給我建議! – 2010-08-17 07:37:27
它看起來像itemNode沒有定義。我編輯了這個例子。 – Garett 2010-08-17 12:22:16