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

  • Home
  • SEARCH
  • 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 103257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:05:44+00:00 2026-05-11T01:05:44+00:00

I am rewriting a project so that it uses getters and setters to reference

  • 0

I am rewriting a project so that it uses getters and setters to reference the TiXmlElement *’s However, I quickly run into problems that seem to be related to debug mode:

Ecxerpt from my class’s header:

TiXmlElement *_rootElement; TiXmlElement *_dialogsElement; TiXmlElement *_dialogElement; TiXmlDocument _document; void setDocument (TiXmlDocument doc) { this->_document = doc; } void setRootElement (TiXmlElement * element) { this->_rootElement = element; } void setDialogsElement (TiXmlElement * element) { this->_dialogsElement = element; }  TiXmlDocument getDocument () { return this->_document; } TiXmlElement* getRootElement () { return this->_rootElement; } TiXmlElement* getDialogsElement () { return this->_dialogsElement; } 

Excerpt from class constructor:

DCXML::DCXML(const char *dialogMark,const char *dialogName,TiXmlDocument doc) { ... this->setDocument(doc); this->setRootElement(this->getDocument().FirstChildElement('dcxml')); this->setDialogsElement(this->getRootElement()->FirstChildElement('dialogs')); 

Excerpt from instantiating the class:

TiXmlDocument doc(input.gettok(2,'\'').to_chr()); bool dcxmlFile = doc.LoadFile(); ... DCXML *dcxml = new DCXML(input.gettok(2).to_chr(),input.gettok(3).to_chr(),doc); 

Now for the weird part. This works up until

this->setDialogsElement(this->getRootElement()->FirstChildElement('dialogs')); 

in the constructor.

->FirstChildElement(‘dialogs’) throws an ‘CXX0039: Error: symbol is ambiguous’ error in VS2008 when in debug mode.

The weird part is IntelliSense picks up on the FirstChildElement method and the compiler doesn’t throw any errors.

What’s even weirder is that when in release mode it just fails silently to get the dialogs element.

What I am doing wrong ? Or if you have succesfully implemented getter setter wrappers for TiXmlElement*’s let me know how I can as well!.

For complete reference here’s an excerpt from the XML file:

<?xml version='1.0' encoding='utf-8'?> <dcxml>     <dialogs>         <dialog              name='mediaplayer'              center=''              w='300'              h='400'              caption='Mamp 4.0 BETA'              border='btmnzy'>         </dialog>     </dialogs> </dcxml> 

Feedback would be much appreciated as I am at a dead end 🙂

  • 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. 2026-05-11T01:05:44+00:00Added an answer on May 11, 2026 at 1:05 am

    Make sure that

    TiXmlDocument getDocument () { return this->_document; }  

    Will not deep copy its contained TiXmlElement’s. Otherwise you return a temporary, use that in the constructor to set the root node, which then will be destructed already. I haven’t looked in its API, but just be aware of such pitfalls.

    The reason for the ambiguous call is because:

    There are three overloads of FirstChildElement taking one argument:

    const TiXmlElement *    FirstChildElement (const char *value) const // :1 const TiXmlElement *    FirstChildElement (const std::string &_value) const // :2 TiXmlElement       *    FirstChildElement (const std::string &_value) // :3 

    You access the TiXmlElement through TiXmlElement& (using a TiXmlElement* pointer). But the version taking a const char* has an implicit object parameter of TiXmlElement const&. That is, a qualification conversion is required to make the call work. For the other versions taking a std::string const&, there are conversions required too:

    <implied obj param> <implicit obj param>    <arg1>         <param1> TiXmlElement&        TiXmlElement const&    char const*    char const*         // :1 TiXmlElement&        TiXmlElement const&    char const*    std::string const&  // :2 TiXmlElement&        TiXmlElement&          char const*    std::string const&  // :3 

    There is an ambiguity between the first and the third overload. An easy fix is to do

    this->setDialogsElement(     this->getRootElement()->FirstChildElement(std::string('dialogs'))); 

    Instead, which will call the last version. Another fix is to const_cast:

    this->setDialogsElement(     const_cast<TiXmlElement const*>(this->getRootElement())->         FirstChildElement('dialogs')); 

    Which will call the first version. As for why it only happens in DEBUG… I remember that TiXML has an option to disable the use of the STL. Maybe in release mode you disabled it (and thus the overloads taking std::string), but in debug mode you forgot?

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

Sidebar

Related Questions

I'm going to start a new project - rewriting an existing system (PHP +
I'm rewriting a PHP+MySQL site that averages 40-50 hits a day using Django. Is
Scenario: A fairly mature project uses Struts2 and Spring and Hibernate. I say mature
I am working on a project that has a class 'A' that contains a
I’m looking at rewriting a portion of our application in C# (currently legacy VB6
We are rewriting our legacy accounting system in VB.NET and SQL Server. We brought
I typically use URL rewriting to pass content IDs to my website, so this
In my last job we ended up rewriting the complete ASP.NET stack (forms, controls,
My company is in the process of rewriting our software from scratch, and I'm
I've seen various options for URL rewriting here on Stack Overflow, and other places

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.