Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

PHP DOM Builder API

PHP DOM Builder has been unveiled in second revision

In 2014 year PHP DOM Builder library was unveiled at the first time within the framework of Baigudin Software project. Two years have been left after that moment and today we are glad to offer the second generation that is PHP DOM Builder Revision 2.

Abstract class «DomBuilder\Element»

Main class for Document Object Model operating.

The root class of some html elements that declares abstarct and static methods for operating with DOM tree and HTML document.

  • abstract class Element

All implemented interfaces:

Object Builder Property Attribute Traverse Fetch Search Tester

public static Element create(string $name='');

Creates a new element.

The method returns the default element node container if argument is defaulted or special element node container for given tag name if the first character of argument is not a slash or back slash character. It means that the method builds a class relatively of self namespace, otherwise a class is built by full given name relatively of root namespace. Note: Relative classes of root namespace may be some extensions of this library.

Parameters:
string $name — a tag name of new element.

Returns:
Element — created element.

public static bool docCompress(bool $docCompress=NULL);

Returns and sets document compress flag.

Parameters:
bool $docCompress — new document compress flag.

Returns:
bool — document compress flag.

public static string docLanguage(string $docLang=NULL);

Returns and sets document language.

This value is used as default value for lang attribute.

Parameters:
string $docLang — document language.

Returns:
string — current document language.

public static string docType(string $docType=NULL);

Returns and sets HTML document type.

Parameters:
string $docType — one of DOC_XHTML_10, DOC_HTML_401, or DOC_HTML_5 constans.

Returns:
string — HTML document type.

public static bool isList(object $node);

Tests if given object is an elements list container.

Parameters:
object $node — tested object.

Returns:
bool — true if object is an elements list.

public static bool isNode(object $node);

Tests if given object is an element node container.

Parameters:
object $node — tested object.

Returns:
bool — true if object is an element node.

public static Element newList();

Creates a new elements list container.

Returns:
Element — created elements list container.

public static Element newNode(string $name='');

Creates a new element node container.

The method returns the default element node container if argument is defaulted or special element node container for given tag name

Parameters:
string $name — a tag name of new element.

Returns:
Element — created element node container.

public static bool printError(bool $printError=NULL);

Returns and sets a print errors flag.

Parameters:
bool $printError — new print errors flag.

Returns:
bool — print errors flag.

Back to class list