Skip to content
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

XML Stream Processing – Proof of concept #43

Draft
wants to merge 10 commits into
base: xml-processor
Choose a base branch
from

Conversation

adamziel
Copy link
Owner

@adamziel adamziel commented Jun 4, 2024

Proof of concept to complement WordPress#6713

Enables stream-processing large XML files as follows:

$wxr = file_get_contents(__DIR__ . '/test.wxr');
$tokens = stream_next_xml_token(chunk_text($wxr));
foreach($tokens as $processor) {
    if ($processor->get_token_type() === '#cdata-section' && $processor->matches_breadcrumbs(array('content:encoded'))) {
        echo "\n " . dump_token($processor);
    }
}

Remaining work

  • Public API that doesn't leak internal details like parsed indices
  • A way to set memory limit

Trac ticket: https://core.trac.wordpress.org/ticket/61365

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant