{"id":305211,"date":"2021-09-12T14:15:07","date_gmt":"2021-09-12T14:15:07","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=305211"},"modified":"2024-07-24T12:14:01","modified_gmt":"2024-07-24T12:14:01","slug":"read-xml-data-from-a-xml-file-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/","title":{"rendered":"Read XML Data from a XML file in Magento 2"},"content":{"rendered":"\n<p>In Magento 2, there are a number of methods are available which are helpful to manage files and directory systems. In this blog, we are going to learn how we can read XML data from an XML file URL.<\/p>\n\n\n\n<p>In Magento 2, it provides <strong>\\Magento\\Framework\\Filesystem\\DriverInterface<\/strong> interface, where the <strong>fileGetContents<\/strong> method is declared, we use this method to read\/get file content or data from any relative or absolute path or an URL. <\/p>\n\n\n\n<p>When we will read the XML file using an URL we can convert it into an Array by using the xmlToAssoc method of <strong>\\Magento\\Framework\\Convert\\Xml<\/strong> Class. <\/p>\n\n\n\n<p>We will use these steps in our Block file ReadXml.php inside app\/code\/Vendor\/CustomModule\/Block\/Demo\/ directory.<\/p>\n\n\n\n<p>We can also parse the XML data into an array by calling the xmlToArray method after loading the parser object(object of \\Magento\\Framework\\Xml\\Parser Class).<\/p>\n\n\n\n<p>Please follow the below steps to get the result:<br>1. <a href=\"https:\/\/webkul.com\/blog\/create-hello-module-in-magento2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Create a Module.<\/a><br>2. Create routename_controllername_action.xml file inside app\/code\/Vendor\/CustomModule\/view\/frontend\/layout\/ directory.<br><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;page xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; layout=&quot;1column&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&quot;&gt;\n    &lt;referenceContainer name=&quot;content&quot;&gt;\n        &lt;block class=&quot;Vendor\\CustomModule\\Block\\Demo\\ReadXml&quot; \n            name=&quot;custom_demo_xml&quot; \n            template=&quot;Vendor_CustomModule::readxml.phtml&quot; \n            cacheable= &quot;false&quot;\/&gt;\n    &lt;\/referenceContainer&gt;\n&lt;\/page&gt;<\/pre>\n\n\n\n<p>3. Create Controller file ReadXml.php inside app\/code\/Vendor\/CustomModule\/Controller\/Demo\/ directory.<br><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Vendor_CustomModule\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Vendor\\CustomModule\\Controller\\Demo;\n\nuse Magento\\Framework\\App\\Action\\Action;\nuse Magento\\Framework\\App\\Action\\Context;\nuse Magento\\Framework\\View\\Result\\PageFactory;\n\nclass ReadXml extends Action\n{\n    \/**\n     * @var PageFactory\n     *\/\n    protected $_resultPageFactory;\n\n    \/**\n     * initialization\n     *\n     * @param Context $context\n     * @param PageFactory $resultPageFactory\n     *\/\n    public function __construct(\n        Context $context,\n        PageFactory $resultPageFactory\n    ) {\n        $this-&gt;_resultPageFactory = $resultPageFactory;\n        parent::__construct($context);\n    }\n    \n    \/**\n     * Execute ...\n     *\/\n    public function execute()\n    {\n        $resultPage = $this-&gt;_resultPageFactory-&gt;create();\n        $resultPage-&gt;getConfig()-&gt;getTitle()-&gt;set(__(&quot;Read Xml&quot;));\n        return $resultPage;\n    }\n}<\/pre>\n\n\n\n<p>4. Create Block file ReadXml.php inside app\/code\/Vendor\/CustomModule\/Block\/Demo\/ directory.<br><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Vendor_CustomModule\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Vendor\\CustomModule\\Block\\Demo;\n\nclass ReadXml extends \\Magento\\Framework\\View\\Element\\Template\n{\n    \/**\n     * @var \\Magento\\Framework\\Xml\\Parser\n     *\/\n    private $parser;\n\n    \/**\n     * @var \\Magento\\Framework\\Xml\\Parser\n     *\/\n    protected $convertXml;\n\n    \/**\n     * @var \\Magento\\Framework\\Filesystem\\DriverInterface\n     *\/\n    protected $driver;\n\n    public function __construct(\n        \\Magento\\Framework\\Xml\\Parser $parser,\n        \\Magento\\Framework\\Convert\\Xml $convertXml,\n        \\Magento\\Framework\\Filesystem\\DriverInterface $driver,\n        \\Magento\\Framework\\View\\Element\\Template\\Context $context\n    ) {\n        $this-&gt;parser     = $parser;\n        $this-&gt;driver     = $driver;\n        $this-&gt;convertXml = $convertXml;\n        parent::__construct($context);\n    }\n\n    \/**\n     * Read xml data from URL and convert it into array by using xmlToAssoc method of \\Magento\\Framework\\Convert\\Xml Class\n     * @return array\n     *\/\n    public function readXmlData()\n    {\n        $filePath = &quot;http:\/\/example.com\/products.xml&quot;;\n        $fileContent = $this-&gt;driver-&gt;fileGetContents($filePath, null, null);\n        $xml = new \\SimpleXMLElement($fileContent);\n        $xmlToArray = $this-&gt;convertXml-&gt;xmlToAssoc($xml);\n        return $xmlToArray;\n    }\n\n    \/**\n     * Get parsed array from xml file&#039;s URL\n     * @return array\n     *\/\n    public function readXmlDataByParser()\n    {\n        $filePath = &quot;http:\/\/example.com\/products.xml&quot;;\n        $parsedArray = $this-&gt;parser-&gt;load($filePath)-&gt;xmlToArray();\n        return $parsedArray;\n    }\n}<\/pre>\n\n\n\n<p>5. Create readxml.phtml file inside app\/code\/Vendor\/CustomModule\/view\/frontend\/templates\/ directory.<br><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n$xmlData = $block-&gt;readXmlData();\n?&gt;\n&lt;pre&gt;\n    &lt;?php\n    print_r($xmlData);\n    $data = $block-&gt;readXmlDataByParser();\n    print_r($data);\n    ?&gt;\n&lt;\/pre&gt;<\/pre>\n\n\n\n<p>6. When we hit the ReadXml Controller in the browser&#8217;s window, we get the result like the following image when getting data from <strong>readXML<\/strong> data method from the Block file.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"617\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png\" alt=\"ReadXmlControllerResponsePage\" class=\"wp-image-305214\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-300x154.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-250x129.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-768x395.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1536x790.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage.png 1813w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>7. When we hit the ReadXml Controller in the browser&#8217;s window, we get the result like the following image when getting data from <strong>readXmlDataByParser<\/strong> data method from the Block file.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"623\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponseWhenUsingParser-1200x623.png\" alt=\"ReadXmlControllerResponseWhenUsingParser\" class=\"wp-image-305215\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponseWhenUsingParser-1200x623.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponseWhenUsingParser-300x156.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponseWhenUsingParser-250x130.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponseWhenUsingParser-768x399.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponseWhenUsingParser-1536x797.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponseWhenUsingParser.png 1803w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Hope this will be helpful. Thanks \ud83d\ude42<br><br>Previous Blog: <a href=\"https:\/\/webkul.com\/blog\/generate-xml-file-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Generate XML file in Magento 2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Magento 2, there are a number of methods are available which are helpful to manage files and directory systems. In this blog, we are going to learn how we can read XML data from an XML file URL. In Magento 2, it provides \\Magento\\Framework\\Filesystem\\DriverInterface interface, where the fileGetContents method is declared, we use this <a href=\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":249,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121],"tags":[12037,12035,12031,12036],"class_list":["post-305211","post","type-post","status-publish","format-standard","hentry","category-magento-2","tag-get-data-from-xml-file","tag-parse-xml","tag-read-xml","tag-xml-file"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Read XML Data from a XML file in Magento 2 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Read XML Data from a XML file in Magento 2, How to read XML Data from a XML file in Magento 2, get data from xml file\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Read XML Data from a XML file in Magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Read XML Data from a XML file in Magento 2, How to read XML Data from a XML file in Magento 2, get data from xml file\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-12T14:15:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-24T12:14:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png\" \/>\n<meta name=\"author\" content=\"Khushboo Sahu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khushboo Sahu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\"},\"author\":{\"name\":\"Khushboo Sahu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\"},\"headline\":\"Read XML Data from a XML file in Magento 2\",\"datePublished\":\"2021-09-12T14:15:07+00:00\",\"dateModified\":\"2024-07-24T12:14:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\"},\"wordCount\":294,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png\",\"keywords\":[\"get data from xml file\",\"Parse XML\",\"Read XML\",\"xml file\"],\"articleSection\":[\"Magento 2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\",\"name\":\"Read XML Data from a XML file in Magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png\",\"datePublished\":\"2021-09-12T14:15:07+00:00\",\"dateModified\":\"2024-07-24T12:14:01+00:00\",\"description\":\"Read XML Data from a XML file in Magento 2, How to read XML Data from a XML file in Magento 2, get data from xml file\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage.png\",\"width\":1813,\"height\":932,\"caption\":\"ReadXmlControllerResponsePage\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Read XML Data from a XML file in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\",\"name\":\"Khushboo Sahu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Khushboo Sahu\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Read XML Data from a XML file in Magento 2 - Webkul Blog","description":"Read XML Data from a XML file in Magento 2, How to read XML Data from a XML file in Magento 2, get data from xml file","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"Read XML Data from a XML file in Magento 2 - Webkul Blog","og_description":"Read XML Data from a XML file in Magento 2, How to read XML Data from a XML file in Magento 2, get data from xml file","og_url":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2021-09-12T14:15:07+00:00","article_modified_time":"2024-07-24T12:14:01+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png","type":"","width":"","height":""}],"author":"Khushboo Sahu","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Khushboo Sahu","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/"},"author":{"name":"Khushboo Sahu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca"},"headline":"Read XML Data from a XML file in Magento 2","datePublished":"2021-09-12T14:15:07+00:00","dateModified":"2024-07-24T12:14:01+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/"},"wordCount":294,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png","keywords":["get data from xml file","Parse XML","Read XML","xml file"],"articleSection":["Magento 2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/","name":"Read XML Data from a XML file in Magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage-1200x617.png","datePublished":"2021-09-12T14:15:07+00:00","dateModified":"2024-07-24T12:14:01+00:00","description":"Read XML Data from a XML file in Magento 2, How to read XML Data from a XML file in Magento 2, get data from xml file","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/ReadXmlControllerResponsePage.png","width":1813,"height":932,"caption":"ReadXmlControllerResponsePage"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/read-xml-data-from-a-xml-file-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Read XML Data from a XML file in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca","name":"Khushboo Sahu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Khushboo Sahu"},"url":"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/305211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/249"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=305211"}],"version-history":[{"count":6,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/305211\/revisions"}],"predecessor-version":[{"id":454538,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/305211\/revisions\/454538"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=305211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=305211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=305211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}