Sorry for possible newbie question, but I need to use xml for an import. I've figured it out so far but then scratched my eyeballs out while trying to figure out this (and searched for it)
I have this
<?php
$xml = new DOMDocument("1.0","UTF-8");
$container = $xml-> createElement("container");
$container = $xml-> appendChild($container);
for($n=0;$n<8;$n++){
$maxnum[]=$n;
}
$xtags = $xml->CreateElement("tags",$maxnum); $xtags = $container->appendChild($xtags);
if($xml->save("stuff2.xml")){echo 'success';} else {echo 'not working';}
?>
Basically I dont want to create a child node for ever value of a loop. And I know that
s not the proper way to do it, nor is array_values
and so on. But it's what I want to achieve. I need to generate an XML file for wpall import so that I can succesfully bulk import to woocommerce. The specific attribute here i ize, and Im getting that using
file_get_contents` from the server, parsing which xpath with a foreach loop. Problem is I want them all in a single field rather than having this
<size>
<value>1</value>
<value>2</value>
</size>
and so on, when I want it like this <size><value>1,2,3....</value></size>
Any help, please?