Problem with simpleXML and addChild
Posted: Wed Dec 03, 2008 7:53 am
Hi!
First at all, it seems like you got really big forums here, so I hope i'll get an answer.
I'm just developing a class to access a service, which is providing a credit card check XML API.
First I got this XML base:
I use the following Code:
But, if I use this code, I got this:
Instead of:
So it's addinc "acdc:" to every child.
Ideas, Suggestions?
Thanks!
First at all, it seems like you got really big forums here, so I hope i'll get an answer.
I'm just developing a class to access a service, which is providing a credit card check XML API.
First I got this XML base:
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1" ?> <acdc:Root xmlns:acdc="urn:acdc_gateway"> </acdc:Root>Code: Select all
$sxe = new SimpleXMLElement($this->xml_header);
$test = $sxe->addChild('testchild', '010101');
$test->addAttribute('testattr', '12345');Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<acdc:Root xmlns:acdc="urn:acdc_gateway">
<acdc:testchild testattr="12345">010101</acdc:testchild>
</acdc:Root>Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<acdc:Root xmlns:acdc="urn:acdc_gateway">
<testchild testattr="12345">010101</testchild>
</acdc:Root>So it's addinc "acdc:" to every child.
Ideas, Suggestions?
Thanks!