From 2f996a3ab48899f7ede64028f34d49ce89fc0f48 Mon Sep 17 00:00:00 2001 From: "Eliel C. Sardanons" Date: Sat, 16 May 2009 20:01:22 +0000 Subject: [PATCH] Allow to include sections of other parts of the xml documentation. Avoid duplicating xml documentation by allowing to include other parts of the xml documentation using XInclude. Example: (Insert this line to include the synopsis of the CHANNEL function xml documentation). It is also possible to include documentation from other files in the 'documentation/' directory using the href="" attribute inside a xinclude element. (closes issue #15107) Reported by: lmadsen (issue #14444) Reported by: ewieling git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194982 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- Makefile | 2 +- doc/appdocsxml.dtd | 39 +++++++++++++++++++++++++-------------- main/xml.c | 9 ++++++++- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 0e2acb73d5..9bed308a8e 100644 --- a/Makefile +++ b/Makefile @@ -497,7 +497,7 @@ doc/core-en_US.xml: $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\" @echo -n "Building Documentation For: " @echo "" > $@ @echo "" >> $@ - @echo "" >> $@ + @echo "" >> $@ @for x in $(MOD_SUBDIRS); do \ echo -n "$$x " ; \ for i in $$x/*.c; do \ diff --git a/doc/appdocsxml.dtd b/doc/appdocsxml.dtd index ba0ef2726c..c06f720e1b 100644 --- a/doc/appdocsxml.dtd +++ b/doc/appdocsxml.dtd @@ -1,4 +1,15 @@ - + + + + + @@ -12,19 +23,19 @@ - + - + - + - + - + @@ -34,24 +45,24 @@ - + - + - + - + @@ -59,11 +70,11 @@ - - + + - - + + diff --git a/main/xml.c b/main/xml.c index 9a0c66d900..fe00bfbf69 100644 --- a/main/xml.c +++ b/main/xml.c @@ -29,6 +29,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #if defined(HAVE_LIBXML2) #include #include +#include /* libxml2 ast_xml implementation. */ @@ -55,11 +56,17 @@ struct ast_xml_doc *ast_xml_open(char *filename) } doc = xmlReadFile(filename, NULL, XML_PARSE_RECOVER); + if (doc) { + /* process xinclude elements. */ + if (xmlXIncludeProcess(doc) <= 0) { + xmlFreeDoc(doc); + return NULL; + } + } return (struct ast_xml_doc *) doc; } - void ast_xml_close(struct ast_xml_doc *doc) { if (!doc) {