qbwc / qbxml

QBXML Parser and Validation Tool
MIT License
27 stars 41 forks source link

Tool Validation More Forgiving Than Quickbooks #15

Closed b9chris closed 8 years ago

b9chris commented 9 years ago

It seems the parsing in this tool is more forgiving than Quickbooks, which is normally a nice to have but in this case it means you can easily validate QBXML files with this tool that won't work in Quickbooks. For example, Quickbooks simply returns "Parsing error" when reading the following QBXML, while this tool happily parses and validates it:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="continueOnError">
    <InvoiceAddRq requestID="0">
      <InvoiceAdd>
        <CustomerRef>
          <FullName>Test Customer</FullName>
        </CustomerRef>
        <RefNumber>INV0</RefNumber>
        <ShipAddress>
          <Addr1>Joe Test</Addr1>
          <Addr2>Company</Addr2>
          <City>Los Angeles</City>
          <State>CA</State>
          <PostalCode>91601</PostalCode>
        </ShipAddress>
        <InvoiceLineAdd>
          <ItemRef>
            <FullName>Shipment from LAX to BOS</FullName>
          </ItemRef>
          <Quantity>1</Quantity>
          <Amount>1243.79</Amount>
        </InvoiceLineAdd>
        <InvoiceLineAdd>
          <ItemRef>
            <FullName>RES</FullName>
          </ItemRef>
          <Quantity>1</Quantity>
          <Amount>45</Amount>
        </InvoiceLineAdd>
      </InvoiceAdd>
    </InvoiceAddRq>
  </QBXMLMsgsRq>
</QBXML>
JasonBarnabe commented 9 years ago

qbxml currently is only validating the hierarchy of the elements (that they're allowed to appear as a child of their parent) and the data type in each field. Not validated are:

I would like to have more validation in here, but the Quickbooks documentation is pretty sparse.

In your specific case, I would guess that your second Amount needs to be 45.00.

b9chris commented 9 years ago

Sparse is an understatement! I'd prefer this library if possible because it doesn't depend on a desktop Quickbooks installation the way the SDK ridiculously does. Thanks for the pointer on my XML! That unfortunately didn't fix it, but, who knows maybe it's just one of many issues.

JasonBarnabe commented 9 years ago

Comparing it to my successful requests, a few things stick out:

JasonBarnabe commented 8 years ago

Changes to make qbxml stricter will be accepted, but the rules will have to be identified and handled individually. Closing as this issue is just too broad.