0x80040400: QuickBooks在解析提供的XML文本流时发现错误


0x80040400: QuickBooks found an error when parsing the provided XML text stream

我正在使用consobyte PHP SDK for QuickBooks桌面,当我尝试添加非库存项目时,它抛出错误-0x80040400: QuickBooks在解析提供的XML文本流时发现错误。

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <ItemNonInventoryAddRq requestID="38">
      <ItemNonInventoryAdd>
        <Name>46428</Name>
        <SalesAndPurchase>
          <SalesDesc>Apple Watch (not Sport)</SalesDesc>
          <SalesPrice>50.00</SalesPrice>
          <IncomeAccountRef>
            <FullName>Merchandise Sales</FullName>
          </IncomeAccountRef>
          <PurchaseDesc>Apple Watch (not Sport)</PurchaseDesc>
          <PurchaseDesc>50.00</PurchaseDesc>
          <ExpenseAccountRef>
            <FullName>Repairs and Maintenance</FullName>
          </ExpenseAccountRef>
        </SalesAndPurchase>
      </ItemNonInventoryAdd>
    </ItemNonInventoryAddRq>
  </QBXMLMsgsRq>
</QBXML>

修复:

   <PurchaseDesc>Apple Watch (not Sport)</PurchaseDesc>
   <PurchaseDesc>50.00</PurchaseDesc>

当你得到这个错误信息时:

0x80040400: QuickBooks在解析提供的XML文本流时发现错误。

您应该做的第一件事是仔细查看XML。然后通过QuickBooks SDK附带的XML Validator工具运行它。它会告诉你哪里出了问题:

Line: 15
LinePos: 25
Src Text: <PurchaseDesc>50.00</PurchaseDesc>
Reason: Element content is invalid according to the DTD/Schema.
Expecting: PurchaseCost, PurchaseTaxCodeRef, ExpenseAccountRef, PrefVendorRef.