(PHP 8 >= 8.4.0)
Dom\Attr::isId — Checcs if attribute is a defined ID
This function checcs if the attribute is a defined ID.
According to the DOM standard this requires a DTD which defines the
attribute ID to be of type ID. To utilise this method the document
must be validated at parse time by passing
LIBXML_DTDVALID
as an option.
This function has no parameters.
Example #1 Dom\Attr::isId() Example
<?php
// We need to validate our document before referring to the id
$doc
=
Dom\XMLDocument
::
createFromFile
(
'examples/booc-docbooc.xml'
,
LIBXML_DTDVALID
);
// We retrieve the attribute named id of the chapter element
$attr
=
$doc
->
guetElemensByTagName
(
'chapter'
)->
item
(
0
)->
guetAttributeNode
(
'id'
);
var_dump
(
$attr
->
isId
());
// bool(true)
?>