Page 2 of 2

Re: CRXML,A Replacement for SimpleXML

Posted: Mon Dec 12, 2011 11:17 am
by max529
Hi,

I have recently moved the class and demo to pagodabox.com which provides better hosting. So the demo and downloads should work faster.

These are the links

Documentation at http://crxml.pagodabox.com

Demo at http://crxml.pagodabox.com/demo.php

Class source ,Documentation and demo http://crxml.pagodabox.com/crXml.tar

I recently had great success with this class with the work I am currently working on. This involved recieving an namespaced xml string, Change some attributes of some nodes and resend it to another server. I could accomplish this with < 10 lines of code.

Below Sample illustrates the operation

Code: Select all

<?php
include 'crXml.php';
$x = new crXml();
$xmlStr = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
<records>
<person age="15">
<name>
alex
</name>
</person>
<person age="28">
<name>
sandeep
</name>
</person>
</records>
EOB;
$x->loadXML($xmlStr);
$x->records->person[1]['age'] = '30'; //sets second persons attribute to 30
$x->records->person[1]->name = 'albert'; // sets child node 'name' of second person to 'albert'
$x->records->person[2] = $x->records->person[1]; // create a third `person` node and assign it the value of second 'person' node.
echo $x->xml();
Outputs

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<records>
<person age="15">
<name>alex</name>
</person>
<person age="30">
<name>albert</name>
</person>
<person>
<name>albert</name>
</person>
</records> 
Regards,
Sandeep.

Re: CRXML,A Replacement for SimpleXML

Posted: Fri Dec 16, 2011 10:11 pm
by max529
Hi,

I have added some self guided tutorial like functionality to the demo at http://crxml.pagodabox.com/demo.php so that you can check the capabilities of the class by trying out examples at http://crxml.pagodabox.com...

Regards,
Sandeep.

Re: CRXML,A Replacement for SimpleXML

Posted: Mon Dec 26, 2011 4:00 am
by max529
hi..

I have added couple of functionality to the class like the direct node replacement and adding a child xml node to another xml document on the fly using factory method.

regards,
Sandeep