473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IXMLDOMDocument::loadXML fails on what seems to be a perfectly fine xml

Hi,

I am trying to parse an XML file using DOM in VC++.

I need an element which is inside other elements.

So I am loading the file.

Calling GetElementsByTagName to get the first level elements.

Iterating through them, get to the one I need and here I am actually in
need of another GetElementsByTagName.

Of course there is no such func in IXMLDOMNode.

Therefore I am creating another IXMLDOMDocument and trying to load into
it that inner xml part of my desired node, by using IXMLDOMNode::xml
property.

I am using loadXML, of course.

And it fails, it returns -1.

While when I substitute that pNode->xml for the same xml piece I copy
and paste from my file it works fine.

I have displayed the pNode->xml and it looks fine. Well structured and
etc.

Please help!

Any ideas ? Leads ?

Thank you!


Nov 12 '05 #1
3 6622
I have tried to get the error using IXMLDOMParseError.
The reason property is empty.
The error code property is 0.

"Alexandra" <al***********@gmail.com> wrote in message
news:e5*************@tk2msftngp13.phx.gbl:
Hi,

I am trying to parse an XML file using DOM in VC++.

I need an element which is inside other elements.

So I am loading the file.

Calling GetElementsByTagName to get the first level elements.

Iterating through them, get to the one I need and here I am actually in
need of another GetElementsByTagName.

Of course there is no such func in IXMLDOMNode.

Therefore I am creating another IXMLDOMDocument and trying to load into
it that inner xml part of my desired node, by using IXMLDOMNode::xml
property.

I am using loadXML, of course.

And it fails, it returns -1.

While when I substitute that pNode->xml for the same xml piece I copy
and paste from my file it works fine.

I have displayed the pNode->xml and it looks fine. Well structured and
etc.

Please help!

Any ideas ? Leads ?

Thank you!


Nov 12 '05 #2
"Alexandra" <al***********@gmail.com> wrote in message
news:e5*************@tk2msftngp13.phx.gbl
I am trying to parse an XML file using DOM in VC++.

I need an element which is inside other elements.

So I am loading the file.

Calling GetElementsByTagName to get the first level elements.
Note that getElementsByTagName returns all matching elements under the
current node or within a current document no matter how deep, not just
immediate children. I'm not sure what you mean by "first level elements"
here.
Iterating through them, get to the one I need and here I am actually
in need of another GetElementsByTagName.

Of course there is no such func in IXMLDOMNode.


.... but there is on IXMLDOMElement. You can QueryInterface from the
former to the latter.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Nov 12 '05 #3
Hi Alexandra!
I am using loadXML, of course.

And it fails, it returns -1.


Are you sure that the passed string is UTF-16?
The "loadXML" function only works with UTF_16 strings! (see docu)
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ajay | last post by:
hi! I have a c++ file that does some XML processing (visual c++ using ATL). The file builds fine. However when i add the header #include<Python.h>, i get a number of errors C:\Windows CE...
3
by: Alexandra | last post by:
Hi, I am trying to parse an XML file using DOM in VC++. I need an element which is inside other elements. So I am loading the file.
2
by: Joe | last post by:
Dear All, Can anyone help me with these two questions? Thank you. I am using MSXML 4.0 SP2 and VC++ .NET.
8
by: Drew | last post by:
I have recently converted all of my native C++ dll's to be compiled with the /CLR switch. After doing this, I notcied a very strange and frustrating issue. One of my managed dll's calls another...
3
by: Polaris | last post by:
Hi Experts: Is there a way to load an existing buffer (an XML file) using IXMLDOMDocumentPtr->load()? I know it works for loading an XML file, but I need to load an existing buffer with known...
4
by: saish | last post by:
Hello Need your help, I have a C++ win32 dll which takes xml document type by reference. I need to call this dll from c# .net. I tried using DllImport, but dll funtion when call does not...
0
by: Daniel | last post by:
Does system.xml have any way to transofrm data with an xswl style sheet using strings like MSXML2 does? how to convert this to use System.XML so i do not depend on MSXML2 interop? static...
1
by: chander | last post by:
Hi! As i'm new this XML and DOMDocument, can someone help me in casting DOMDocument schema into XMLDocument and assign the value. below attached is the piece of code which uses MSXML2 with a...
3
by: =?Utf-8?B?ai5hLiBoYXJyaW1hbg==?= | last post by:
Hi, I am new to using the MSXML functions in C++. I found this on MSDN as an example of what I wanted to do, http://msdn2.microsoft.com/en-us/library/ms765465.aspx. I have tried a number of...
1
by: sree83 | last post by:
Hi All, I am new to MSXML. Now i have am facing a strange problem while loading xml file using c++. I have a C++ library which is used to parse an xml having server configurations.. We have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.