2
votes

I want to achieve the below output using xmldom

<ENVELOPE>
<LEDGER NAME="Shah" Action="CREATE">
</LEDGER>
</ENVELOPE>

for this how can i write 2nd line using xmldom?

1
That is not valid XML, the <LEDGER> tag is not closed. I think you want <LEDGER NAME="Shah" Action="CREATE" />. - Anders Lindahl
i just cut and paste few lines from my code so it is their and how to write using xmldom in php.. not simple xml tree format. - Helping Hand..
I Solved my problem.:) - Helping Hand..
@UmangShah: Thanks for coming back to post the answer! That's exactly the right thing to do. :-) - Lightness Races in Orbit
@LightnessRacesinOrbit thaks for your appreciation. - Helping Hand..

1 Answers

3
votes

Need To Set Attributes for it..

$ledger = $xml->createElement("LEDGER");
$ledger->setAttribute("NAME", "$resul");
$ledger->setAttribute("Action", "CREATE");