php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55821 Provide readonly access to the meta data for the XML stream.
Submitted: 2011-09-30 16:39 UTC Modified: -
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: RQuadling at GMail dot com Assigned:
Status: Open Package: *XML functions
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
25 + 41 = ?
Subscribe to this entry?

 
 [2011-09-30 16:39 UTC] RQuadling at GMail dot com
Description:
------------
My start point is the SimpleXMLIterator, but I realise the the any extension 
based upon libxml would have the same issue.

When you are reading a XML stream, file or string, there is no mechanism 
available to access the position within the XML unless you implement a 2 pass 
mechanism to count the nodes in the first pass and then record your position in 
the second pass.

Using the count() method is available in some of the XML classes, but this is 
still a 2 pass system.

My feature would be to have a mechanism to be able to read the start and end 
position of the element as well as knowing the total size of the file. So the 
progress through the file is still possible (and displayed as a %age rather than 
as an "n of m").

From what I can see, this is not a minor amount of work. Especially as I can do 
something like ...

$it = new SimpleXMLIterator('compress.zlib://http://www.site.com/file.xml.gz');

In this instance, there are 2 filelengths. The .gz file from the site as well as 
the streamed/expanded XML file.

Realistically, only the expanded XML file value would be useful in my use case.

It may be that any/all stream/filters/etc that interact with the data would need 
to be able to report their data.




Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 14:01:30 2024 UTC