开发者

PHP XMLReader - accessing ELEMENT constant but getting T_PAAMAYIM_NEKUDOTAYIM error [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not ge开发者_如何学编程nerally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

Got a server running: php 5.2.17, libxml 2.7.8 with XMLReader enabled.

The problem is, it's complaining about parse error with T_PAAMAYIM_NEKUDOTAYIM when I try $xmlReader::ELEMENT.

Is there any specific version that this behavior was introduced? as it seems to work fine on my offline 5.3.6 server...

    $xmlReader = new XMLReader;
    if (!$xmlReader->open('file.xml', null, 1<<19)){
        throw new Exception('Unable to read file',1);
    }

    # Go down to WEBRESOURCES node level
    while ($xmlReader::ELEMENT){ // This is what it throws the parse error for
        if ($xmlReader->name == "blahblah"){
            break;
        }
        $xmlReader->read();
    }

Thanks, Dom


Use the name of the class instead of the instance. XMLReader::ELEMENT


I think your while-loop should look like

while ($xmlReader->nodeType == XMLReader::ELEMENT) { 
    if ($xmlReader->name == "blahblah"){
        break;
    }
    $xmlReader->read();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜