Introduction Quite possibly, if you’ve read the two preceding articles of this series, you’ll know how to load XML files and strings onto PHP objects by using the helpful “simplexml_load_file()” and “simplexml_load_string()” functions. You'll also know how to access parent and child XML nodes through a simple array syntax. Also, at this point you’ll realize that one of the best things about this extension is how easily you can use it for parsing XML data by using typical foreach loops, which makes all the XML processing operations a breeze. Here, there’s no need to deal with complex parsers. Once XML data has been stored in a PHP object, the process for accessing nodes is reduced to navigating the corresponding tree and calling the appropriate methods. So far, the couple of functions that I mentioned before actually do a good job of parsing simple XML files and strings. However, the “simpleXML” library has a few additional handy functions that I’d like to show you in this last tutorial. That said, in the next few lines, I’ll be covering these functions, in order to demonstrate how to quickly search and replace nodes within XML data strings. So that’s the subject of this article. It’s time to continue learning about the “simpleXML” extension. Let’s do it together!
blog comments powered by Disqus |