[Asterisk-code-review] xmldoc: Fix issue with xmlstarlet validation (asterisk[16])

Friendly Automation asteriskteam at digium.com
Wed Mar 2 12:50:53 CST 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18124 )

Change subject: xmldoc: Fix issue with xmlstarlet validation
......................................................................

xmldoc: Fix issue with xmlstarlet validation

Added the missing xml-stylesheet and Xinclude namespace
declarations in pjsip_config.xml and pjsip_manager.xml.

Updated make_xml_documentation to show detailed errors when
xmlstarlet is the validator.  It's now run once with the '-q'
option to suppress harmless/expected messages and if it actually
fails, it's run again without '-q' but with '-e' to show
the actual errors.

Change-Id: I4bdc9d2ea6741e8d2e5eb82df60c68ccc59e1f5e
---
M build_tools/make_xml_documentation
M res/res_pjsip/pjsip_config.xml
M res/res_pjsip/pjsip_manager.xml
3 files changed, 8 insertions(+), 4 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/build_tools/make_xml_documentation b/build_tools/make_xml_documentation
index fafb81c..54144ce 100755
--- a/build_tools/make_xml_documentation
+++ b/build_tools/make_xml_documentation
@@ -224,7 +224,8 @@
 			if [ "${XMLLINT}" != ":" ] ; then
 				${XMLLINT} --dtdvalid "${source_tree}/doc/appdocsxml.dtd" --path "${source_tree}/doc" --noout "${i}" || { echo "" ; exit 1 ; }
 			else
-				${XMLSTARLET} val -d "${source_tree}/doc/appdocsxml.dtd" "${i}" || { echo "" ; exit 1 ; }
+				${XMLSTARLET} val -q -d "${source_tree}/doc/appdocsxml.dtd" "${i}" ||
+					${XMLSTARLET} val -e -d "${source_tree}/doc/appdocsxml.dtd" "${i}" || { echo "" ; exit 1 ; }
 			fi
 		fi
 		${SED} -r "/^\s*(<[?]xml|<.DOCTYPE|<.?docs)/d" "${i}" >> "${output_file}"
@@ -241,7 +242,8 @@
 	if [ "${XMLLINT}" != ":" ] ; then
 		${XMLLINT} --dtdvalid "${source_tree}/doc/appdocsxml.dtd" --path "${source_tree}/doc" --noout "${output_file}" || exit 1
 	else
-		${XMLSTARLET} val -d "${source_tree}/doc/appdocsxml.dtd" "${output_file}" || exit 1
+		${XMLSTARLET} val -q -d "${source_tree}/doc/appdocsxml.dtd" "${output_file}" ||
+			${XMLSTARLET} val -e -d "${source_tree}/doc/appdocsxml.dtd" "${output_file}" || { echo "" ; exit 1 ; }
 	fi
 fi
 
diff --git a/res/res_pjsip/pjsip_config.xml b/res/res_pjsip/pjsip_config.xml
index c51c644..6470ab6 100644
--- a/res/res_pjsip/pjsip_config.xml
+++ b/res/res_pjsip/pjsip_config.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE docs SYSTEM "appdocsxml.dtd">
-<docs>
+<?xml-stylesheet type="text/xsl" href="appdocsxml.xslt"?>
+<docs xmlns:xi="http://www.w3.org/2001/XInclude">
 	<configInfo name="res_pjsip" language="en_US">
 		<synopsis>SIP Resource using PJProject</synopsis>
 		<configFile name="pjsip.conf">
diff --git a/res/res_pjsip/pjsip_manager.xml b/res/res_pjsip/pjsip_manager.xml
index a0047aa..810a5e3 100644
--- a/res/res_pjsip/pjsip_manager.xml
+++ b/res/res_pjsip/pjsip_manager.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE docs SYSTEM "appdocsxml.dtd">
-<docs>
+<?xml-stylesheet type="text/xsl" href="appdocsxml.xslt"?>
+<docs xmlns:xi="http://www.w3.org/2001/XInclude">
 	<manager name="PJSIPQualify" language="en_US">
 		<synopsis>
 			Qualify a chan_pjsip endpoint.

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18124
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I4bdc9d2ea6741e8d2e5eb82df60c68ccc59e1f5e
Gerrit-Change-Number: 18124
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220302/fd95746e/attachment-0001.html>


More information about the asterisk-code-review mailing list