PHP Classes

File: sample2.php

Recommend this page to a friend!
  Classes of Tom Schaefer   QXML   sample2.php   Download  
File: sample2.php
Role: Example script
Content type: text/plain
Description: Sample File
Class: QXML
XML <> Array (preserve attrib.), JSON, etc.
Author: By
Last change: - removing typos
Date: 16 years ago
Size: 714 bytes
 

Contents

Class file image Download
<?php
include_once("QSet.class.php");
include_once(
"QXml.class.php");

$xmlFile = "menu.xml";



/*
 * Final Node Set to XML
 *
 */
$xml = new QXML;
$xml->setXmlFromFile($xmlFile);

$xml->setNode("menu.submenu.0.submenu.2.@attributes.name", "test");
$xml->setNode("menu.submenu.0.submenu.2.@textNode", "open test");

$xml->setNode("menu.submenu.2.submenu.0.@attributes.name", "test");
$xml->setNode("menu.submenu.2.submenu.0.@attributes.id", "tst");
$xml->setNode("menu.submenu.2.submenu.0.@attributes.headerText", "It works!");
$xml->setNode("menu.submenu.2.submenu.0.@textNode", "open test");

$xml->toXML($xml->getArray());

header("content-type:text/xml");

echo
$xml->getXml();
?>