PHP で DOMDocument を使用して、QuickBooks 統合用のクリーンな XML を作成しようとしています。私が立ち往生している唯一のことは、次のものを生成するために必要な<?qbxml version="2.0"?>after<?xml version="1.0" encoding="utf-8"?>を追加する方法です:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.0"?>
.....
これが私がこれまでに持っているものです..
$dom = new DOMDocument('1.0', 'utf-8');
//Need to somehow add qbxml version here
$qbxml = $dom->appendChild($dom->createElement('QBXML'));
$qbxmlmsg = $qbxml->appendChild($dom->createElement('QBXMLMsgsRq'));
$qbxmlmsg->setAttribute('onError', 'stopOnError');
$salesReceiptAddRq = $qbxmlmsg->appendChild($dom->createElement('SalesReceiptAddRq'));
$salesReceiptAddRq->setAttribute('requestID', 1234);
$dom->formatOutput = true;
echo $dom->saveXML();