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

时间:2016-08-31 15:27:44

标签: php quickbooks

我正在使用用于QuickBooks Desktop的consobyte PHP SDK,当我尝试添加非库存项时,它会抛出错误-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>

1 个答案:

答案 0 :(得分:3)

解决此问题:

   <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.