XSD dynamic structure

Joined
Jun 15, 2011
Messages
2
Reaction score
0
Hi,

I want to define schema structure which forms dynamically. I mean in my Filter criteria I have Expression in that I have LeftOperand, Operator and RightOperand. When I want to apply filters I add more Expressions in my xml instance and this will be inside one of the Operands (Left or Right). How can I define my Expression record so it can be defined N number of times and it has form inside Operands. Below is the sample, here number of expressions are dynamic they can increase or decrease.

<Filter>
<Expression>
<LeftOperand>
<Expression>
<LeftOperand>
<Expression>
<LeftOperand>
<Expression>
<LeftOperand>
<Expression>
<LeftOperand>
<Expression>
<LeftOperand>
<PropName>CustLinkMode</PropName>
</LeftOperand>
<Operator>
<Type>Comparison</Type>
<Val>Equal</Val>
</Operator>
<RightOperand>
<Literal>
<Type>string</Type>
<Val>Linked</Val>
</Literal>
</RightOperand>
</Expression>
</LeftOperand>
<Operator>
<Type>Logical</Type>
<Val>And</Val>
</Operator>
<RightOperand>
<Expression>
<LeftOperand>
<PropName>ProductStatus</PropName>
</LeftOperand>
<Operator>
<Type>Comparison</Type>
<Val>Equal</Val>
</Operator>
<RightOperand>
<Literal>
<Type>string</Type>
<Val>Active</Val>
</Literal>
</RightOperand>
</Expression>
</RightOperand>
</Expression>
</LeftOperand>
<Operator>
<Type>Logical</Type>
<Val>And</Val>
</Operator>
<RightOperand>
<Expression>
<LeftOperand>
<PropName>CustomerNumber</PropName>
</LeftOperand>
<Operator>
<Type>Comparison</Type>
<Val>Equal</Val>
</Operator>
<RightOperand>
<Literal>
<Type>string</Type>
<Val>000341746</Val>
</Literal>
</RightOperand>
</Expression>
</RightOperand>
</Expression>
</LeftOperand>
<Operator>
<Type>Logical</Type>
<Val>And</Val>
</Operator>
<RightOperand>
<Expression>
<LeftOperand>
<PropName>InquiryMode</PropName>
</LeftOperand>
<Operator>
<Type>Comparison</Type>
<Val>Equal</Val>
</Operator>
<RightOperand>
<Literal>
<Type>string</Type>
<Val>Extended</Val>
</Literal>
</RightOperand>
</Expression>
</RightOperand>
</Expression>
</LeftOperand>
<Operator>
<Type>Logical</Type>
<Val>And</Val>
</Operator>
<RightOperand>
<Expression>
<LeftOperand>
<PropName>IncludeTransferFlag</PropName>
</LeftOperand>
<Operator>
<Type>Comparison</Type>
<Val>Equal</Val>
</Operator>
<RightOperand>
<Literal>
<Type>bolean</Type>
<Val>True</Val>
</Literal>
</RightOperand>
</Expression>
</RightOperand>
</Expression>
</LeftOperand>
<Operator>
<Type>Logical</Type>
<Val>And</Val>
</Operator>
<RightOperand>
<Expression>
<LeftOperand>
<PropName>ProdListType</PropName>
</LeftOperand>
<Operator>
<Type>Comparison</Type>
<Val>Equal</Val>
</Operator>
<RightOperand>
<Literal>
<Type>string</Type>
<Val>All</Val>
</Literal>
</RightOperand>
</Expression>
</RightOperand>
</Expression>
</Filter>
 
Joined
Jun 15, 2011
Messages
2
Reaction score
0
To make it even clear, below is the full schema. Here I want to make entire Expression structure repeated N times inside LeftOperand and RightOperand.

<xs:element minOccurs="1" maxOccurs="1" name="Filter">
<xs:complexType>
<xs:sequence>
<xs:element name="Expression">
<xs:complexType>
<xs:sequence>
<xs:element name="LeftOperand">
<xs:complexType>
<xs:sequence>
<xs:element name="Literal">
<xs:complexType>
<xs:sequence>
<xs:element name="Type" type="xs:string" />
<xs:element name="Val" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PropName" type="xs:string" />
<xs:element name="Expression">
<xs:complexType />
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Operator">
<xs:complexType>
<xs:sequence>
<xs:element name="Type" type="xs:string" />
<xs:element name="Val" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RightOperand">
<xs:complexType>
<xs:sequence>
<xs:element name="Literal">
<xs:complexType>
<xs:sequence>
<xs:element name="Type" type="xs:string" />
<xs:element name="Val" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PropName" type="xs:string" />
<xs:element name="Expression">
<xs:complexType />
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top