473,563 Members | 2,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tired and dumb. XML & the DOM

Hi all,

I've spent literally hours trying to figure this one out. I'm
re-developing an app from vb6 to vb.net, and I cannot get my XML code
working. I've just started using .NET. I'm tired, highly annoyed and
this is my problem (I know it is very easy for someone who has done
this before):

My entire XML file is here - The '<CALL_12260>' tag name is dynamic
(the XML file is generated by something else), everything else stays
the same. I would like to easily read the contents of every node
selectively:

<CDC>
<CALL_12260>
<JobKey>65</JobKey>
<hTapiCall>1226 0</hTapiCall>
<JobMode>1</JobMode>
<JobState>1</JobState>
<ForeignTel>004 4863313</ForeignTel>
<OwnerTel></OwnerTel>
<RedirectingID> </RedirectingID>
<RedirectionID> </RedirectionID>
<Profile>Enterp riseApplication </Profile>
<ADRKey>13</ADRKey>
<ADRText>BLEH </ADRText>
<CustomerID>1 3</CustomerID>
<ASPKey></ASPKey>
<ASPText></ASPText>
<ASPFound>0</ASPFound>
<ADRFound>-1</ADRFound>
<Date>21/08/2006</Date>
<Time>14:59:2 6</Time>
<Choices></Choices>
<Contacts></Contacts>
</CALL_12260>
</CDC>

My lame attempts at .NET - I have no idea what I'm doing with
traversing the DOM...

xmlOBJ.Load(xml PathTXT)
xmlNodeList = xmlOBJ.SelectNo des("//CDC/*")

For Each xmlNode In xmlNodeList
xmlNode.FirstCh ild.NodeType
Console.WriteLi ne(xmlNode.Chil dNodes.Count)
Next

I've just been noodling around with X number of configurations of the
above trying to get something useful. Nada.

Thanks for reading my pleas for help, apologies in advance for posting
such a stupid request.

n

Aug 21 '06 #1
1 1599
Seem to have solved it myself. Not sure if this is the best way, but I
like it. Amazing what going to sleep can do.

FYI for future developers:

Imports System.IO
Imports System.Xml

Public Function XMLPoo()

Dim xmlPathTXT As String
Dim xmlNode As XmlNode
Dim xmlNodeList As XmlNodeList
Dim xmlRoot As XmlNode
Dim xmlNodesCollect ion As New Collection

xmlPathTXT = "myXML.xml"
xmlOBJ.Load(xml PathTXT)
xmlRoot = xmlOBJ.Document Element
xmlNodeList = xmlRoot.SelectN odes("/CDC/*/*")

For Each xmlNode In xmlNodeList
xmlNodesCollect ion.Add(xmlNode .InnerText.ToSt ring,
xmlNode.Name.To String)
Next

Return xmlNodesCollect ion

End Function


ni*******@gmail .com wrote:
Hi all,

I've spent literally hours trying to figure this one out. I'm
re-developing an app from vb6 to vb.net, and I cannot get my XML code
working. I've just started using .NET. I'm tired, highly annoyed and
this is my problem (I know it is very easy for someone who has done
this before):

My entire XML file is here - The '<CALL_12260>' tag name is dynamic
(the XML file is generated by something else), everything else stays
the same. I would like to easily read the contents of every node
selectively:

<CDC>
<CALL_12260>
<JobKey>65</JobKey>
<hTapiCall>1226 0</hTapiCall>
<JobMode>1</JobMode>
<JobState>1</JobState>
<ForeignTel>004 4863313</ForeignTel>
<OwnerTel></OwnerTel>
<RedirectingID> </RedirectingID>
<RedirectionID> </RedirectionID>
<Profile>Enterp riseApplication </Profile>
<ADRKey>13</ADRKey>
<ADRText>BLEH </ADRText>
<CustomerID>1 3</CustomerID>
<ASPKey></ASPKey>
<ASPText></ASPText>
<ASPFound>0</ASPFound>
<ADRFound>-1</ADRFound>
<Date>21/08/2006</Date>
<Time>14:59:2 6</Time>
<Choices></Choices>
<Contacts></Contacts>
</CALL_12260>
</CDC>

My lame attempts at .NET - I have no idea what I'm doing with
traversing the DOM...

xmlOBJ.Load(xml PathTXT)
xmlNodeList = xmlOBJ.SelectNo des("//CDC/*")

For Each xmlNode In xmlNodeList
xmlNode.FirstCh ild.NodeType
Console.WriteLi ne(xmlNode.Chil dNodes.Count)
Next

I've just been noodling around with X number of configurations of the
above trying to get something useful. Nada.

Thanks for reading my pleas for help, apologies in advance for posting
such a stupid request.

n
Aug 22 '06 #2

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

Similar topics

1
11429
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link like this: <a href="mailto:DrTebi@yahoo.com">DrTebi</a> This would work like a regular mailto link in any browser, but wouldn't be visible to spiders if they don't have a function to decode it.
0
2411
by: Thomas Scheffler | last post by:
Hi, I runned in trouble using XALAN for XSL-Transformation. The following snipplet show what I mean: <a href="http://blah.com/?test=test&amp;test2=test2">Test1&amp;</a> <a href="http://blah.com/?test=test&amp;amp;test2=test2">Test2&amp;amp;</a> This results in the following HTML Code:
4
3207
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know that I could externalize my JavaScript, but that will not be practical throughout this application. Is there any way to get around this issue? ...
4
1319
by: Stelrad Doulton | last post by:
Hi, Apologies if this isn't the correct forum. I am writing a communication solution (actually on the Compact Framework) based on HttpWebRequests hooking up with custom handlers on the server side. My dumb question is this: how reliable is http? For example if I use PUT and call GetResponse on my request object with no problem, can I...
2
2219
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new folder using whatever project name I supplied. Is there a work around for this? Thanks Bill
16
1638
by: CMM | last post by:
Is it me or has anyone noticed that F1 is really dumb in VS2005. Since VB3 I have been able to click F1 on an ambiguous method in code and the IDE automatically determines the type based on the code itself and shows the right help topic. This even worked more or less in VS2003. But in VS2005, if I highlight the "Host" method below and hit F1...
14
5915
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary...
12
10076
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b) ..... // xsl contents abc.aspx?p1=v1&amp;p2=<xsl:value-of select="$v2" />
25
1333
by: mdh | last post by:
I have looked this up in the FAQ, and still do not have a nice understanding of it. If I have defined a function in foo.c, and if, for the sake of argument have foo.h contain that function's declaration, and if , as one of the answers to a similar question was "All definitions are also declarations!" then does one need to use "# include...
0
7664
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...
0
7583
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...
0
8106
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...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6250
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
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...
0
3642
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...
1
2082
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
1
1198
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.