PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am using php 4.3.11 and try to execute following code.But gives me the error.This code works fine on php 5.0.4 but i have to use it on php 4.3.11 because my web server doesn't support php 5.0.4. Please help me out I got dom enabled on php 4.3.11.
1. The appropriate forum for your question is PHP Code
2. Use [ php ]-tags around your code
3. Read up on DOM XML functions, especially the user-notes in the manual tend to have very useful examples.
XML management has been completely overhauled for PHP5, if you want to create a new XML document in PHP4x, use
tags around your code. Edit your posts, please.
What's wrong with your code? It's actually very straighforward: you are trying to run before you can walk. If you are not familiar with classes and/or variables, don't use them or read up on them. Google $this and PHP or, even better, read up on it in the manual.
I m really sorry that i didn't review the rule for posting the code first.now i edited my post. I want to save the output into xml file please post the code to save file if possible.I read the entire manual but didn't find to save the file.What i find is save method of domdocument. As i alread said while creating instance of DomDocument it gives me the error. Please help me out.
The difference is: the code I coded previously presupposed that you were using a class. The code above doesn't.
I'd advise strongly to read up on classes and PHP's object orientation. It's a very important development technique.
P.S.: Thanks for editing your posts. You will need to open the [ php ] tag and close it later at the end of the code with [ /php ] (without the spaces between the square brackets) to have it all displayed as PHP-code. I re-edited your posts so that it shows correctly.
I guess i m posting the code in well format. please assume that there is question mark tag at the begining and at the end of this code.that's why error is showind at line 5( while appending child)
The code didn't work.Even this works how can i save the file named "test.xml".Please put a demo code for that
Thank you very much for your help.I tried all code but couldn't solve my problem. I don't know when $this will used and how can i use it. I just needed a 5-7 lines of code to save an xml file. Please provide me the code which works fine on my computer if possible. Since i am new to php and xml i got frustated with this php and xml.
tags around your code.
it works as described earlier: you open them with [php] and close them after the code with [/php]
Apart from that let me repeat myself: copy the code from the my post above. IF you think you've done it, copy and paste it again regardless.