Untitled
unknown
plain_text
a year ago
1.5 kB
1
Indexable
Never
<?php // XML verisini çek $xmlData = 'https://cdn1.xmlbankasi.com/p1/gumush/image/data/xml/gumush.xml'; // $xml_content = file_get_contents($xml_url); $xml = new SimpleXMLElement($xmlData); $newXmlFile = "yeni_veri.xml"; // Yeni bir SimpleXMLElement oluşturun $newXml = new SimpleXMLElement('<Product></Product>'); // Description öğesini CDATA içine yerleştirin $description = $newXml->addChild('Description'); $description->addChild('item', $xml->Description->asXML(), null, 'http://www.w3.org/1999/xhtml'); // Diğer öğeleri de yeni XML'e kopyalayın $newXml->urunler = $xml->urunler; $newXml->Product_id = $xml->Product_id; $newXml->Name = $xml->Name; $newXml->mainCategory = $xml->mainCategory; $newXml->mainCategory_id = $xml->mainCategory_id; $newXml->category = $xml->category; $newXml->category_id = $xml->category_id; $newXml->subCategory = $xml->subCategory; $newXml->subCategory_id = $xml->subCategory_id; $newXml->Price = $xml->Price; $newXml->Price2 = $xml->Price2; $newXml->CurrencyType = $xml->CurrencyType; $newXml->Tax = $xml->Tax; $newXml->Stock = $xml->Stock; $newXml->Brand = $xml->Brand; $newXml->Image1 = $xml->Image1; $newXml->Image2 = $xml->Image2; $newXml->Image3 = $xml->Image3; $newXml->Image4 = $xml->Image4; $newXml->Image5 = $xml->Image5; $newXml->variants = $xml->variants; // XML verisini yeni XML dosyasına yazın $newXml->asXML($newXmlFile); echo "Yeni XML dosyası oluşturuldu: " . $newXmlFile; ?>