我需要得到两个总数CreditCardTotal
,CashTotal
并且必须在另一个标签中显示它们AccountCost
,如下所示。
基本上,我需要获取费用金额并检查它是信用卡还是现金,然后将其添加到相应的总变量中。或者如果有更优雅的方式请告诉我。
我对 Xpath 完全感到困惑和陌生。谢谢,并将真正感谢您的时间和精力。
<ExpenseCatDetail>
<Expense>500</Expense>
<PaymentMethod>CreditCard</PaymentMethod>
<AccountCost>700</AccountCost>
</ExpenseCatDetail>
<ExpenseCatDetail>
<Expense>100</Expense>
<PaymentMethod>Cash</PaymentMethod>
<AccountCost>400</AccountCost>
</ExpenseCatDetail>
<ExpenseCatDetail>
<Expense>200</Expense>
<PaymentMethod>CreditCard</PaymentMethod>
<AccountCost>700</AccountCost>
</ExpenseCatDetail>
<ExpenseCatDetail>
<Expense>300</Expense>
<PaymentMethod>Cash</PaymentMethod>
<AccountCost>400</AccountCost>
</ExpenseCatDetail>