PHP DOMDocument: error adding DOMElement with no children -


update: working , answer in first comment  $dom = new domdocument('1.0', 'utf8');  $elroot   = $dom->createelement ('root');  $elitems1 = $dom->createelement ('items1');  $elitems2 = $dom->createelement ('items2'); $elroot->appendchild($elitems1);  $elroot->appendchild($elitems2);  $dom->appendchild($elroot);  echo $dom->savexml(); 

i expected create following xml:

<root><items1></items1><items2></items2></root>  

but instead creates

<root><items1><items2></items2></items1></root> 

if add 1 children items1 works better may have no nodes/children elements , error occur.

or isn't error?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -