Home arrow PHP arrow Parsing XML With DOMXML And PHP
PHP

Parsing XML With DOMXML And PHP


Extensible Mark-up Language (XML) has just about made its impression everywhere: B2B, B2C, as a replacement for .INI files, to aid with data abstraction and transportation, etc. In this article Mitchell shows us how to use the DOMXML library to parse and extract data from both local and remote XML files with PHP.

Author Info:
By: Mitchell Harper
Rating: 4 stars4 stars4 stars4 stars4 stars / 27
January 10, 2002
TABLE OF CONTENTS:
  1. · Parsing XML With DOMXML And PHP
  2. · What is the DOMXML parsing method?
  3. · Parsing a simple XML document
  4. · Parsing Example 2
  5. · Putting our DOMXML knowledge to good use
  6. · Conclusion

print this article
SEARCH DEVARTICLES

Parsing XML With DOMXML And PHP
(Page 1 of 6 )

Extensible Mark-up Language (XML) has just about made its impression everywhere: B2B, B2C, as a replacement for .INI files, to aid with data abstraction and transportation, etc. There are a huge number of companies that offer some sort of content over the web in the form of XML, such as news headlines, weather conditions, traffic reports, etc.

When we're talking about data manipulation and implementation with a reference to PHP, most people will automatically assume some sort of interaction with a MySQL database. MySQL has become synonymous with PHP, just like Oracle has become synonymous with Java. MySQL is great, but we can make our data more readily available over the web in the form of XML.

Two benefits of transporting data across the web in the format of XML spring into mind: its cross-platform availability, and its language-neutral syntax: as long as an XML document is available for download from a web site or FTP server, we can parse that document through PHP and then do whatever we like (subject to copyright laws) with that data.

In this article I'm going to give you the 101 on how to parse XML documents using the DOMXML library in PHP. I will discuss setting up the XML parser, loading and parsing documents. Once we've covered enough solid ground, I will show you how to implement a real-time XML feed from devArticles.com, which you can then use on your site.

To get the most out of this article and its coding samples, you should be running a Windows/Linux/Unix web server with the latest version of Apache installed. You can download Apache for Windows, Linux and Unix for free from http://apache.org.

Because this article describes how to actually parse XML documents and not what XML is, you should have a fairly substantial knowledge of the XML language syntax already (If you donít, then refer to some of the books at the end of this article). You should also be proficient with PHP.
blog comments powered by Disqus
PHP ARTICLES

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials