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 8166929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:03:06+00:00 2026-06-06T20:03:06+00:00

I made a code that parse Function but it won’t parse the Argument (name,type)

  • 0

I made a code that parse Function but it won’t parse the Argument (name,type) My Code:

xml_node GCC_XML = doc.child("GCC_XML");

{


for (xml_node Function = GCC_XML.child("Function");Function; Function= Function.next_sibling("Function"))
{    
    cout<<"Function\n"<<"id= "<<Function.attribute("id").value()<<" , name= "<<Function.attribute("name").value()<<" ,returns: "<<Function.attribute("returns").value()<<Function.child_value("Argument") <<endl;

}

}

That is the XML file i am trying to parse

<?xml version="1.0"?>
<GCC_XML>
  <Namespace id="_1" name="::" members="_2 _3 _4 "/>
  <Function id="_2" name="main" returns="_5" context="_1" location="f0:8"/>
  <Function id="_3" name="a_function" returns="_5" context="_1" location="f0:4">
    <Argument name="f" type="_6"/>
    <Argument name="e" type="_4"/>
  </Function>
  <Struct id="_4" name="EmptyClass" context="_1" location="f0:1" members="_7 _8 " bases=""/>
  <FundamentalType id="_5" name="int"/>
  <FundamentalType id="_6" name="float"/>
  <Constructor id="_7" name="EmptyClass" context="_4" location="f0:1">
    <Argument name="_ctor_arg" type="_9"/>
  </Constructor>
  <Constructor id="_8" name="EmptyClass" context="_4" location="f0:1"/>
  <ReferenceType id="_9" type="_4c"/>
  <File id="f0" name="example1.cxx"/>
</GCC_XML>

The problem is that it refuse to read the functions arguments my results are :

 Load result: No error 
Function 
id= _2 , name= main ,returns: _5
 Function 
id= _3 , name= a_function ,returns: _5

I also tried

cout<<"Function\n"<<"id= "<<Function.attribute("id").value()<<" , name= "<<Function.attribute("name").value()<<" ,returns: "<<Function.attribute("returns").value()<<Function.attribute("Argument") <<endl;

put it gave the same result just added 0 output in the Argument output which show it doesn’t read it

Put i got the same results above

  • 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-06T20:03:07+00:00Added an answer on June 6, 2026 at 8:03 pm

    Argument is not an attribute. It is an element, a child element of Function. You access child elements the same way you access any element.

    xml_node::child_value finds the XML element with the given name (Argument in this case), and returns the text of the first child text node of that element. Argument, in your XML file, is empty; it doesn’t have child text nodes. It has attribute nodes, but that’s not the same thing. If you want the attributes of Argument, you have to ask for them, exactly as you asked for the attributes of the Function node.

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

Sidebar

Related Questions

I have recently made changes in some code that makes a char name field
I've made some function that generates an email template. Code it generates is pure
I have made a code that read data from flash Nand (without filesystem). fd
I've made some experimental code that I would like to save in the repository,
I've made a piece of code in jquery that assigns a href attribute to
my question is that I have made multimap.Here is the partial code. if(binary_search(final.begin() ,
So another web bureau made a design for a website that I will code.
Last summer, I made a Java application that would parse some PDF files and
I made php file that parse JSON object. here's an example of result from
I'm writing a function that should parse a string containing a description of a

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.