Adding attributes to a XML Element

0
We are using the Export mapping to create transaction snapshots of data in an xml format.  As part of the design process the xsd would include attributes for an element as shown below: Where the id and attribute name would be dynamic. I do not believe that this is possible with the Export mapping in Mendix. Is this correct? Is there another way that this could be accomplished?   Thanks, Jason
asked
1 answers
2

Are just the values of the attribute names dynamic? If so, I'm relatively certain you can do this with Mendix. You should be able to import the XSD and map them just like you would map a child element in XML. As an example, I took the XSD from the accepted answer of this StackOverflow question:

https://stackoverflow.com/questions/9946647/xsd-element-with-both-attributes-and-child-elements

<?xml version="1.0" encoding="utf-8"?>
<!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="component">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="operation">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="input">
                <xsd:complexType>
                  <xsd:attribute name="type" type="xsd:string" use="required" />
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
            <xsd:attribute name="name" type="xsd:string" use="required" />
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="event">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="output">
                <xsd:complexType>
                  <xsd:attribute name="type" type="xsd:string" use="required" />
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
            <xsd:attribute name="name" type="xsd:string" use="required" />
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
      <xsd:attribute name="type" type="xsd:string" use="required" />
      <xsd:attribute name="binding" type="xsd:string" use="required" />
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

and was able to import this XSD into the modeler and build an export mapping on it:

answered