[xsd-users] abstract types access

Azadeh Omrani a.omrani at gmail.com
Thu Jan 8 05:52:55 EST 2009


Hello Boris and everybody,

Can you please help me on this:

I want to retrieve parsed data that I need. But I was confused.

///////////////////////////////////////////////////////////////////////////The
schema is like this:

<xsd:schema [...]>

  <xsd:element name="ESG" type="ESGType"/>


  <xsd:complexType name="ESGType">
    <xsd:sequence>
      [...]
      <xsd:element name="ComponentDescription"
type="ComponentDescriptionType" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>


  <xsd:complexType name="ComponentDescriptionType">
    <xsd:sequence>
      <xsd:element name="ComponentCharacteristic"
type="ComponentCharacteristicType"     minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="SessionDescription"
type="SessionDescriptionBaseType"/>
    </xsd:sequence>
  </xsd:complexType>

<!---------------------------------------This is the abstract
type-----------------------------!>

  <xsd:complexType name="SessionDescriptionBaseType" abstract="true" />


<!--------------------------------That can have two
instantiations:-------------------------------!>
  <xsd:complexType name="InlinedSDPType">
    <xsd:complexContent>
      <xsd:extension base="SessionDescriptionBaseType">
        <xsd:sequence>
          <xsd:element name="SDP" type="SDPType"/>
          [....]
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="SDPRefType">
    <xsd:complexContent>
      <xsd:extension base="SessionDescriptionBaseType">
        <xsd:sequence>
          <xsd:element name="*SDPStream*" type="SDPType"/>
          <xsd:element name="SDPURI" type="xsd:anyURI" />
          <xsd:element name="AssociatedDeliveryProcedure" type="xsd:anyURI"
minOccurs="0"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>


 <xsd:simpleType name= "SDPType">
    <!--- Note: the InlinedSDP below must be embedded in a CDATA section -->
    <xsd:restriction base="xsd:string"/>
  </xsd:simpleType>


</xsd:schema>


/////////////////////////////////////////// the xml instance is like this:

<ESG>
<ComponentDescription>
<ComponentCharacteristic xsi:type="AudioComponentType">
<Codec href=" urn:dvb:cs:AudioCodecCS:2006:1.3.2"/>
<Language>en</Language>
</ComponentCharacteristic>
<SessionDescription xsi:type="SDPRefType" >
*<SDPStream>*
<![CDATA[v=0
o=example.com 751092616 751111042 IN IP6 FE80::1:4D3E
s=SDP Delivery
t=0 0
a=flute-tsi:9532
a=flute-ch:1
a=source-filter: incl IN IP6 * FE80::2::70CA
m=application 12345 FLUTE/UDP 0
c=IN IP6 FF15::1:141B
]]>
*</SDPStream>*
<SDPURI>http://example.com/defaultSDP</SDPURI>
</SessionDescription>
</ComponentDescription>
</ESG>


////////////////////////////////////This is how I tried to retrieve
SDPStream::

esg::ESGType::ComponentDescription_sequence& cds
(eagdata.esgData->ComponentDescription());
for(esg::ESGType::ComponentDescription_iterator i (cds.begin ());i !=
cds.end (); ++j)
   {
         esg::ComponentDescriptionType::SessionDescription_type sdt
(i->SessionDescription());
//////// Then what? ( Regarding that I don't know which of the
instantiations of SessionDescriptionBaseType will arrive by this time.)
////////or maybe the above line of code is not useful...SOS...

     }

Thank you so much
Azadeh



More information about the xsd-users mailing list