hi all :) here is a xml file: <directive> <rule> <rules> <rule> </rule> <rule> </rule> </rules> </rule> </directive> <directive> <rule> <rules> <rule> </rule> <rule> </rule> </rules> </rule> </directive> . . . ..... I have a xml file with a name for example(test.xml).. and 3 tables of database, (group,directives,rules) group is for recording the name of the opened xml file, directives is for storing the attributes of directive tag and rules is for 'rule' tag's attributes. I know I must use of recursive function.. but how? first read name of the xml file and store it in group table, then the content of the file and fill the directive and rules table... <directive .*... attrs go to directives table..*.> <rule * ...attrs go to rules table...*.> <rules * ..no attrs.*.> <rule *...attrs go to rules table...*.> </rule> <rule *...attrs go to rules table..*..> </rule> </rules> </rule> </directive> how to implement it in php? Thanks, Shahrzad