Adds a child node
public function addChild ( ?NodeInterface $child )
Adds multiple child nodes
public function addChildren ( ...$children )
Returns the parent node
public function getParent ( ) : ? Node
Returns the first child node of a given type
public function getFirstChildNode ( ...$types )
Returns the first token of a given kind See: TokenKind class
public function getFirstToken ( ...$kinds )
Returns all child nodes of a given type
public function getChildNodesOfType ( ...$types )
Returns all child tokens of a given kind See: TokenKind class
public function getChildTokensOfType ( ...$kinds )
Walks through all descendant nodes and tokens
public function walkDescendantNodesAndTokens ( callable $callback )
Walks through all descendant nodes
public function walkDescendantNodes ( callable $callback )
Walks through all descendant tokens
public function walkDescendantTokens ( callable $callback )
Returns the root node. Will return self if node has no parent
public function getRoot ( ) : Node
Returns all child nodes and tokens
public function getChildNodesAndTokens ( )
Returns all child nodes
public function getChildNodes ( )
Returns all child tokens
public function getChildTokens ( )
public function getTokenAtOffset ( int $offset )
JSON serialize node for debugging purposes
public function jsonSerialize ( ) : mixed
Returns the prolog node
public function getProlog ( ) : ? Prolog
Returns the root element node
public function getRootElement ( ) : ? Element
Returns the misc node
public function getMisc ( ) : array
Returns the element name as string. Returns null if NAME token is not found
public function getName ( ) : ? string
Returns all element attribute nodes
public function getAttributes ( ) : array
Returns the content node
public function getContent ( ) : ? Content
Returns all child element nodes
public function getElements ( ) : array
Returns all child reference nodes
public function getReferences ( ) : array
Returns all child charData nodes
public function getCharData ( ) : array
Returns all CData strings
public function getCData ( ) : array
Returns all comment strings
public function getComments ( ) : array
Returns the attribute name as string. Returns null if NAME token is not found
public function getName ( ) : ? string
Returns the attribute value as string (without quotes) Returns null if STRING token is not found
public function getValue ( ) : ? string
Returns the attribute value as string (with quotes) Returns null if STRING token is not found
public function getFullValue ( ) : ? string
Returns the text content of the node. Does not include whitesspace
public function getText ( ) : ? string
Returns all child attribute nodes
public function getAttributes ( ) : array
Returns the entity reference as string.
public function getEntityRef ( ) : ? string
Returns the character reference as string.
public function getCharRef ( ) : ? string
public function __construct ( )
Parses an XML string into a Document node
public function parse ( string $xml ) : Node\Document
public function __construct ( )
Splits raw XML string into tokens
public function tokenize ( string $input )
public function __construct ( int $kind,
string $fullValue,
string $value,
int $offset,
int $fullOffset, )
JSON serialize token for debugging purposes
public function jsonSerialize ( ) : mixed