arelle-release 2.37.46__py3-none-any.whl → 2.38.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arelle/BetaFeatures.py +0 -21
- arelle/Cntlr.py +15 -8
- arelle/CntlrCmdLine.py +121 -56
- arelle/CntlrWinMain.py +143 -70
- arelle/DialogFind.py +1 -1
- arelle/DialogPluginManager.py +6 -4
- arelle/DisclosureSystem.py +7 -0
- arelle/ErrorManager.py +21 -6
- arelle/FileSource.py +11 -4
- arelle/FunctionIxt.py +16 -11
- arelle/HtmlUtil.py +5 -4
- arelle/LeiUtil.py +63 -43
- arelle/ModelDocument.py +20 -15
- arelle/ModelDtsObject.py +8 -0
- arelle/ModelInstanceObject.py +1 -1
- arelle/ModelObject.py +16 -18
- arelle/ModelObjectFactory.py +35 -17
- arelle/ModelXbrl.py +28 -11
- arelle/PluginManager.py +130 -105
- arelle/RuntimeOptions.py +1 -0
- arelle/UrlUtil.py +14 -0
- arelle/Validate.py +17 -12
- arelle/ValidateDuplicateFacts.py +3 -1
- arelle/ValidateFileSource.py +38 -0
- arelle/ValidateFilingText.py +3 -3
- arelle/ValidateXbrl.py +5 -2
- arelle/ValidateXbrlCalcs.py +210 -186
- arelle/ValidateXbrlDTS.py +1 -1
- arelle/ViewFile.py +1 -0
- arelle/ViewFileFactTable.py +2 -2
- arelle/ViewWinDTS.py +4 -1
- arelle/WebCache.py +28 -24
- arelle/XbrlConst.py +22 -0
- arelle/XmlUtil.py +16 -21
- arelle/XmlValidate.py +6 -9
- arelle/_version.py +16 -3
- arelle/api/Session.py +11 -2
- arelle/config/disclosuresystems.xsd +2 -0
- arelle/config/rosettaEntitlements.plist +8 -0
- arelle/conformance/CSVTestcaseLoader.py +1 -1
- arelle/formula/XPathContext.py +3 -3
- arelle/logging/formatters/LogFormatter.py +3 -1
- arelle/packages/report/ReportPackage.py +26 -13
- arelle/packages/report/ReportPackageConst.py +0 -1
- arelle/plugin/inlineXbrlDocumentSet.py +19 -5
- arelle/plugin/validate/DBA/DisclosureSystems.py +19 -1
- arelle/plugin/validate/DBA/PluginValidationDataExtension.py +2 -4
- arelle/plugin/validate/DBA/ValidationPluginExtension.py +2 -1
- arelle/plugin/validate/DBA/resources/config.xml +5 -0
- arelle/plugin/validate/DBA/rules/__init__.py +2 -2
- arelle/plugin/validate/DBA/rules/fr.py +19 -2
- arelle/plugin/validate/DBA/rules/tc.py +2 -0
- arelle/plugin/validate/DBA/rules/th.py +6 -0
- arelle/plugin/validate/DBA/rules/tm.py +18 -5
- arelle/plugin/validate/DBA/rules/tr.py +11 -5
- arelle/plugin/validate/EDINET/Constants.py +193 -9
- arelle/plugin/validate/EDINET/ContextRequirement.py +58 -0
- arelle/plugin/validate/EDINET/ControllerPluginData.py +220 -1
- arelle/plugin/validate/EDINET/CoverItemRequirements.py +42 -0
- arelle/plugin/validate/EDINET/DeiRequirements.py +118 -0
- arelle/plugin/validate/EDINET/FilingFormat.py +275 -0
- arelle/plugin/validate/EDINET/FormType.py +134 -0
- arelle/plugin/validate/EDINET/ManifestInstance.py +72 -5
- arelle/plugin/validate/EDINET/NamespaceConfig.py +50 -0
- arelle/plugin/validate/EDINET/PluginValidationDataExtension.py +493 -132
- arelle/plugin/validate/EDINET/{InstanceType.py → ReportFolderType.py} +72 -15
- arelle/plugin/validate/EDINET/Statement.py +139 -0
- arelle/plugin/validate/EDINET/TableOfContentsBuilder.py +595 -0
- arelle/plugin/validate/EDINET/UploadContents.py +48 -0
- arelle/plugin/validate/EDINET/ValidationPluginExtension.py +20 -2
- arelle/plugin/validate/EDINET/__init__.py +31 -6
- arelle/plugin/validate/EDINET/resources/config.xml +8 -1
- arelle/plugin/validate/EDINET/resources/cover-item-requirements.json +793 -0
- arelle/plugin/validate/EDINET/resources/dei-requirements.csv +27 -0
- arelle/plugin/validate/EDINET/resources/edinet-taxonomies.xml +2 -0
- arelle/plugin/validate/EDINET/rules/contexts.py +375 -14
- arelle/plugin/validate/EDINET/rules/edinet.py +1934 -45
- arelle/plugin/validate/EDINET/rules/frta.py +122 -3
- arelle/plugin/validate/EDINET/rules/gfm.py +1907 -11
- arelle/plugin/validate/EDINET/rules/upload.py +989 -141
- arelle/plugin/validate/ESEF/Const.py +3 -1
- arelle/plugin/validate/ESEF/ESEF_2021/DTS.py +5 -0
- arelle/plugin/validate/ESEF/ESEF_2021/Image.py +2 -2
- arelle/plugin/validate/ESEF/ESEF_2021/ValidateXbrlFinally.py +23 -20
- arelle/plugin/validate/ESEF/ESEF_Current/DTS.py +47 -14
- arelle/plugin/validate/ESEF/ESEF_Current/ValidateXbrlFinally.py +100 -25
- arelle/plugin/validate/ESEF/__init__.py +20 -6
- arelle/plugin/validate/ESEF/resources/authority-validations.json +76 -9
- arelle/plugin/validate/ESEF/resources/config.xml +20 -0
- arelle/plugin/validate/NL/DisclosureSystems.py +22 -0
- arelle/plugin/validate/NL/PluginValidationDataExtension.py +27 -9
- arelle/plugin/validate/NL/ValidationPluginExtension.py +51 -7
- arelle/plugin/validate/NL/resources/config.xml +18 -0
- arelle/plugin/validate/NL/rules/br_kvk.py +17 -61
- arelle/plugin/validate/NL/rules/fg_nl.py +7 -38
- arelle/plugin/validate/NL/rules/fr_kvk.py +7 -42
- arelle/plugin/validate/NL/rules/fr_nl.py +31 -147
- arelle/plugin/validate/NL/rules/nl_kvk.py +142 -28
- arelle/plugin/validate/ROS/PluginValidationDataExtension.py +2 -0
- arelle/plugin/validate/ROS/ValidationPluginExtension.py +4 -1
- arelle/plugin/validate/ROS/rules/ros.py +41 -9
- arelle/plugin/validate/UK/ValidateUK.py +130 -66
- arelle/plugin/validate/UK/__init__.py +89 -103
- arelle/utils/EntryPointDetection.py +79 -13
- arelle/utils/PluginHooks.py +125 -0
- arelle/utils/validate/ESEFImage.py +6 -6
- arelle/utils/validate/Validation.py +18 -0
- arelle/utils/validate/ValidationPlugin.py +76 -11
- arelle/utils/validate/ValidationUtil.py +35 -3
- {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/METADATA +30 -20
- {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/RECORD +115 -191
- {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/licenses/LICENSE.md +0 -3
- arelle/archive/CustomLogger.py +0 -43
- arelle/archive/LoadEFMvalidate.py +0 -32
- arelle/archive/LoadSavePreLbCsv.py +0 -26
- arelle/archive/LoadValidate.cs +0 -31
- arelle/archive/LoadValidate.py +0 -36
- arelle/archive/LoadValidateCmdLine.java +0 -69
- arelle/archive/LoadValidatePostedZip.java +0 -57
- arelle/archive/LoadValidateWebService.java +0 -34
- arelle/archive/SaveTableToExelle.py +0 -140
- arelle/archive/TR3toTR4.py +0 -88
- arelle/archive/plugin/ESEF_2022/__init__.py +0 -47
- arelle/archive/plugin/bigInstance.py +0 -394
- arelle/archive/plugin/cmdWebServerExtension.py +0 -43
- arelle/archive/plugin/crashTest.py +0 -38
- arelle/archive/plugin/functionsXmlCreation.py +0 -106
- arelle/archive/plugin/hello_i18n.pot +0 -26
- arelle/archive/plugin/hello_i18n.py +0 -32
- arelle/archive/plugin/importTestChild1.py +0 -21
- arelle/archive/plugin/importTestChild2.py +0 -22
- arelle/archive/plugin/importTestGrandchild1.py +0 -21
- arelle/archive/plugin/importTestGrandchild2.py +0 -21
- arelle/archive/plugin/importTestImported1.py +0 -23
- arelle/archive/plugin/importTestImported11.py +0 -22
- arelle/archive/plugin/importTestParent.py +0 -48
- arelle/archive/plugin/instanceInfo.py +0 -306
- arelle/archive/plugin/loadFromOIM-2018.py +0 -1282
- arelle/archive/plugin/locale/fr/LC_MESSAGES/hello_i18n.po +0 -25
- arelle/archive/plugin/objectmaker.py +0 -285
- arelle/archive/plugin/packagedImportTest/__init__.py +0 -47
- arelle/archive/plugin/packagedImportTest/importTestChild1.py +0 -21
- arelle/archive/plugin/packagedImportTest/importTestChild2.py +0 -22
- arelle/archive/plugin/packagedImportTest/importTestGrandchild1.py +0 -21
- arelle/archive/plugin/packagedImportTest/importTestGrandchild2.py +0 -21
- arelle/archive/plugin/packagedImportTest/importTestImported1.py +0 -24
- arelle/archive/plugin/packagedImportTest/importTestImported11.py +0 -21
- arelle/archive/plugin/packagedImportTest/subdir/importTestImported111.py +0 -21
- arelle/archive/plugin/packagedImportTest/subdir/subsubdir/importTestImported1111.py +0 -21
- arelle/archive/plugin/sakaCalendar.py +0 -215
- arelle/archive/plugin/saveInstanceInfoset.py +0 -121
- arelle/archive/plugin/sphinx/FormulaGenerator.py +0 -823
- arelle/archive/plugin/sphinx/SphinxContext.py +0 -404
- arelle/archive/plugin/sphinx/SphinxEvaluator.py +0 -783
- arelle/archive/plugin/sphinx/SphinxMethods.py +0 -1287
- arelle/archive/plugin/sphinx/SphinxParser.py +0 -1093
- arelle/archive/plugin/sphinx/SphinxValidator.py +0 -163
- arelle/archive/plugin/sphinx/US-GAAP Ratios Example.xsr +0 -52
- arelle/archive/plugin/sphinx/__init__.py +0 -285
- arelle/archive/plugin/streamingExtensions.py +0 -335
- arelle/archive/plugin/updateTableLB.py +0 -242
- arelle/archive/plugin/validate/SBRnl/CustomLoader.py +0 -19
- arelle/archive/plugin/validate/SBRnl/DTS.py +0 -305
- arelle/archive/plugin/validate/SBRnl/Dimensions.py +0 -357
- arelle/archive/plugin/validate/SBRnl/Document.py +0 -799
- arelle/archive/plugin/validate/SBRnl/Filing.py +0 -467
- arelle/archive/plugin/validate/SBRnl/__init__.py +0 -75
- arelle/archive/plugin/validate/SBRnl/config.xml +0 -26
- arelle/archive/plugin/validate/SBRnl/sbr-nl-taxonomies.xml +0 -754
- arelle/archive/plugin/validate/USBestPractices.py +0 -570
- arelle/archive/plugin/validate/USCorpAction.py +0 -557
- arelle/archive/plugin/validate/USSecTagging.py +0 -337
- arelle/archive/plugin/validate/XDC/__init__.py +0 -77
- arelle/archive/plugin/validate/XDC/config.xml +0 -20
- arelle/archive/plugin/validate/XFsyntax/__init__.py +0 -64
- arelle/archive/plugin/validate/XFsyntax/xf.py +0 -2227
- arelle/archive/plugin/validate/calc2.py +0 -536
- arelle/archive/plugin/validateSchemaLxml.py +0 -156
- arelle/archive/plugin/validateTableInfoset.py +0 -52
- arelle/archive/us-gaap-dei-docType-extraction-frm.xml +0 -90
- arelle/archive/us-gaap-dei-ratio-cash-frm.xml +0 -150
- arelle/examples/plugin/formulaSuiteConverter.py +0 -212
- arelle/examples/plugin/functionsCustom.py +0 -59
- arelle/examples/plugin/hello_dolly.py +0 -64
- arelle/examples/plugin/multi.py +0 -58
- arelle/examples/plugin/rssSaveOim.py +0 -96
- arelle/examples/plugin/validate/XYZ/DisclosureSystems.py +0 -2
- arelle/examples/plugin/validate/XYZ/PluginValidationDataExtension.py +0 -10
- arelle/examples/plugin/validate/XYZ/ValidationPluginExtension.py +0 -49
- arelle/examples/plugin/validate/XYZ/__init__.py +0 -75
- arelle/examples/plugin/validate/XYZ/resources/config.xml +0 -16
- arelle/examples/plugin/validate/XYZ/rules/__init__.py +0 -0
- arelle/examples/plugin/validate/XYZ/rules/rules01.py +0 -110
- arelle/examples/plugin/validate/XYZ/rules/rules02.py +0 -59
- arelle/model/CommentBase.py +0 -9
- arelle/model/ElementBase.py +0 -11
- arelle/model/PIBase.py +0 -10
- arelle/model/__init__.py +0 -15
- arelle/scripts-macOS/startWebServer.command +0 -3
- arelle/scripts-unix/startWebServer.sh +0 -1
- arelle/scripts-windows/startWebServer.bat +0 -5
- {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/WHEEL +0 -0
- {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/entry_points.txt +0 -0
- {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/top_level.txt +0 -0
|
@@ -1,799 +0,0 @@
|
|
|
1
|
-
'''
|
|
2
|
-
See COPYRIGHT.md for copyright information.
|
|
3
|
-
'''
|
|
4
|
-
from arelle import ModelDocument, XmlUtil, XbrlConst
|
|
5
|
-
from arelle.ModelDtsObject import ModelConcept, ModelLocator, ModelResource, ModelType
|
|
6
|
-
from arelle.ModelValue import qname
|
|
7
|
-
from arelle.ModelObject import ModelObject, ModelComment
|
|
8
|
-
from arelle.ValidateXbrlDTS import arcFromConceptQname, arcToConceptQname
|
|
9
|
-
from arelle import XmlValidate
|
|
10
|
-
from lxml import etree
|
|
11
|
-
import regex as re
|
|
12
|
-
|
|
13
|
-
xsd1_1datatypes = {qname(XbrlConst.xsd,'anyAtomicType'), qname(XbrlConst.xsd,'yearMonthDuration'), qname(XbrlConst.xsd,'dayTimeDuration'), qname(XbrlConst.xsd,'dateTimeStamp'), qname(XbrlConst.xsd,'precisionDecimal')}
|
|
14
|
-
|
|
15
|
-
def checkDTSdocument(val, modelDocument, isFilingDocument):
|
|
16
|
-
if not isFilingDocument:
|
|
17
|
-
return # not a filing's extension document
|
|
18
|
-
|
|
19
|
-
val.valUsedPrefixes = set()
|
|
20
|
-
val.referencedNamespaces = set()
|
|
21
|
-
val.substititutionGroupQname = {}
|
|
22
|
-
|
|
23
|
-
modelXbrl = val.modelXbrl
|
|
24
|
-
if modelDocument.type in (ModelDocument.Type.SCHEMA, ModelDocument.Type.LINKBASE):
|
|
25
|
-
isSchema = modelDocument.type == ModelDocument.Type.SCHEMA
|
|
26
|
-
docinfo = modelDocument.xmlDocument.docinfo
|
|
27
|
-
if docinfo and docinfo.xml_version != "1.0":
|
|
28
|
-
modelXbrl.error("SBR.NL.2.2.0.02" if isSchema else "SBR.NL.2.3.0.02",
|
|
29
|
-
_('%(docType)s xml version must be "1.0" but is "%(xmlVersion)s"'),
|
|
30
|
-
modelObject=modelDocument, docType=modelDocument.gettype().title(),
|
|
31
|
-
xmlVersion=docinfo.xml_version)
|
|
32
|
-
if modelDocument.documentEncoding.lower() != "utf-8":
|
|
33
|
-
modelXbrl.error("SBR.NL.2.2.0.03" if isSchema else "SBR.NL.2.3.0.03",
|
|
34
|
-
_('%(docType)s encoding must be "utf-8" but is "%(xmlEncoding)s"'),
|
|
35
|
-
modelObject=modelDocument, docType=modelDocument.gettype().title(),
|
|
36
|
-
xmlEncoding=modelDocument.documentEncoding)
|
|
37
|
-
lookingForPrecedingComment = True
|
|
38
|
-
for commentNode in modelDocument.xmlRootElement.itersiblings(preceding=True):
|
|
39
|
-
if isinstance(commentNode, etree._Comment):
|
|
40
|
-
if lookingForPrecedingComment:
|
|
41
|
-
lookingForPrecedingComment = False
|
|
42
|
-
else:
|
|
43
|
-
modelXbrl.error("SBR.NL.2.2.0.05" if isSchema else "SBR.NL.2.3.0.05",
|
|
44
|
-
_('%(docType)s must have only one comment node before schema element'),
|
|
45
|
-
modelObject=modelDocument, docType=modelDocument.gettype().title())
|
|
46
|
-
if lookingForPrecedingComment:
|
|
47
|
-
modelXbrl.error("SBR.NL.2.2.0.04" if isSchema else "SBR.NL.2.3.0.04",
|
|
48
|
-
_('%(docType)s must have comment node only on line 2'),
|
|
49
|
-
modelObject=modelDocument, docType=modelDocument.gettype().title())
|
|
50
|
-
|
|
51
|
-
if isSchema:
|
|
52
|
-
for elt in modelDocument.xmlRootElement.iter(tag="{http://www.w3.org/2001/XMLSchema}*"):
|
|
53
|
-
parent = elt.getparent()
|
|
54
|
-
parentIsSchema = parent is not None and parent.tag == "{http://www.w3.org/2001/XMLSchema}schema"
|
|
55
|
-
localName = elt.localName
|
|
56
|
-
if localName == "schema":
|
|
57
|
-
if elt.get("targetNamespace") is None:
|
|
58
|
-
val.modelXbrl.error("SBR.NL.2.2.0.08",
|
|
59
|
-
_('Schema element must have a targetNamespace attribute'),
|
|
60
|
-
modelObject=elt)
|
|
61
|
-
if (elt.get("attributeFormDefault") != "unqualified" or
|
|
62
|
-
elt.get("elementFormDefault") != "qualified"):
|
|
63
|
-
val.modelXbrl.error("SBR.NL.2.2.0.09",
|
|
64
|
-
_('Schema element attributeFormDefault must be "unqualified" and elementFormDefault must be "qualified"'),
|
|
65
|
-
modelObject=elt)
|
|
66
|
-
for attrName in ("blockDefault", "finalDefault", "version"):
|
|
67
|
-
if elt.get(attrName) is not None:
|
|
68
|
-
val.modelXbrl.error("SBR.NL.2.2.0.10",
|
|
69
|
-
_('Schema element must not have a %(attribute)s attribute'),
|
|
70
|
-
modelObject=elt, attribute=attrName)
|
|
71
|
-
else:
|
|
72
|
-
if localName in ("assert", "openContent", "fallback"):
|
|
73
|
-
val.modelXbrl.error("SBR.NL.2.2.0.01",
|
|
74
|
-
_('Schema contains XSD 1.1 content "%(element)s"'),
|
|
75
|
-
modelObject=elt, element=elt.qname)
|
|
76
|
-
|
|
77
|
-
if localName == "element":
|
|
78
|
-
for attr, presence, errCode in (("block", False, "2.2.2.09"),
|
|
79
|
-
("final", False, "2.2.2.10"),
|
|
80
|
-
("fixed", False, "2.2.2.11"),
|
|
81
|
-
("form", False, "2.2.2.12"),):
|
|
82
|
-
if (elt.get(attr) is not None) != presence:
|
|
83
|
-
val.modelXbrl.error("SBR.NL.{0}".format(errCode),
|
|
84
|
-
_('Schema element %(concept)s %(requirement)s contain attribute %(attribute)s'),
|
|
85
|
-
modelObject=elt, concept=elt.get("name"),
|
|
86
|
-
requirement=(_("MUST NOT"),_("MUST"))[presence], attribute=attr,
|
|
87
|
-
messageCodes=("SBR.NL.2.2.2.09", "SBR.NL.2.2.2.10", "SBR.NL.2.2.2.11", "SBR.NL.2.2.2.12"))
|
|
88
|
-
eltName = elt.get("name")
|
|
89
|
-
if eltName is not None: # skip for concepts which are refs
|
|
90
|
-
type = qname(elt, elt.get("type"))
|
|
91
|
-
eltQname = elt.qname
|
|
92
|
-
if type in xsd1_1datatypes:
|
|
93
|
-
val.modelXbrl.error("SBR.NL.2.2.0.01",
|
|
94
|
-
_('Schema element %(concept)s contains XSD 1.1 datatype "%(xsdType)s"'),
|
|
95
|
-
modelObject=elt, concept=elt.get("name"), xsdType=type)
|
|
96
|
-
if not parentIsSchema: # root element
|
|
97
|
-
if elt.get("name") is not None and (elt.isItem or elt.isTuple):
|
|
98
|
-
val.modelXbrl.error("SBR.NL.2.2.2.01",
|
|
99
|
-
_('Schema concept definition is not at the root level: %(concept)s'),
|
|
100
|
-
modelObject=elt, concept=elt.get("name"))
|
|
101
|
-
elif eltQname not in val.typedDomainQnames:
|
|
102
|
-
for attr, presence, errCode in (("abstract", True, "2.2.2.08"),
|
|
103
|
-
("id", True, "2.2.2.13"),
|
|
104
|
-
("nillable", True, "2.2.2.15"),
|
|
105
|
-
("substitutionGroup", True, "2.2.2.18"),):
|
|
106
|
-
if (elt.get(attr) is not None) != presence:
|
|
107
|
-
val.modelXbrl.error("SBR.NL.{0}".format(errCode),
|
|
108
|
-
_('Schema root element %(concept)s %(requirement)s contain attribute %(attribute)s'),
|
|
109
|
-
modelObject=elt, concept=elt.get("name"),
|
|
110
|
-
requirement=(_("MUST NOT"),_("MUST"))[presence], attribute=attr,
|
|
111
|
-
messageCodes=("SBR.NL.2.2.2.08", "SBR.NL.2.2.2.13", "SBR.NL.2.2.2.15", "SBR.NL.2.2.2.18"))
|
|
112
|
-
# semantic checks
|
|
113
|
-
if elt.isTuple:
|
|
114
|
-
val.hasTuple = True
|
|
115
|
-
elif elt.isLinkPart:
|
|
116
|
-
val.hasLinkPart = True
|
|
117
|
-
elif elt.isItem:
|
|
118
|
-
if elt.isDimensionItem:
|
|
119
|
-
val.hasDimension = True
|
|
120
|
-
#elif elt.substitutesFor()
|
|
121
|
-
if elt.isAbstract:
|
|
122
|
-
val.hasAbstractItem = True
|
|
123
|
-
else:
|
|
124
|
-
val.hasNonAbstraceElement = True
|
|
125
|
-
if elt.isAbstract and elt.isItem:
|
|
126
|
-
val.hasAbstractItem = True
|
|
127
|
-
if elt.typeQname is not None:
|
|
128
|
-
val.referencedNamespaces.add(elt.typeQname.namespaceURI)
|
|
129
|
-
if elt.substitutionGroupQname is not None:
|
|
130
|
-
val.referencedNamespaces.add(elt.substitutionGroupQname.namespaceURI)
|
|
131
|
-
if elt.isTypedDimension and elt.typedDomainElement is not None:
|
|
132
|
-
val.referencedNamespaces.add(elt.typedDomainElement.namespaceURI)
|
|
133
|
-
else:
|
|
134
|
-
referencedElt = elt.dereference()
|
|
135
|
-
if referencedElt is not None:
|
|
136
|
-
val.referencedNamespaces.add(referencedElt.modelDocument.targetNamespace)
|
|
137
|
-
if not parentIsSchema:
|
|
138
|
-
eltDecl = elt.dereference()
|
|
139
|
-
if (elt.get("minOccurs") is None or elt.get("maxOccurs") is None):
|
|
140
|
-
val.modelXbrl.error("SBR.NL.2.2.2.14",
|
|
141
|
-
_('Schema %(element)s must have minOccurs and maxOccurs'),
|
|
142
|
-
modelObject=elt, element=eltDecl.qname)
|
|
143
|
-
elif elt.get("maxOccurs") != "1" and eltDecl.isItem:
|
|
144
|
-
val.modelXbrl.error("SBR.NL.2.2.2.30",
|
|
145
|
-
_("Tuple concept %(concept)s must have maxOccurs='1'"),
|
|
146
|
-
modelObject=elt, concept=eltDecl.qname)
|
|
147
|
-
if eltDecl.isItem and eltDecl.isAbstract:
|
|
148
|
-
val.modelXbrl.error("SBR.NL.2.2.2.31",
|
|
149
|
-
_("Abstract concept %(concept)s must not be a child of a tuple"),
|
|
150
|
-
modelObject=elt, concept=eltDecl.qname)
|
|
151
|
-
elif localName in ("sequence","choice"):
|
|
152
|
-
for attrName in ("minOccurs", "maxOccurs"):
|
|
153
|
-
attrValue = elt.get(attrName)
|
|
154
|
-
if attrValue is None:
|
|
155
|
-
val.modelXbrl.error("SBR.NL.2.2.2.14",
|
|
156
|
-
_('Schema %(element)s must have %(attrName)s'),
|
|
157
|
-
modelObject=elt, element=elt.elementQname, attrName=attrName)
|
|
158
|
-
elif attrValue != "1":
|
|
159
|
-
val.modelXbrl.error("SBR.NL.2.2.2.33",
|
|
160
|
-
_('Schema %(element)s must have %(attrName)s = "1"'),
|
|
161
|
-
modelObject=elt, element=elt.elementQname, attrName=attrName)
|
|
162
|
-
elif localName in {"complexType","simpleType"}:
|
|
163
|
-
qnameDerivedFrom = elt.qnameDerivedFrom
|
|
164
|
-
if qnameDerivedFrom is not None:
|
|
165
|
-
if isinstance(qnameDerivedFrom, list): # union
|
|
166
|
-
for qn in qnameDerivedFrom:
|
|
167
|
-
val.referencedNamespaces.add(qn.namespaceURI)
|
|
168
|
-
else: # not union type
|
|
169
|
-
val.referencedNamespaces.add(qnameDerivedFrom.namespaceURI)
|
|
170
|
-
elif localName == "attribute":
|
|
171
|
-
if elt.typeQname is not None:
|
|
172
|
-
val.referencedNamespaces.add(elt.typeQname.namespaceURI)
|
|
173
|
-
elif localName == "appinfo":
|
|
174
|
-
if (parent.localName != "annotation" or parent.namespaceURI != XbrlConst.xsd or
|
|
175
|
-
parent.getparent().localName != "schema" or parent.getparent().namespaceURI != XbrlConst.xsd or
|
|
176
|
-
XmlUtil.previousSiblingElement(parent) != None):
|
|
177
|
-
val.modelXbrl.error("SBR.NL.2.2.0.12",
|
|
178
|
-
_('Annotation/appinfo record must be be behind schema and before import'), modelObject=elt)
|
|
179
|
-
nextSiblingElement = XmlUtil.nextSiblingElement(parent)
|
|
180
|
-
if nextSiblingElement is not None and nextSiblingElement.localName != "import":
|
|
181
|
-
val.modelXbrl.error("SBR.NL.2.2.0.14",
|
|
182
|
-
_('Annotation/appinfo record must be followed only by import'),
|
|
183
|
-
modelObject=elt)
|
|
184
|
-
elif localName == "annotation":
|
|
185
|
-
val.annotationsCount += 1
|
|
186
|
-
if not XmlUtil.hasChild(elt,XbrlConst.xsd,"appinfo"):
|
|
187
|
-
val.modelXbrl.error("SBR.NL.2.2.0.12",
|
|
188
|
-
_('Schema file annotation missing appinfo element must be be behind schema and before import'),
|
|
189
|
-
modelObject=elt)
|
|
190
|
-
elif localName in {"all", "documentation", "any", "anyAttribute", "attributeGroup",
|
|
191
|
-
# comment out per R.H. 2011-11-16 "complexContent", "complexType", "extension",
|
|
192
|
-
"field", "group", "key", "keyref",
|
|
193
|
-
"list", "notation", "redefine", "selector", "unique"}:
|
|
194
|
-
val.modelXbrl.error("SBR.NL.2.2.11.{0:02}".format({"all":1, "documentation":2, "any":3, "anyAttribute":4, "attributeGroup":7,
|
|
195
|
-
"complexContent":10, "complexType":11, "extension":12, "field":13, "group":14, "key":15, "keyref":16,
|
|
196
|
-
"list":17, "notation":18, "redefine":20, "selector":22, "unique":23}[localName]),
|
|
197
|
-
_('Schema file element must not be used "%(element)s"'),
|
|
198
|
-
modelObject=elt, element=elt.qname,
|
|
199
|
-
messageCodes=("SBR.NL.2.2.11.01", "SBR.NL.2.2.11.02", "SBR.NL.2.2.11.03", "SBR.NL.2.2.11.04", "SBR.NL.2.2.11.07", "SBR.NL.2.2.11.10", "SBR.NL.2.2.11.11", "SBR.NL.2.2.11.12",
|
|
200
|
-
"SBR.NL.2.2.11.13", "SBR.NL.2.2.11.14", "SBR.NL.2.2.11.15", "SBR.NL.2.2.11.16", "SBR.NL.2.2.11.17", "SBR.NL.2.2.11.18", "SBR.NL.2.2.11.20", "SBR.NL.2.2.11.22", "SBR.NL.2.2.11.23"))
|
|
201
|
-
if not elt.prefix:
|
|
202
|
-
val.modelXbrl.error("SBR.NL.2.2.0.06",
|
|
203
|
-
'Schema element is not prefixed: "%(element)s"',
|
|
204
|
-
modelObject=elt, element=elt.qname)
|
|
205
|
-
for elt in modelDocument.xmlRootElement.iter(tag="{http://www.xbrl.org/2003/linkbase}*"):
|
|
206
|
-
if elt.localName in ("roleType","arcroleType"):
|
|
207
|
-
uriAttr = {"roleType":"roleURI",
|
|
208
|
-
"arcroleType":"arcroleURI"}[elt.localName]
|
|
209
|
-
XmlValidate.validate(val.modelXbrl, elt) # validate [arc]roleType
|
|
210
|
-
roleURI = elt.get(uriAttr)
|
|
211
|
-
if elt.localName == "arcroleType":
|
|
212
|
-
val.modelXbrl.error("SBR.NL.2.2.4.01",
|
|
213
|
-
_('ArcroleType is not allowed %(roleURI)s'),
|
|
214
|
-
modelObject=elt, roleURI=roleURI)
|
|
215
|
-
else: # roleType
|
|
216
|
-
roleTypeModelObject = modelDocument.idObjects.get(elt.get("id"))
|
|
217
|
-
if roleTypeModelObject is not None and not roleTypeModelObject.genLabel(lang="nl"):
|
|
218
|
-
val.modelXbrl.error("SBR.NL.2.3.8.05",
|
|
219
|
-
_('RoleType %(roleURI)s must have a label in lang "nl"'),
|
|
220
|
-
modelObject=elt, roleURI=roleURI)
|
|
221
|
-
# check for used on duplications
|
|
222
|
-
usedOns = set()
|
|
223
|
-
for usedOn in elt.iterdescendants(tag="{http://www.xbrl.org/2003/linkbase}usedOn"):
|
|
224
|
-
if isinstance(usedOn,ModelObject):
|
|
225
|
-
qName = qname(usedOn, XmlUtil.text(usedOn))
|
|
226
|
-
val.valUsedPrefixes.add(qName.prefix)
|
|
227
|
-
if qName == XbrlConst.qnLinkCalculationLink:
|
|
228
|
-
val.modelXbrl.error("SBR.NL.2.2.3.01",
|
|
229
|
-
_("%(element)s usedOn must not be link:calculationLink"),
|
|
230
|
-
modelObject=elt, element=elt.qname, value=qName)
|
|
231
|
-
if elt.localName == "roleType" and qName in XbrlConst.standardExtLinkQnames:
|
|
232
|
-
if not any((key[1] == roleURI and key[2] == qName)
|
|
233
|
-
for key in val.modelXbrl.baseSets.keys()):
|
|
234
|
-
val.modelXbrl.error("SBR.NL.2.2.3.02",
|
|
235
|
-
_("%(element)s usedOn %(usedOn)s not addressed for role %(role)s"),
|
|
236
|
-
modelObject=elt, element=elt.qname, usedOn=qName, role=roleURI)
|
|
237
|
-
if val.annotationsCount > 1:
|
|
238
|
-
modelXbrl.error("SBR.NL.2.2.0.22",
|
|
239
|
-
_('Schema has %(annotationsCount)s xs:annotation elements, only 1 allowed'),
|
|
240
|
-
modelObject=modelDocument, annotationsCount=val.annotationsCount)
|
|
241
|
-
if modelDocument.type == ModelDocument.Type.LINKBASE:
|
|
242
|
-
for elt in modelDocument.xmlRootElement.iter():
|
|
243
|
-
if isinstance(elt, ModelObject) and not elt.prefix:
|
|
244
|
-
val.modelXbrl.error("SBR.NL.2.2.0.06",
|
|
245
|
-
_('Linkbase element is not prefixed: "%(element)s"'),
|
|
246
|
-
modelObject=elt, element=elt.qname)
|
|
247
|
-
if not val.containsRelationship:
|
|
248
|
-
modelXbrl.error("SBR.NL.2.3.0.12",
|
|
249
|
-
"Linkbase has no relationships",
|
|
250
|
-
modelObject=modelDocument)
|
|
251
|
-
# check file name suffixes
|
|
252
|
-
extLinkElt = XmlUtil.descendant(modelDocument.xmlRootElement, XbrlConst.link, "*", "{http://www.w3.org/1999/xlink}type", "extended")
|
|
253
|
-
if extLinkElt is not None:
|
|
254
|
-
expectedSuffix = None
|
|
255
|
-
if extLinkElt.localName == "labelLink":
|
|
256
|
-
anyLabel = XmlUtil.descendant(modelDocument.xmlRootElement, XbrlConst.link, "label", "{http://www.w3.org/XML/1998/namespace}lang", "*")
|
|
257
|
-
if anyLabel is not None:
|
|
258
|
-
xmlLang = anyLabel.get("{http://www.w3.org/XML/1998/namespace}lang")
|
|
259
|
-
expectedSuffix = "-lab-{0}.xml".format(xmlLang)
|
|
260
|
-
else:
|
|
261
|
-
expectedSuffix = {"referenceLink": "-ref.xml",
|
|
262
|
-
"presentationLink": "-pre.xml",
|
|
263
|
-
"definitionLink": "-def.xml"}.get(extLinkElt.localName, None)
|
|
264
|
-
if expectedSuffix:
|
|
265
|
-
if not modelDocument.uri.endswith(expectedSuffix):
|
|
266
|
-
modelXbrl.error("SBR.NL.3.2.1.09",
|
|
267
|
-
"Linkbase filename expected to end with %(expectedSuffix)s: %(filename)s",
|
|
268
|
-
modelObject=modelDocument, expectedSuffix=expectedSuffix, filename=modelDocument.uri)
|
|
269
|
-
elif extLinkElt.qname == XbrlConst.qnGenLink:
|
|
270
|
-
anyLabel = XmlUtil.descendant(modelDocument.xmlRootElement, XbrlConst.link, "label", "{http://www.w3.org/XML/1998/namespace}lang", "*")
|
|
271
|
-
if anyLabel is not None:
|
|
272
|
-
xmlLang = anyLabel.get("{http://www.w3.org/XML/1998/namespace}lang")
|
|
273
|
-
expectedSuffix = "-generic-lab-{0}.xml".format(xmlLang)
|
|
274
|
-
elif XmlUtil.descendant(modelDocument.xmlRootElement, XbrlConst.link, "reference") is not None:
|
|
275
|
-
expectedSuffix = "-generic-ref.xml"
|
|
276
|
-
if expectedSuffix and not modelDocument.uri.endswith(expectedSuffix):
|
|
277
|
-
modelXbrl.error("SBR.NL.3.2.1.10",
|
|
278
|
-
"Generic linkbase filename expected to end with %(expectedSuffix)s: %(filename)s",
|
|
279
|
-
modelObject=modelDocument, expectedSuffix=expectedSuffix, filename=modelDocument.uri)
|
|
280
|
-
# label checks
|
|
281
|
-
for qnLabel in (XbrlConst.qnLinkLabel, XbrlConst.qnGenLabel):
|
|
282
|
-
for modelLabel in modelDocument.xmlRootElement.iterdescendants(tag=qnLabel.clarkNotation):
|
|
283
|
-
if isinstance(modelLabel, ModelResource):
|
|
284
|
-
if not modelLabel.text or not modelLabel.text[:1].isupper():
|
|
285
|
-
modelXbrl.error("SBR.NL.3.2.7.05",
|
|
286
|
-
_("Labels MUST have a capital first letter, label %(label)s: %(text)s"),
|
|
287
|
-
modelObject=modelLabel, label=modelLabel.xlinkLabel, text=modelLabel.text[:64])
|
|
288
|
-
if modelLabel.role in (XbrlConst.standardLabel, XbrlConst.genStandardLabel):
|
|
289
|
-
if len(modelLabel.text) > 255:
|
|
290
|
-
modelXbrl.error("SBR.NL.3.2.7.06",
|
|
291
|
-
_("Labels with the 'standard' role MUST NOT exceed 255 characters, label %(label)s: %(text)s"),
|
|
292
|
-
modelObject=modelLabel, label=modelLabel.xlinkLabel, text=modelLabel.text[:64])
|
|
293
|
-
if modelLabel.role in (XbrlConst.standardLabel, XbrlConst.genStandardLabel):
|
|
294
|
-
if len(modelLabel.text) > 255:
|
|
295
|
-
modelXbrl.error("SBR.NL.3.2.7.06",
|
|
296
|
-
_("Labels with the 'standard' role MUST NOT exceed 255 characters, label %(label)s: %(text)s"),
|
|
297
|
-
modelObject=modelLabel, label=modelLabel.xlinkLabel, text=modelLabel.text[:64])
|
|
298
|
-
for modelResource in modelDocument.xmlRootElement.iter():
|
|
299
|
-
# locator checks
|
|
300
|
-
if isinstance(modelResource, ModelLocator):
|
|
301
|
-
hrefModelObject = modelResource.dereference()
|
|
302
|
-
if isinstance(hrefModelObject, ModelObject):
|
|
303
|
-
expectedLocLabel = hrefModelObject.id + "_loc"
|
|
304
|
-
if modelResource.xlinkLabel != expectedLocLabel:
|
|
305
|
-
modelXbrl.error("SBR.NL.3.2.11.01",
|
|
306
|
-
_("Locator @xlink:label names MUST be concatenated from: @id from the XML node, underscore, 'loc', expected %(expectedLocLabel)s, found %(foundLocLabel)s"),
|
|
307
|
-
modelObject=modelResource, expectedLocLabel=expectedLocLabel, foundLocLabel=modelResource.xlinkLabel)
|
|
308
|
-
# xlinkLabel checks
|
|
309
|
-
if isinstance(modelResource, ModelResource):
|
|
310
|
-
if re.match(r"[^a-zA-Z0-9_-]", modelResource.xlinkLabel):
|
|
311
|
-
modelXbrl.error("SBR.NL.3.2.11.03",
|
|
312
|
-
_("@xlink:label names MUST use a-zA-Z0-9_- characters only: %(xlinkLabel)s"),
|
|
313
|
-
modelObject=modelResource, xlinkLabel=modelResource.xlinkLabel)
|
|
314
|
-
elif modelDocument.targetNamespace: # SCHEMA with targetNamespace
|
|
315
|
-
# check for unused imports
|
|
316
|
-
for referencedDocument in modelDocument.referencesDocument.keys():
|
|
317
|
-
if (referencedDocument.type == ModelDocument.Type.SCHEMA and
|
|
318
|
-
referencedDocument.targetNamespace not in {XbrlConst.xbrli, XbrlConst.link} and
|
|
319
|
-
referencedDocument.targetNamespace not in val.referencedNamespaces):
|
|
320
|
-
modelXbrl.error("SBR.NL.2.2.0.15",
|
|
321
|
-
_("A schema import schemas of which no content is being addressed: %(importedFile)s"),
|
|
322
|
-
modelObject=modelDocument, importedFile=referencedDocument.basename)
|
|
323
|
-
if modelDocument.targetNamespace != modelDocument.targetNamespace.lower():
|
|
324
|
-
modelXbrl.error("SBR.NL.3.2.3.02",
|
|
325
|
-
_("Namespace URI's MUST be lower case: %(namespaceURI)s"),
|
|
326
|
-
modelObject=modelDocument, namespaceURI=modelDocument.targetNamespace)
|
|
327
|
-
if len(modelDocument.targetNamespace) > 255:
|
|
328
|
-
modelXbrl.error("SBR.NL.3.2.3.03",
|
|
329
|
-
_("Namespace URI's MUST NOT be longer than 255 characters: %(namespaceURI)s"),
|
|
330
|
-
modelObject=modelDocument, namespaceURI=modelDocument.targetNamespace)
|
|
331
|
-
if re.match(r"[^a-z0-9_/-]", modelDocument.targetNamespace):
|
|
332
|
-
modelXbrl.error("SBR.NL.3.2.3.04",
|
|
333
|
-
_("Namespace URI's MUST use only signs from a-z0-9_-/: %(namespaceURI)s"),
|
|
334
|
-
modelObject=modelDocument, namespaceURI=modelDocument.targetNamespace)
|
|
335
|
-
if not modelDocument.targetNamespace.startswith('http://www.nltaxonomie.nl'):
|
|
336
|
-
modelXbrl.error("SBR.NL.3.2.3.05",
|
|
337
|
-
_("Namespace URI's MUST start with 'http://www.nltaxonomie.nl': %(namespaceURI)s"),
|
|
338
|
-
modelObject=modelDocument, namespaceURI=modelDocument.targetNamespace)
|
|
339
|
-
namespacePrefix = XmlUtil.xmlnsprefix(modelDocument.xmlRootElement, modelDocument.targetNamespace)
|
|
340
|
-
if not namespacePrefix:
|
|
341
|
-
modelXbrl.error("SBR.NL.3.2.4.01",
|
|
342
|
-
_("TargetNamespaces MUST have a prefix: %(namespaceURI)s"),
|
|
343
|
-
modelObject=modelDocument, namespaceURI=modelDocument.targetNamespace)
|
|
344
|
-
elif namespacePrefix in val.prefixNamespace:
|
|
345
|
-
modelXbrl.error("SBR.NL.3.2.4.02",
|
|
346
|
-
_("Namespace prefix MUST be unique within the NT but prefix '%(prefix)s' is used by both %(namespaceURI)s and %(namespaceURI2)s."),
|
|
347
|
-
modelObject=modelDocument, prefix=namespacePrefix,
|
|
348
|
-
namespaceURI=modelDocument.targetNamespace, namespaceURI2=val.prefixNamespace[namespacePrefix])
|
|
349
|
-
else:
|
|
350
|
-
val.prefixNamespace[namespacePrefix] = modelDocument.targetNamespace
|
|
351
|
-
val.namespacePrefix[modelDocument.targetNamespace] = namespacePrefix
|
|
352
|
-
if namespacePrefix in {"xsi", "xsd", "xs", "xbrli", "link", "xlink", "xbrldt", "xbrldi", "gen", "xl"}:
|
|
353
|
-
modelXbrl.error("SBR.NL.3.2.4.03",
|
|
354
|
-
_("Namespace prefix '%(prefix)s' reserved by organizations for international specifications is used %(namespaceURI)s."),
|
|
355
|
-
modelObject=modelDocument, prefix=namespacePrefix, namespaceURI=modelDocument.targetNamespace)
|
|
356
|
-
if len(namespacePrefix) > 20:
|
|
357
|
-
modelXbrl.warning("SBR.NL.3.2.4.06",
|
|
358
|
-
_("Namespace prefix '%(prefix)s' SHOULD not exceed 20 characters %(namespaceURI)s."),
|
|
359
|
-
modelObject=modelDocument, prefix=namespacePrefix, namespaceURI=modelDocument.targetNamespace)
|
|
360
|
-
# check every non-targetnamespace prefix against its schema
|
|
361
|
-
requiredLinkrole = None # only set for extension taxonomies
|
|
362
|
-
|
|
363
|
-
for elt in modelDocument.xmlRootElement.iter():
|
|
364
|
-
if isinstance(elt, ModelObject):
|
|
365
|
-
xlinkType = elt.get("{http://www.w3.org/1999/xlink}type")
|
|
366
|
-
xlinkRole = elt.get("{http://www.w3.org/1999/xlink}role")
|
|
367
|
-
if elt.tag in ("{http://www.xbrl.org/2003/linkbase}arcroleRef", "{http://www.xbrl.org/2003/linkbase}roleRef"):
|
|
368
|
-
if elt.tag =="{http://www.xbrl.org/2003/linkbase}arcroleRef": # corrected merge of pre-plugin code per LOGIUS
|
|
369
|
-
for attrName, errCode in (("{http://www.w3.org/1999/xlink}arcrole","SBR.NL.2.3.2.05"),("{http://www.w3.org/1999/xlink}role","SBR.NL.2.3.2.06")):
|
|
370
|
-
if elt.get(attrName):
|
|
371
|
-
val.modelXbrl.error(errCode,
|
|
372
|
-
_("Arcrole %(refURI)s arcroleRef %(xlinkHref)s must not have an %(attribute)s attribute"),
|
|
373
|
-
modelObject=elt, refURI=elt.get("arcroleURI"),
|
|
374
|
-
xlinkHref=elt.get("{http://www.w3.org/1999/xlink}href"), attribute=attrName,
|
|
375
|
-
messageCodes=("SBR.NL.2.3.2.05", "SBR.NL.2.3.2.06"))
|
|
376
|
-
elif elt.tag == "{http://www.xbrl.org/2003/linkbase}roleRef": # corrected merge of pre-plugin code per LOGIUS
|
|
377
|
-
for attrName, errCode in (("{http://www.w3.org/1999/xlink}arcrole","SBR.NL.2.3.10.09"),("{http://www.w3.org/1999/xlink}role","SBR.NL.2.3.10.10")):
|
|
378
|
-
if elt.get(attrName):
|
|
379
|
-
val.modelXbrl.error(errCode,
|
|
380
|
-
_("Role %(refURI)s roleRef %(xlinkHref)s must not have an %(attribute)s attribute"),
|
|
381
|
-
modelObject=elt, refURI=elt.get("roleURI"),
|
|
382
|
-
xlinkHref=elt.get("{http://www.w3.org/1999/xlink}href"), attribute=attrName,
|
|
383
|
-
messageCodes=("SBR.NL.2.3.10.09", "SBR.NL.2.3.10.10"))
|
|
384
|
-
if not xlinkType:
|
|
385
|
-
val.modelXbrl.error("SBR.NL.2.3.0.01",
|
|
386
|
-
_("Xlink 1.1 simple type is not allowed (xlink:type is missing)"),
|
|
387
|
-
modelObject=elt)
|
|
388
|
-
if xlinkType == "resource":
|
|
389
|
-
if elt.localName in ("label", "reference"):
|
|
390
|
-
if not XbrlConst.isStandardRole(xlinkRole):
|
|
391
|
-
val.modelXbrl.error("SBR.NL.2.3.10.13",
|
|
392
|
-
_("Extended link %(element)s must have a standard xlink:role attribute (%(xlinkRole)s)"),
|
|
393
|
-
modelObject=elt, element=elt.elementQname, xlinkRole=xlinkRole)
|
|
394
|
-
if elt.localName == "reference": # look for custom reference parts
|
|
395
|
-
for linkPart in elt.iterchildren():
|
|
396
|
-
if linkPart.namespaceURI not in val.disclosureSystem.baseTaxonomyNamespaces:
|
|
397
|
-
val.modelXbrl.error("SBR.NL.2.2.5.01",
|
|
398
|
-
_("Link part %(element)s is not authorized"),
|
|
399
|
-
modelObject=linkPart, element=linkPart.elementQname)
|
|
400
|
-
# corrected merge of pre-plugin code per LOGIUS
|
|
401
|
-
if not XbrlConst.isStandardRole(xlinkRole):
|
|
402
|
-
modelsRole = val.modelXbrl.roleTypes.get(xlinkRole)
|
|
403
|
-
if (modelsRole is None or len(modelsRole) == 0 or
|
|
404
|
-
modelsRole[0].modelDocument.targetNamespace not in val.disclosureSystem.standardTaxonomiesDict):
|
|
405
|
-
val.modelXbrl.error("SBR.NL.2.3.10.14",
|
|
406
|
-
_("Resource %(xlinkLabel)s role %(role)s is not a standard taxonomy role"),
|
|
407
|
-
modelObject=elt, xlinkLabel=elt.get("{http://www.w3.org/1999/xlink}label"), role=xlinkRole, element=elt.qname,
|
|
408
|
-
roleDefinition=val.modelXbrl.roleTypeDefinition(xlinkRole))
|
|
409
|
-
if elt.localName == "reference":
|
|
410
|
-
for child in elt.iterdescendants():
|
|
411
|
-
if isinstance(child,ModelObject) and child.namespaceURI.startswith("http://www.xbrl.org") and child.namespaceURI != "http://www.xbrl.org/2006/ref":
|
|
412
|
-
val.modelXbrl.error("SBR.NL.2.3.3.01",
|
|
413
|
-
_("Reference %(xlinkLabel)s has unauthorized part element %(element)s"),
|
|
414
|
-
modelObject=elt, xlinkLabel=elt.get("{http://www.w3.org/1999/xlink}label"),
|
|
415
|
-
element=qname(child))
|
|
416
|
-
id = elt.get("id")
|
|
417
|
-
if not id:
|
|
418
|
-
val.modelXbrl.error("SBR.NL.2.3.3.02",
|
|
419
|
-
_("Reference %(xlinkLabel)s is missing an id attribute"),
|
|
420
|
-
modelObject=elt, xlinkLabel=elt.get("{http://www.w3.org/1999/xlink}label"))
|
|
421
|
-
elif id in val.DTSreferenceResourceIDs:
|
|
422
|
-
val.modelXbrl.error("SBR.NL.2.3.3.03",
|
|
423
|
-
_("Reference %(xlinkLabel)s has duplicated id %(id)s also in linkbase %(otherLinkbase)s"),
|
|
424
|
-
modelObject=elt, xlinkLabel=elt.get("{http://www.w3.org/1999/xlink}label"),
|
|
425
|
-
id=id, otherLinkbase=val.DTSreferenceResourceIDs[id])
|
|
426
|
-
else:
|
|
427
|
-
val.DTSreferenceResourceIDs[id] = modelDocument.basename
|
|
428
|
-
if elt.qname not in {
|
|
429
|
-
XbrlConst.qnLinkLabelLink: (XbrlConst.qnLinkLabel,),
|
|
430
|
-
XbrlConst.qnLinkReferenceLink: (XbrlConst.qnLinkReference,),
|
|
431
|
-
XbrlConst.qnLinkPresentationLink: tuple(),
|
|
432
|
-
XbrlConst.qnLinkCalculationLink: tuple(),
|
|
433
|
-
XbrlConst.qnLinkDefinitionLink: tuple(),
|
|
434
|
-
XbrlConst.qnLinkFootnoteLink: (XbrlConst.qnLinkFootnote,),
|
|
435
|
-
# XbrlConst.qnGenLink: (XbrlConst.qnGenLabel, XbrlConst.qnGenReference, val.qnSbrLinkroleorder),
|
|
436
|
-
}.get(val.extendedElementName,(elt.qname,)): # allow non-2.1 to be ok regardless per RH 2013-03-13
|
|
437
|
-
val.modelXbrl.error("SBR.NL.2.3.0.11",
|
|
438
|
-
_("Resource element %(element)s may not be contained in a linkbase with %(element2)s"),
|
|
439
|
-
modelObject=elt, element=elt.qname, element2=val.extendedElementName)
|
|
440
|
-
elif xlinkType == "extended":
|
|
441
|
-
if xlinkRole is None: # no @role on extended link
|
|
442
|
-
val.modelXbrl.error("SBR.NL.2.3.10.13",
|
|
443
|
-
_("Extended link %(element)s must have an xlink:role attribute"),
|
|
444
|
-
modelObject=elt, element=elt.elementQname)
|
|
445
|
-
if not val.extendedElementName:
|
|
446
|
-
val.extendedElementName = elt.qname
|
|
447
|
-
elif val.extendedElementName != elt.qname:
|
|
448
|
-
val.modelXbrl.error("SBR.NL.2.3.0.11",
|
|
449
|
-
_("Extended element %(element)s must be the same as %(element2)s"),
|
|
450
|
-
modelObject=elt, element=elt.qname, element2=val.extendedElementName)
|
|
451
|
-
elif xlinkType == "locator":
|
|
452
|
-
if elt.qname != XbrlConst.qnLinkLoc:
|
|
453
|
-
val.modelXbrl.error("SBR.NL.2.3.0.11",
|
|
454
|
-
_("Loc element %(element)s may not be contained in a linkbase with %(element2)s"),
|
|
455
|
-
modelObject=elt, element=elt.qname, element2=val.extendedElementName)
|
|
456
|
-
elif xlinkType == "arc":
|
|
457
|
-
if elt.namespaceURI == XbrlConst.link:
|
|
458
|
-
if elt.localName == "presentationArc" and not elt.get("order"):
|
|
459
|
-
val.modelXbrl.error("SBR.NL.2.3.4.04",
|
|
460
|
-
_("PresentationArc from %(xlinkFrom)s to %(xlinkTo)s must have an order"),
|
|
461
|
-
modelObject=elt,
|
|
462
|
-
xlinkFrom=elt.get("{http://www.w3.org/1999/xlink}from"),
|
|
463
|
-
xlinkTo=elt.get("{http://www.w3.org/1999/xlink}to"),
|
|
464
|
-
conceptFrom=arcFromConceptQname(elt),
|
|
465
|
-
conceptTo=arcToConceptQname(elt))
|
|
466
|
-
if elt.namespaceURI == XbrlConst.link:
|
|
467
|
-
arcrole = elt.get("{http://www.w3.org/1999/xlink}arcrole")
|
|
468
|
-
if elt.localName == "definitionArc":
|
|
469
|
-
if arcrole in (XbrlConst.essenceAlias, XbrlConst.similarTuples, XbrlConst.requiresElement):
|
|
470
|
-
val.modelXbrl.error({XbrlConst.essenceAlias: "SBR.NL.2.3.2.02",
|
|
471
|
-
XbrlConst.similarTuples: "SBR.NL.2.3.2.03",
|
|
472
|
-
XbrlConst.requiresElement: "SBR.NL.2.3.2.04"}[arcrole],
|
|
473
|
-
_("DefinitionArc from %(xlinkFrom)s to %(xlinkTo)s has unauthorized arcrole %(arcrole)s"),
|
|
474
|
-
modelObject=elt,
|
|
475
|
-
xlinkFrom=elt.get("{http://www.w3.org/1999/xlink}from"),
|
|
476
|
-
xlinkTo=elt.get("{http://www.w3.org/1999/xlink}to"),
|
|
477
|
-
arcrole=arcrole,
|
|
478
|
-
messageCodes=("SBR.NL.2.3.2.02", "SBR.NL.2.3.2.03", "SBR.NL.2.3.2.04"))
|
|
479
|
-
elif elt.localName == "referenceArc":
|
|
480
|
-
if elt.get("order"):
|
|
481
|
-
val.modelXbrl.error("SBR.NL.2.3.3.05",
|
|
482
|
-
_("ReferenceArc from %(xlinkFrom)s to %(xlinkTo)s has an order"),
|
|
483
|
-
modelObject=elt,
|
|
484
|
-
xlinkFrom=elt.get("{http://www.w3.org/1999/xlink}from"),
|
|
485
|
-
xlinkTo=elt.get("{http://www.w3.org/1999/xlink}to"))
|
|
486
|
-
if elt.get("use") == "prohibited" and elt.getparent().tag in (
|
|
487
|
-
"{http://www.xbrl.org/2003/linkbase}presentationLink",
|
|
488
|
-
"{http://www.xbrl.org/2003/linkbase}labelLink",
|
|
489
|
-
"{http://xbrl.org/2008/generic}link",
|
|
490
|
-
"{http://www.xbrl.org/2003/linkbase}referenceLink"):
|
|
491
|
-
val.modelXbrl.error("SBR.NL.2.3.0.10",
|
|
492
|
-
_("%(arc)s must not contain use='prohibited'"),
|
|
493
|
-
modelObject=elt, arc=elt.getparent().qname)
|
|
494
|
-
if elt.qname not in {
|
|
495
|
-
XbrlConst.qnLinkLabelLink: (XbrlConst.qnLinkLabelArc,),
|
|
496
|
-
XbrlConst.qnLinkReferenceLink: (XbrlConst.qnLinkReferenceArc,),
|
|
497
|
-
XbrlConst.qnLinkPresentationLink: (XbrlConst.qnLinkPresentationArc,),
|
|
498
|
-
XbrlConst.qnLinkCalculationLink: (XbrlConst.qnLinkCalculationArc,),
|
|
499
|
-
XbrlConst.qnLinkDefinitionLink: (XbrlConst.qnLinkDefinitionArc,),
|
|
500
|
-
XbrlConst.qnLinkFootnoteLink: (XbrlConst.qnLinkFootnoteArc,),
|
|
501
|
-
# XbrlConst.qnGenLink: (XbrlConst.qnGenArc,),
|
|
502
|
-
}.get(val.extendedElementName, (elt.qname,)): # allow non-2.1 to be ok regardless per RH 2013-03-13
|
|
503
|
-
val.modelXbrl.error("SBR.NL.2.3.0.11",
|
|
504
|
-
_("Arc element %(element)s may not be contained in a linkbase with %(element2)s"),
|
|
505
|
-
modelObject=elt, element=elt.qname, element2=val.extendedElementName)
|
|
506
|
-
if elt.qname == XbrlConst.qnLinkLabelArc and elt.get("order"):
|
|
507
|
-
val.modelXbrl.error("SBR.NL.2.3.8.08",
|
|
508
|
-
_("labelArc may not be contain order (%(order)s)"),
|
|
509
|
-
modelObject=elt, order=elt.get("order"))
|
|
510
|
-
|
|
511
|
-
xmlLang = elt.get("{http://www.w3.org/XML/1998/namespace}lang")
|
|
512
|
-
if val.validateXmlLang and xmlLang is not None:
|
|
513
|
-
if not val.disclosureSystem.xmlLangPattern.match(xmlLang): # corrected merge of pre-plugin code per LOGIUS
|
|
514
|
-
val.modelXbrl.error("SBR.NL.2.3.8.01" if xmlLang.startswith('nl') else "SBR.NL.2.3.8.02" if xmlLang.startswith('en') else "arelle:langError",
|
|
515
|
-
_("Element %(element)s %(xlinkLabel)s has unauthorized xml:lang='%(lang)s'"),
|
|
516
|
-
modelObject=elt, element=elt.qname,
|
|
517
|
-
xlinkLabel=elt.get("{http://www.w3.org/1999/xlink}label"),
|
|
518
|
-
lang=elt.get("{http://www.w3.org/XML/1998/namespace}lang"),
|
|
519
|
-
messageCodes=("SBR.NL.2.3.8.01", "SBR.NL.2.3.8.02", "arelle:langError"))
|
|
520
|
-
# check attributes for prefixes and xmlns
|
|
521
|
-
val.valUsedPrefixes.add(elt.prefix)
|
|
522
|
-
if elt.namespaceURI not in val.disclosureSystem.baseTaxonomyNamespaces:
|
|
523
|
-
val.modelXbrl.error("SBR.NL.2.2.0.20",
|
|
524
|
-
_("%(fileType)s element %(element)s must not have custom namespace %(namespace)s"),
|
|
525
|
-
modelObject=elt, element=elt.qname,
|
|
526
|
-
fileType="schema" if isSchema else "linkbase" ,
|
|
527
|
-
namespace=elt.namespaceURI)
|
|
528
|
-
for attrTag, attrValue in elt.items():
|
|
529
|
-
prefix, ns, localName = XmlUtil.clarkNotationToPrefixNsLocalname(elt, attrTag, isAttribute=True)
|
|
530
|
-
if prefix: # don't count unqualified prefixes for using default namespace
|
|
531
|
-
val.valUsedPrefixes.add(prefix)
|
|
532
|
-
if ns and ns not in val.disclosureSystem.baseTaxonomyNamespaces:
|
|
533
|
-
val.modelXbrl.error("SBR.NL.2.2.0.20",
|
|
534
|
-
_("%(fileType)s element %(element)s must not have %(prefix)s:%(localName)s"),
|
|
535
|
-
modelObject=elt, element=elt.qname,
|
|
536
|
-
fileType="schema" if isSchema else "linkbase" ,
|
|
537
|
-
prefix=prefix, localName=localName)
|
|
538
|
-
if isSchema and localName in ("base", "ref", "substitutionGroup", "type"):
|
|
539
|
-
valuePrefix, sep, valueName = attrValue.partition(":")
|
|
540
|
-
if sep:
|
|
541
|
-
val.valUsedPrefixes.add(valuePrefix)
|
|
542
|
-
# check for xmlns on a non-root element
|
|
543
|
-
parentElt = elt.getparent()
|
|
544
|
-
if parentElt is not None:
|
|
545
|
-
for prefix, ns in elt.nsmap.items():
|
|
546
|
-
if prefix not in parentElt.nsmap or parentElt.nsmap[prefix] != ns:
|
|
547
|
-
val.modelXbrl.error(("SBR.NL.2.2.0.19" if isSchema else "SBR.NL.2.3.1.01"),
|
|
548
|
-
_("%(fileType)s element %(element)s must not have xmlns:%(prefix)s"),
|
|
549
|
-
modelObject=elt, element=elt.qname,
|
|
550
|
-
fileType="schema" if isSchema else "linkbase" ,
|
|
551
|
-
prefix=prefix,
|
|
552
|
-
messageCodes=("SBR.NL.2.2.0.19", "SBR.NL.2.3.1.01"))
|
|
553
|
-
|
|
554
|
-
if elt.localName == "roleType" and not elt.get("id"):
|
|
555
|
-
val.modelXbrl.error("SBR.NL.2.3.10.11",
|
|
556
|
-
_("RoleType %(roleURI)s missing id attribute"),
|
|
557
|
-
modelObject=elt, roleURI=elt.get("roleURI"))
|
|
558
|
-
elif elt.localName == "loc" and elt.get("{http://www.w3.org/1999/xlink}role"):
|
|
559
|
-
val.modelXbrl.error("SBR.NL.2.3.10.08",
|
|
560
|
-
_("Loc %(xlinkLabel)s has unauthorized role attribute"),
|
|
561
|
-
modelObject=elt, xlinkLabel=elt.get("{http://www.w3.org/1999/xlink}label"))
|
|
562
|
-
elif elt.localName == "documentation":
|
|
563
|
-
val.modelXbrl.error("SBR.NL.2.3.10.12" if elt.namespaceURI == XbrlConst.link else "SBR.NL.2.2.11.02",
|
|
564
|
-
_("Documentation element must not be used: %(value)s"),
|
|
565
|
-
modelObject=elt, value=XmlUtil.text(elt),
|
|
566
|
-
messageCodes=("SBR.NL.2.3.10.12", "SBR.NL.2.2.11.02"))
|
|
567
|
-
if elt.localName == "linkbase":
|
|
568
|
-
schemaLocation = elt.get("{http://www.w3.org/2001/XMLSchema-instance}schemaLocation")
|
|
569
|
-
if schemaLocation:
|
|
570
|
-
schemaLocations = schemaLocation.split()
|
|
571
|
-
for sl in (XbrlConst.link, XbrlConst.xlink):
|
|
572
|
-
if sl in schemaLocations:
|
|
573
|
-
val.modelXbrl.error("SBR.NL.2.3.0.07",
|
|
574
|
-
_("Linkbase element must not have schemaLocation entry for %(schemaLocation)s"),
|
|
575
|
-
modelObject=elt, schemaLocation=sl)
|
|
576
|
-
for attrName, errCode in (("id", "SBR.NL.2.3.10.04"),
|
|
577
|
-
("{http://www.w3.org/2001/XMLSchema-instance}nil", "SBR.NL.2.3.10.05"),
|
|
578
|
-
("{http://www.w3.org/2001/XMLSchema-instance}noNamespaceSchemaLocation", "SBR.NL.2.3.10.06"),
|
|
579
|
-
("{http://www.w3.org/2001/XMLSchema-instance}type", "SBR.NL.2.3.10.07")):
|
|
580
|
-
if elt.get(attrName) is not None:
|
|
581
|
-
val.modelXbrl.error(errCode,
|
|
582
|
-
_("Linkbase element %(element)s must not have attribute %(attribute)s"),
|
|
583
|
-
modelObject=elt, element=elt.qname, attribute=attrName,
|
|
584
|
-
messageCodes=("SBR.NL.2.3.10.04", "SBR.NL.2.3.10.05", "SBR.NL.2.3.10.06", "SBR.NL.2.3.10.07"))
|
|
585
|
-
for attrName, errCode in (("{http://www.w3.org/1999/xlink}actuate", "SBR.NL.2.3.10.01"),
|
|
586
|
-
("{http://www.w3.org/1999/xlink}show", "SBR.NL.2.3.10.02"),
|
|
587
|
-
("{http://www.w3.org/1999/xlink}title", "SBR.NL.2.3.10.03")):
|
|
588
|
-
if elt.get(attrName) is not None:
|
|
589
|
-
val.modelXbrl.error(errCode,
|
|
590
|
-
_("Linkbase element %(element)s must not have attribute xlink:%(attribute)s"),
|
|
591
|
-
modelObject=elt, element=elt.qname, attribute=attrName,
|
|
592
|
-
messageCodes=("SBR.NL.2.3.10.01", "SBR.NL.2.3.10.02", "SBR.NL.2.3.10.03"))
|
|
593
|
-
elif isinstance(elt,ModelComment): # comment node
|
|
594
|
-
if elt.itersiblings(preceding=True): # corrected merge of pre-plugin code per LOGIUS
|
|
595
|
-
val.modelXbrl.error("SBR.NL.2.2.0.05" if isSchema else "SBR.NL.2.3.0.05",
|
|
596
|
-
_('%(fileType)s must have only one comment node before schema element: "%(value)s"'),
|
|
597
|
-
modelObject=elt, fileType=modelDocument.gettype().title(), value=elt.text,
|
|
598
|
-
messageCodes=("SBR.NL.2.2.0.05", "SBR.NL.2.3.0.05"))
|
|
599
|
-
|
|
600
|
-
# check folder names
|
|
601
|
-
if modelDocument.filepathdir.startswith(modelXbrl.uriDir):
|
|
602
|
-
partnerPrefix = None
|
|
603
|
-
pathDir = modelDocument.filepathdir[len(modelXbrl.uriDir) + 1:].replace("\\", "/")
|
|
604
|
-
lastPathSegment = None
|
|
605
|
-
for pathSegment in pathDir.split("/"):
|
|
606
|
-
if pathSegment.lower() != pathSegment:
|
|
607
|
-
modelXbrl.error("SBR.NL.3.2.1.02",
|
|
608
|
-
_("Folder names must be in lower case: %(folder)s"),
|
|
609
|
-
modelObject=modelDocument, folder=pathSegment)
|
|
610
|
-
if len(pathSegment) >= 15 :
|
|
611
|
-
modelXbrl.error("SBR.NL.3.2.1.03",
|
|
612
|
-
_("Folder names must be less than 15 characters: %(folder)s"),
|
|
613
|
-
modelObject=modelDocument, folder=pathSegment)
|
|
614
|
-
if pathSegment in ("bd", "kvk", "cbs"):
|
|
615
|
-
partnerPrefix = pathSegment + '-'
|
|
616
|
-
lastPathSegment = pathSegment
|
|
617
|
-
if modelDocument.basename.lower() != modelDocument.basename:
|
|
618
|
-
modelXbrl.error("SBR.NL.3.2.1.05",
|
|
619
|
-
_("File names must be in lower case: %(file)s"),
|
|
620
|
-
modelObject=modelDocument, file=modelDocument.basename)
|
|
621
|
-
if partnerPrefix and not modelDocument.basename.startswith(partnerPrefix):
|
|
622
|
-
modelXbrl.error("SBR.NL.3.2.1.14",
|
|
623
|
-
"NT Partner DTS files MUST start with %(partnerPrefix)s consistently: %(filename)s",
|
|
624
|
-
modelObject=modelDocument, partnerPrefix=partnerPrefix, filename=modelDocument.uri)
|
|
625
|
-
if modelDocument.type == ModelDocument.Type.SCHEMA:
|
|
626
|
-
if modelDocument.targetNamespace:
|
|
627
|
-
nsParts = modelDocument.targetNamespace.split("/")
|
|
628
|
-
# [0] = https, [1] = // [2] = nl.taxonomie [3] = year or version
|
|
629
|
-
nsYrOrVer = nsParts[3]
|
|
630
|
-
requiredNamespace = "http://www.nltaxonomie.nl/" + nsYrOrVer + "/" + pathDir + "/" + modelDocument.basename[:-4]
|
|
631
|
-
requiredLinkrole = "http://www.nltaxonomie.nl/" + nsYrOrVer + "/" + pathDir + "/"
|
|
632
|
-
if modelDocument == modelXbrl.modelDocument: # entry point
|
|
633
|
-
nsYr = "{year}"
|
|
634
|
-
if '2009' <= nsParts[3] < '2020': # must be a year, use as year
|
|
635
|
-
nsYr = nsParts[3]
|
|
636
|
-
else: # look for year in parts of basename of required namespace
|
|
637
|
-
for nsPart in nsParts:
|
|
638
|
-
for baseNamePart in nsPart.split('-'):
|
|
639
|
-
if '2009' <= baseNamePart < '2020':
|
|
640
|
-
nsYr = baseNamePart
|
|
641
|
-
break
|
|
642
|
-
if not requiredNamespace.endswith('-' + nsYr):
|
|
643
|
-
requiredNamespace += '-' + nsYr
|
|
644
|
-
if not modelDocument.targetNamespace.startswith(requiredNamespace):
|
|
645
|
-
modelXbrl.error("SBR.NL.3.2.3.06",
|
|
646
|
-
_("Namespace URI's MUST be constructed like %(requiredNamespace)s: %(namespaceURI)s"),
|
|
647
|
-
modelObject=modelDocument, requiredNamespace=requiredNamespace, namespaceURI=modelDocument.targetNamespace)
|
|
648
|
-
else:
|
|
649
|
-
requiredLinkrole = ''
|
|
650
|
-
# concept checks
|
|
651
|
-
for modelConcept in modelDocument.xmlRootElement.iterdescendants(tag="{http://www.w3.org/2001/XMLSchema}element"):
|
|
652
|
-
if isinstance(modelConcept, ModelConcept):
|
|
653
|
-
# 6.7.16 name not duplicated in standard taxonomies
|
|
654
|
-
name = modelConcept.get("name")
|
|
655
|
-
if name:
|
|
656
|
-
''' removed per RH 2013-03-25
|
|
657
|
-
substititutionGroupQname = modelConcept.substitutionGroupQname
|
|
658
|
-
if substititutionGroupQname:
|
|
659
|
-
if name.endswith("Member") ^ (substititutionGroupQname.localName == "domainMemberItem" and
|
|
660
|
-
substititutionGroupQname.namespaceURI.endswith("/xbrl/xbrl-syntax-extension")):
|
|
661
|
-
modelXbrl.error("SBR.NL.3.2.5.11",
|
|
662
|
-
_("Concept %(concept)s must end in Member to be in sbr:domainMemberItem substitution group"),
|
|
663
|
-
modelObject=modelConcept, concept=modelConcept.qname)
|
|
664
|
-
if name.endswith("Domain") ^ (substititutionGroupQname.localName == "domainItem" and
|
|
665
|
-
substititutionGroupQname.namespaceURI.endswith("/xbrl/xbrl-syntax-extension")):
|
|
666
|
-
modelXbrl.error("SBR.NL.3.2.5.12",
|
|
667
|
-
_("Concept %(concept)s must end in Domain to be in sbr:domainItem substitution group"),
|
|
668
|
-
modelObject=modelConcept, concept=modelConcept.qname)
|
|
669
|
-
if name.endswith("TypedAxis") ^ (substititutionGroupQname == XbrlConst.qnXbrldtDimensionItem and
|
|
670
|
-
modelConcept.isTypedDimension):
|
|
671
|
-
modelXbrl.error("SBR.NL.3.2.5.14",
|
|
672
|
-
_("Concept %(concept)s must end in TypedAxis to be in xbrldt:dimensionItem substitution group if they represent a typed dimension"),
|
|
673
|
-
modelObject=modelConcept, concept=modelConcept.qname)
|
|
674
|
-
if (name.endswith("Axis") and
|
|
675
|
-
not name.endswith("TypedAxis")) ^ (substititutionGroupQname == XbrlConst.qnXbrldtDimensionItem and
|
|
676
|
-
modelConcept.isExplicitDimension):
|
|
677
|
-
modelXbrl.error("SBR.NL.3.2.5.13",
|
|
678
|
-
_("Concept %(concept)s must end in Axis to be in xbrldt:dimensionItem substitution group if they represent an explicit dimension"),
|
|
679
|
-
modelObject=modelConcept, concept=modelConcept.qname)
|
|
680
|
-
if name.endswith("Table") ^ (substititutionGroupQname == XbrlConst.qnXbrldtHypercubeItem):
|
|
681
|
-
modelXbrl.error("SBR.NL.3.2.5.15",
|
|
682
|
-
_("Concept %(concept)s must end in Table to be in xbrldt:hypercubeItem substitution group"),
|
|
683
|
-
modelObject=modelConcept, concept=modelConcept.qname)
|
|
684
|
-
if name.endswith("Title") ^ (substititutionGroupQname.localName == "presentationItem" and
|
|
685
|
-
substititutionGroupQname.namespaceURI.endswith("/xbrl/xbrl-syntax-extension")):
|
|
686
|
-
modelXbrl.error("SBR.NL.3.2.5.16",
|
|
687
|
-
_("Concept %(concept)s must end in Title to be in sbr:presentationItem substitution group"),
|
|
688
|
-
modelObject=modelConcept, concept=modelConcept.qname)
|
|
689
|
-
'''
|
|
690
|
-
if len(name) > 200:
|
|
691
|
-
modelXbrl.error("SBR.NL.3.2.12.02" if modelConcept.isLinkPart
|
|
692
|
-
else "SBR.NL.3.2.5.21" if (modelConcept.isItem or modelConcept.isTuple)
|
|
693
|
-
else "SBR.NL.3.2.14.01",
|
|
694
|
-
_("Concept %(concept)s name length %(namelength)s exceeds 200 characters"),
|
|
695
|
-
modelObject=modelConcept, concept=modelConcept.qname, namelength=len(name))
|
|
696
|
-
# type checks
|
|
697
|
-
for typeType in ("simpleType", "complexType"):
|
|
698
|
-
for modelType in modelDocument.xmlRootElement.iterdescendants(tag="{http://www.w3.org/2001/XMLSchema}" + typeType):
|
|
699
|
-
if isinstance(modelType, ModelType):
|
|
700
|
-
name = modelType.get("name")
|
|
701
|
-
if name is None:
|
|
702
|
-
name = ""
|
|
703
|
-
if modelType.get("ref") is not None:
|
|
704
|
-
continue # don't validate ref's here
|
|
705
|
-
if len(name) > 200:
|
|
706
|
-
modelXbrl.error("SBR.NL.3.2.5.21",
|
|
707
|
-
_("Type %(type)s name length %(namelength)s exceeds 200 characters"),
|
|
708
|
-
modelObject=modelType, type=modelType.qname, namelength=len(name))
|
|
709
|
-
if modelType.qnameDerivedFrom and modelType.qnameDerivedFrom.namespaceURI != XbrlConst.xbrli:
|
|
710
|
-
modelXbrl.error("SBR.NL.3.2.8.01",
|
|
711
|
-
_("Custom datatypes MUST be a restriction from XII defined datatypes: %(type)s"),
|
|
712
|
-
modelObject=modelType, type=modelType.qname)
|
|
713
|
-
if re.match(r"[^a-zA-Z0-9_-]", name):
|
|
714
|
-
modelXbrl.error("SBR.NL.3.2.8.02",
|
|
715
|
-
_("Datatype names MUST use characters a-zA-Z0-9_- only: %(type)s"),
|
|
716
|
-
modelObject=modelDocument, type=modelType.qname)
|
|
717
|
-
if modelType.facets and "enumeration" in modelType.facets:
|
|
718
|
-
if not modelType.qnameDerivedFrom == XbrlConst.qnXbrliStringItemType:
|
|
719
|
-
modelXbrl.error("SBR.NL.3.2.13.01",
|
|
720
|
-
_("Enumerations MUST use a restriction on xbrli:stringItemType: %(type)s"),
|
|
721
|
-
modelObject=modelDocument, type=modelType.qname)
|
|
722
|
-
if lastPathSegment == "entrypoints":
|
|
723
|
-
if not modelDocument.xmlRootElement.id:
|
|
724
|
-
modelXbrl.error("SBR.NL.2.2.0.23",
|
|
725
|
-
_("xs:schema/@id MUST be present in schema files in the reports/{NT partner}/entrypoints/ folder"),
|
|
726
|
-
modelObject=modelDocument)
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
# check for idObject conflicts
|
|
730
|
-
for modelObject in modelDocument.xmlRootElement.iter():
|
|
731
|
-
if isinstance(modelObject,ModelObject):
|
|
732
|
-
id = modelObject.id
|
|
733
|
-
if id:
|
|
734
|
-
if id in val.idObjects:
|
|
735
|
-
modelXbrl.error("SBR.NL.3.2.6.01",
|
|
736
|
-
_("ID %(id)s must be unique in the DTS but is present on two elements."),
|
|
737
|
-
modelObject=(modelObject, val.idObjects[id]), id=id)
|
|
738
|
-
else:
|
|
739
|
-
val.idObjects[id] = modelObject
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
for roleURI, modelRoleTypes in modelXbrl.roleTypes.items():
|
|
743
|
-
if not roleURI.startswith("http://www.xbrl.org"):
|
|
744
|
-
usedOns = set.union(*[modelRoleType.usedOns for modelRoleType in modelRoleTypes])
|
|
745
|
-
# check roletypes for linkroles (only)
|
|
746
|
-
if usedOns & {XbrlConst.qnLinkPresentationLink, XbrlConst.qnLinkCalculationLink, XbrlConst.qnLinkDefinitionLink,
|
|
747
|
-
XbrlConst.qnLinkLabel, XbrlConst.qnLinkReference, XbrlConst.qnLinkFootnote}:
|
|
748
|
-
if len(modelRoleTypes) > 1:
|
|
749
|
-
modelXbrl.error("SBR.NL.3.2.9.01",
|
|
750
|
-
_("Linkrole URI's MUST be unique in the NT: %(linkrole)s"),
|
|
751
|
-
modelObject=modelRoleTypes, linkrole=roleURI)
|
|
752
|
-
if roleURI.lower() != roleURI:
|
|
753
|
-
modelXbrl.error("SBR.NL.3.2.9.02",
|
|
754
|
-
_("Linkrole URI's MUST be in lowercase: %(linkrole)s"),
|
|
755
|
-
modelObject=modelRoleTypes, linkrole=roleURI)
|
|
756
|
-
if re.match(r"[^a-z0-9_/-]", roleURI):
|
|
757
|
-
modelXbrl.error("SBR.NL.3.2.9.03",
|
|
758
|
-
_("Linkrole URI's MUST use characters a-z0-9_-/ only: %(linkrole)s"),
|
|
759
|
-
modelObject=modelRoleTypes, linkrole=roleURI)
|
|
760
|
-
if len(roleURI) > 255:
|
|
761
|
-
modelXbrl.error("SBR.NL.3.2.9.04",
|
|
762
|
-
_("Linkrole URI's MUST NOT be longer than 255 characters, length is %(len)s: %(linkrole)s"),
|
|
763
|
-
modelObject=modelRoleTypes, len=len(roleURI), linkrole=roleURI)
|
|
764
|
-
''' removed per RH 2013-03-13 e-mail
|
|
765
|
-
if not roleURI.startswith('http://www.nltaxonomie.nl'):
|
|
766
|
-
modelXbrl.error("SBR.NL.3.2.9.05",
|
|
767
|
-
_("Linkrole URI's MUST start with 'http://www.nltaxonomie.nl': %(linkrole)s"),
|
|
768
|
-
modelObject=modelRoleTypes, linkrole=roleURI)
|
|
769
|
-
if (requiredLinkrole and
|
|
770
|
-
not roleURI.startswith(requiredLinkrole) and
|
|
771
|
-
re.match(r".*(domain$|axis$|table$|lineitem$)", roleURI)):
|
|
772
|
-
modelXbrl.error("SBR.NL.3.2.9.06",
|
|
773
|
-
_("Linkrole URI's MUST have the following construct: http://www.nltaxonomie.nl / {folder path} / {functional name} - {domain or axis or table or lineitem}: %(linkrole)s"),
|
|
774
|
-
modelObject=modelRoleTypes, linkrole=roleURI)
|
|
775
|
-
'''
|
|
776
|
-
for modelRoleType in modelRoleTypes:
|
|
777
|
-
if len(modelRoleType.id) > 255:
|
|
778
|
-
modelXbrl.error("SBR.NL.3.2.10.02",
|
|
779
|
-
_("Linkrole @id MUST NOT exceed 255 characters, length is %(length)s: %(linkroleID)s"),
|
|
780
|
-
modelObject=modelRoleType, length=len(modelRoleType.id), linkroleID=modelRoleType.id)
|
|
781
|
-
partnerPrefix = modelRoleTypes[0].modelDocument.basename.split('-')
|
|
782
|
-
if partnerPrefix: # first element before dash is prefix
|
|
783
|
-
urnPartnerLinkroleStart = "urn:{0}:linkrole:".format(partnerPrefix[0])
|
|
784
|
-
if not roleURI.startswith(urnPartnerLinkroleStart):
|
|
785
|
-
modelXbrl.error("SBR.NL.3.2.9.10",
|
|
786
|
-
_("Linkrole MUST start with urn:{NT partner code}:linkrole:, \nexpecting: %(expectedStart)s..., \nfound: %(linkrole)s"),
|
|
787
|
-
modelObject=modelRoleType, expectedStart=urnPartnerLinkroleStart, linkrole=roleURI)
|
|
788
|
-
|
|
789
|
-
if modelDocument.type in (ModelDocument.Type.SCHEMA, ModelDocument.Type.LINKBASE):
|
|
790
|
-
# check namespaces are used
|
|
791
|
-
for prefix, ns in modelDocument.xmlRootElement.nsmap.items():
|
|
792
|
-
if ((prefix not in val.valUsedPrefixes) and
|
|
793
|
-
(modelDocument.type != ModelDocument.Type.SCHEMA or ns != modelDocument.targetNamespace)):
|
|
794
|
-
modelXbrl.error("SBR.NL.2.2.0.11" if modelDocument.type == ModelDocument.Type.SCHEMA else "SBR.NL.2.3.0.08",
|
|
795
|
-
_('%(docType)s namespace declaration "%(declaration)s" is not used'),
|
|
796
|
-
modelObject=modelDocument, docType=modelDocument.gettype().title(),
|
|
797
|
-
declaration=("xmlns" + (":" + prefix if prefix else "") + "=" + ns))
|
|
798
|
-
|
|
799
|
-
del val.valUsedPrefixes
|