stereomatching 17 Posting Whiz in Training

We already use a tool which called codeSynthesisXSD to transform xml into source codes of C++
Yet there are too many tedious routines could be automated.

like

<xs:complexType name="common_t">
  <xs:attribute name="channel_id" type="channel_id_st" use="optional" />
  <xs:attribute name="audio_record" type="xs:string" use="required" />
  <xs:attribute name="firmware" type="xs:string" use="optional" />
  <xs:attribute name="login_id" type="xs:string" use="optional" />
  <xs:attribute name="login_passwd" type="xs:string" use="optional" />	
</xs:complexType>

is equal to the C++ source codes like "code #1"

//"code #1"
//type common_t is generated by CodeSynthesisXSD
static void setCommon(common_t& request, channel_id_st& channel_id, std::string const& audio_record, std::string const& firmware, std::string const& login_id, std::string const& login_passwd)
{  
  if(request.channel_id().present()) request.channel_id(channel_id);	
  request.audio_record(audio_record);
  if( request.firmware().present() ) request.firmware(firmware);	
  if(request.login_id().present()) request.login_id(login_id);		
  if(request.login_passwd().present()) request.login_passwd(login_passwd);	
}

Every complexType could transform to source codes by the similar way
I would like to make this procedures become automatic
I want to combine the power of boost::spirit and xml parser(I prefer pugixml since
it support XPATH) to parse the xml into code #1
do you have another comments?

This kind of job is extremely tedious, this is the first time I feel that programming could
be so dxxn boring. But I am glad that I am a programmer so I have a chance to
generate the codes automatic.

ps : now I know what makes "10 years experiences" equal to "one year experience"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.