Category Archives: XML


January 6, 2024 5:03 am

How to generate XML sitemap


How to generate XML sitemap
Today i am going to write a tutorial about sitemaps, Sitemap is a very important part of your website for SEO.Sitemaps is a protocol to inform search engines about your website links available for crawling. Most of the search engines accept XML formats so this article i will show you how to generate a XML sitemap.

[ Read More ]


December 30, 2014 8:32 am

Writing to XML files in PHP using XMLWriter and DOM


Writing to XML files in PHP using XMLWriter and DOM
Using PHP’s XMLWriter to write XML files is not very complicated. It uses element nesting to create the tree you want and it saves the tree to the memory so you can output the contents of the memory and the tree in any place you want, be it a file or display to the browser. You can easily create dynamic XML files by fetching some data from a database and using XMLWriter. XMLWriter is preferred to DOMDocument when working with larger files because you can periodically flush the XML in memory to a file and keep building the tree you want without running out of memory.

[ Read More ]


December 28, 2014 9:29 am

Using PHP and SimpleXML to parse WordPress feeds


Using PHP and SimpleXML to parse WordPress feeds
SimpleXML is probably the easiest way to parse a XML document. We have created a class that only has to be instantiated to get the feed’s data and added a utility function to display it in a tabular format (HTML table). We have also added some simple CSS styling to the table to make it look better than the browser’s default rendering. It has to be noted that this is just for demonstration and teaching’s sake and it could be better to use XMLReader instead of SimpleXML for lengthy XML files because SimpleXML processes the inputs at once by writing them to the memory which is not a good idea if you have a big XML file.

[ Read More ]