1

in this sample found here:

<?php
$newsXML = new SimpleXMLElement("<news></news>");
$newsXML->addAttribute('newsPagePrefix', 'value goes here');
$newsIntro = $newsXML->addChild('content');
$newsIntro->addAttribute('type', 'latest');
Header('Content-type: text/xml');
echo $newsXML->asXML();
?>

We create an xml object from scratch. all righ. my question is, how to embed a prefix in a tag during the construction of the object?

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header />
    <soapenv:Body>
        <EnviarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws">
                           ...some important xml...
        </EnviarLoteRpsEnvio>
    </soapenv:Body>
</soapenv:Envelope>

in this code above, show a final xml, how, during the create of xml object, i embed the prefixes in the tags? sorry for my bugged english.. thanks for all help.

Community
  • 1
  • 1
ikkarus
  • 21
  • 6
  • You probably want the [SOAP](http://php.net/manual/en/book.soap.php) extension instead of creating the XML manually. – DaveRandom Jan 20 '12 at 14:07
  • Right, .. i'm trying to send through the soap but, the webservice that i want to integrate with my system, waits for a object as parameter, then i belive that is the only way to do it. – ikkarus Jan 20 '12 at 16:19

0 Answers0