0
我無法使用linq將xml修改爲xml。 下面是我使用的代碼:嘗試使用linq將xml修改爲xml和xpath
在下面的代碼參數[0]具有值「支付」
XElement modMethodXElement = new XElement(xdoc1.XPathSelectElement("//INPUT[@VALUE='SLN7DEACTIVATION']/METHOD[@NAME='"+Parameters[0]+"']"));
modMethodXElement.SetAttributeValue("PARAMETERS", "ParameterValue");
而且這裏的XML我想修改的部分:
SESSIONANALYSER>
<AP>
<MODES>
<NI>
<STATEINFORMATION TYPE="PREPAID">
<INIT INVALIDINPUTRESPONSE="-2">
<INPUT VALUE="SLN7ACTIVATION">
<METHOD NAME="CHECKSUBSCRIBERBALANCE" PARAMETERS="SLN7" POSSIBLEACTIONS="FALLOUTON_FAILUREREGION_SETPSOFAILED_FALSE" MAINTAINSESSION="NO" RESPONSE="-4" NEXTLEVEL="" />
<METHOD NAME="SETPSOINUCIP" PARAMETERS="SLN7" POSSIBLEACTIONS="FALLOUTON_FAILUREREGION_SETPSOFAILED_FALSE" MAINTAINSESSION="NO" RESPONSE="-4" NEXTLEVEL="" />
<METHOD NAME="SENDMESSAGE" PARAMETERS="" POSSIBLEACTIONS="FALLOUTONSUCCESS" MAINTAINSESSION="NO" RESPONSE="0" NEXTLEVEL="" />
</INPUT>
<INPUT VALUE="SLN7DEACTIVATION">
<METHOD NAME="UNSETPSOINUCIP" PARAMETERS="SLN7" POSSIBLEACTIONS="FALLOUTON_FAILUREREGION_SETPSOFAILED_FALSE" MAINTAINSESSION="NO" RESPONSE="-4" NEXTLEVEL="" />
***<METHOD NAME="payments" PARAMETERS="fsdg" POSSIBLEACTIONS1="fg,f" MAINTAINSESSION="fdjfg89" RESPONSE="ndfgm" NEXTLEVEL="msdfm"></METHOD>***
<METHOD NAME="SENDMESSAGE" PARAMETERS="23" POSSIBLEACTIONS1="FALLOUTONSUCCESS" MAINTAINSESSION="yes" RESPONSE="format" NEXTLEVEL="msdfm"></METHOD>
<METHOD NAME="payments" PARAMETERS="12" POSSIBLEACTIONS1="FALLOUTONSUCCESS" MAINTAINSESSION="yes" RESPONSE="format" NEXTLEVEL="msvm"></METHOD>
<METHOD NAME="SENDMESSAGE" PARAMETERS="23" POSSIBLEACTIONS1="FALLOUTONSUCCESS" MAINTAINSESSION="yes" RESPONSE="0" NEXTLEVEL="3"></METHOD>
<METHOD NAME="SENDMESSAGE" PARAMETERS="23" POSSIBLEACTIONS1="FALLOUTONSUCCESS" MAINTAINSESSION="NO" RESPONSE="format" NEXTLEVEL="3"></METHOD>
</INPUT>
</INIT>