Re: create xml in php
Posted: Tue Jan 29, 2008 5:34 am
i've do what you tell in the above thread with no progress.
regards
regards
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$doc = new DOMDocument();
$doc->load($fileUrl);
$nodeName = $doc->getElementsByTagName(node name");
$returnValue[0] = $address->item(0)->nodeValue;
return $returnValue;
?>
Code: Select all
<?php
$filename = 'out.xml';
$doc = new DOMDocument('1.0', 'Windows-1252');
$doc->formatOutput = true;
$r = $doc->createElement( "AuditFile" );
$doc->appendChild( $r );
$MasterFiles = $doc->createElement( "MasterFiles" );
/* Customer */
$Customer = $doc->createElement( "Customer" );
$customerDB = dbase_open('C:\root\ing\inc_mes.dbf', 0) or die (error());
if ( $customerDB ) {
//$record_numbers = dbase_numrecords( $customerDB );
$record_numbers = 20;
for ($i = 1; $i <= $record_numbers; $i++) {
$row = dbase_get_record_with_names($customerDB, $i);
$CustomerID = $doc->createElement( "CustomerID" );
$CustomerID->appendChild( $doc->createTextNode( $row['CNUM'] ) );
$Customer->appendChild( $CustomerID );
$CustomerTaxID = $doc->createElement( "CustomerTaxID" );
$CustomerTaxID->appendChild( $doc->createTextNode( $row['CCON'] ) );
$Customer->appendChild( $CustomerTaxID );
$CompanyName = $doc->createElement( "CompanyName" );
$CompanyName->appendChild( $doc->createTextNode( $row['CNOM'] ) );
$Customer->appendChild( $CompanyName );
}
}
dbase_close( $customerDB );
$MasterFiles->appendChild( $Customer );
$r->appendChild( $MasterFiles );
$doc->save( $filename );
?>
Code: Select all
$doc = new DOMDocument('1.0', 'Windows-1252');Code: Select all
$doc = new DOMDocument('1.0', 'UTF-8');