Picking up where we left off, the HMRC has rejected our submission because of a schema validation, but locally everything validates. How can that be?
Well, xmllint is somewhat "generous" in that it only validates schemas it has access to; anything else it just waves on through. We need to find and use those. Do I have these additional schemas somewhere?
Digging through everything I have, I do not have the schemas, but it turns out that one of the technical packs has another document that uses them (and it's considerably longer), so I'm going to copy that across. But where are the schemas? It turns out that xbrl.org has put the schemas exactly where they declare them to be. Who knew?
There are quite a few of them; a bit of manual downloading followed by writing a short script to curl more of them down later, and we have at least the ixbrl schema. I think I may need to go back and download others. When I run xmllint on my ixbrl sample, I get schema validation errors. I fixed a number of them (which were just spaces in tokens that I had not removed from the PDF), and one seemed a random token (had I copied it in by accident)?
OK, let's try submitting again:
---- xmllint outputOK, no different. Well, let's check all those schemas in under the tag CT600_XBRL_SCHEMAS anyway. I'm sure it's better validation (it certainly takes longer; I'd started to think I'd created an infinite loop). I included more of these in importer.xml but it seems that a lot of them are already included by something else, so I commented them out again.
submit.xml validates
----
2 error(s) reported:
Code Raised By Location Type Message
3001 Department business The submission of this document has failed due to departmental specific business logic in the Body tag.
4999 ChRIS /hd:GovTalkMessage[1]/hd:Body[1]/ct:IRenvelope[1]/ct:CompanyTaxReturn[1]/ct:AttachedFiles[1]/ct:XBRLsubmission[1]/ct:Accounts[1]/ct:Instance[1]/ct:InlineXBRLDocument[1] schema Internal schema validation error
Let's try using the other file I found.
---- xmllint output(I won't bore you with all 101; there is a lot of similarity here.)
submit.xml validates
----
101 error(s) reported:
Code Raised By Location Type Message
3001 Department business The submission of this document has failed due to departmental specific business logic in the Body tag.
0 ChRIS Accounts xbrl.core.xml.SchemaValidationError.UndeclaredPrefix UndeclaredPrefix: Cannot resolve 'iso4217:GBP' as a QName: the prefix 'iso4217' is not declared.
0 ChRIS Accounts xbrl.core.xml.SchemaValidationError.cvc-type31_3 cvc-type.3.1.3: The value 'iso4217:GBP' of element 'xbrli:measure' is not valid.
0 ChRIS Accounts xbrl.core.xml.SchemaValidationError.UndeclaredPrefix UndeclaredPrefix: Cannot resolve 'ct-comp:CompanyName' as a QName: the prefix 'ct-comp' is not declared.
...
I don't know why this one gives detailed errors while the other one didn't, but what stands out to me here is that it is telling me that I don't have schemas defined, when the xbrl file does. What gives?
Well, we're still saving the submissions as we send them (mainly so that we can check them against the schema locally). So we can look at what we're actually submitting. And something immediately jumps out at me. When we look at the attachment, it looks like this:
<XBRLsubmission>All the namespace declarations have been removed! No wonder it's complaining that they're not there. So the question is, where do I attach them? Let's try with the iso4217 first and try attaching it to the GovTalkMessage first, since I normally see them attached to the top level element.
<Accounts>
<Instance>
<InlineXBRLDocument>
<html xmlns="http://www.w3.org/1999/xhtml" version="-//XBRL International//DTD XHTML Inline XBRL 1.0//EN">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"></meta>
<title>Sample iXBRL instance</title>
</head>
So now submit.xml starts like this:
<GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope" xmlns:iso4217="http://www.xbrl.org/2003/iso4217">and the response starts like this:
101 error(s) reported:OK, that's no improvement. Let's try adding it onto the IRenvelope instead.
Code Raised By Location Type Message
3001 Department business The submission of this document has failed due to departmental specific business logic in the Body tag.
0 ChRIS Accounts xbrl.core.xml.SchemaValidationError.UndeclaredPrefix UndeclaredPrefix: Cannot resolve 'iso4217:GBP' as a QName: the prefix 'iso4217' is not declared.
No, again, the canonicalisation process seems to remove it from there. Time to go back to Google.
Google offers that there is an iXBRL validator offered by Companies House, which, while part of the government, is different from the HMRC tax people. Let's try that.
That fails. Your file is not valid. Most telling, it says that it cannot obtain the schemaRef referred to by http://www.hmrc.gov.uk/schemas/ct/comp/2023-01-01/ct-comp-2023.xsd. But that URL is a schema.
Wait a moment ... that URL is the actual schema location; I thought we were using the fake schema names. Looking through the file, I can see that there is a section in ix:header that explicitly links in the schema location:
<ix:references>And given that the xsd has a targetNamespace which links back to the "fake" name for the schema, all should be good. So now there are about three things I do not understand:
<link:schemaRef xlink:type="simple"
xlink:href="http://www.hmrc.gov.uk/schemas/ct/comp/2023-01-01/ct-comp-2023.xsd"/>
</ix:references>
- How to submit my CT-600 with these external namespaces;
- Why the ixbrl validation fails for the sample files;
- Why, specifically, it complains that a schema for which it can find the correct xsd path cannot be found.
At the end of the day, nothing I read, including the xbrl style guide and the XBRL Technical Pack helped me at all. I'm stuck. Time to email the SDST again.
No comments:
Post a Comment