@@ -85,6 +85,8 @@ function usage() // {{{
8585 --with-php=PATH Path to php CLI executable [detect]
8686 --with-lang=LANG Language to build [ {$ acd ['LANG ' ]}]
8787 --with-partial=my-xml-id Root ID to build (e.g. <book xml:id="MY-ID">) [ {$ acd ['PARTIAL ' ]}]
88+ --with-jing=auto|yes|no Validate with Jing (requires Java) instead of
89+ libxml [ {$ acd ['JING ' ]}]
8890 --disable-broken-file-listing Do not ignore translated files in
8991 broken-files.txt
9092 --disable-xpointer-reporting Do not show XInclude/XPointer failures. Only effective
@@ -294,6 +296,7 @@ function find_xml_files($path) // {{{
294296 'TRANSLATION_ONLY_INCL_BEGIN ' => '' ,
295297 'TRANSLATION_ONLY_INCL_END ' => '' ,
296298 'XPOINTER_REPORTING ' => 'yes ' ,
299+ 'JING ' => 'auto ' ,
297300); // }}}
298301
299302$ ac = $ acd ;
@@ -425,6 +428,14 @@ function find_xml_files($path) // {{{
425428 $ ac ['XPOINTER_REPORTING ' ] = $ v ;
426429 break ;
427430
431+ case 'jing ' :
432+ if (!in_array ($ v , array ('auto ' , 'yes ' , 'no ' ))) {
433+ errbox ("Invalid value for --with-jing: {$ v } (expected auto, yes or no) " );
434+ errors_are_bad (1 );
435+ }
436+ $ ac ['JING ' ] = $ v ;
437+ break ;
438+
428439 case '' :
429440 break ;
430441
@@ -989,11 +1000,17 @@ function xml_validate( $dom )
9891000
9901001 // Jing is faster, but depends on Java.
9911002
992- $ out = null ;
993- $ ret = null ;
994- exec ( "java -version 2>&1 " , $ out , $ ret );
1003+ $ jing = $ GLOBALS ['ac ' ]['JING ' ];
9951004
996- if ( $ ret == 0 )
1005+ if ( $ jing == 'auto ' )
1006+ {
1007+ $ out = null ;
1008+ $ ret = null ;
1009+ exec ( "java -version 2>&1 " , $ out , $ ret );
1010+ $ jing = $ ret == 0 ? 'yes ' : 'no ' ;
1011+ }
1012+
1013+ if ( $ jing == 'yes ' )
9971014 xml_validate_jing ();
9981015 else
9991016 xml_validate_libxml ( $ dom );
0 commit comments