[xsd-users] Supporting recursive types with XSD/Parser

Wood, Matthew D matthew.d.wood at intel.com
Wed Feb 9 14:55:34 EST 2011


With or without the --generate-validation switch, I get the same sequence of calls from the skeleton. Could the issue be the combination of recursive parsing and polymorphic types? Every element within the <Condition> element is part of the ExpressionType substitution group.

I set a breakpoint in xsd::cxx::parser::expat::document<C>::end_element_thunk_(void*, const C*) at the point where it calls d.end_element_() to correlate incoming end tag to the to the *_pimpl::post_* method called up the stack. When the second </Apply> end tag is found in the original sample, it calls ApplyType_pimpl::Expression(), but doesn't call ApplyType_pimpl::post_ExpressionType() first, as expected (ApplyType_pimpl overrides post_ExpressionType() to call ApplyType_pimpl::post_ApplyType() for polymorphic support).

Going back to the call sequence I'm experiencing, I've noted the missing call that would make the sequence work correctly.

ConditionType_pimpl::pre()
  ApplyType_pimpl::pre() // First Apply element start
  ApplyType_pimpl::FunctionId()
    AttributeValueType_pimpl::pre()
    AttributeValueType_pimpl:: _any_characters() // xsi:anyType
    AttributeValueType_pimpl::post_AttributeValueType() // via post_ExpressionType() override
  ApplyType_pimpl::Expression() // result of AttributeValueType_pimpl::post_AttributeValueType()
    ApplyType_pimpl::pre() // Second Apply element start
    ApplyType_pimpl::FunctionId()
      ActionAttributeDesignatorType_pimpl::pre()
      ActionAttributeDesignatorType_pimpl::AttributeId()
      ActionAttributeDesignatorType_pimpl::DataType()
      ActionAttributeDesignatorType_pimpl::post_ActionAttributeDesignatorType() // via post_ExpressionType() override
    ApplyType_pimpl::Expression() // result of ActionAttributeDesignatorType_pimpl::post_AttributeValueType()
******** Begin Expected Reaction to second </Apply> ********
++++++++ Begin Missing Call ++++++++
    ApplyType_pimpl::post_ApplyType() // via postExpressionType() override
++++++++ End Missing Call ++++++++
  ApplyType_pimpl::Expression()
******** End Expected Reaction to second </Apply> ********
  ApplyType_pimpl::post_ApplyType() // via post_ExpressionType() override
ConditionType_pimpl::Expression() // result of ApplyType_pimpl::post_ApplyType()
ConditionType_pimpl::post_ConditionType()


My options file contains the following lines:
--xml-parser expat
--generate-validation
--namespace-map urn:oasis:names:tc:xacml:2.0:policy:schema:os=XACMLPolicyParser
--root-element Policy
--root-element PolicySet
--type-map xsd.map
--char-type char
--generate-polymorphic

Thanks,
Matt


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, February 09, 2011 7:42 AM
To: Wood, Matthew D
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Supporting recursive types with XSD/Parser
Importance: Low

Hi Matthew,

Wood, Matthew D <matthew.d.wood at intel.com> writes:

> I see the following set of calls using XSD/Parser w/Expat for the XML 
> above (indented to match XML):

C++/Parser supports recursive parsing and we have a test case for that in
the test suite. If you have validation enabled, can you try to disable
it and see if anything changes?

Boris



More information about the xsd-users mailing list