XSD dynamic structure

Discussion in 'XML' started by helpneded, Jun 15, 2011.

  1. helpneded

    helpneded

    Joined:
    Jun 15, 2011
    Messages:
    2
    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>
    helpneded, Jun 15, 2011
    #1
    1. Advertising

  2. helpneded

    helpneded

    Joined:
    Jun 15, 2011
    Messages:
    2
    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>
    helpneded, Jun 15, 2011
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,079
    Markus
    Nov 22, 2005
  2. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    Replies:
    1
    Views:
    466
    C. M. Sperberg-McQueen
    Sep 26, 2003
  3. JavaDeveloper@nowhere.com

    referencing another XSD file within an XSD file

    JavaDeveloper@nowhere.com, Jan 14, 2004, in forum: XML
    Replies:
    1
    Views:
    845
    Martin Honnen
    Jan 14, 2004
  4. Peter Aberline

    xsd:any as a child of xsd:all

    Peter Aberline, Apr 5, 2004, in forum: XML
    Replies:
    0
    Views:
    771
    Peter Aberline
    Apr 5, 2004
  5. Bernd Oninger
    Replies:
    1
    Views:
    514
    Henry S. Thompson
    Jun 30, 2004
Loading...

Share This Page