Invoice ItemLine schema error

I have discovered an issue with creating invoices via the API. It’s happy until I specify a Tax child element as per the docs - the error given is this:

The element ‘ItemLine’ in namespace ‘http://www.QuickFile.co.uk’ has invalid child element ‘Tax1’ in namespace ‘http://www.QuickFile.co.uk’.

Here’s a sample request in XML:

   <Body>
      <InvoiceData>
        <InvoiceType>INVOICE</InvoiceType>
        <ClientID>1547068</ClientID>
        <Currency>GBP</Currency>
		<TermDays>30</TermDays>
		<Language>en</Language>
		<SingleInvoiceData>
			<InvoiceNumber>T0000015</InvoiceNumber>
			<IssueDate>2015-10-28</IssueDate>
		</SingleInvoiceData>
		<InvoiceLines>
			<ItemLines>
				<ItemLine>
					<ItemID>0</ItemID>
					<ItemDescription>TestItem</ItemDescription>
					<UnitCost>1</UnitCost>
					<Qty>1</Qty>
					<Tax1>
						<TaxName>VAT</TaxName>
						<TaxPercentage>20.00</TaxPercentage>
					</Tax1>
				</ItemLine>
			</ItemLines>
		</InvoiceLines>
    </InvoiceData>
  </Body>

Aha! As soon as I’m about to give up, I give it one last try and put Cost and Qty below Tax1 and it works … I also forgot that UnitCost is of double type (1.00) not (1)

It’s happy now. As you were … :smile:

1 Like

Yep usually these schema validation errors are due to incorrect sequencing. I highly recommend XMLSpy for visualising the schemas, it’s hard to read the XSD in it’s raw form.