1
Good afternoon!
I’m developing a webservice in which I will not disclose the name in which there is a method that accepts XML in the following mode:
<exemplo>
<exemplo></exemplo>
<exemplo></exemplo>
</exemplo>
I am creating XML’s by Domdocument but I can not generate XML’s as above, always comes out in this format children who have no values: <exemplo/>
and this generates errors in the webservice not returning what I need.
Is there any way that output is generated by DOM?
Follow how I raise my children.
$exemplo = $dom->createElement("exemplo","");
$root->appendChild($exemplo);
Wow it’s so simple and I didn’t even know! kkkk until I’ll use this answer to my problems!
– FRNathan13
And in case you want to use DOM to add attributes?
– FRNathan13
Just use the $dom->createAttribute method and then add a value to it, and finally add it to the element you want.
– Yure Pereira
You have an example here: http://ideone.com/DWbaZQ
– Yure Pereira
Thanks :) now yes I can continue using XML for some api’s
– FRNathan13
Excellent, it worked!!! Thank you very much!!!
– Bruno Folle