Skip to content

Commit e764219

Browse files
alfsbAndré L F S Bacci
andauthored
Simplify XInclude/XPointer error reporting. (#98)
Co-authored-by: André L F S Bacci <[email protected]>
1 parent bc270ef commit e764219

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

configure.php

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ function usage() // {{{
6767
--with-php=PATH Path to php CLI executable [detect]
6868
--with-lang=LANG Language to build [{$acd['LANG']}]
6969
--with-partial=my-xml-id Root ID to build (e.g. <book xml:id="MY-ID">) [{$acd['PARTIAL']}]
70-
--disable-broken-file-listing Do not ignore translated files in
70+
--disable-broken-file-listing Do not ignore translated files in
7171
broken-files.txt
72+
--disable-xpointer-reporting Do not show XInclude/XPointer failures. Only effective
73+
on translations
7274
--redirect-stderr-to-stdout Redirect STDERR to STDOUT. Use STDOUT as the
7375
standard output for XML errors [{$acd['STDERR_TO_STDOUT']}]
7476
--output=FILENAME Save to given file (i.e. not .manual.xml)
@@ -356,6 +358,7 @@ function generate_sources_file() // {{{
356358
'INPUT_FILENAME' => 'manual.xml',
357359
'TRANSLATION_ONLY_INCL_BEGIN' => '',
358360
'TRANSLATION_ONLY_INCL_END' => '',
361+
'XPOINTER_REPORTING' => 'yes',
359362
); // }}}
360363

361364
$ac = $acd;
@@ -490,7 +493,11 @@ function generate_sources_file() // {{{
490493
case 'stderr-to-stdout':
491494
$ac['STDERR_TO_STDOUT'] = $v;
492495
break;
493-
496+
497+
case 'xpointer-reporting':
498+
$ac['XPOINTER_REPORTING'] = $v;
499+
break;
500+
494501
case '':
495502
break;
496503

@@ -710,14 +717,26 @@ function generate_sources_file() // {{{
710717
print_xml_errors();
711718
errors_are_bad(1);
712719
}
713-
714720
echo "done.\n";
715-
echo "Validating {$ac["INPUT_FILENAME"]}... ";
721+
722+
echo "Running XInclude/XPointer... ";
716723
flush();
717724

718725
$dom->xinclude();
719-
print_xml_errors();
720726

727+
echo "done.\n";
728+
flush();
729+
730+
if ( $ac['XPOINTER_REPORTING'] == 'yes' || ($ac['LANG'] == 'en') )
731+
{
732+
$errors = libxml_get_errors();
733+
$output = ( $ac['STDERR_TO_STDOUT'] == 'yes' ) ? STDOUT : STDERR;
734+
foreach( $errors as $error )
735+
fprintf( $output , "{$error->message}\n");
736+
}
737+
738+
echo "Validating {$ac["INPUT_FILENAME"]}... ";
739+
flush();
721740
if ($ac['PARTIAL'] != '' && $ac['PARTIAL'] != 'no') { // {{{
722741
$dom->validate(); // we don't care if the validation works or not
723742
$node = $dom->getElementById($ac['PARTIAL']);

0 commit comments

Comments
 (0)