anf.etienne Posted March 11, 2009 Share Posted March 11, 2009 Hi, I have this php code that creates a xml file(#1)....is is possible to get it to generate a xml like the 1 below(#2)? The main part of my xml is the caption....can i add a new line to be generated for the xml for the amount of images/captions required? #1 # <? # $doc = new_xmldoc('1.0'); # $root = $doc->add_root('members'); # $member = $root->new_child('member',''); # # $member->new_child('lastName','John'); # $member->new_child('firstName','Adams'); # $member->new_child('contribution','3400'); # # $fp = @fopen('members.xml','w'); # if(!$fp) { # die('Error cannot create XML file'); # } # fwrite($fp,$doc->dumpmem()); # fclose($fp); # ?> #2 # <gallery> # <pic1 name="PHOTO 1" caption="This is the space where you can put in your own customised caption for each image."/> # <pic2 name="PHOTO 2" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic3 name="PHOTO 3" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic4 name="PHOTO 4" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic5 name="PHOTO 5" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic6 name="PHOTO 6" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic7 name="PHOTO 7" caption="This is the space where you can put in your own customised caption for each image."/> # <pic8 name="PHOTO 8" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic9 name="PHOTO 9" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic10 name="PHOTO 10" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic11 name="PHOTO 11" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic12 name="PHOTO 12" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic13 name="PHOTO 13" caption="This is the space where you can put in your own customised caption for each image."/> # <pic14 name="PHOTO 14" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic15 name="PHOTO 15" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic16 name="PHOTO 16" caption="This is the space where you can put in your own customised caption for each image. "/> # <pic17 name="PHOTO 17" caption="This is the space where you can put in your own customised caption for each image. "/> # </gallery> Quote Link to comment https://forums.phpfreaks.com/topic/148918-php-to-xml/ Share on other sites More sharing options...
JonnoTheDev Posted March 11, 2009 Share Posted March 11, 2009 Not familiar with your classes but could esily be done with DOMDocument(); Examples: http://uk3.php.net/manual/en/class.domdocument.php Quote Link to comment https://forums.phpfreaks.com/topic/148918-php-to-xml/#findComment-782006 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.