I am actually moving a custom dataflow extension from Magento 1 to Magento 2.

In M1 we can add custom configuration / mapping for each flow using XML. The XML structure is free and thought by the developer that he use with getNode() function in his code.

In M2 I would like to do the same thing. Have a file flow.xml where the developer put his flow mapping and configuration.
I create the correct Reader from this post https://magento.stackexchange.com/a/82049/33619 which is working fine.

Now my issue is with XSD for my flow.xml file to tell that node <mapping></mapping and <options></options> can contain whatever developer wants.
Here are my actual files :

# File flow.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Dnd_Flow:etc/flow.xsd">
        // Here can be string or other nodes on X levels
        // Here can be string or other nodes on X levels

My XSD file looks like this :

# File flow.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="config" type="configType" />

    <xs:complexType name="configType">
            <xs:element type="xs:????" name="mapping" minOccurs="0" />
            <xs:element type="xs:????" name="options" minOccurs="0" />

I tried mixed values, differents element types but no result.
I am new to XSD so I would like to know what is the solution to tell that there can be everything in my nodes ?

Thank you,


I answer to my question, I have the solution for other people found this post:

The type you want is xsd:anyType, which you can get either by name:

<xs:element type="xs:anyType" name="mapping" minOccurs="0" />
<xs:element type="xs:anyType" name="options" minOccurs="0" />

or by omitting the type attribute:

<xs:element name="mapping" minOccurs="0" />
<xs:element name="options" minOccurs="0" />

Source by C. M. Sperberg-McQueen : https://stackoverflow.com/a/36489488/3531064

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.