Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
603 views
in Technique[技术] by (71.8m points)

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

I am using consobyte PHP SDK for QuickBooks Desktop and when I try to add Non Inventory Item, it throws the error-0x80040400: QuickBooks found an error when parsing the provided XML text stream.

<?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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Fix this:

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

Anytime you get this error message:

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

The first thing you should do is look at your XML closely. And then run it through the XML Validator tool included with the QuickBooks SDK. It tells you exactly what's wrong:

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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...