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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:52:07+00:00 2026-06-12T00:52:07+00:00

Why does the compiler (g++) complain about this line of code? XalanNode *docElement =

  • 0

Why does the compiler (g++) complain about this line of code?

    XalanNode *docElement = static_cast<XalanNode*> (docBuilder_->getDocument()->getDocumentElement());

The error I get from the compiler is:

 error: invalid static_cast from type `amxalanc_1_6::XalanElement*' to type `amxalanc_1_6::XalanNode*' 

Without the static_cast, the compiler prints:

error: cannot convert `amxalanc_1_6::XalanElement*' to `amxalanc_1_6::XalanNode*' in initialization 

The XalanElement class is defined as:

class XALAN_DOM_EXPORT XalanElement : public XalanNode

The documentation also shows that XalanNode should derive from XalanElement, as you can see here – XalanElement Class Reference.

Within XalanDocument.hpp, the method signature of getDocumentElement() is:

virtual XalanElement* getDocumentElement() const = 0;
  • 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-12T00:52:08+00:00Added an answer on June 12, 2026 at 12:52 am

    Most of the Xalan headers only use forward declarations for classes that they are not defining even if they are declaring functions that take or return pointers to these classes. (This is common and good practice.)

    For your compiler to see the fact that XalanElement is derived from XalanNode you need to explicitly #include the header which defines XalanElement.

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

Sidebar

Related Questions

Why does the C# compiler not even complain with a warning on this code?
In other words, why does the compiler complain about things like this: class Integer
The C# 4.0 compiler does not complain about this (not even a warning): if(10.0
What's going on when the assignment statement executed at Line 4 , does compiler
In forward referencing language such as c#, how does the compiler handle this? What
Consider the code below. I don't understand why my GCC compiler does not try
We're stumped as to why gcc complains about this line in our app: doubleFrom->setValidator(new
This may be a silly question about inheritance, but it does not make much
Possible Duplicate: Why does Eclipse complain about @Override on interface methods? I have some
Consider the following code (it came about as a result of this discussion ):

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.