Reputation: 2713
I am reading a xml file with:
$reader = new XMLReader();
$reader->xml($myXml, NULL, LIBXML_NOWARNIG | LIBXML_NOERROR);
but in the same situation in any occasion show this warning on the line $reader->xml($myXml, NULL, LIBXML_NOWARNING, LIBXML_NOERROR);
warning: XMLReader::XML() [xmlreader.xml] Empty string supplied as input.
My question is, Why is showing the warning whether I have used the option LIBXML_NOWARNIG.
Thank you very much.
Upvotes: 0
Views: 2535
Reputation: 316989
you are missing the N in WARNING.
Also, it should be new
not nex
and the method signature of XMLReader::url
is
bool XMLReader::xml ( string $source [, string $encoding [, int $options = 0 ]] )
which means you should call it
$reader->xml($myXml, NULL, LIBXML_NOWARNING|LIBXML_NOERROR);
However: both constants suppress parsing errors and passing an empty string to the method is not a parsing error but a logic error (you cannot parse an empty string) and thus, you cannot suppress it with them.
Upvotes: 1