Hallo,
ich habe ein kleines Problem. Ich möchte einen Bestand abfragen und muss dafür folgende Struktur übermitteln:
   
	Mein logisches Verständniss
	
mein XML ->
	Irgendwie stehe ich gerade auf meinem Hirn oder so aber mir will nicht einfallen wo ich den Denkfehler drin habe.
[COLOR="Red"]*join*[/COLOR]
	
Funktioniert!
							
						
					ich habe ein kleines Problem. Ich möchte einen Bestand abfragen und muss dafür folgende Struktur übermitteln:
Code:
	
	
<Products>
  <Product>
    <ProductID>xxx</ProductID>
  </Product>
  <Product>
    <ProductID>xxx</ProductID>
  </Product>
</Products>
PHP-Code:
	
	
 $xml = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><Request></Request>");
   $array = array("xxx","xxx");
   $xml->AddChild("Products");
    for($i=0;$i<2;$i++){
      $xml->Products->AddChild("Product");
      $xml->Products->Product->AddChild("ProductID",$array[$i]);
    }
    
    echo $xml->asXml();
Code:
	
	<?xml version="1.0" encoding="utf-8"?>
<Request>
 <Products>
  <Product>
    <ProductID>6252881</ProductID>
    <ProductID>6252881</ProductID>
  </Product>
  <Product/>
 </Products>
</Request>
[COLOR="Red"]*join*[/COLOR]
PHP-Code:
	
	
$xml->Products->AddChild("Product")->AddChild("ProductID",$array[$i]); 
 
          
 Moderatorin
 Moderatorin

Kommentar