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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:46:48+00:00 2026-06-05T16:46:48+00:00

I am trying to read some XML code from a website, and am having

  • 0

I am trying to read some XML code from a website, and am having a bit of trouble figuring out where my errors are. Using the code from this extremely useful post, I am trying to read a file that I have saved to my desktop (“H:\MyName\Desktop\secLendingXML.cfm.xml”). The code is below:

#include "stdafx.h"
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#import <msxml6.dll> rename_namespace(_T("MSXML"))

int main(/*int argc, char* argv[]*/)
{
HRESULT hr = CoInitialize(NULL); 
if (SUCCEEDED(hr))
{
    try
    {
        MSXML::IXMLDOMDocument2Ptr xmlDoc;
        hr = xmlDoc.CreateInstance(__uuidof(MSXML::DOMDocument60), NULL, CLSCTX_INPROC_SERVER);
        // TODO: if (FAILED(hr))...
        if (xmlDoc->load(_T("H:\MyName\Desktop\secLendingXML.cfm.xml")) != VARIANT_TRUE)
        {
            printf("Unable to load input.xml\n");
        }
        else
        {
            printf("XML was successfully loaded\n");

            xmlDoc->setProperty("SelectionLanguage", "XPath");
            MSXML::IXMLDOMNodeListPtr wheels = xmlDoc->selectNodes("/Car/Wheels/*");
            printf("Car has %u wheels\n", wheels->Getlength());

            MSXML::IXMLDOMNodePtr node;
            node = xmlDoc->createNode(MSXML::NODE_ELEMENT, _T("Engine"), _T(""));
            node->text = _T("Engine 1.0");
            xmlDoc->documentElement->appendChild(node);
            hr = xmlDoc->save(_T("output.xml"));
            if (SUCCEEDED(hr))
                printf("output.xml successfully saved\n");
        }
    }
    catch (_com_error &e)
    {
        printf("ERROR: %ws\n", e.ErrorMessage());
    }
    CoUninitialize();
}
system("PAUSE");
return 0;

}

The message “Unable to load input.xml” always shows, so I know I’m not having an error, but that the code is unable to load my XML file.

Do I need to save the XML file in a different location? Is the “.cfm” before the “.xml” screwing with the reading process?

To give an idea of my intended direction, I want to be able to load the XML file from the New York Fed website and read it into some sort of data file where I can automate the data retrieving process. That way, whenever the website is updated, I will automatically be notified, and it will be reflected by the change in the data file that I will have saved somewhere on my computer. If anyone also wants to help with how I go about that part – poll intervals, tracking website changes, etc. – that would also be appreciated.

Thank you for any and all help.

  • 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-05T16:46:50+00:00Added an answer on June 5, 2026 at 4:46 pm

    Do you need to escape the backslashes in your path string? e.g.

    xmlDoc->load(_T("H:\\MyName\\Desktop\\secLendingXML.cfm.xml")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to read in some sample data from an XML file in a
I am trying to read some settings from php.ini using zend. The API that
I am trying to read some info from a text file by using windows
I am just trying to read some details from an XML file, part of
I am trying to convert some code from using DOM (via jDOM) to use
I'm trying to read XML data from Google weather webservice. The response contain some
I am trying to read tags from XML using LibXML. I can print all
I am trying to read some data from a python module from a web.
I'm experiencing some problems while trying to read a binary file in C. This
I'm trying to read xml file from vbs script. Xml is encoded in utf-8

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.