1. Go to this page and download the library: Download php-xml/large-text-node library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php-xml / large-text-node example snippets
// php://temp writes first to memory, but if the text node is large, a temporary file is used on the fly.
$output = fopen('php://temp', 'w+');
$input = fopen('some-large-file.xml', 'r');
$path = 'some/target';
// Use the resource reader to parse the XML document
try {
$reader = new StreamReader($input, $path, $output);
$reader->parse();
rewind($output);
// Maybe do something with $output
} catch (XMLException $e) {
// Whoops
} finally {
fclose($output);
fclose($input);
}
// Assume $input is some given stream
$input = fopen('some-file');
$path = 'some/target';
// Open an output stream and add PHP's own base64 decoder filter
$output = fopen('php://temp', 'w+');
stream_filter_append($output, 'convert.base64-decode');
try {
$reader = new StreamReader($input, $path, $output);
$reader->parse();
rewind($output);
} catch (XMLException $e) {
// Whoops
} finally {
fclose($output);
fclose($input);
}
xml
<document>
<tag>
<name>I am matched</name>
</tag>
<tag>
<name>I am skipped</name>
</tag>
</document>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.