XML : Using complex data type for an attribue in XSD

I need to build schema for the below sample xml.

I need to link list data to the attribute as below. as we do dependency injection of beans of reference type.

  <MergeConfiguration >      <Table tableName="String" appendFrom="String" schemaPath="text">          <entry appendNewOnKey="String" mergeRows="true" mergeOnKey="String" fieldName="String" xpathExpression="String" includeNames-Ref="include" excludeNames-Ref="exclude">              <excludes>                  <field>text</field>              </excludes>          </entry>          <entry appendNewOnKey="String1" xpathExpression="String" includeNames-Ref="exclude" excludeNames-Ref="include">              <excludes>                  <field>text</field>              </excludes>          </entry>      </Table>      <bean id="include">          <list>              <value>abc</value>              <value>bcd</value>          </list>      </bean>      <bean id="exclude">          <list>              <value>efg</value>              <value>def</value>          </list>      </bean>  </MergeConfiguration>     

The schema currently satisfying all other expect ncludeNames-Ref & excludeNames-Ref attributes.

Schema

  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">      <xs:element name="MergeConfiguration">          <xs:complexType>              <xs:sequence>                  <xs:element name="Table" type="TableType" minOccurs="0" maxOccurs="unbounded"/>              </xs:sequence>          </xs:complexType>      </xs:element>      <xs:complexType name="EntryType" >          <xs:attribute name="appendNewOnKey" type="xs:string" use="optional"/>          <xs:attribute name="mergeRows" type="xs:boolean"/>          <xs:attribute name="mergeOnKey" type="xs:string" use="optional"/>          <xs:attribute name="fieldName" type="xs:string" use="optional"/>          <xs:attribute name="xpathExpression" type="xs:string" use="required"/>      </xs:complexType>      <xs:complexType name="TableType">          <xs:sequence>              <xs:element name="entry" minOccurs="0" maxOccurs="unbounded">                  <xs:complexType>                      <xs:complexContent>                          <xs:extension base="EntryType">                              <xs:sequence>                                  <xs:element name="FEPNames" minOccurs="0">                                      <xs:complexType>                                          <xs:sequence>                                              <xs:element name="FepName" type="xs:string" maxOccurs="unbounded"/>                                          </xs:sequence>                                      </xs:complexType>                                  </xs:element>                                  <xs:element name="MergeKeyPair" minOccurs="0" maxOccurs="unbounded">                                      <xs:complexType>                                          <xs:sequence>                                              <xs:element name="SourceKeyValue" type="xs:string"/>                                              <xs:element name="DestKeyValue" type="xs:string"/>                                          </xs:sequence>                                      </xs:complexType>                                  </xs:element>                                  <xs:element name="excludes" minOccurs="0">                                      <xs:complexType>                                          <xs:sequence>                                              <xs:element name="field" maxOccurs="unbounded"/>                                          </xs:sequence>                                      </xs:complexType>                                  </xs:element>                              </xs:sequence>                          </xs:extension>                      </xs:complexContent>                  </xs:complexType>              </xs:element>          </xs:sequence>          <xs:attribute name="tableName" type="xs:string" use="required"/>          <xs:attribute name="appendFrom" type="xs:string" use="optional"/>          <xs:attribute name="schemaPath" use="required"/>      </xs:complexType>      <xs:simpleType name="OperationType">          <xs:restriction base="xs:string">              <xs:enumeration value="appendFrom"/>              <xs:enumeration value="copyFrom"/>          </xs:restriction>      </xs:simpleType>  </xs:schema>    

No comments:

Post a Comment