Home arrow PHP arrow Tracking Parsing Errors with the Tidy Library in PHP 5

Tracking Parsing Errors with the Tidy Library in PHP 5

Creating well-formed (X)HTML documents can be a hard-to-accomplish task, particularly for PHP developers who need to focus mainly on the data and business layers of their web applications, and not on their visual presentation modules. However, this issue can be addressed with minor hassles with the assistance of the excellent Tidy extension.

TABLE OF CONTENTS:
  1. Tracking Parsing Errors with the Tidy Library in PHP 5
  2. Summarizing some Tidy library concepts
  3. Using the tidy_get_error_buffer() function
  4. Using the tidy_access_count(), tidy_error_count() and tidy_warning_count() functions
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
July 11, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Welcome to the last tutorial of the series "Working with the Tidy library in PHP 5." As you might have guessed, this series offers a friendly guide to using the most important functions that come bundled with the Tidy library, so you can start quickly incorporating them into your own PHP applications.

Going straight to subject of this series, you'll remember that in the preceding article I showed you how to dissect and extract different parts of a given (X)HTML string (or even an (X)HTML file) for further processing. More concretely speaking, I demonstrated how to use the straightforward "tidy_get_html()," "tidy_get_head()" and "tidy_get_body()" functions, obviously included with the Tidy extension, in order to retrieve the entire content of a specific (X)HTML string, in addition to extracting its <head> and <body> sections respectively.

While it must be admitted that retrieving the distinct parts of a concrete (X)HTML string might not be the most useful task for a seasoned PHP developer, it's valid to mention here that the Tidy library comes equipped with a remarkable set of functions for breaking up a web document in its main section, in this way allowing users to parse the different nodes of the document in question in a simpler way.

All right, at this stage you've hopefully learned how to parse and fix the format of a given (X)HTML file via its specific set of Tidy functions, in addition to splitting a file into its most important pieces. So, the question that comes up is the following: what is the next step? Well, from a PHP developer's point of view, tracking all the errors that occurred when parsing a concrete (X)HTML string might be quite useful. Therefore, in this final tutorial of the series I'm going to cover some new functions bundled with the Tidy extension which are designed to show you the potential errors raised when interpreting (X)HTML data.

Now, with the preliminaries out of our way, it's time to tackle this last article of the series and learn how to handle parsing errors with the Tidy extension. Let's move on!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: