Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8296453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:00:02+00:00 2026-06-08T15:00:02+00:00

I have a structure represented as follows: (Example) struct struct3 { struct structchild4 {

  • 0

I have a structure represented as follows: (Example)

struct struct3
{
   struct structchild4
   {  
      float child5;
   } child6;
   unsigned int child7;
};

I want this to be represented as follows in XML:

<tag1= "struct3">
        <name>struct3</name>
        <input_type>byte</input_type>
        <method></method>
        <tag_ref = "structchild4">
            <name>child6</name>
        </tag_ref>
        <tag2= "child7">
            <name>child7</name>
            <len>4</len>
            <value> </value>
        </tag2>
    </tag1>

The method I’m following is that I’m converting this into a gccXML format and I then parse it using Visual C++. I use the xerces-c DOM parser.

Could anyone suggest how to go about doing this? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:00:05+00:00Added an answer on June 8, 2026 at 3:00 pm

    The better way to do this is reflection, BoostLib has some ready to use.
    You do something like:

    for( Attribute::Iterator it = reflectiveObject.getAttributeList().begin();
         it != reflectiveObject.getAttributeList().end();
         ++it )
    {
        XML.createNode( it.getAttributeName() );
    }
    

    //then the same for methods.
    Should have an upper iterator going recursively through types, if type has a sub-class or sub-structure, then ident the XML and run the same code for them.

    Without reflection is pretty more boring, you should create and Formater and a Parser for it, like

    if( dynamic_cast< DesirecClass* >( obj ) != NULL ){
        XML.createNode( typeid( obj ).name() );
    }
    // Hard Code (terrible treatment) for each attribute, etc...
    

    There’s also some demangling methods that you can search for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple tree structure represented like this: Node { int Id; int
struct s { int a; float b; int c; } How is this structure
I have huge amont of geographic data represented in simple object structure consisting only
I have a structure like this struct structure { BaseObject &A; //BaseObject has a
I have a structure: typedef struct stock { const char* key1p2; // stock code
I have a structure that can be very easily represented using a three-deep nested
Let's say you have a tree structure as follows: a [Level 0] / |
Let's say we have a data structure like this: var sequences = new List<Tuple<int,
If I have a class as follows class Example_Class { private: int x; int
I have documents that represent a folder structure. A folder can contain other folders

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.