PHP Classes
elePHPant
Icontem

File: sample1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of giulio  >  XML-Writer  >  sample1.php  >  Download  
File: sample1.php
Role: Example script
Content type: text/plain
Description: XML sample 1
Class: XML-Writer
Write XML documents to files
Author: By
Last change:
Date: 4 years ago
Size: 696 bytes
 

Contents

Class file image Download
<?php

 
require_once 'XMLFile.php';

   
$x = new XMLFile();
     
$x->open("./test1.xml");
     
$x->writeHeader();
     
$x->writeOpenTag('UTENTI','');
           
$x->writeOpenTag('UTENTI_SPECIALI','');
                   
$x->writeElement('NOME','','Mario');
                   
$x->writeElement('COGNOME','','Rossi');
               
$x->writecloseTag('UTENTI_SPECIALI');
     
$x->writecloseTag('UTENTI');
     
$x->close();


$xml_file = "test1.xml";

echo
file_get_contents($xml_file);

/*
xml file

<?xml version="1.0" encoding="ISO-8859-1"?>
<UTENTI>
<UTENTI_SPECIALI>
<NOME>Mario</NOME>
<COGNOME>Rossi</COGNOME>
</UTENTI_SPECIALI>
</UTENTI>


*/
?>