473,326 Members | 1,972 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,326 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 6613
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.