I have a data structure where values of a certain complex type (let's call it myComplexType) are stored in a list. myComplexType is under another complex type (called complexType1) which is under the "root" i.e (RootName -> complexType1 -> myComplexType)
I am trying to create a loop where the values that I gathered from reading a data file will fill out this complex type. However, this complex type has a minimum occurrence of 1 and a maximum occurrence of 4.
Can anyone show me how to easily create an "n" number of myComplexType (based on the length of the nested loops d, e, f) for each iteration/complexType1 in my loop?
Please let me know if there is any confusion so that I may attempt to clarify further.
Thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And the list J would correspond to "mathOperand" which is defined as follows:
<xs:elementname="mathOperand"minOccurs="0"maxOccurs="11"><xs:annotation><xs:documentation>Value or register to be operated on. Could be numeric or alphanumeric. </xs:documentation></xs:annotation><xs:simpleType><xs:restrictionbase="xs:string"><xs:minLengthvalue="1"/><xs:maxLengthvalue="32"/></xs:restriction></xs:simpleType></xs:element>
I want the XML to output something like this (example are the first two steps of the expected XML generation):
I have a data structure where values of a certain complex type (let's call it
myComplexType
) are stored in a list.myComplexType
is under another complex type (calledcomplexType1
) which is under the "root" i.e (RootName -> complexType1 -> myComplexType
)I am trying to create a loop where the values that I gathered from reading a data file will fill out this complex type. However, this complex type has a minimum occurrence of 1 and a maximum occurrence of 4.
The code I have goes something like this:
How can I create "n" number of
myComplexType
where "n" is the length of the nested lists d,e,f?Further clarification:
I need something like this:
Can anyone show me how to easily create an "n" number of
myComplexType
(based on the length of the nested loops d, e, f) for each iteration/complexType1
in my loop?Please let me know if there is any confusion so that I may attempt to clarify further.
Thanks in advance.
Schema:
Build:
Program:
Output:
Thank you so much Peter.
Ignore this
Last edit: Michael Issa 2016-01-21
I have one more problem I hope you can help me address.
Let's say there are two more lists:
I = [['ADD'], ['SUBTRACT','DIVIDE','MULTIPLY'], 'None', ['ADD'], 'None', ['DIVIDE']]
J = [[12,2], [5,1,4,5,6], 'None', [8,1], 'None', [6,3]]
The list
I
would correspond to "mathOperator" which is defined in the schema as follows:And the list
J
would correspond to "mathOperand" which is defined as follows:I want the XML to output something like this (example are the first two steps of the expected XML generation):
(This is what I think the expected XML would look like based on what I understand from the schema)
The math operators and math operands need to go in between the
h
andextraInfo
elements of the XML.I tried creating a conditional statement in my loop that goes something like this:
Could you please help me understand what I'm doing wrong?
Thanks in advance.
Last edit: Michael Issa 2016-01-21