regards
create xml in php
Moderator: General Moderators
Re: create xml in php
i've do what you tell in the above thread with no progress.
regards
regards
- hannnndy
- Forum Contributor
- Posts: 131
- Joined: Sat Jan 12, 2008 2:09 am
- Location: Iran>Tehran
- Contact:
Re: create xml in php
have you read the xml using php code ?
do not forget opening with text editors will cause some problems
use this:
do not forget opening with text editors will cause some problems
use this:
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;
?>
Re: create xml in php
no i'm creating the xml file only.~
i have a .bat to run this script, and then it generates the out.xml file
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 );
?>
Re: create xml in php
i manage to solve my problems, thanks to you and the other.
i create a new file using the script in the thread above, and then i edit the generated xml file, with notepad, and save it as UTF-8 and that works like you said
. but one more question, my final one, do i have to do the same process every time i create a xml file with that script, there's no other way to solve this issue, maybe using another function instead of DOMDocument->save () ?
thanks in advance
i create a new file using the script in the thread above, and then i edit the generated xml file, with notepad, and save it as UTF-8 and that works like you said
thanks in advance
- hannnndy
- Forum Contributor
- Posts: 131
- Joined: Sat Jan 12, 2008 2:09 am
- Location: Iran>Tehran
- Contact:
Re: create xml in php
i did not use anything else maybe the som guys in forum do 
- hannnndy
- Forum Contributor
- Posts: 131
- Joined: Sat Jan 12, 2008 2:09 am
- Location: Iran>Tehran
- Contact:
Re: create xml in php
i did not use anything else maybe the some guys in forum do 
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: create xml in php
Code: Select all
$doc = new DOMDocument('1.0', 'Windows-1252');Code: Select all
$doc = new DOMDocument('1.0', 'UTF-8');