-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loading a valid XML from a URL gives empty data #52
Comments
I think the problem is the huge size of the XML file because usingle simplexml_load_string will only work if I add the
|
@daniele-orlando Could you please explain why you don't think this is an issue? I think fluidxml should provide a way to handle big files. How can I work around this limitation? |
Sorry for the wrong handling of this ticket. 😓 FluidXML uses DOMDocument which in turn uses libxml for parsing XML. It's 100% an error due to the default limits of libxml, which can be relaxed as you noted using the LIBXML_PARSEHUGE and LIBXML_COMPACT. Handling the libxml flags requires an integration of the load API, the implementation of the tests and the update of the documentation. Due to my busy schedule, it could take some time. I could enable those flags by default in the future, but it has to be considered as a breaking change because it changes the behaviour of the library which could exhaust the memory of a server. I reopen the ticket, marking it as a request for a feature. In the meantime, you can import the file with DOMDocument/simplexml and then import it inside fluidxml. $xml = file_get_contents('https://www.yourstaging.eu/products.xml');
$dom = new DOMDocument();
$dom->loadXML($xml, LIBXML_PARSEHUGE | LIBXML_COMPACT);
$doc = new FluidXml($dom); Thanks for getting time to report the issue and please, let me know if the workaround does solve the issue in the meantime. |
Hi @daniele-orlando . It's no problem at all this part. In my case I changed the code to use LIBXML directly for my needs but I reported this issue because I found it restricting not being able to set the parse flags as I mentioned. It's not something that needs to be done urgently or anything and I think you're right to mark it as an enhancement. But I also think it will be great to document it in the readme. When I find free time I'll also test the workaround to tell if it works or not and hopefully you can add it to a troubleshooting section in the readme |
I'm trying to load an XML from a URL however it's not loading correctly using fluidxml
URL is
https://www.yourstaging.eu/products.xml
Both queries return 0 nodes and the resulting xml is empty.
I'm not sure why this is happening.
xmlstarlet finds the file is valid xml.
The text was updated successfully, but these errors were encountered: