You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 KiB
16 KiB
title |
---|
Document |
The Document Class
Introduction
Represents an entire HTML document; serves as the root of the document tree. Unlike the PHP \DOMDocument
class in which it inherits from it cannot be used to represent an XML document. It is strictly used to represent HTML.
Info Only new methods and methods which make outward-facing changes from \DOMDocument will be documented here, otherwise they will be linked back to PHP's documentation.
Class Synopsis
MensBeam\HTML\Document extends \DOMDocument {
use Node, Walk;
/* Constants */
public const NO_QUIRKS_MODE = 0 ;
public const QUIRKS_MODE = 1 ;
public const LIMITED_QUIRKS_MODE = 2 ;
/* Properties */
public Element|null $body = null ;
public string|null $documentEncoding = null ;
public int $quirksMode = 0 ;
/* Inherited properties from \DOMDocument */
public readonly DocumentType $doctype ;
public readonly Element $documentElement ;
public string|null $documentURI ;
public readonly \DOMImplementation $implementation ;
/* Inherited properties from \DOMNode */
public readonly string $nodeName ;
public string $nodeValue ;
public readonly int $nodeType ;
public readonly \DOMNode|null $parentNode ;
public readonly \DOMNodeList $childNodes ;
public readonly \DOMNode|null $firstChild ;
public readonly \DOMNode|null $lastChild ;
public readonly \DOMNode|null $previousSibling ;
public readonly \DOMNode|null $nextSibling ;
public readonly \DOMNamedNodeMap|null $attributes ;
public readonly Document|null $ownerDocument ;
public readonly string|null $namespaceURI ;
public string $prefix ;
public readonly string $localName ;
public readonly string|null $baseURI ;
public string $textContent ;
/* Methods */
public __construct ( )
public createEntityReference ( string $name ) : false
public load ( string $filename , null $options = null , string|null $encodingOrContentType = null ) : bool
public loadHTML ( string $source , null $options = null , string|null $encodingOrContentType = null ) : bool
public loadHTMLFile ( string $filename , null $options = null , string|null $encodingOrContentType = null ) : bool
public loadXML ( string $source , null $options = null ) : false
public save ( string $filename , null $options = null ) : int|false
public saveHTMLFile ( string $filename , null $options = null ) : int|false
public saveXML ( \DOMNode|null $node = null , null $options = null ) : false
public validate ( ) : true
public xinclude ( null $options = null ) : false
/* Magic Methods */
public __toString() : string
/* Methods from Node */
public Node::appendChild ( \DOMNode $node ) : \DOMNode|false
public Node::C14N ( bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
public Node::C14NFile ( string $uri , bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
public Node::insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
/* Methods from Walk */
public walk ( ?\Closure $filter = null ) : \Generator
/* Methods inherited from \DOMDocument */
public createAttribute ( string $localName ) : \DOMAttr|false
public createAttributeNS ( string|null $namespace , string $qualifiedName ) : \DOMAttr|false
public createCDATASection ( string $data ) : \DOMCdataSection|false
public createComment ( string $data ) : Comment|false
public createDocumentFragment ( ) : DocumentFragment|false
public createElement ( string $localName , string $value = "" ) : Element|false
public createElementNS ( string|null $namespace , string $qualifiedName , string $value = "" ) : Element|false
public createProcessingInstruction ( string $target , string $data = "" ) : ProcessingInstruction|false
public createTextNode ( string $data ) : Text|false
public getElementById ( string $elementId ) : Element|null
public getElementsByTagName ( string $qualifiedName ) : \DOMNodeList
public getElementsByTagNameNS ( string $namespace , string $localName ) : \DOMNodeList
public importNode ( \DOMNode $node , bool $deep = false ) : \DOMNode|false
public normalizeDocument ( ) : void
public registerNodeClass ( string $baseClass , string|null $extendedClass ) : bool
public relaxNGValidate ( string $filename ) : bool
public relaxNGValidateSource ( string $source ) : bool
public saveHTML ( \DOMNode|null $node = null ) : string|false
public schemaValidate ( string $filename , int $flags = 0 ) : bool
public schemaValidateSource ( string $source , int $flags = 0 ) : bool
/* Methods inherited from \DOMNode */
public \DOMNode::cloneNode ( bool $deep = false ) : \DOMNode|false
public \DOMNode::getLineNo ( ) : int
public \DOMNode::getNodePath ( ) : string|null
public \DOMNode::hasAttributes ( ) : bool
public \DOMNode::hasChildNodes ( ) : bool
public \DOMNode::isDefaultNamespace ( string $namespace ) : bool
public \DOMNode::isSameNode ( \DOMNode $otherNode ) : bool
public \DOMNode::isSupported ( string $feature , string $version ) : bool
public \DOMNode::lookupNamespaceUri ( string $prefix ) : string
public \DOMNode::lookupPrefix ( string $namespace ) : string|null
public \DOMNode::normalize ( ) : void
public \DOMNode::removeChild ( \DOMNode $child ) : \DOMNode|false
public \DOMNode::replaceChild ( \DOMNode $node , \DOMNode $child ) : \DOMNode|false
}
Constants
Constant | Value | Description |
---|---|---|
MensBeam\HTML\Document::NO_QUIRKS_MODE | 0 | Document not in quirks mode |
MensBeam\HTML\Document::QUIRKS_MODE | 1 | Document is in quirks mode |
MensBeam\HTML\Document::LIMITEDQUIRKS_MODE | 2 | Document is in limited quirks mode |
Properties
- body
- Represents the
body
orframeset
node of the current document, ornull
if no such element exists. - documentEncoding
- Encoding of the document, as specified when parsing or when determining encoding type. Use this instead of
\DOMDocument::encoding
. - quirksMode
- Used when parsing. Specifies which mode the document was parsed in. One of the predefined quirks mode constants.
The following properties inherited from \DOMDocument
have no effect in Mensbeam\HTML\Document
, so therefore are not listed in the schema above: