本文介绍了XMLStartlet 未更新 salesforce package.xml 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建 Salesforce Dynamic package.xml 文件.我遵循了这个apexandbeyond.wordpress.com/2017/03/15/dynamic-package-xml-generation/blog中提到的过程,它既不更新也不在xml文件中插入数据.我正在尝试以下方式,但我不适合我.请帮我解决这个问题.下面的代码处于循环中,我需要动态更新 xml 文件.在这里,我正在动态修改文件.

I want to create Salesforce Dynamic package.xml file. I followed the process mentioned in this apexandbeyond.wordpress.com/2017/03/15/dynamic-package-xml-generation/ blog, it is neither updating not inserting data in xml file. I am trying following way but i doesn't work for me. please help me on this.Below code is in loop i need update xml file dynamically. Here i am getting modified file dynamically.

git diff-tree --no-commit-id --name-only --diff-filter=ACMRTUXB -t -r $PREVRSA $LCOMMIT |\读取时 -r CFILE;做案例$CFILE"在.cls) TYPENAME="ApexClass";;.component) TYPENAME="ApexComponent";;.page) TYPENAME="ApexPage";;*) TYPENAME="未知类型";;

git diff-tree --no-commit-id --name-only --diff-filter=ACMRTUXB -t -r $PREVRSA $LCOMMIT | \while read -r CFILE; do case "$CFILE" in .cls) TYPENAME="ApexClass";; .component) TYPENAME="ApexComponent";; .page) TYPENAME="ApexPage";; *) TYPENAME="UNKNOWN TYPE";;

    esac

    if [[ "$TYPENAME" != "UNKNOWN TYPE" ]]
    then
        echo $TYPENAME "," $ENTITY #example:(ApexClass,TestClass1
                                   #example: ApexClass,Testclass2
                                   #example: ApexPage,TestPage) # getting values Dynamically

       xmlstarlet edit -L --subnode "/Package/types[name=$TYPENAME]" --type elem -n members -v
         "$ENTITY" testpackage.xml > edipackage.xml


    fi

完成

echo 清理 Package.xml

echo Cleaning up Package.xml

xmlstarlet ed -L -i/Package -t attr -n xmlns -v "http://soap.sforce.com/2006/04/metadata" testpackage.xml > edipackage.xml

xmlstarlet ed -L -i /Package -t attr -n xmlns -v "http://soap.sforce.com/2006/04/metadata" testpackage.xml > edipackage.xml

原始 testpackage.xml 文件:

Original testpackage.xml file:

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
<types>
<members>*</members>
<name>ApexPage</name>
</types>
<version>48.0</version>
</Package>

预期输出:

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>TestClass1</members>
<members>TestClass2</members>
<name>ApexClass</name>
</types>
<types>
<members>TestPage</members>
<name>ApexPage</name>
</types>
<version>48.0</version>
</Package>

请帮我解决这个问题.

推荐答案

命名空间应定义如下:

xml sel -N x=http://soap.sforce.com/2006/04/metadata -t -m//x:name -v .-n salesforce.xml

返回:

ApexClass
ApexComponent
ApexPage

这篇关于XMLStartlet 未更新 salesforce package.xml 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:26