-
October 23rd, 2019, 06:38 PM
#1
Urgent: XML path
Hi,
I had asked a Q about loading the xml from a path. But then, I thought this wil work implicitly. But now im testing my code with the client and ah ! no its not working.
Code:
function( BSTR * path)
{
HRESULT hr = CoInitialize(NULL);
MSXML2::IXMLDOMDocumentPtr pXMLDom;
MSXML2::IXMLDOMDocumentPtr pXSLDoc;
MSXML2::IXMLDOMDocumentPtr pXMLOut;
std::wstring pathofXmls(*modelList);
xmlName = "\\Bob.xml";
xmlInfo += xmlName;
pXMLDom->load(L"xmlInfo");
}
In the above function, receive the input
pathofXmls = L"F:\\Temp\\New\\x64\\Debug"
Now I see the xml is not getting loaded.
But on the other hand if i put the xml in the current directory, it gets loaded properly.
@kaud: please help me
-
October 23rd, 2019, 07:07 PM
#2
Re: Urgent: XML path
Just to update: I tried directly giving the path:
pXMLDom->load(L"F:\\Temp\\New\\x64\\Debug\/xmlinputfile.xml");
And it works.
Now i was trying to deduce this from the input path:
std:wstring ListXml(L"\/xmlinputfile.xml");
pathofXmls = pathofXmls + (L"\") + mListXml;
does not work
neither pathofXmls +=xmlName ;
-
October 23rd, 2019, 08:07 PM
#3
Re: Urgent: XML path
The following definitely won't work, unless you are trying to load an file named, "xmlInfo" with no file extension that happens to be in the current directory.
Code:
pXMLDom->load(L"xmlInfo")
At any rate, use the debugger, step through your code and inspect the contents of the variables to make sure they contain what you think they should contain.
Quite often, the problem is a simple mistake (like the one above) and using the debugger will help you find them.
-
October 24th, 2019, 01:53 AM
#4
Re: Urgent: XML path
 Originally Posted by pdk5
Hi,
I had asked a Q about loading the xml from a path. But then, I thought this wil work implicitly. But now im testing my code with the client and ah ! no its not working.
Code:
function( BSTR * path)
{
HRESULT hr = CoInitialize(NULL);
MSXML2::IXMLDOMDocumentPtr pXMLDom;
MSXML2::IXMLDOMDocumentPtr pXSLDoc;
MSXML2::IXMLDOMDocumentPtr pXMLOut;
std::wstring pathofXmls(*modelList);
xmlName = "\\Bob.xml";
xmlInfo += xmlName;
pXMLDom->load(L"xmlInfo");
}
And what are you passing in the load(...)? The file name L"xmlInfo", not the file path/name contained in the xmlInfo variable!
Is it what you wanted?
Victor Nijegorodov
-
October 24th, 2019, 01:58 AM
#5
Re: Urgent: XML path
Thanks Arjay,
I tried giving the path directly:
pXMLDom->load(L"F:\\Temp\\New\\x64\\Debug\/xmlinputfile.xml");
And it works.
My issues is , i get the
BSTR * pathofXmls
and its coming in as
wstring pathofXmls = "F:\\Temp\\New\\x64\\Debug"
I need to get the xmlinputfile from this path:
std:wstring NameOfxml(L"\/xmlinputfile.xml");
wstring fullpath = pathofXmls +NameOfxml;
It always puts two extra \\ at end of pathofXmls
-
October 24th, 2019, 02:51 AM
#6
Re: Urgent: XML path
To make it simple (sorry i was writting in sleep yesterday)
From :
wstring pathofXmls = "F:\\Temp\\New\\x64\\Debug"
wstring nameofxml = "Bob.xml"
I want to get : wstring fullpath = "F:\\Temp\\New\\x64\\Debug\/Bob.xml"
-
October 24th, 2019, 02:56 AM
#7
Re: Urgent: XML path
 Originally Posted by pdk5
To make it simple (sorry i was writting in sleep yesterday)
From :
wstring pathofXmls = "F:\\Temp\\New\\x64\\Debug"
wstring nameofxml = "Bob.xml"
I want to get : wstring fullpath = "F:\\Temp\\New\\x64\\Debug\/Bob.xml"
But why "F:\\Temp\\New\\x64\\Debug\/Bob.xml",
not the "F:\\Temp\\New\\x64\\Debug\\Bob.xml"?
Victor Nijegorodov
-
October 24th, 2019, 03:26 AM
#8
Re: Urgent: XML path
SORRY GUYS. Now figured out the issue.
Sorry was doing too many things at same time.
Thanks a lot for this forum, forgiving me for asking these Qs.
And again this is friendliest and great forum, without which i would never have struggled lot to do c++ coding.
Last edited by pdk5; October 24th, 2019 at 03:44 AM.
-
October 24th, 2019, 03:47 AM
#9
Re: Urgent: XML path
 Originally Posted by pdk5
SORRY GUYS. Now figured out the issue.
...
Could you explain us how did you figure it out?
Victor Nijegorodov
-
October 24th, 2019, 04:15 AM
#10
Re: Urgent: XML path
"wstring pathofXmls = "F:\\Temp\\New\\x64\\Debug"" is working !!!.
Not sure yesterday somehow i culdnot get it working (ofcourse i was doing many things). Very sorry
-
October 24th, 2019, 05:48 AM
#11
Re: Urgent: XML path
 Originally Posted by pdk5
"wstring pathofXmls = "F:\\Temp\\New\\x64\\Debug"" is working !!!.
Not sure yesterday somehow i culdnot get it working (ofcourse i was doing many things). Very sorry
It wasn't working because you had the goofy \/ characters in the path as Victor pointed out in post #7. This is why you should use a debugger and step through your code to inspect the variables.
Last edited by Arjay; October 24th, 2019 at 05:52 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|