PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Korvus   DOM Document   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Test
Class: DOM Document
Edit XML documents with Expat DOM implementation
Author: By
Last change: Example updated
Date: 19 years ago
Size: 602 bytes
 

Contents

Class file image Download
<? include( "Document.php" );

# Document object declaration

$oDocument = new Document( "test.xml" );

# Adds button caption

$oResult = $oDocument->getElementsByTagName( "input" );
$oResult[ 0 ]->setAttribute( "value", "button" );

# Removes a combobox item

$oComboBox = $oDocument->getElementById( "combo" );
$oComboBox->firstChild->unlink();

# Adds a new item and clones the combobox

$oComboBox->appendChild( $oDocument->createElement( "option", 3, array( "value" => 3 ) ) );
$oComboBox->appendSibling( $oComboBox->copy() );

echo
$oDocument->toString( true );

?>