 | News Feed |
Sections
Community Events
|
| feed this: |  |
Greg Szorc's Blog: Using DTD's and Catalogs for XHTML Validation
posted Thursday April 10, 2008 @ 11:29:48
voice your opinion now!
BY CHRIS CORNUTT
Greg Szorc shows how, in this entry on his blog, to use DTDs and catalogs to validate your XHTML pages with a little help from PHP.
This [validation from an external site like the W3C validator] approach is a good start, but it is far from ideal because it is based on an honor system of sorts. You often forget to validate each change you make and there is always some corner case that you forget. So, what can be done about it? Well, if you find yourself developing in PHP, you can employ the following solution.
The code he includes pulls in the XHTML content from your page (or the output of the framework's view layer) and pushes it into a DOMDocument that's build with the LIBXML_DTDLOAD and LIBXML_DTDATTR options.
tagged with: html validation dom extension document import
DevShed: Handling HTML Strings and Files with the DOM XML Extension in PHP 5
posted Wednesday March 26, 2008 @ 08:46:05
voice your opinion now!
BY CHRIS CORNUTT
On DevShed today, they continue their series looking at working with XML in PHP with the DOM functionality with the fifth part of their series, a look at working with HTML strings and file data.
Understanding how to use the methods and properties provided by this library requires a little effort from you, despite its fairly easy learning curve. [...] The DOM XML extension has plenty of options when it comes to moving portions of an XML document (or even the entire document) from one place to another. This is certainly a process that can be performed with minor hassles by utilizing the intuitive DOM API mentioned in the beginning.
They show how to use loadHTML to pull in the text from an HTML string and use loadHTMLFile to pull it in from an external HTML file. Finally, they show how to write the data and whatever changes you might have made to it, back out to a file with saveHTMLFile.
tagged with: tutorial dom extension xml handling html savehtmlfile loadhtml loadhtmlfile
DevShed: Inserting Comments and Accessing Nodes with the DOM XML Extension in PHP 5
posted Tuesday March 11, 2008 @ 15:40:21
voice your opinion now!
BY CHRIS CORNUTT
DevShed continues their series looking at using the DOM extension in PHP5 to work with XML in your application. They've already looked at adding attributes and creating CDATA information in a new DOM document. This time they build on that and also include new methods - appending comment nodes and getting at XML nodes by their IDs.
I'm talking about the DOM XML extension, which allows you to handle XML documents by using the DOM API. Thus, if you're interested in learning how to put this extension to work for you quickly, look no further, because you've come to the right place. [...] In this third installment of the series, I'll be teaching you specifically how to append comment nodes to a given XML string and how to extract certain elements via their IDs.
They review the method to add attributes and CDATA to an XML document first. Then they cover the other two new topics - appending comment nodes and grabbing nodes by their ID attribute.
tagged with: dom extension php5 node cdata attribute id fetch tutorial
|