|  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: -
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:
Solve the problem:
29 + 47 = ?
Subscribe to this entry?

 [2011-09-30 16:39 UTC] RQuadling at GMail dot com
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://');

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.


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 03:03:35 2021 UTC