473,320 Members | 2,094 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,320 software developers and data experts.

XMLDocument SelectNodes hangs if called through COM

Hello,
I have created simple COM service in .NET. COM is accessed from another
not NET application by late binding call.

And the problem:
If I call NetComClass.Hello from another .NET code, all works fine. But
when calling from COM, the program hangs at line nodeList =
root.SelectNodes("/bookstore/book"). CPU is utilized 100%. Briefly:
XmlDocument.SelectNodes call hangs EVERY TIME when selected nodes count
is greater than 0. I have attached debugger to calling process, I have
spend many hour on this problem, but without any result.

This is a test program to simplify the problem with SelectNode from more
complex part of application. The behaviour is the same.

Does anybody know, where the problem is?

***** script *****
WScript.StdOut.Write("Press Enter")
WScript.StdIn.Read(0)
strTemp = WScript.StdIn.ReadLine()
Set Obj = CreateObject("Anete.TestCom.NetComClass")
Obj.Hello()

** test dll ***
Imports System.Diagnostics
Imports System.Xml
Imports System

Namespace Anete.TestCOM

<ComClass(NetComClass.ClassId, NetComClass.InterfaceId,
NetComClass.EventsId)_
Public Class NetComClass

#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String =
"a1fe8f7b-aee7-4db7-9e49-7a4a10c6a03d"
Public Const InterfaceId As String =
"0a8dc583-7f23-4523-9f05-70e35c4dc2de"
Public Const EventsId As String =
"93e01224-a3ad-418c-8fba-1b781914f289"
#End Region

' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
Trace.Write("New")
End Sub

Public Sub Hello(ByVal baseDir As String)
' Create the XmlDocument.
Dim doc As XmlDocument = New XmlDocument()
doc.Load(baseDir + "\" + "booksort.xml")

Dim book As XmlNode
Dim nodeList As XmlNodeList
Dim root As XmlNode = doc.DocumentElement

' on this line COM hangs
nodeList = root.SelectNodes("/bookstore/book")
End Sub

End Class

End Namespace
<?xml version='1.0'?>
<bookstore>
<book genre="novel" style="hardcover">
<title>The Handmaid's Tale</title>
<author>
<first-name>Margaret</first-name>
<last-name>Atwood</last-name>
</author>
<price>19.95</price>
</book>
<book genre="novel" style="other">
<title>The Poisonwood Bible</title>
<author>
<first-name>Barbara</first-name>
<last-name>Kingsolver</last-name>
</author>
<price>11.99</price>
</book>
</bookstore>

Karel

--
---------
Environment: VB.NET, VS2005 Pro, XP Pro/P4 3GHz, 2GB RAM
__________________________________________________ _
Karel Kral, developer
ANETE, s.r.o.
__________________________________________________ _
Feb 12 '07 #1
0 2379

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

Similar topics

2
by: Dave | last post by:
Hi, Is there an easier way to pull a subset of nodes from one XmlDocument to another? I have the code below but would like to know if there is a more streamlined method. Thanks, Dave ...
7
by: SQLScott | last post by:
I have a Web Service in which I am trying to pass an XMLDocument as a parameter to one of the methods. I would like to use the XMLTextReader to read the XML but I am getting the following error: ...
8
by: pete | last post by:
Hi there, Can someone explain to me why I can't bind to an XmlDocument but I can bind to an XmlNodeList. It's my understanding that they both implement the IEnumerable interface which is...
2
by: Michael H | last post by:
Hello group, I have a some xml that looks like this below: <tuneRequests ct="3" xmlns:sql="urn:schemas-microsoft-com:xml-sql" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <tr...
1
by: Peter Nofelt | last post by:
Hey All, I'm running into this issue with parsing through an xml document by tag name. Below is an example xml document: File Name: things.xml <things> <people> <name>Peter</name>
4
by: Roshawn Dawson | last post by:
Hi, I don't know why, but I can't seem to get this to work: Public Sub DoSomething() Dim sb as New StringBuilder() sb.Append("http://webservices.amazon.com/onca/xml?")...
16
by: PiotrKolodziej | last post by:
Hi I'am using SelectNodes method to find if node followed by string exists, and if so i going to select that node. Create doc i such a way: doc = new XmlDocument(); ...
3
by: Stuart Shay | last post by:
Hello All In the following XML Below which is a XMLDocument in my application. I want to remove the <extensions></extensions> Node completely. What is the best way to do this, my files are...
1
by: =?Utf-8?B?RGF2aWRHQg==?= | last post by:
OK, so I've created and loaded an XMLDocument object. But how do I go about using it? Specifically, how do I: 1) move to the first node (I assume I start on it when I load the XML?) 2) move to...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.