public function parse(): array
    {
        $previousEntityState = libxml_disable_entity_loader(true);
        $previousSetting = libxml_use_internal_errors(true);

        try {
            while (self::ELEMENT !== $this->nodeType) {
                if (!$this->read()) {
                    $errors = libxml_get_errors();
                    libxml_clear_errors();
                    if ($errors) {
                        throw new LibXMLException($errors);
                    }
                }
            }
            $result = $this->parseCurrentElement();

            // last line of defense in case errors did occur above
            $errors = libxml_get_errors();
            libxml_clear_errors();
            if ($errors) {
                throw new LibXMLException($errors);
            }
        } finally {
            libxml_use_internal_errors($previousSetting);
            libxml_disable_entity_loader($previousEntityState);
        }

        return $result;
    }
public function parse(): array
    {
        $previousEntityState = libxml_disable_entity_loader(true);
        $previousSetting = libxml_use_internal_errors(true);

        try {
            while (self::ELEMENT !== $this->nodeType) {
                if (!$this->read()) {
                    $errors = libxml_get_errors();
                    libxml_clear_errors();
                    if ($errors) {
                        throw new LibXMLException($errors);
                    }
                }
            }
            $result = $this->parseCurrentElement();

            // last line of defense in case errors did occur above
            $errors = libxml_get_errors();
            libxml_clear_errors();
            if ($errors) {
                throw new LibXMLException($errors);
            }
        } finally {
            libxml_use_internal_errors($previousSetting);
            libxml_disable_entity_loader($previousEntityState);
        }

        return $result;
    }
public function parse ( ) : array { $ previousEntityState = libxml_disable_entity_loader ( true ) ; $ previousSetting = libxml_use_internal_errors ( true ) ; try { while ( self :: ELEMENT !== $ this -> nodeType ) { if ( ! $ this -> read ( ) ) { $ errors = libxml_get_errors ( ) ; libxml_clear_errors ( ) ; if ( $ errors ) { throw new LibXMLException ( $ errors ) ; } } } $ result = $ this -> parseCurrentElement ( ) ; // last line of defense in case errors did occur above $ errors = libxml_get_errors ( ) ; libxml_clear_errors ( ) ; if ( $ errors ) { throw new LibXMLException ( $ errors ) ; } } finally { libxml_use_internal_errors ( $ previousSetting ) ; libxml_disable_entity_loader ( $ previousEntityState ) ; } return $ result ; }
Reads the entire document.

This function returns an array with the following three elements:
* name - The root element name.
* value - The value for the root element.
* attributes - An array of attributes.

This function will also disable the standard libxml error handler (which
usually just results in PHP errors), and throw exceptions instead.
Reads the entire document .