XMLReader example

/** * @author Baptiste ClaviƩ <clavie.b@gmail.com> */
class XmlReaderCasterTest extends TestCase
{
    use VarDumperTestTrait;

    private \XMLReader $reader;

    protected function setUp(): void
    {
        $this->reader = new \XMLReader();
        $this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml');
    }

    protected function tearDown(): void
    {
        $this->reader->close();
    }

    public function testParserProperty()
    {
        $this->reader->setParserProperty(\XMLReader::SUBST_ENTITIES, true);

        
$return = false;
            }

            $this->current_line = xml_get_current_line_number($xml);
            $this->current_column = xml_get_current_column_number($xml);
            $this->current_byte = xml_get_current_byte_index($xml);
            xml_parser_free($xml);
            return $return;
        }

        libxml_clear_errors();
        $xml = new XMLReader();
        $xml->xml($data);
        while (@$xml->read())
        {
            switch ($xml->nodeType)
            {

                case constant('XMLReader::END_ELEMENT'):
                    if ($xml->namespaceURI !== '')
                    {
                        $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
                    }
                    
Home | Imprint | This part of the site doesn't use cookies.