试图使用QuickBooks中的DOMDocument为DOMDocument集成编写干净的XML。我唯一坚持的是如何在<?qbxml version="2.0"?>之后添加所需的<?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();发布于 2013-12-01 10:31:16
该节点称为处理指令。
$dom = new DOMDocument('1.0', 'utf-8');
$dom->appendChild($dom->createProcessingInstruction('qbxml', 'version="2.0"'));
$qbxml = $dom->appendChild($dom->createElement('QBXML'));
// ...
echo $dom->saveXml();https://stackoverflow.com/questions/20308413
复制相似问题