diff --git a/configure.php b/configure.php index 17a6483b7..9926156ae 100755 --- a/configure.php +++ b/configure.php @@ -24,6 +24,10 @@ echo "configure.php: $cvs_id\n"; +const RNG_SCHEMA_DIR = __DIR__ . DIRECTORY_SEPARATOR . 'docbook' . DIRECTORY_SEPARATOR . 'docbook-v5.2-os' . DIRECTORY_SEPARATOR . 'rng' . DIRECTORY_SEPARATOR; +const RNG_SCHEMA_FILE = RNG_SCHEMA_DIR . 'docbook.rng'; +const RNG_SCHEMA_XINCLUDE_FILE = RNG_SCHEMA_DIR . 'docbookxi.rng'; + function usage() // {{{ { global $acd; @@ -800,7 +804,7 @@ function getFileModificationHistory(): array { echo "Validating {$ac["INPUT_FILENAME"]}... "; flush(); if ($ac['PARTIAL'] != '' && $ac['PARTIAL'] != 'no') { // {{{ - $dom->validate(); // we don't care if the validation works or not + $dom->relaxNGValidate(RNG_SCHEMA_FILE); // we don't care if the validation works or not $node = $dom->getElementById($ac['PARTIAL']); if (!$node) { echo "failed.\n"; @@ -838,7 +842,11 @@ function getFileModificationHistory(): array { } // }}} $mxml = $ac["OUTPUT_FILENAME"]; -if ($dom->validate()) { + +/* TODO: For some reason libxml does not validate the RelaxNG schema unless reloading the document in full */ +$dom->save($mxml); +$dom->load($mxml, $LIBXML_OPTS); +if ($dom->relaxNGValidate(RNG_SCHEMA_FILE)) { echo "done.\n"; printf("\nAll good. Saving %s... ", basename($ac["OUTPUT_FILENAME"])); flush(); @@ -870,26 +878,23 @@ function getFileModificationHistory(): array { exit(0); // Tell the shell that this script finished successfully. } else { echo "failed.\n"; - echo "\nThe document didn't validate, "; - - // Allow the .manual.xml file to be created, even if it is not valid. - if ($ac['FORCE_DOM_SAVE'] == 'yes') { - printf("writing %s anyway, and ", basename($ac["OUTPUT_FILENAME"])); - $dom->save($mxml); - } - - if ($ac['DETAILED_ERRORMSG'] == 'yes') { - echo "trying to figure out what went wrong...\n"; - echo "(This could take awhile. If you experience segfaults here, try again with --disable-xml-details)\n"; - libxml_clear_errors(); // Clear the errors, they contain incorrect filename&line - - $dom->load("{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}", $LIBXML_OPTS | LIBXML_DTDVALID); - print_xml_errors(); + echo "\nThe document didn't validate\n"; + + /** + * TODO: Integrate jing to explain schema violations as libxml is *useless* + * And this is not going to change for a while as the maintainer of libxml2 even acknowledges: + * > As it stands, libxml2's Relax NG validator doesn't seem suitable for production. + * cf. https://gitlab.gnome.org/GNOME/libxml2/-/issues/448 + */ + $output = shell_exec('java -jar ' . $srcdir . '/docbook/jing.jar ' . RNG_SCHEMA_FILE. ' ' . $acd['OUTPUT_FILENAME']); + if ($output === null) { + echo "Command failed do you have Java installed?"; } else { - echo "here are the errors I got:\n"; - echo "(If this isn't enough information, try again with --enable-xml-details)\n"; - print_xml_errors(false); + echo $output; } + //echo 'Please use Jing and the:' . PHP_EOL + // . 'java -jar ./build/jing.jar /path/to/doc-base/docbook/docbook-v5.2-os/rng/docbookxi.rng /path/to/doc-base/.manual.xml' . PHP_EOL + // . 'command to check why the RelaxNG schema failed.' . PHP_EOL; // Exit normally when don't care about validation if ($ac["FORCE_DOM_SAVE"] == "yes") { diff --git a/docbook/docbook-xml/README b/docbook/docbook-xml/README deleted file mode 100644 index 6fc60c4bf..000000000 --- a/docbook/docbook-xml/README +++ /dev/null @@ -1,8 +0,0 @@ -README for the DocBook XML DTD - -For more information about DocBook, please see - - http://www.oasis-open.org/docbook/ - -Please send all questions, comments, concerns, and bug reports to the -DocBook mailing list: docbook@lists.oasis-open.org diff --git a/docbook/docbook-xml/docbook.dtd b/docbook/docbook-xml/docbook.dtd deleted file mode 100644 index ba33b842d..000000000 --- a/docbook/docbook-xml/docbook.dtd +++ /dev/null @@ -1,4246 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docbook/jing.jar b/docbook/jing.jar new file mode 100644 index 000000000..e8dd52687 Binary files /dev/null and b/docbook/jing.jar differ diff --git a/install-unix.xml.in b/install-unix.xml.in index 359bdeacb..a445d072b 100644 --- a/install-unix.xml.in +++ b/install-unix.xml.in @@ -1,6 +1,5 @@ - @@ -21,7 +20,7 @@ ]> - + Installing PHP Preface diff --git a/install-win.xml.in b/install-win.xml.in index 2a7c567b6..5d5d362d1 100644 --- a/install-win.xml.in +++ b/install-win.xml.in @@ -1,6 +1,5 @@ - @@ -26,7 +25,7 @@ en/install/windows/index.xml file to build this file --> - + Installation on Windows systems Installing PHP on modern Microsoft Windows systems and recommended configuration with common web servers. diff --git a/manual.xml.in b/manual.xml.in index 36593f636..17d7e556e 100644 --- a/manual.xml.in +++ b/manual.xml.in @@ -1,9 +1,5 @@ - - + @TRANSLATION_ONLY_INCL_BEGIN@ @@ -37,7 +33,7 @@ %frontpage.entities; ]> - + &PHPManual; &bookinfo;