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 ContainerNode, 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 */
public readonly \DOMNamedNodeMap|null $attributes ;
public readonly string|null $baseURI ;
public readonly \DOMNodeList $childNodes ;
public readonly DocumentType $doctype ;
public readonly Element $documentElement ;
public string|null $documentURI ;
public readonly \DOMNode|null $firstChild ;
public readonly \DOMImplementation $implementation ;
public readonly \DOMNode|null $lastChild ;
public readonly string $localName ;
public readonly string|null $namespaceURI ;
public readonly \DOMNode|null $nextSibling ;
public readonly string $nodeName ;
public string $nodeValue ;
public readonly int $nodeType ;
public readonly Document|null $ownerDocument ;
public readonly \DOMNode|null $parentNode ;
public string $prefix ;
public readonly \DOMNode|null $previousSibling ;
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
/* Trait Methods */
public ContainerNode::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 ContainerNode::insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
public Walk::walk ( \Closure|null $filter = null ) : \Generator
/* Magic Methods */
public __toString() : string
/* Inherited methods */
public \DOMNode::cloneNode ( bool $deep = false ) : \DOMNode|false
public \DOMDocument::createAttribute ( string $localName ) : \DOMAttr|false
public \DOMDocument::createAttributeNS ( string|null $namespace , string $qualifiedName ) : \DOMAttr|false
public \DOMDocument::createCDATASection ( string $data ) : \DOMCdataSection|false
public \DOMDocument::createComment ( string $data ) : Comment|false
public \DOMDocument::createDocumentFragment ( ) : DocumentFragment|false
public \DOMDocument::createElement ( string $localName , string $value = "" ) : Element|false
public \DOMDocument::createElementNS ( string|null $namespace , string $qualifiedName , string $value = "" ) : Element|false
public \DOMDocument::createProcessingInstruction ( string $target , string $data = "" ) : ProcessingInstruction|false
public \DOMDocument::createTextNode ( string $data ) : Text|false
public \DOMDocument::getElementById ( string $elementId ) : Element|null
public \DOMDocument:getElementsByTagName ( string $qualifiedName ) : \DOMNodeList
public getElementsByTagNameNS ( string $namespace , string $localName ) : \DOMNodeList
public \DOMNode::getLineNo ( ) : int
public \DOMNode::getNodePath ( ) : string|null
public \DOMNode::hasAttributes ( ) : bool
public \DOMNode::hasChildNodes ( ) : bool
public \DOMDocument::importNode ( \DOMNode $node , bool $deep = false ) : \DOMNode|false
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 \DOMDocument::normalizeDocument ( ) : void
public \DOMDocument::registerNodeClass ( string $baseClass , string|null $extendedClass ) : bool
public \DOMDocument::relaxNGValidate ( string $filename ) : bool
public \DOMDocument::relaxNGValidateSource ( string $source ) : bool
public \DOMNode::removeChild ( \DOMNode $child ) : \DOMNode|false
public \DOMNode::replaceChild ( \DOMNode $node , \DOMNode $child ) : \DOMNode|false
public \DOMDocument::saveHTML ( \DOMNode|null $node = null ) : string|false
public \DOMDocument::schemaValidate ( string $filename , int $flags = 0 ) : bool
public \DOMDocument::schemaValidateSource ( string $source , int $flags = 0 ) : bool
}
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: