Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mark Holtzhausen  >  XMLns2array  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Test File containing XML snippet to parse
Class: XMLns2array
Convert a XML document into an array
Author: By
Last change:
Date: 2009-07-06 05:43
Size: 1,524 bytes
 

Contents

Class file image Download
<?php

include_once('XMLns2array.inc.php');


$xml='<?xml version="1.0" encoding="utf-8"?>
<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05" xmlns:alf="http://www.alfresco.org">
  <workspace cmis:repositoryRelationship="self">
    <atom:title>Main Repository</atom:title>
    <cmis:repositoryInfo>
      <cmis:repositoryId>0f91f397-7cd1-479b-9f56-266affe188d8</cmis:repositoryId>
      <cmis:repositoryName>Main Repository</cmis:repositoryName>
      <cmis:cmisVersionsSupported cmis:normal="bleg">
          <major>0</major>
          <minor>5</minor>
      </cmis:cmisVersionsSupported>
    </cmis:repositoryInfo>
    <collection href="http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/children" cmis:collectionType="root-children">
      <atom:title>root collection</atom:title>
    </collection>
    <collection href="http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/descendants" cmis:collectionType="root-descendants">
      <atom:title>root collection</atom:title>
    </collection>
  </workspace>
</service>
'
;


echo 
'<b>XML Example Code to Parse:</b><pre>'.htmlentities($xml).'</pre>';
echo 
'<hr /><b>Testing XML String Parsing into Array</b><pre>'.print_r(XMLns2array::parse($xml),true).'</pre>';
echo 
'<hr /><b>Testing SimpleXMLElement Parsing into Array</b><pre>'.print_r(XMLns2array::parse(simplexml_load_string($xml)),true).'</pre>';

?>