[Phpxd-commits] CVS: phpXD/samples/dwtest dwtest.php,NONE,1.1
Status: Beta
Brought to you by:
growbal
|
From: Growbal K. <gr...@us...> - 2002-03-03 06:23:22
|
Update of /cvsroot/phpxd/phpXD/samples/dwtest
In directory usw-pr-cvs1:/tmp/cvs-serv8265/samples/dwtest
Added Files:
dwtest.php
Log Message:
Add DOMWriter.php
sample_big5.xml
dwtest.php
Modify dom.php for including DOMWriter.php
by Growbal
--- NEW FILE: dwtest.php ---
<?php
// phpXMLDOM - an XML DOM Implementation
//
// This Software and all associated files are released unter the
// GNU Public License (GPL), see LICENSE for details.
//
// $Id: dwtest.php,v 1.1 2002/03/03 06:23:17 growbal Exp $
/**
* Sample PHP script for using DOMWriter of phpXMLDOM.
* Loads the file ../files/sample_big5.xml (some content in Chinese Big5 encode)
* and output it to test.xml and stdout
*
* you can try this by PHP excutable directly:
* php -q dwtest.php
*
* remember put the sample file in the right path
*
* @package phpXD
* @author Growbal Kuo <gr...@ta...>
* @version $Revision: 1.1 $
*/
//... define your phpXD root path here
define( "PHPXD_INCLUDE_DIR", "/dev/cvs/phpXD/" );
include( PHPXD_INCLUDE_DIR . "phpXD.php" );
//... remove this line if DOMWriter.php was included by include/dom.php
//require(PHPXD_INCLUDE_DIR."include/dom/DOMWriter.php");
//... XML source file
$sampleFile = "../files/sample_big5.xml";
//... build a DOM Document object
$parser = new DOMParser();
$document = $parser->parseFile($sampleFile, true);
//... build a DOMWriter object , set the encoding
$dw = new DOMWriter();
$dw->encoding = "Big5";
//... write output to file test.xml
$dw->writeNode("test.xml", $document);
//... write output to stdout
$dw->writeNode("php://stdout", $document);
//... write output to stdout
echo $dw->writeToString($document);
?>
|