[xsd-users] Parsing issue

Ildar Farkhshatov ildar.farkhshatov at db.com
Wed Nov 5 09:43:10 EST 2008


Here is the schema:

 <xs:complexType name="Product">
    <xs:sequence>
      <xs:element name="Name" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
<xs:complexType name="FxEuroOpt">
    <xs:complexContent mixed="false">
      <xs:extension base="Product">
        <xs:sequence>
          <xs:element name="Strike" type="xs:double" />
          <xs:element name="ExpiryDate" type="xs:dateTime" />
          <xs:element name="NotionalAmount" type="xs:double" />
          <xs:element name="NotionalCurrency" type="Currency" />
          <xs:element name="ZoneCut" type="Cut" />
          <xs:element name="CurrencyPair" type="CurrencyPair" />
          <xs:element name="SettleDate" type="xs:dateTime" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

I am using default C++\Tree parser and turned off the validation.

I looked into parsing code:

this->::Product::parse (p, f);

  for (; p.more_elements (); p.next_element ())
  {
/// fields

//    when field is successfully parsed, the block calls continue;
//    otherwise it hits break; below meaning that after it reaches 
EffectiveDate xml entry with no appropriate class-field for it - it stops 
the parsing

      break;
  }


Best Regards, Ildar.




Boris Kolpackov <boris at codesynthesis.com> 
11/05/2008 05:00 PM

To
Ildar Farkhshatov/db/dbcom at DBEMEA
cc
xsd-users at codesynthesis.com
Subject
Re: [xsd-users] Parsing issue






Hi Ildar,

Ildar Farkhshatov <ildar.farkhshatov at db.com> writes:

>         <Product xsi:type="FxEuroOpt">
>                 <Name>Euro</Name>
>                 <Strike>1.0</Strike> 
>                 <NotionalAmount>1</NotionalAmount>
>                 <ZoneCut>NY</ZoneCut>
>                 <EffectiveDate>2008-11-29T00:00:00</EffectiveDate>
>                 <ExpiryDate>2008-11-12T00:00:00</ExpiryDate>
>                 <SettleDate>2008-11-14T00:00:00</SettleDate>
>                 <CurrencyPair>
>                         <Und>JPY</Und>
>                         <Acc>USD</Acc>
>                 </CurrencyPair>
>                 <NotionalCurrency>USD</NotionalCurrency>
>                 <PayCurrency>USD</PayCurrency>
>         </Product>
> 
> EffectiveDate is not a part of FxEuroOpt and should be ignored, however, 
I 
> am receiving 
> expected_element< char > (
>       "ExpiryDate",
>       "")
> 
> exception, which seems to be incorrect, as XML standard states that 
> unknown elements should be ignored.

When XML Schema validation is involved, it is hard to say whether
a particular element can be ignored or not without seeing the
corresponding schema fragment.

There are also ways to disable XML Schema validation but that
depends on which mapping you are using (C++/Tree or C++/Parser).
If you can let me know which mapping it is, I can give you some
pointers on how to turn validation off.

Boris




---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.


More information about the xsd-users mailing list