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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:59:27+00:00 2026-06-11T23:59:27+00:00

My problem is that Xerces and Windows both have a ‘DOMDocument’ object. Xerces and

  • 0

My problem is that Xerces and Windows both have a 'DOMDocument' object. Xerces and just about everything I’ve read here, here and here has suggested to define the namespace or undefine DOMDocument which should look something like this.

Void foo(XERCES_CPP_NAMESPACE::DOMDocument* pDocument);

or

#undef DOMDocument
#include <xerces/Stuff>

I wanted to go the sane route and just apply the namespace but it doesn’t seem to work. I’m really hesitant to use an #undef that feels like hacking around the problem.

The windows file msxml.h is the one that’s complaining about a redefinition.

Could this have to do with the order they are loaded? I have something like this,

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <list>
#include <map>
#include <ctime>
#include "XMLClass.h"

Where XMLClass.h includes xerces headers. It’s really hard to tell whats causing the issue because the error shows up in a microsoft header.

I’ve also searched for 'DOMDocument' in the whole project and everywhere I use 'DOMDocument' has a namespace of XERCES_CPP_NAMESPACE.

Note: I’m using xerces 3.1 and VS 2010.

Ideas?

Update:
I have tried #undef before adding the xerces headers and I’m still receiving the error. So I’m really at a lost as to why both solutions aren’t working for me.

Update 2:
I’ve also tried changing the namespace from XERCES_CPP_NAMESPACE::DOMDocument to xercesc::DOMDocument but this has not helped.

  • 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-11T23:59:28+00:00Added an answer on June 11, 2026 at 11:59 pm

    It was a header load order problem.

    There are 2 libraries I’m aware of that include msxml.h somewhere inside their code,

    #include<Windows.h>
    

    and

    #include<ole2.h>
    

    In my case #include <Windows.h> happened to be down stream of my #include "XMLClass.h". So the solution was to define msxml.h before xerces like this,

    #include<msxml.h>             //defines DOMDocument first     
    //defines DOMDocument with a different namespace
    #include <xercesc/dom/DOMDocument.hpp>  
    

    Because xerces was mindful of namespaces and Microsoft wasn’t, if the headers are defined in reverse order like this,

    #include <xercesc/dom/DOMDocument.hpp>
    #include<msxml.h>
    

    no matter what you do your code will not compile. The compiler will tell you that you are redefining 'DOMDocument', which is actually whats happening. This is because of the way Microsoft wrote msxml.h.

    Hope this helps anyone bumping into this problem.

    Note:

    you must ALWAYS include the namespace when defining ‘DOMDocument’ objects, parameters and return types like this,

    XERCES_CPP_NAMESPACE::DOMDocument xmlDoc;
    
    void setDoc(XERCES_CPP_NAMESPACE::DOMDocument xmlDoc);
    
    XERCES_CPP_NAMESPACE::DOMDocument getDoc();
    

    or you will continue to receive ambiguity errors or worst it will assume the wrong data-type at run-time.

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

Sidebar

Related Questions

Here is a problem that has been bothering me a lot about Python, I
I have a problem that when I try to save an object in the
I have a problem with the Java and Xerces parser on Windows. I have
The problem that I have is somehow very specific. I have to implement a
I have a problem that I'm working on for quite some time now. I
Seems to be a problem that many people have, but all the answers I
I'm facing a problem that I can summarize as it follows: I have a
I have the same problem that is listed in the following thread. WSDL first
I have a big problem that a recursive treeview doesn't update any childs if
Problem that i face: -I have an input string, a SQL statement that i

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.