ballhogjoni Posted July 8, 2007 Share Posted July 8, 2007 Can anyone tell what is invalid about this php to xml code? <?php $doc = new_xmldoc('1.0'); $root = $doc->add_root('checkout-shopping-cart'); $shopping_cart = $root->new_child('shopping-cart',''); $items = $shopping_cart->new_child('items',''); $item = $items->new_child('item',''); $item->new_child('item-name','$5 off all Valentines Day Orders'); $item->new_child('item-description','Save $5 today only!'); $item->new_child('unit-price currency="USD"','-5.00'); $item->new_child('quantity','1'); $item = $items->new_child('item',''); $fp = @fopen('members.xml','w+'); if(!$fp) { die('Error cannot create XML file'); } fwrite($fp,$doc->dumpmem()); fclose($fp); ?> Link to comment https://forums.phpfreaks.com/topic/58994-php-to-xml-help/ Share on other sites More sharing options...
teng84 Posted July 8, 2007 Share Posted July 8, 2007 that is working tru class so how can we see the prob. just tell us whats the error Link to comment https://forums.phpfreaks.com/topic/58994-php-to-xml-help/#findComment-292758 Share on other sites More sharing options...
ballhogjoni Posted July 8, 2007 Author Share Posted July 8, 2007 O i figured our what the error is, how do you fix it? This is the xml file but the xml reader in the browser cannot publish it to the web page because of the closing tag on this line. The code in my last post closes the tag automatically with the same as the opening tag. <unit-price currency="USD">-5.00</unit-price currency="USD"> Link to comment https://forums.phpfreaks.com/topic/58994-php-to-xml-help/#findComment-292770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.