cadrumo.application.filing._export_xml_dictionary module¶
XML-dictionary declaration export renderer.
Renders approved declaration drafts through registry xml_dictionary export
layouts. The renderer reuses the official AEAT dictionary and XSD source refs
resolved by the registry schema provider, then writes only a local XML payload
for the draft export path.
See also
export_draft()Draft export service that selects this renderer for XML dictionary layouts.
ModeloDraftApproved declaration draft whose casilla and header values are rendered.
ExportLayoutDefinitionRegistry export layout carrying dictionary and XSD source references.
XmlDictionaryEntryParsed dictionary row consumed while projecting XML fields.
xml_dictionary_entries()Registry helper that reads the official dictionary source.
RegistrySchemaAccessorRuntime schema provider that resolves source roots and references.
- render_xml_dictionary_layout(layout, *, draft, headers, dictionary_values=None, schema_provider)[source]¶
Render an XML-dictionary layout for an approved declaration draft.
- Parameters:
layout (
ExportLayoutDefinition) – RegistryExportLayoutDefinitionwhose format isxml_dictionary.draft (
ModeloDraft) – ApprovedModeloDraftsupplying casilla values, modelo, and period metadata.headers (
Mapping[FilingProducerKey,object]) – Normalized declaration header values such as identity fields.dictionary_values (
Mapping[str,object] |None) – Values addressed by the dictionary field id AEAT declares for them, each still carrying its own Python type. Absent (orNone) means the caller declares no such values, which is how every caller outside the work-unit export service reaches here.schema_provider (
RegistrySchemaAccessor) –RegistrySchemaAccessorthat resolves dictionary and XSD source references.
- Return type:
- Returns:
UTF-8 XML declaration bytes for the local export artefact.
- expected_xml_dictionary_root_identity(layout, *, draft, schema_provider)[source]¶
Return the
Declaracionroot attributesdraftidentifies itself by.The sole declaration of the root-attribute contract. The writer builds the element from it and
verify_export()rebuilds the same mapping to compare against what a file on disk actually carries, so the two halves cannot name different attributes — which is how the verifier came to check none of them at all.- Parameters:
layout (
ExportLayoutDefinition) – Thexml_dictionaryexport layout being rendered or verified.draft (
ModeloDraft) – The approvedModeloDraftsupplying modelo and period identity.schema_provider (
RegistrySchemaAccessor) – Resolves the layout’s XSD source and its version.
- Return type:
- Returns:
The root attributes, keyed exactly as they appear on the element.
- read_xml_dictionary_root_identity(payload)[source]¶
Return the root identity attributes carried by an exported XML declaration.
- Parameters:
payload (
bytes) – The exported XML declaration bytes.- Return type:
- Returns:
The declared root attributes, keyed as
expected_xml_dictionary_root_identity()writes them. A key is absent when the file omits that attribute, which the caller must treat as a divergence rather than as a match.- Raises:
FilingExportValidationError – The payload is not parseable XML, or its root is not a
Declaracionelement.
- format_xml_dictionary_value(data_type, value)[source]¶
Render one value in the form the dictionary row’s declared type accepts.
The row’s
data_typedecides the rendering, not the Python type of the value. Deciding from the value alone cannot distinguish rows that happen to carry the same Python type but are declared differently by AEAT: every boolean rendered as"S"/"N"regardless of whether the row wastipo_logico(which accepts only0/1) ortipo_SINO_Exclusivo(onlySI/NO), and every numeric row was rendered with two decimals even where the row is anxs:integer.