• Advertisement
Sign in to follow this  

Xml to C++ translater in Perl

This topic is 3891 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

recently I have taken up perl and as a project for myself I have decided to write a script that translates XML files into C++ class files (I find myself writing XML file loaders way too often) The script is progressing fairly well (it successfully generates a header file for the class) but before I move onto the source code of loading each item I wanted to ask how nested items in the XML file should be handled. Right now the nested node is simply listed as a nested class but I was wondering weather I should instead create a separate header header file and just give the class an appropriate member variable to represent the nested object. EX:
class A
{
    public:
           A(){};
           class B
           {
               public:
                   B(){};
           };
};

as opposed to

#include <B.h>
class A
{
    public:
           A(){};
           std::vector< B > v_B;
};
NOTE that the vector is there because child nodes do not have any name in XML so they would all be put anonymously in a vector for later use. thanks for your time [smile]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement