import custom xml file to magento

import custom xml file to magento

August 16, 2026 · Illustrated author avatarBy Stefan Bogdanescu
import custom xml file to magento

Importing Custom XML Files into Magento

Hello developers! Today we’re going to tackle an important question about importing custom XML files into Magento. If you’re struggling with this process, you’ve come to the right place.

Understanding the Problem

Roland has a well-structured XML file containing product data. However, when he tries to import it using Magento’s built-in import system, the process fails. The error message is “FOUND 0 ROWS.” This indicates that the mapping between the XML fields and the Magento attributes isn’t being established correctly.

Analyzing the XML File Structure

Roland’s XML file follows a clean structure:

<?xml version="1.0" encoding="iso-8859-2"?>
<service >
   <product id="2476" sku="SA 177-2" category="51" visible="1">
     <title><![CDATA[Fedde Le Grand - OUTPUT]]></title>
     <short><![CDATA[Fedde Le Grand presents OUTPUT...]]</short>
     <long />
     <category><![CDATA[elektronika/dance/ambient]]></category>
     <price>1600</price>
     <vat>25</vat>
     <image>200909/92917a17f143088ce219_20090907.jpg</image>
     <actor><![CDATA[Fedde le Grand]]></actor>
     <album><![CDATA[Output]]></album>
     <label><![CDATA[CLS]]></label>
     <type><![CDATA[Audio CD]]></type>
   </product>
</service>

Key points to note:

  • The root element is <service>.
  • Each product is enclosed within a <product> tag with attributes like id, sku, category, and visible.
  • Product details are contained within sub-tags like <title>, <short>, <long>, etc.

Investigating the Magento Import Profile

Roland has set up an import profile in Magento. The XML mapping looks like this:

<action type="dataflow/convert_parser_xml_excel" method="parse">
    <var name="single_sheet"><![CDATA[]]></var>
    <var name="fieldnames"></var>
    <var name="map">
        <!-- Mapping definitions here -->
    </var>
    ...
</action>

The Issue with the Current Mapping

The main problem lies in the mapping between the XML fields and Magento attributes. Roland is trying to map some fields that don’t exist or have different names in the Magento product setup.

For example:

  • In the XML, category refers to a specific category ID (51). In Magento, you would typically use category_ids for multiple categories.
  • The <long> tag in XML has no corresponding field in Roland’s mapping. It seems he is missing or improperly handling this field.

To resolve this issue effectively:

Solution 1: Use the Correct Map Names

Ensure your map names match exactly with what Magento expects for each attribute. For example, use category_ids instead of category.

<map name="category_ids"><![CDATA[category]]></map>

Solution 2: Handle Missing Fields Properly

If a field is missing in the source XML but required in the target product (like <long>), you can:

a. Provide a default value in your mapping.

<map name="description"><![CDATA[]]></map>

b. Use the dataflow/convert_parser_xml_excel method’s ifnull parameter to replace empty values with a specific string or null.

Solution 3: Validate and Clean Your XML

Before importing, validate your XML structure using online validators like https://www.freeformatter.com/xml-validator-xsd.html to ensure it’s clean and well-formed. This can help catch any minor issues that might be causing the import to fail silently.

Conclusion

In conclusion, Roland’s issue is a common one in Magento imports—mismatched field names between the source XML and target product attributes. The solution typically involves adjusting your mapping definitions accordingly.

Remember, Magento uses specific attribute names for its products. Always double-check these against your source data fields to ensure a successful import.

For more advanced Magento importing techniques and tools, check out our comprehensive guide at Laravel Company.

Happy coding! Let me know if you have any other questions or need further clarification.

Catalog Pricing Import/Export Errors

Our network