nathanblogs Posted November 2, 2007 Share Posted November 2, 2007 Hello, Does any know an associative array to XML function? At the moment I'm creating a associative array from a xml file, for example <root> <name>test</name> <age>20</age> <city>perth</city> </root> would turn into array(1) { ["ROOT"]=> array(1) { [0]=> array(3) { ["NAME"]=> array(1) { [0]=> array(1) { ["VALUE"]=> string(4) "test" } } ["AGE"]=> array(1) { [0]=> array(1) { ["VALUE"]=> string(2) "20" } } ["CITY"]=> array(1) { [0]=> array(1) { ["VALUE"]=> string(5) "perth" } } } } } Link to comment https://forums.phpfreaks.com/topic/75724-associative-array-to-xml-function/ Share on other sites More sharing options...
rajivgonsalves Posted November 2, 2007 Share Posted November 2, 2007 see this url http://www.phpfreaks.com/script/view/202.php Mod edit: email tags removed. Link to comment https://forums.phpfreaks.com/topic/75724-associative-array-to-xml-function/#findComment-383360 Share on other sites More sharing options...
nathanblogs Posted November 5, 2007 Author Share Posted November 5, 2007 I'm looking to go from an array to xml, I can already go from xml to array. Link to comment https://forums.phpfreaks.com/topic/75724-associative-array-to-xml-function/#findComment-384742 Share on other sites More sharing options...
rajivgonsalves Posted November 5, 2007 Share Posted November 5, 2007 here you go http://www.phpclasses.org/browse/package/2286.html Link to comment https://forums.phpfreaks.com/topic/75724-associative-array-to-xml-function/#findComment-384754 Share on other sites More sharing options...
nathanblogs Posted November 5, 2007 Author Share Posted November 5, 2007 Thanks, but they don't work the same way . I have moved on and I am now trying to achieve what I was doing with simpleXML instead of using arrays. basically I'm trying to modify an xml file based on the parent nodes it has for example I might have something like this <root> <nav> <ref>name1</ref> <parent>name2</parent> <item>a heap of irrelevant information</item> </nav> <nav> <ref>name2</ref> <parent></parent> <item>a heap of irrelevant information</item> </nav> </root> would be modified to <root> <nav> <ref>name2</ref> <parent></parent> <item> <nav> <ref>name1</ref> <parent>name2</parent> <item>a heap of irrelevant information</item> </nav> </item> <item>a heap of irrelevant information</item> </nav> </root> Link to comment https://forums.phpfreaks.com/topic/75724-associative-array-to-xml-function/#findComment-384773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.