How do I generate mixed XML output?
The output XML file that I need to generate looks like the following:
<key>[some text]
<name>[some name]</name>
<address>[some address]</address>
...
</key>
In the XSD for the schema defines the <key> element as follows:
<xs:element name="key" maxOccurs="unbounded" minOccurs="0">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element type="xs:string" name="name"/>
...
How do I set up the Data Mapping to populate the <key> element in such a way?
-
Hi Apollo,
When you open the Schema in the data mapper, what fields are appearing?
0 -
When I open the schema in the data mapper, a field corresponding to each element in the XSD appears.
The XSD looks like the following:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Signature">
<xs:complexType>
<xs:sequence>
<xs:element name="Key" maxOccurs="unbounded" minOccurs="0">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element type="xs:string" name="vc"/>
<xs:element type="xs:string" name="Date"/>
<xs:element type="xs:string" name="Time"/>
...
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>The <Signature> element appears as the root element in the mapper. <Key> shows up underneath that, and <vc>, <Date>, <Time>, etc. appear underneath <Key>.
0 -
HI Apollo,
You can filter out the necessary elements (and pass through the required ones) by using the filter condition IFF -
http://support.adeptia.com/entries/21281588-Using-Filter-IFF-function
You can also refer to the Adeptia Help > Home > Transforming Data > Using Data Mapper > Filtering of Elements/Attributes in Target Data
0 -
In fact, my mapping already does what the article suggests, but the support article doesn't address my problem. My problem isn't just a filtering problem. My problem is that the same target node is being used both for filtering and for containing text data. The output XML needs to include a text value AFTER the <Key> element. That's exactly the implication of the XSD directive, "<xs:complexType mixed="true">". Normal complex types have nothing by other child elements. Normal simple types basically contain some value between the start and end tags. I require a mix of child elements and text outside of any of the child elements in the XML output. To me, there's no obvious place in the <key> node mapping for me to link the text source to.
Where does "Adeptia Help > Home > Transforming Data > Using Data Mapper > Filtering of Elements/Attributes in Target Data" refer to?
0 -
Hi Apollo,
Please try using the Custom XSL Before on the Element after the key element. For Example in the Attached screenshots we have applied a Custom XSL Before on element that will map the value to the key element.
For more information refer the below forum post:
http://support.adeptia.com/entries/28228726-Custom-XSL-example
0 -
The Custom XSL technique works. Thanks for your help.
0
Post is closed for comments.
Comments
6 comments