Quickbooky

Accounting News

SDK & Integration

QuickBooks Desktop SDK Invoice Modify Fails with XML Parsing Error

Developers modifying invoices through the QuickBooks Desktop SDK hit a parsing error when XML elements like FOB and ShipDate appear in the wrong order.

QuickBooks Desktop SDK Invoice Modify Fails with XML Parsing Error

QuickBooks Desktop users integrating with the software through the SDK’s qbXML interface are running into a parsing error when attempting to modify invoices. The error message reads that QuickBooks found an error when parsing the provided XML text stream, and the cause is not immediately obvious from the message itself.

The issue surfaces when a developer builds an XML request to update an existing invoice — for instance, writing shipping details such as a tracking number into the “Other” field and populating the “FOB” and “ShipDate” fields with shipment information. The request appears well-formed at a glance, and the individual data elements look correct. Yet QuickBooks rejects the entire request with the parsing error, leaving the developer to hunt for a typo or encoding problem that does not exist.

The Root Cause: Element Order Matters

The accepted explanation comes down to a strict and easily overlooked requirement of the qbXML format: the order of the child elements inside a request must match the sequence defined by the schema. This is not a loose guideline. QuickBooks enforces the sequence and rejects any request that deviates from it.

In the case reported, the developer placed the ShipDate element ahead of the FOB element. The schema, however, calls for FOB to come first, followed by ShipDate. That single transposition is enough to produce the parsing error. The values themselves — the dates, the tracking number, the transaction and edit sequence identifiers — were all valid. The problem was purely structural.

Why This Trips Up Developers

If you have worked with XML in other contexts, this behavior can feel unexpected. Many XML parsers treat child elements as an unordered collection of name-value pairs, where the sequence of elements has no bearing on validity. qbXML does not work that way. It expects a specific, documented order for every element within every transaction type, and any deviation — even between two optional fields — causes the request to fail.

This makes the error message somewhat misleading. When QuickBooks says it could not parse the XML, a developer’s instinct is to look for malformed tags, character-encoding issues, or invalid data types. In reality, the XML may be perfectly valid by general standards; it simply does not conform to the ordering rules that the QuickBooks schema demands.

The Fix

Correcting the problem is straightforward once the cause is understood. Reorder the elements in the request so that FOB appears before ShipDate, matching the sequence laid out in the SDK documentation. Once the order aligns with the schema, the same request goes through without error.

For broader guidance on structuring requests and understanding the schema, the QuickBooks SDK documentation lays out the required element order for each transaction type. The onscreen reference included with the SDK also lists every supported field and its expected position within the XML hierarchy.

Avoiding the Problem Going Forward

The safest approach is to treat the schema documentation as authoritative for element placement rather than assuming that field order is flexible. When building a new request — whether for invoice modification, customer adds, or any other transaction — check the documented sequence before sending it. This is especially important when you are working with optional fields like FOB and ShipDate, since it is tempting to assume that optional elements can appear in any order or be omitted freely. They can be omitted, but when they are present, they must appear in the designated position.

If you are generating XML programmatically, consider building requests using a template or helper structure that enforces the correct order by design rather than relying on manual placement. This reduces the chance of a transposition slipping in when fields are added or removed during development.

← Back to Community Issues