XML getElementsByTagName项目编号

时间:2014-07-04 14:16:42

标签: php xml

在我的PHP文件中,我使用以下两行代码将其他项附加到我的XML文件中;

// add more elements to xml file
    $CustomerDDInfo = $xml->getElementsByTagName('CstmrDrctDbtInitn')->item(0);

    // add this element to the root
     $xml->documentElement->appendChild($CustomerDDInfo);

这很好用。但在另一部分中,我使用以下两行代码从PaymentInformation附加;

// add more elements to xml file
    $PaymentInformation = $xml->getElementsByTagName('PmtInf')->item(0);

    // add this element to the root
    $xml->documentElement->appendChild($PaymentInformation);

这会弄乱节点的顺序。我是XML的新手,我意识到它,因为我在两行中都有项目(0),但有关如何解决此问题的任何建议?

如果有人甚至可以向我解释这件商品的含义,我真的很感激吗?感谢。

0 个答案:

没有答案
相关问题