@@ -164,8 +164,8 @@ function merge_update_required($scan, $persist)
164
164
if (!$ sysTime ) return true ;
165
165
//print "\n<br/>xml_file::merge_update_required - sysTime=$sysTime, aPath=$this->aPath";
166
166
//print_r($this->merge_list());
167
- foreach ($ this ->merge_list ($ scan ) as $ m )
168
- if (@filemtime ($ m ) > $ sysTime ) return true ;
167
+ foreach ($ this ->merge_list ($ scan ) as $ accessor )
168
+ if (@filemtime ($ accessor ) > $ sysTime ) return true ;
169
169
return false ;
170
170
}
171
171
@@ -180,9 +180,9 @@ function merge_join_to_xml($scan, $root, $item, $target, $persist)
180
180
}
181
181
182
182
// print "\n<br/>xml_file:: merge_join_to_xml - list="; print_r($this->merge_list($scan));
183
- foreach ($ this ->merge_list ($ scan ) as $ m ) {
184
- // print "\n<br/>xml_file::merge_join_to_xml - m=$m ";
185
- $ M = new xml_file ($ m );
183
+ foreach ($ this ->merge_list ($ scan ) as $ accessor ) {
184
+ // print "\n<br/>xml_file::merge_join_to_xml - accessor=$accessor ";
185
+ $ M = new xml_file ($ accessor );
186
186
$ n = 0 ;
187
187
while (++$ n > 0 ) { // Always. See break below.
188
188
// print "\n<br/>>xml_file::merge_join_to_xml - cnt = " . $this->cnt("/$root/$item");
@@ -427,7 +427,7 @@ static function toDoc($k)
427
427
return null ;
428
428
}
429
429
430
- static function toXML ($ k )
430
+ static function toXml ($ k )
431
431
{
432
432
if (is_string ($ k )) {
433
433
if (file_exists ($ k )) return file_get_contents ($ k );
@@ -439,6 +439,16 @@ static function toXML($k)
439
439
}
440
440
return null ;
441
441
}
442
+
443
+ static function toXhtml ($ k )
444
+ {
445
+ $ s = self ::toXML ($ k );
446
+ if (substr ($ s , 0 , 6 ) == "<?xml " && false !== ($ l = strpos ($ s , '?> ' )))
447
+ $ s = substr ($ s , $ l + 2 );
448
+
449
+ $ s = trim ($ s );
450
+ return $ s ;
451
+ }
442
452
443
453
static function toJson ($ k ) { return self ::toXmlFile ($ k )->saveJson (); }
444
454
@@ -547,14 +557,14 @@ static function qsplit($separator = ",", $string, $delim = "\"", $remove = true)
547
557
}
548
558
549
559
// Extends XPaths correctly
550
- static function extend_path ($ b , $ l , $ m )
560
+ static function extend_path ($ base , $ field , $ accessor )
551
561
{
552
- if ($ b == "" ) $ b = '/ ' ;
553
- if ($ b [strlen ($ b ) - 1 ] != '/ ' ) $ b = $ b . "/ " ;
554
- if ($ m == '@ ' ) $ m = $ b . '@ ' . $ l ;
555
- else if ($ m == '' ) $ m = $ b . $ l ;
556
- else if ($ m [0 ] != '/ ' ) $ m = $ b . $ m ;
557
- return $ m ;
562
+ if ($ base == "" ) $ base = '/ ' ;
563
+ if ($ base [strlen ($ base ) - 1 ] != '/ ' ) $ base = $ base . "/ " ;
564
+ if ($ accessor == '@ ' ) $ accessor = $ base . '@ ' . $ field ;
565
+ else if ($ accessor == '' ) $ accessor = $ base . $ field ;
566
+ else if ($ accessor [0 ] != '/ ' ) $ accessor = $ base . $ accessor ;
567
+ return $ accessor ;
558
568
}
559
569
////////////////////////////////////////////////////////////////////////////////////////////////////////
560
570
////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -675,18 +685,18 @@ private function CreateXMLNode($srcx, $value = "")
675
685
676
686
$ s = "" ;
677
687
$ xsx = $ this ->xpathsplit ($ srcx );
678
- foreach ($ xsx as $ n => $ m ) {
688
+ foreach ($ xsx as $ n => $ accessor ) {
679
689
$ pre_s = $ s ;
680
- if (!($ m == "" && $ s == "" )) $ s = "$ s/ $ m " ;
690
+ if (!($ accessor == "" && $ s == "" )) $ s = "$ s/ $ accessor " ;
681
691
if ($ s == "" ) continue ;
682
692
683
693
$ en = $ this ->query ($ s );
684
694
if ($ en ->length == 0 ) {
685
- if ($ m [0 ] == '@ ' ) {
686
- $ this ->replace_attribute ($ parent , substr ($ m , 1 ), $ value , false );
695
+ if ($ accessor [0 ] == '@ ' ) {
696
+ $ this ->replace_attribute ($ parent , substr ($ accessor , 1 ), $ value , false );
687
697
} else {
688
- if (!$ this ->XPathAttribute ($ m , $ a , $ b , $ c )) {
689
- $ dd = $ this ->Doc ->createElement ($ m );
698
+ if (!$ this ->XPathAttribute ($ accessor , $ a , $ b , $ c )) {
699
+ $ dd = $ this ->Doc ->createElement ($ accessor );
690
700
if ($ n == count ($ xsx ) - 1 )
691
701
$ this ->replace_content ($ dd , $ value );
692
702
$ parent ->appendChild ($ dd );
0 commit comments