Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2014, 07:02 AM
Registered User
 
Join Date: Mar 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml file to print to help in html table data.

Hi, I need your help.

xml file:

<?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:

PHP 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.

PHP 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)





Similar Threads
Thread Thread Starter Forum Replies Last Post
converting Table XML to HTML kvbhaskar7 XSLT 5 November 10th, 2011 09:36 PM
XML Table to Html JohnBampton XSLT 2 March 9th, 2009 08:54 AM
constructing a HTML table from xml data using xslt rameshnarayan XSLT 0 September 19th, 2005 06:53 AM
how to print html data from access database method Classic ASP Databases 2 March 11th, 2005 12:51 PM
putting xml data in a html <table> rev XSLT 4 September 10th, 2003 08:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.