Example-4: Validate XBRL
The following example shows how to validate an XBRL file. A problem that could occur is that one or more taxonomies might be missing. In such cases, RaptorXML+XBRL Server will indicate the problem and likely suggest how to a remedy the problem.
Validate XBRL from the command line
Validation can fail because of missing taxonomies. For example, when using PowerShell to run a validation command, the following might occur:
PS C:\temp\Nanonull> raptorxmlxbrl valxbrl nanonull.xbrl
file:///C:/temp/Nanonull/nanonull.xbrl: runtime="141ms" result="Failed"
Error: file:///C:/temp/Nanonull/nanonull.xsd:52:
Unable to load a schema with target namespace 'http://fasb.org/us-types/2013-01-31'
from 'http://xbrl.fasb.org/us-gaap/2013/elts/us-types-2013-01-31.xsd'.
FatalError: I/O operation on file 'http://xbrl.fasb.org/us-gaap/2013/elts/us-types-2013-01-31.xsd' failed.
Details: I/O Error 1001: File 'us-types-2013-01-31.xsd' is part of missing taxonomy 'US GAAP 2013.01'.
Call 'C:\ProgramData\Altova\SharedBetweenVersions\taxonomymanager.exe install us-gaap-2013.0'.
In this case, run the suggested Altova Taxonomy Manager command:
PS C:\temp\Nanonull> C:\ProgramData\Altova\SharedBetweenVersions\taxonomymanager.exe install us-gaap-2013.0
Install ratings-2015.0.0, us-gaap-2013.0.0.
Create folder C:\ProgramData\Altova\pkgs\xbrl\ratings\.
Download from Altova taxonomy store: ratings-2015-03-31_0.zip.
Create folder C:\ProgramData\Altova\pkgs\xbrl\us-gaap\.
Download from Altova taxonomy store: country-2012-01-31_0.zip.
Download from Altova taxonomy store: country-2013-01-31_0.zip.
Download from Altova taxonomy store: edgartaxonomies-2013_0.xml.
Download from Altova taxonomy store: dei-2012-01-31_0.zip.
Download from Altova taxonomy store: currency-2011-01-31_0.zip.
Download from Altova taxonomy store: dei-2013-01-31_0.zip.
Download from Altova taxonomy store: currency-2012-01-31_0.zip.
Download from Altova taxonomy store: invest-2012-01-31_0.zip.
Download from Altova taxonomy store: rr-2010-02-28_0.zip.
Download from Altova taxonomy store: exch-2013-01-31_0.zip.
Download from Altova taxonomy store: invest-2013-01-31_0.zip.
Download from Altova taxonomy store: naics-2011-01-31_0.zip.
Download from Altova taxonomy store: rr-2012-01-31_0.zip.
Download from Altova taxonomy store: sic-2011-01-31_0.zip.
Download from Altova taxonomy store: stpr-2011-01-31_0.zip.
Download from Altova taxonomy store: us-gaap-2013-01-31_0.zip.
OK.
Confirm the installed taxonomies using Taxonomy Manager:
PS C:\temp\Nanonull> taxonomymanager list -i
PKGID NAME VERSION STATUS
ratings-2015.0 "Ratings 2015" installed: ratings-2015.0.0 "2015.03"
us-gaap-2013.0 "US GAAP 2013" installed: us-gaap-2013.0.0 "2013.01"
2 packages, 0 upgradeable
OK.
Now that the taxonomies have been correctly installed by Taxonomy Manager, validation should be successful:
PS C:\temp\Nanonull> raptorxmlxbrl valxbrl nanonull.xbrl
file:///C:/temp/Nanonull/nanonull.xbrl: runtime="787ms" result="OK"
Test POST requests with CURL
A POST request can now be tested with CURL:
PS C:\temp\Nanonull> curl.exe -F 'msg={\"command\": \"xbrl\", ["args\":[\"file:///C:/temp/Nanonull/nanonull.xbrl\"], \"options\":{}};type=application/json' http://localhost:8087/v1/queue
The result is:
"state": "OK"
Use POST to upload the instance file using the additional-files scheme:
PS C:\temp\Nanonull> curl.exe -F 'msg={\"command\": \"xbrl\", \"args\":[\"additional-files:///nanonull.xbrl\"], \"options\":{}};type=application/json'
-F "additional-files=@nanonull.xbrl;type=application/xml" http://localhost:8087/v1/queue
Let us assume that taxonomy nanonull.xsd is not found. We get:
Error: additional-files:///nanonull.xbrl:3: Value 'nanonull.xsd' of attribute 'xlink:href' on element <link:schemaRef> must point to a valid taxonomy schema.
Error: I/O operation on file 'additional-files:///nanonull.xsd' failed.
Details: System Error 2: The system cannot find the file specified.
I/O Error 400: Don't know how to deal with relative URI (scheme name is missing).
FatalError: additional-files:///nanonull.xbrl:2: The DTS discovered starting from XBRL instance <xbrli:xbrl> is not valid.
So we include the taxonomy and associated files in the POST request as listed below:
PS C:\temp\Nanonull> curl.exe -F 'msg={\"command\": \"xbrl\", \"args\":[\"additional-files:///nanonull.xbrl\"], \"options\":{}};type=application/json' -F "additional-files=@nanonull.xbrl;type=application/xml" -F "additional-files=@nanonull.xsd;type=application/xml" -F "additional-files=@nanonull_cal.xml;type=application/xml" -F "additional-files=@nanonull_def.xml;type=application/xml" -F "additional-files=@nanonull_for.xml;type=application/xml" -F "additional-files=@nanonull_lab.xml;type=application/xml" -F "additional-files=@nanonull_pre.xml;type=application/xml" -F "additional-files=@nanonull_tab.xml;type=application/xml" http://localhost:8087/v1/queue
Finally, we can submit the entire Nanonull.zip archive:
PS C:\temp\Nanonull> curl.exe -F 'msg={\"command\": \"xbrl\", \"args\":[\"additional-files:///Nanonull.zip%7Czip/nanonull.xbrl\"], \"options\":{}};type=application/json' -F "additional-files=@Nanonull.zip;type=application/octet-stream" http://localhost:8087/v1/queue