Skip to content

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