XML parsing in .net 
Author Message
 XML parsing in .net

Hi,
   I am having trouble accessing an xml field.  The XML is below.
-------------------------------------------------------------
  <?xml version="1.0" encoding="iso-8859-1" ?>
  <!DOCTYPE SCAN (View Source for full doctype...)>
- <!--  
  -->
- <SCAN value="scan/4234.422">
- <HEADER>
  <KEY value="USERNAME">appletest</KEY>
- <KEY value="COMPANY">
- <![CDATA[ IDC Global Networks
  ]]>
  </KEY>
  <KEY value="DATE">20030505131744</KEY>
- <KEY value="TITLE">
- <![CDATA[ Manual vulnerability analysis on 24.54.20.120
  ]]>
  </KEY>
  <KEY value="TARGET">24.148.0.140</KEY>
  <KEY value="DURATION">00:10:44</KEY>
  <KEY value="SCAN_HOST">167.216.252.44 (SCANNER 1.8.50-29, WEB
2.15.64-7, VULNSIGS 1.3.35-1)</KEY>
  <KEY value="NBHOST_ALIVE">1</KEY>
  <KEY value="NBHOST_TOTAL">1</KEY>
  </HEADER>

---------------------------------------
Say I am trying to access one of the KEY value fields, lets say
"DATE".  I am able to successfully obtain the data within the field
20030505131744.. however I would like to know if the KEY value field
that I am accessing says "DATE"  I am able to access it by using the
following code:

Dim node As System.Xml.XmlNode        

If InnerNode.Name= "DATE" Then
      TextBox1.Text = InnerNode.InnerText
End If

However the code above does not suit my purposes.  I'd like to use a
node to loop through the xml file and check to find the KEY value
field called date.

--------------------
Dim doc As System.Xml.XmlDocument = New XmlDocument
        doc.Load("C:\scan_results1.xml")
Dim int i as integer
Dim node As System.Xml.XmlNode

For i = 0 To node.ChildNodes.Count
   'check to see if node currently on is the date node then do
something.
    ' TextBox1.Text = node.InnerText does not work equals appletest
    '  TextBox1.Text = node.Name does not work equals KEY
    ' TextBox1.Text = node.InnerText does not work equals appletest
    ' TextBox1.Text = node.InnerXml does not work s equals appletest
    ' I want TextBox1.Text to equal the word DATE

next
----------------------

Thanks,
Bill



Sun, 06 Nov 2005 06:57:18 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. vb.net newbie needs help with basic XML parsing

2. Parsing XML from an ASP page that Creates XML fails

3. Date problems with XML in ASP.NET / VB.NET- newbie question

4. XML Parse

5. How to parse XML from a VBA macro

6. Starting external application from Word/Parsing XML

7. how to parse wml (xml) files

8. XML Parse

9. Parse RSS XML files (news feeds)

10. Reading/parsing an XML file into VB.

11. vb library/procedure for parsing html/xml/sgml like files

12. SAX XML parsing in VBScript?

 

 
Powered by phpBB® Forum Software