Baigudin Software avatar
Baigudin Software logo
ru region
en region

PHP DOM Builder API 2.0

BOOS Core is released as version 2.1

The new release of BOOS Core has gotten ARM architecture with instruction set version 5, some independent algorithms of any compilers, root interface for all interfaces, and many tiny aspects, which were implemented in it.

Beginning of work

So, we have included the library and set it. Now we can create a basic HTML document.

use DomBuilder\Element as Element
// Create document 
$document Element::create(); 
// Add main tags to document 
$node $document->insert('html'); 
// Output document
echo Element::getDocument($document);

The result of this example is here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en" lang="en">

Every HTML document can be represented as a tree list of elements . In our example, we have created a root element of document and linked some elements to it. All methods for creating elements, such as create, insert, after,and before, create a new element and return a reference to it. That is why we could rewrite our example like here:

use DomBuilder\Element as Element
// Create tree list 
$root Element::create('html')
// Output document 
echo Element::getDocument($root);

If we want to get a correct document, we need to give getDocument method a root element of document. It is possible by using root method, which travels all DOM tree and returns a reference to a root element.

To the previous article

To the articles list

To the next article