473,666 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Hel lo from another .NET code, all works fine. But
when calling from COM, the program hangs at line nodeList =
root.SelectNode s("/bookstore/book"). CPU is utilized 100%. Briefly:
XmlDocument.Sel ectNodes 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.R ead(0)
strTemp = WScript.StdIn.R eadLine()
Set Obj = CreateObject("A nete.TestCom.Ne tComClass")
Obj.Hello()

** test dll ***
Imports System.Diagnost ics
Imports System.Xml
Imports System

Namespace Anete.TestCOM

<ComClass(NetCo mClass.ClassId, NetComClass.Int erfaceId,
NetComClass.Eve ntsId)_
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("Ne w")
End Sub

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

Dim book As XmlNode
Dim nodeList As XmlNodeList
Dim root As XmlNode = doc.DocumentEle ment

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

End Class

End Namespace
<?xml version='1.0'?>
<bookstore>
<book genre="novel" style="hardcove r">
<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 2408

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

Similar topics

2
6202
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 XmlNodeList nodeList = doc1.SelectNodes("//row"); foreach (XmlNode nodeCode in nodeList) { sb.Append(nodeCode.OuterXml);
7
4895
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: Value of type System.xml.xmldocument cannot be converted to System.IO.textreader. I would think this is possible to do. Code snippet is below:
8
6160
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 required for databinding. Am happy to work with the XmlNodeList but I can't shake the feeling I'm missing something <blush> Thanks, Pete
2
1756
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 xsi:type="trGenericType" number="2">
1
9674
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
1452
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?") sb.Append("Service=AWSECommerceService&SubscriptionId") sb.Append("=0525E2PQ81DD7ZTWTK82&Operation=ItemSearch") sb.Append("&SearchIndex=Books&Keywords=css")
16
19972
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(); doc.AppendChild(doc.CreateXmlDeclaration("1.0", "UTF-8", null)); docHandle = doc.CreateElement("Base");
3
3011
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 not that large Thanks Stuart
1
1700
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 the next node (.read?) 3) move back to a previous node? Is there a sample program somewhere to show this? (preferably VB.net) TIA David
0
8444
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.