From 6b6c11f3ea4b7ac5966f9f39ce3c2500c1740972 Mon Sep 17 00:00:00 2001 From: Matroskeen <matroskeen@3426249.no-reply.drupal.org> Date: Sat, 23 Apr 2022 16:37:27 +0000 Subject: [PATCH] Issue #3276619 by Matroskeen: Document XML parsers and explain the difference between them --- src/Plugin/migrate_plus/data_parser/SimpleXml.php | 5 +++++ src/Plugin/migrate_plus/data_parser/Xml.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Plugin/migrate_plus/data_parser/SimpleXml.php b/src/Plugin/migrate_plus/data_parser/SimpleXml.php index 0d6eb9ec..5f86b8bc 100644 --- a/src/Plugin/migrate_plus/data_parser/SimpleXml.php +++ b/src/Plugin/migrate_plus/data_parser/SimpleXml.php @@ -10,6 +10,11 @@ use Drupal\migrate_plus\DataParserPluginBase; /** * Obtain XML data for migration using the SimpleXML API. * + * SimpleXML parses the whole file into memory, which allows using XPath + * expression in the item selector. For large XML sources it results in + * consuming lots of memory, which can be undesirable. If you run into memory + * issues, then consider using the 'xml' data parser. + * * @DataParser( * id = "simple_xml", * title = @Translation("Simple XML") diff --git a/src/Plugin/migrate_plus/data_parser/Xml.php b/src/Plugin/migrate_plus/data_parser/Xml.php index ead05917..580df846 100644 --- a/src/Plugin/migrate_plus/data_parser/Xml.php +++ b/src/Plugin/migrate_plus/data_parser/Xml.php @@ -10,6 +10,11 @@ use Drupal\migrate_plus\DataParserPluginBase; /** * Obtain XML data for migration using the XMLReader pull parser. * + * XMLReader reader performs incremental parsing of an XML file. This allows + * parsing very large XML sources (e.g. 200MB WordPress dumps), which reduces + * the memory usage and increases the performance. The disadvantage is that it's + * not possible to use XPath search across the entire source. + * * @DataParser( * id = "xml", * title = @Translation("XML") -- GitLab