Repository navigation
Retire XML DOM Management: ES SII and XML VAT Declaration (native XML) - #12641
Draft
Darrick (darjoo) wants to merge 1 commit into
Draft
Darrick (darjoo) wants to merge 1 commit into
Darrick (darjoo) wants to merge 1 commit into
Conversation
Build the SII XML (SII XML Creator), format SII Session request/response XML, and generate the XML VAT Declaration file with native AL XML types instead of codeunit 6224 "XML DOM Management" and DotNet System.Xml. - SII XML Creator: native XmlDocument/XmlElement/XmlNode. The Envelope is read from text so the declaration and namespace declaration order match the old DotNet output; child elements resolve sii/siiLR/soapenv prefixes from it. New GenerateXml overload with XmlDocument; DotNet overload obsoleted (CLEAN30). 12 integration events with DotNet XmlNode parameters get native *V2 replacements; the old events are obsoleted and no longer raised. InnerXml text events keep DotNet-compatible text. - SII Doc. Upload Management: uses the native GenerateXml overload and converts to its existing DotNet XmlDocument (no other change). - SII Session: XMLTextIndent uses native XmlDocument. - XML VAT Declaration: native XmlDocument; DotNet AppendVATStatementLine overload obsoleted (CLEAN30). - ES SII tests and Library - SII moved to native XmlDocument. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
This is part of retiring BaseApp codeunit 6224
XML DOM Management(Remove/Reduce dotnet). It covers the ES SII area and the ESXML VAT Declarationreport. These now build XML with native ALXmlDocument/XmlElement/XmlNode/XmlAttributeinstead of cu 6224 and DotNetSystem.Xml. Other areas are handled in separate PRs, and a final PR obsoletes the codeunit. Follows the pattern of #10755, #12254, #12324 and #12606. Tag is30.0/CLEAN30, which matches BaseAppapp.json30.0.0.0 and #12606.In scope
SII XML Creator(cu 10750)AddElementWithPrefixand 35FindNode('..')calls now go through two small local native helpers.Enveloperoot (declaration plusxmlns:sii,xmlns:siiLR,xmlns:soapenv) is read from text. That keeps the declaration (nostandalone="") and the namespace-declaration order the DotNet writer produced. Child elements are created in the namespace and take their prefix from the root, so element names, order and number/date formatting are unchanged.GenerateXml(...; var XMLDocOut: XmlDocument; ...)overload. The OnPrem DotNet overload is kept under#if not CLEAN30and marked obsolete. It wraps the native one and loads the result into the DotNet document.DotNet XmlNodeget native replacements with aV2suffix, for exampleOnBeforeContraparteNodeV2. The old events are kept under#if not CLEAN30and marked obsolete. They are no longer raised. The document is now native, so there is no live DotNet node to pass, and a copied node would silently drop subscriber changes. The obsolete reason says this.OnAfterFillDetalleIVANodeandOnAfterInitializePurchXmlBodypass the node's inner XML as text and are unchanged. The text has the same form as DotNetInnerXml. When a subscriber changes it, the text is parsed back and redundant root namespace declarations are dropped, as DotNet did.OnBeforeGenerateXmlDocumentandOnAfterGenerateXmlDocumentkeep their copy semantics.SII Session(table 10753):XMLTextIndentuses a nativeXmlDocument. Whitespace-only text nodes are removed first so the indented output matches DotNetLoad+Save.XML VAT Declaration(report 10718): the file is built with native types and the root element is written without a declaration. The old code never appended its processing instruction, so there was no declaration before either. New nativeAppendVATStatementLineoverload; the DotNet one is obsolete underCLEAN30.Outside the listed scope, needed because the Clean build removes the DotNet
GenerateXml(agreed with the coordinating session; no other session touches these files)SII Doc. Upload Management:TryGenerateXmlcalls the native overload and loads the result into the existing DotNetXmlDocumentthat the HTTP code still uses. Nothing else in that file changes.Library - SII:XMLDocvariables and library parameters are now nativeXmlDocument. Library helpers use XPath with a namespace manager in place ofGetElementsByTagName. Two tests asserted the DotNet "variable not instantiated" error text to provesii:CodigoPaisis absent; they now callValidateNoElementsByName.Linked work
Fixes AB#649587
Part of AB#647963
How I validated this
What I tested and the outcome
Compiled locally with
alc.exefrom artifactbcinsider/Sandbox/30.0.55871.0, with CodeCop, UICop andsrc/rulesets/base.ruleset.json, on the composed ES view (New-GDLView -CountryCode ES):CLEAN25..CLEAN30: passed. The only remaining reference to "XML DOM Management" in this area is gone.main: no new warnings in either mode.Output equivalence was checked in PowerShell 7 against
System.XmlandSystem.Xml.Linq(the types behind AL native XML):sii,siiLR,soapenv) matches DotNet.<x />and escaping matches.InnerXml, includingxmlns:on top-level children.XML VAT Declarationoutput with no declaration and no BOM matches DotNetSave(file).Pending (not run yet):
Test VAT Statement(147590) in an ES BC container.SII XML Creatorbeside the native one on every SII test scenario, comparesOuterXmland the text passed to the inner-XML events, and compares theXML VAT Declarationfile output byte-for-byte.Both are built. They're waiting for a free container slot because the previous slot needs a manual repair. This PR stays in draft until they pass.
Risk & compatibility
XmlNodeevents are no longer raised. Subscribers must move to the...V2events, which have the same parameters with a nativeXmlNode. This is called out in each obsolete reason.GenerateXmlandAppendVATStatementLineoverloads still work and are removed withCLEAN30.Library - SIIpublic verification procedures now take a nativeXmlDocument. The only callers are the ES SII tests updated here.