B
boeledi
Hello,
Here is a sample of XML I would like to obtain.
<message xmlns = "........">
<Entities>
<Persons>
<Person entityID="12">
<Name>Name1</Name>
<Info>blablabla</Info>
</Person>
<Person entityID="34">
<Name>Another person</Name>
<Info>Another information</Info>
</Person>
</Persons>
<Companies>
<Company entityID="145">
<Name>My First Company</Name>
<Address>AddressOfFirstCompany</Address>
</Company>
<Company entityID="235">
<Name>My Second Company</Name>
<Address>AddressOf SecondCompany</Address>
</Company>
</Companies>
</Entities>
<!-- Details part -->
<Details>
<Info1>jqdjqdkjqdqjdlqjdqlk</Info1>
<Owner refEntityId = "145" />
<Driver refEntityId = "12" />
<Contact refEntityId = "34" />
</Details>
</message>
------------------------------------------------------------------------------
....a little bit of information:
1. Persons and Companies are both extensions of a same ComplexType:
Entity (here is an extract of the definitions)
<!-- Entity -->
<xs:complexType name="entity">
<xs:sequence>
<xs:element name="type" type="xs:string" />
<xs:element name="name" type="xs:string" />
...
</xs:sequence>
<xs:attribute name="entityID" type="xs:integer" />
</xs:complexType>
<!-- Person -->
<xs:complexType name="person">
<xs:complexContent>
<xs:extension base="myns:entity">
<xs:sequence>
<xs:element name="firstNames" type="xs:string" />
<xs:element name="sex" type="xs:integer" />
<xs:element name="placeOfBirth" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- Company -->
<xs:complexType name="company">
<xs:complexContent>
<xs:extension base="myns:entity">
<xs:sequence>
<xs:element name="tradingNames" type="xs:string" />
<xs:element name="remarks" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
-----------------------------------------------------------------------------------
2. I would like to be able to either refer to a Person or a Company
when I am specifying the "owner", "driver" or "contact"
-----------------------------------------------------------------------------------
A first thought was...
<xs:complexType name="messageContent">
<xs:sequence>
<xs:element name="Entities" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Persons" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="person" type="mynserson" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Companies" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="company" type="myns:company" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Details" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Info1" type="xs:string" />
<xs:element name="Owner" type="myns:refToEntity" minOccurs="1"
maxOccurs="1" />
<xs:element name="Driver" type="myns:refToEntity" minOccurs="1"
maxOccurs="1" />
<xs:element name="Contact" type="myns:refToEntity" minOccurs="1"
maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="refToEntity">
<xs:complexType>
<xs:attibute name="refEntityId" type="xs:integer" />
</xs:complexType>
</xs:complexType>
<xs:element name="message" type="myns:messageContent" />
-----------------------------------------------------------------------------------
....but I don't know how (or where) to put 'ref' and/or 'keyref' in
order to answer my needs?
Could anyone help me?
Thanks in advance,
Didier
Here is a sample of XML I would like to obtain.
<message xmlns = "........">
<Entities>
<Persons>
<Person entityID="12">
<Name>Name1</Name>
<Info>blablabla</Info>
</Person>
<Person entityID="34">
<Name>Another person</Name>
<Info>Another information</Info>
</Person>
</Persons>
<Companies>
<Company entityID="145">
<Name>My First Company</Name>
<Address>AddressOfFirstCompany</Address>
</Company>
<Company entityID="235">
<Name>My Second Company</Name>
<Address>AddressOf SecondCompany</Address>
</Company>
</Companies>
</Entities>
<!-- Details part -->
<Details>
<Info1>jqdjqdkjqdqjdlqjdqlk</Info1>
<Owner refEntityId = "145" />
<Driver refEntityId = "12" />
<Contact refEntityId = "34" />
</Details>
</message>
------------------------------------------------------------------------------
....a little bit of information:
1. Persons and Companies are both extensions of a same ComplexType:
Entity (here is an extract of the definitions)
<!-- Entity -->
<xs:complexType name="entity">
<xs:sequence>
<xs:element name="type" type="xs:string" />
<xs:element name="name" type="xs:string" />
...
</xs:sequence>
<xs:attribute name="entityID" type="xs:integer" />
</xs:complexType>
<!-- Person -->
<xs:complexType name="person">
<xs:complexContent>
<xs:extension base="myns:entity">
<xs:sequence>
<xs:element name="firstNames" type="xs:string" />
<xs:element name="sex" type="xs:integer" />
<xs:element name="placeOfBirth" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- Company -->
<xs:complexType name="company">
<xs:complexContent>
<xs:extension base="myns:entity">
<xs:sequence>
<xs:element name="tradingNames" type="xs:string" />
<xs:element name="remarks" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
-----------------------------------------------------------------------------------
2. I would like to be able to either refer to a Person or a Company
when I am specifying the "owner", "driver" or "contact"
-----------------------------------------------------------------------------------
A first thought was...
<xs:complexType name="messageContent">
<xs:sequence>
<xs:element name="Entities" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Persons" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="person" type="mynserson" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Companies" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="company" type="myns:company" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Details" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Info1" type="xs:string" />
<xs:element name="Owner" type="myns:refToEntity" minOccurs="1"
maxOccurs="1" />
<xs:element name="Driver" type="myns:refToEntity" minOccurs="1"
maxOccurs="1" />
<xs:element name="Contact" type="myns:refToEntity" minOccurs="1"
maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="refToEntity">
<xs:complexType>
<xs:attibute name="refEntityId" type="xs:integer" />
</xs:complexType>
</xs:complexType>
<xs:element name="message" type="myns:messageContent" />
-----------------------------------------------------------------------------------
....but I don't know how (or where) to put 'ref' and/or 'keyref' in
order to answer my needs?
Could anyone help me?
Thanks in advance,
Didier