[asterisk-bugs] [JIRA] (ASTERISK-29792) xmldoc: Dump invalid to XML DTD: XInclude

Alexander Traud (JIRA) noreply at issues.asterisk.org
Mon Dec 6 08:17:34 CST 2021


Alexander Traud created ASTERISK-29792:
------------------------------------------

             Summary: xmldoc: Dump invalid to XML DTD: XInclude
                 Key: ASTERISK-29792
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29792
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Codecs/codec_opus, Documentation
    Affects Versions: 19.0.0, 18.8.0, 16.22.0
            Reporter: Alexander Traud


In Jul. 2018 with Asterisk 13.23.0 (Gerrit-[9541|https://gerrit.asterisk.org/9541], Commit [58c7b64|https://github.com/asterisk/asterisk/commit/58c7b64]), the in-memory, runtime XML document(s) are copied into a new XML root to create a single file. By this, any XML Stylesheet (XSLT) is removed. Furthermore, libxml2 moves the namespace ‘xi’ for W3C XInclude from the root XML element down to four XML elements called ‘manager’:
* CoreShowChannels
* PJSIPShowEndpoint
* PJSIPShowAors
* PJSIPShowAuths

However, {{doc/appdocsxml.dtd}} only allows that namespace in the root. Consequently, both XMLStarlet and xmllint (of libxml2) state that the XML file created as a result of the command {{xmldoc dump <file>}} is not valid:
{code}
No declaration for attribute xmlns:xi of element manager
{code}
The commands used:
{code}
xmllint --noout --dtdvalid doc/appdocsxml.dtd <file>
xmlstarlet val --err --dtd doc/appdocsxml.dtd <file>
{code}
When reversing that change, the resulting XML file validates, if the Digium audio-codec module opus_codec is not loaded.

*Note 1*:
I am not planning to work on this because I came to the conclusion that the whole approach in that change is wrong: Why does codec_opus module create a complete new XML document, why does it not attach its XML element ‘configInfo’ into the existing XML DOM? Because that module is closed source, I can not investigate and fix further. My recommendation: Reverse that change and fix the codec_opus module instead. Yes, I could fix that change and copy over the namespace(s) and XSLT … however, as stated, I do not think that the is correct approach.

*Note 2*:
The dumped XML file still lacks a DTD. Not sure why.

*Note 3*:
This issue report here is rather a nit-pick because the XML file is valid semantically. Another approach would be simply to change the DTD or not validating against the DTD at all. However, this issue _blocks_ me to add a DTD validation step to {{tests/CI/publishAsteriskDocs.sh}} to prevent similar issues in future.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list