• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

nested element in xsd ??

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it correct to have nested element in xml and then define it correspondingly in xsd ?

eg: <?xml version="1.0" encoding="UTF-8"?>
<!--Generated by SWIFTStandards Workstation (build:R5.0.1.3) on 2005 Jan 20 14:19:09-->
<!-- complex type ProprietaryData has been edited to cope with specific requirements -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:swift:xsd:swift.eni$camt.034.001.01" elementFormDefault="qualified" targetNamespace="urn:swift:xsd:swift.eni$camt.034.001.01">
<xs:element name="Document" type="Document"/>
<xs:simpleType name="AnyBICIdentifier">
<xs:restriction base="xs:string">
<xs attern value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Case">
<xs:sequence>
<xs:element name="Id" type="Max35Text"/>
<xs:element name="Cretr" type="AnyBICIdentifier"/>
<xs:element name="ReopCaseIndctn" type="YesNoIndicator" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CaseAssignment">
<xs:sequence>
<xs:element name="Id" type="Max35Text"/>
<xs:element name="Assgnr" type="AnyBICIdentifier"/>
<xs:element name="Assgne" type="AnyBICIdentifier"/>
<xs:element name="CreDtTm" type="ISODateTime"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Document">
<xs:sequence>
<xs:element name="camt.034.001.01" type="camt.034.001.01"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="ISODateTime">
<xs:restriction base="xs ateTime"/>
</xs:simpleType>
<!-- start removed element
<xs:simpleType name="Max350Text">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="350"/>
</xs:restriction>
</xs:simpleType>
end removed element -->
<xs:simpleType name="Max35Text">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="35"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ProprietaryData">
<xs:sequence>
<xs:element name="Tp" type="Max35Text"/>
<!-- start added element -->
<xs:any processContents="skip" minOccurs="0"/>
<!-- end added element -->
<!-- removed element <xs:element name="Cntnt" type="Max350Text"/> -->
</xs:sequence>
</xs:complexType>
<xs:simpleType name="YesNoIndicator">
<xs:restriction base="xs:boolean"/>
</xs:simpleType>
<xs:complexType name="camt.034.001.01">
<xs:sequence>
<xs:element name="Assgnmt" type="CaseAssignment"/>
<xs:element name="Case" type="Case"/>
<xs:element name="DplctInstr" type="ProprietaryData"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

and the xml sample i have is this:
<?xml version="1.0" encoding="UTF-8"?>
<Doc ocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns oc="urn:swift:xsd:swift.eni$camt.034.001.01" >
<Doc:camt.034.001.01>
<Doc:Assgnmt>
<Doc:Id>ABCDEFGHIJKLMNOPQRST123456789012345</Doc:Id>
<Doc:Assgnr>CORPBE22</Doc:Assgnr>
<Doc:Assgne>CHASUS33</Doc:Assgne>
<Doc:CreDtTm>2002-07-21T08:35:30</Doc:CreDtTm>
</Doc:Assgnmt>
<Doc:Case>
<Doc:Id>Case001</Doc:Id>
<Doc:Cretr>CORPUK33</Doc:Cretr>
</Doc:Case>
<Doc: DplctInstr>

<Doc:Cntnt>
<Doc ocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns oc="MessageXXX">
<Doc:MessageXXX >
<Doc:Assgnmt>
<Doc:Id>ABCDEFGHIJKLMNOPQRST123456789012345</Doc:Id>
<Doc:Assgnr>CORPBE22</Doc:Assgnr>
<Doc:Assgne>CHASUS33</Doc:Assgne>
<Doc:CreDtTm>2002-07-21T08:35:30</Doc:CreDtTm>
</Doc:Assgnmt>
<Doc:Case>
<Doc:Id>Case001</Doc:Id>
<Doc:Cretr>CORPUK33</Doc:Cretr>
<Doc:ReopCaseIndctn>true</Doc:ReopCaseIndctn>
</Doc:Case>

</Doc:MessageXXX >
</Doc ocument></Doc:Cntnt>
</Doc: DplctInstr>
</Doc:camt.034.001.01 >
</Doc ocument>

Is it possible that an xsd is defined and when xml is generated at runtime, it could sometime have teh nested element and sometiem not and this can be logically be correct ?
 
reply
    Bookmark Topic Watch Topic
  • New Topic