xml file to print to help in html table data.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • turk182
    New Member
    • Mar 2014
    • 1

    #1

    xml file to print to help in html table data.

    Hi, I need your help.

    xml file(exapropert ies.ashx):

    <?xml version="1.0" encoding="utf-8"?>
    <ROOT>
    <STOKLAR>
    <STOK Stok_Kod="" Stok_Ad="">
    <OZELLIKLER>
    <OZELLIK></OZELLIK>
    <DEGER></DEGER>
    <OZELLIK></OZELLIK>
    <DEGER></DEGER>
    <OZELLIK></OZELLIK>
    <DEGER></DEGER>
    <OZELLIK></OZELLIK>
    <DEGER></DEGER>
    <OZELLIK></OZELLIK>
    <DEGER></DEGER>
    <OZELLIK></OZELLIK>
    <DEGER></DEGER>
    </OZELLIKLER>
    </STOK>
    </STOKLAR>
    </ROOT>

    --------------------------------------------

    This way you can print:

    Code:
    <?php
    
    $root = simplexml_load_file("exaproperties.ashx");
    
    foreach ($root->STOKLAR->STOK as $stok) {
    	foreach ($stok->OZELLIKLER as $ozellikler) {
    	for ($i=0;$i <=count($ozellikler);$i++){ 
    			
    					 echo '<table>' ;
                         echo '<tr>' ;
                         echo '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$ozellikler->OZELLIK[$i].'</td>';
                         echo '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">:</td>';
                         echo '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$ozellikler->DEGER[$i].'</td>';
                         echo '</tr>' ;        
                         echo '</table>' ;
                         $i++;
    					 
            }
            }
    		}
    
    ?>

    ----------------------------------------------------
    However, only the html table is added to the database, data is not added into HTML table cells.

    Code:
    $xmlData = simplexml_load_file($xml_directory.$this->code."/exaproperties.ashx");
    		 foreach ($xmlData->STOKLAR->children() as $STOK) {
             foreach ($STOK->children() as $OZELLIKLER => $data) {
    	     for ($i=0;$i <=count($data);$i++){
        
                         $tablo = '';
                         $tablo.= '<table>' ;
                         $tablo.= '<tr>' ;
                         $tablo = '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$data->OZELLIK[$i].'</td>';
                         $tablo.= '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">::</td>';
                         $tablo.= '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$data->DEGER[$i].'</td>';
                         $tablo.= '</tr>' ;        
                         $tablo.= '</table>' ;
            }
        }
    }

    ----------------------------------------
    If the support I rejoice.(Sorry for bad english)
Working...