Click here to Skip to main content
15,902,112 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: A very simple question with a twist Pin
dan!sh 22-Oct-09 0:46
professional dan!sh 22-Oct-09 0:46 
GeneralRe: A very simple question with a twist Pin
Dave Kreskowiak22-Oct-09 1:46
mveDave Kreskowiak22-Oct-09 1:46 
GeneralRe: A very simple question with a twist Pin
offroaderdan22-Oct-09 0:13
offroaderdan22-Oct-09 0:13 
GeneralRe: A very simple question with a twist Pin
offroaderdan22-Oct-09 0:32
offroaderdan22-Oct-09 0:32 
GeneralRe: A very simple question with a twist Pin
dan!sh 22-Oct-09 0:45
professional dan!sh 22-Oct-09 0:45 
GeneralRe: A very simple question with a twist Pin
offroaderdan22-Oct-09 1:01
offroaderdan22-Oct-09 1:01 
AnswerRe: A very simple question with a twist Pin
Steve Westbrook22-Oct-09 2:22
Steve Westbrook22-Oct-09 2:22 
QuestionXML Extraction using VB Pin
nhsal6921-Oct-09 22:51
nhsal6921-Oct-09 22:51 
Hey there

I'm having trouble getting one element out of this XML file..

<sizedata Size= "VALUE" IGNORE THE REST OF THEM/>

here is a fully formed, but shortened XML file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Root Type="TRoot">
<Date>15/10/2009 12:30:08</Date>
<Folder fullpath="C:\" IsFilesNode="0">
<Name>C:\</Name>
<SizeData Size="74609238013" Allocated="72396726232" Wasted="234062016" CDRom="74727184384" Files="116733" Folders="12272" Compression="3"/>
</Folder>
<Folder fullpath="C:\" IsFilesNode="-1">
<Name>[Files]</Name>
<SizeData Size="18745407271" Allocated="18745561088" Wasted="153817" CDRom="18745475072" Files="69" Folders="0" Compression="1"/>
</Folder>
<Folder fullpath="C:\TEMP_\" IsFilesNode="0">
<Name>TEMP_ALAN</Name>
<SizeData Size="15469174140" Allocated="15489126222" Wasted="19886724" CDRom="15478267904" Files="9570" Folders="1832" Compression="1"/>
</Folder>
<Folder fullpath="C:\TEMP_\mp3\" IsFilesNode="0">
<Name>mp3</Name>
<SizeData Size="11504514137" Allocated="11513361814" Wasted="8829863" CDRom="11508457472" Files="4561" Folders="510" Compression="1"/>
</Folder>
<Folder fullpath="C:\TEMP_\mp3\My Music\" IsFilesNode="0">
<Name>My Music</Name>
<SizeData Size="11247143252" Allocated="11255940398" Wasted="8779436" CDRom="11251054592" Files="4532" Folders="506" Compression="1"/>
</Folder>
<Folder fullpath="C:\TEMP_\mp3\My Music\MP3\" IsFilesNode="0">
<Name>MP3</Name>
<SizeData Size="11074836494" Allocated="11083256268" Wasted="8402930" CDRom="11078576128" Files="4357" Folders="481" Compression="1"/>
</Folder>
<Folder fullpath="C:\TEMP_\mp3\My Music\MP3\MP3\" IsFilesNode="0">
<Name>MP3</Name>
<SizeData Size="9808652194" Allocated="9813168460" Wasted="4507742" CDRom="9810542592" Files="2458" Folders="242" Compression="1"/>
</Folder>
</Root>

The code I have is below:

<code>Try

   Dim odoc As New System.Xml.XmlDocument
   odoc.Load("C:\test\test.xml")
   Dim oXmlLog As System.Xml.XmlElement
   Dim text As String = ""
   For Each oXmlLog In odoc.SelectNodes("Root")
         Dim node As System.Xml.XmlElement
            For Each node In oXmlLog.SelectNodes("Folder")
               Dim fullpath As String = node.Attributes.GetNamedItem("fullpath").Value
               'Dim SizeData As String = node.Attributes.GetNamedItem("SizeData").Value
               Dim subnode = node.SelectSingleNode("Name")
               Dim name As String = subnode.InnerText


               Dim Date_ As XmlElement = odoc.DocumentElement
               Dim Date_time As XmlNodeList = Date_.ChildNodes
               Dim Date__time = (Date_time(0).InnerText)



               text &= Date__time   & fullpath   & name & SizeData & Environment.NewLine
               Next
            Next

            Console.Write(text)
            Console.Read()
         Catch ex As Exception
         Console.Write(ex.ToString())
         Console.Read()
      End Try</code>


But I can't get the SIZE from SIZEDATA out and into a variable, can you help???
AnswerRe: XML Extraction using VB Pin
Christian Graus21-Oct-09 23:42
protectorChristian Graus21-Oct-09 23:42 
GeneralRe: XML Extraction using VB Pin
nhsal6922-Oct-09 0:19
nhsal6922-Oct-09 0:19 
GeneralRe: XML Extraction using VB Pin
Christian Graus22-Oct-09 0:49
protectorChristian Graus22-Oct-09 0:49 
GeneralRe: XML Extraction using VB Pin
nhsal6922-Oct-09 1:42
nhsal6922-Oct-09 1:42 
GeneralRe: XML Extraction using VB Pin
John M Bundy22-Oct-09 9:07
John M Bundy22-Oct-09 9:07 
GeneralRe: XML Extraction using VB Pin
nhsal6922-Oct-09 21:29
nhsal6922-Oct-09 21:29 
GeneralRe: XML Extraction using VB Pin
John M Bundy23-Oct-09 4:38
John M Bundy23-Oct-09 4:38 
Questioncmd.executenonquery not accepting nz function Pin
rabih.tawil21-Oct-09 20:57
rabih.tawil21-Oct-09 20:57 
AnswerRe: cmd.executenonquery not accepting nz function Pin
Ashfield21-Oct-09 21:11
Ashfield21-Oct-09 21:11 
GeneralRe: cmd.executenonquery not accepting nz function Pin
rabih.tawil21-Oct-09 21:27
rabih.tawil21-Oct-09 21:27 
AnswerRe: cmd.executenonquery not accepting nz function Pin
Mycroft Holmes21-Oct-09 21:11
professionalMycroft Holmes21-Oct-09 21:11 
GeneralRe: cmd.executenonquery not accepting nz function Pin
rabih.tawil21-Oct-09 21:22
rabih.tawil21-Oct-09 21:22 
GeneralRe: cmd.executenonquery not accepting nz function Pin
Mycroft Holmes21-Oct-09 21:33
professionalMycroft Holmes21-Oct-09 21:33 
GeneralRe: cmd.executenonquery not accepting nz function Pin
rabih.tawil21-Oct-09 21:36
rabih.tawil21-Oct-09 21:36 
GeneralRe: cmd.executenonquery not accepting nz function Pin
Christian Graus21-Oct-09 22:03
protectorChristian Graus21-Oct-09 22:03 
GeneralRe: cmd.executenonquery not accepting nz function Pin
rabih.tawil21-Oct-09 22:22
rabih.tawil21-Oct-09 22:22 
GeneralRe: cmd.executenonquery not accepting nz function Pin
Christian Graus21-Oct-09 23:15
protectorChristian Graus21-Oct-09 23:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.