On 5/6/14 10:20 PM, Peter Eisentraut wrote: > Agreed. I have committed the SGML changes that make things valid now, > but I will postpone the xmllint addition until the 9.5 branch, complete > with more documentation.
Per the above announcement, here is an updated patch, also with more documentation and explanations. It would especially be valuable if someone with a different-than-mine OS would verify whether they can install xmllint according to the documentation, or update the documentation if not.
>From 27f1fabb4afb32ec44373100ab438277ebdac806 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Thu, 14 Aug 2014 21:48:44 -0400 Subject: [PATCH] doc: Check DocBook XML validity during the build Building the documentation with XSLT does not check the DTD, like a DSSSL build would. One can often get away with having invalid XML, but the stylesheets might then create incorrect output, as they are not designed to handle that. Therefore, check the validity of the XML against the DTD, using xmllint, during the build. Add xmllint detection to configure, and add some documentation. xmllint comes with libxml2, which is already in use, but it might be in a separate package, such as libxml2-utils on Debian. --- configure | 43 +++++++++++++++++++++++++++++++++++++++++++ configure.in | 1 + doc/src/sgml/Makefile | 9 ++++++++- doc/src/sgml/docguide.sgml | 19 +++++++++++++++++-- src/Makefile.global.in | 1 + 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 0f435b5..57c2455 100755 --- a/configure +++ b/configure @@ -630,6 +630,7 @@ vpath_build PROVE OSX XSLTPROC +XMLLINT COLLATEINDEX DOCBOOKSTYLE have_docbook @@ -14415,6 +14416,48 @@ fi fi +for ac_prog in xmllint +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_XMLLINT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$XMLLINT"; then + ac_cv_prog_XMLLINT="$XMLLINT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_XMLLINT="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +XMLLINT=$ac_cv_prog_XMLLINT +if test -n "$XMLLINT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5 +$as_echo "$XMLLINT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$XMLLINT" && break +done + for ac_prog in xsltproc do # Extract the first word of "$ac_prog", so it can be a program name with args. diff --git a/configure.in b/configure.in index f8a4507..0d963c6 100644 --- a/configure.in +++ b/configure.in @@ -1864,6 +1864,7 @@ PGAC_PROG_JADE PGAC_CHECK_DOCBOOK(4.2) PGAC_PATH_DOCBOOK_STYLESHEETS PGAC_PATH_COLLATEINDEX +AC_CHECK_PROGS(XMLLINT, xmllint) AC_CHECK_PROGS(XSLTPROC, xsltproc) AC_CHECK_PROGS(OSX, [osx sgml2xml sx]) diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile index 271c700..d2517f2 100644 --- a/doc/src/sgml/Makefile +++ b/doc/src/sgml/Makefile @@ -40,6 +40,10 @@ ifndef OSX OSX = osx endif +ifndef XMLLINT +XMLLINT = xmllint +endif + ifndef XSLTPROC XSLTPROC = xsltproc endif @@ -76,6 +80,7 @@ override SPFLAGS += -wall -wno-unused-param -wno-empty -wfully-tagged man distprep-man: man-stamp man-stamp: stylesheet-man.xsl postgres.xml + $(XMLLINT) --noout --valid postgres.xml $(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $^ touch $@ @@ -252,11 +257,13 @@ endif xslthtml: xslthtml-stamp xslthtml-stamp: stylesheet.xsl postgres.xml + $(XMLLINT) --noout --valid postgres.xml $(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $^ cp $(srcdir)/stylesheet.css html/ touch $@ htmlhelp: stylesheet-hh.xsl postgres.xml + $(XMLLINT) --noout --valid postgres.xml $(XSLTPROC) $(XSLTPROCFLAGS) $^ %-A4.fo.tmp: stylesheet-fo.xsl %.xml @@ -266,7 +273,6 @@ htmlhelp: stylesheet-hh.xsl postgres.xml $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type USletter -o $@ $^ FOP = fop -XMLLINT = xmllint # reformat FO output so that locations of errors are easier to find %.fo: %.fo.tmp @@ -279,6 +285,7 @@ XMLLINT = xmllint epub: postgres.epub postgres.epub: postgres.xml + $(XMLLINT) --noout --valid $< $(DBTOEPUB) $< diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml index 816375f..2fe325e 100644 --- a/doc/src/sgml/docguide.sgml +++ b/doc/src/sgml/docguide.sgml @@ -149,6 +149,20 @@ <title>Tool Sets</title> </varlistentry> <varlistentry> + <term><ulink url="http://xmlsoft.org/">Libxml2</ulink> for <command>xmllint</command></term> + <listitem> + <para> + This library and the <command>xmllint</command> tool it contains are + used for processing XML. Many developers will already + have <application>Libxml2</application> installed, because it is also + used when building the PostgreSQL code. Note, however, + that <command>xmllint</command> might need to be installed from a + separate subpackage. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><ulink url="http://xmlsoft.org/XSLT/">Libxslt</ulink> for <command>xsltproc</command></term> <listitem> <para> @@ -201,7 +215,8 @@ <title><productname>Linux</productname> <acronym>RPM</acronym> Installation</tit installing, or the following packages: <filename>sgml-common</filename>, <filename>docbook</filename>, <filename>stylesheets</filename>, <filename>openjade</filename> - (or <filename>jade</filename>). You may also need <filename>sgml-tools</filename> + (or <filename>jade</filename>). You may also need <filename>sgml-tools</filename>, + either <filename>libxml2</filename> or <filename>libxml2-utils</filename>, and either <filename>xsltproc</filename> or <filename>libxslt</>. If your distributor does not provide these then you should be able to make use of the packages from some other, reasonably compatible vendor. @@ -273,7 +288,7 @@ <title>Debian Packages</title> available for <productname>Debian GNU/Linux</productname>. To install, simply use: <programlisting> -apt-get install docbook docbook-dsssl docbook-xsl openjade1.3 opensp xsltproc +apt-get install docbook docbook-dsssl docbook-xsl libxml2-utils openjade1.3 opensp xsltproc </programlisting> </para> </sect2> diff --git a/src/Makefile.global.in b/src/Makefile.global.in index ecd4015..b3b5df5 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -342,6 +342,7 @@ DOCBOOKSTYLE = @DOCBOOKSTYLE@ JADE = @JADE@ NSGMLS = @NSGMLS@ OSX = @OSX@ +XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ # Code coverage -- 2.0.4
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers