Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Thomas Weinert:
FluentDOM 5 + XML Namespaces
Aug 07, 2014 @ 15:50:22

In this new post to his site Thomas Weinert shows how to use the FluentDOM library (a PHP implementation of a Javascript library by the same name) when XML namespaces are involved.

FluentDOM 5 allows to register namespaces on the DOM document class. These are not the namespaces of a loaded document, but a definition of namespaces for your programming logic.

He compares it to both a PHP example, using the DOMXpath handling and a Javascript sample using its own xmlDocument functionality. Finally he compares these examples to the few lines of FluentDOM code to handle the same kind of evaluation. He wraps up the post with a brief mention of the "appendElement" function that wraps serveral operations in one for easy element additions.

tagged: fluentdom xml namespace tutorial javascript domxpath element

Link: http://www.a-basketful-of-papayas.net/2014/08/fluentdom-5-xml-namespaces.html

Thomas Weinert's Blog:
Highlight Words In HTML
May 10, 2010 @ 15:34:24

In the latest post to his blog Thomas Weinert takes a look at a simple challenge someone asked him about - highlighting a section of HTML based on a search string - and his solution.

The challenge is to wrap given words in text content with a span and add a class to the span depending on the word. Do not touch elements, attributes, comments or processing instructions. Do it case insensitive and do it the safe way.

He uses the FluentDOM tool to get the job done. It allows him to create an XPath expression to single out the item to be highlighted (in this case a single or series of words) and wrap them in a matching span tag with the correct styles attached.

tagged: fluentdom tutorial highlight word

Link:

Thomas Weinert's Blog:
FluentDOM
Jun 12, 2009 @ 12:59:13

Thomas Weinert has posted about a new tool he's worked up to make working with the DOM in PHP a bit more fluent - FluentDOM.

Today I like to present a new projekt: FluentDOM. It provides an easy to use, jQuery like, fluent interface for DOMDocument. The idea was born in a workshop of Tobias Schlitt about the PHP XML extensions at the IPC Spring in Berlin.

He includes a basic code example - locating items with an ID of "first" and removing that ID to replace it with a class. If you'd like to check it out (literally) you can grab the latest version from the project's public svn.

tagged: jquery xml dom fluentdom

Link:


Trending Topics: