locked
read XML data using VB.NET RRS feed

  • Question

  • Hi experts,

    How can I read the AttributeString value of a XML file?

    Example using below XML file


    <?xml version="1.0" ?>
    - <!--  generated by @(#) uts_sendResult 1.08 03/04/07 e.b.
      -->
    - <BATCH COMPATIBLE_REV="1.0" SYNTAX_REV="1.2" TIMESTAMP="2008-10-17 12:41:01" xmlns="http://www.abc.com/fts/sfs/res">
      <FACTORY FIXTURE="testk07" LINE="" NAME="SJC" SHIFT="" TESTER="PostPackAudUTS-01" USER="testk07" />
      <PRODUCT CUSTOMER="" FAMILY="" NAME="" REVISION="" />
      <REFS CAL_REF="" CFG_REF="" FTS_REF="psl/cmd (version/date)" INSTR_REF="" LIM_REF="fullconf (version/date)" SEQ_REF="" />
    - <PANEL COMMENT="" ID="Undef" RUNMODE="Production" STATUS="Failed" TESTTIME="2421" TIMESTAMP="2008-10-17 12:00:37" WAITTIME="0.00">
    - <DUT COMMENT="" ID="BEL0841CWD" PANEL="0" SOCKET="0" STATUS="Failed" TESTTIME="2421" TIMESTAMP="2008-10-17 12:00:37">
    - <GROUP GROUPINDEX="0" LOOPINDEX="-1" MODULETIME="0.00" NAME="MAIN" RESOURCE="GROUP0" STATUS="Failed" STEPGROUP="" TIMESTAMP="2008-10-17 12:00:37" TOTALTIME="2421" TYPE="MainSequence PPA">
    - <GROUP GROUPINDEX="0000000000" LOOPINDEX="-1" MODULETIME="0" NAME="TEST_SETUP" RESOURCE="GROUP1" STATUS="Passed" STEPGROUP="" TIMESTAMP="2008-10-17 12:00:37" TOTALTIME="50" TYPE="PS">
      <GROUP GROUPINDEX="0000000000" LOOPINDEX="-1" MODULETIME="0" NAME="DOUBLE_LINE" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.1" TIMESTAMP="2008-10-17 12:00:37" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000001" LOOPINDEX="-1" MODULETIME="0" NAME="DOUBLE_LINE" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.3" TIMESTAMP="2008-10-17 12:00:37" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000002" LOOPINDEX="-1" MODULETIME="0" NAME="DOUBLE_LINE" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.7" TIMESTAMP="2008-10-17 12:00:37" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000003" LOOPINDEX="-1" MODULETIME="0" NAME="init_testenv" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.8" TIMESTAMP="2008-10-17 12:00:37" TOTALTIME="1" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000004" LOOPINDEX="-1" MODULETIME="0" NAME="check_testenv" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.9" TIMESTAMP="2008-10-17 12:00:38" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000005" LOOPINDEX="-1" MODULETIME="0" NAME="power_setup" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.10" TIMESTAMP="2008-10-17 12:00:38" TOTALTIME="48" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000006" LOOPINDEX="-1" MODULETIME="0" NAME="start_test" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.11" TIMESTAMP="2008-10-17 12:01:26" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000007" LOOPINDEX="-1" MODULETIME="0" NAME="check_all_parts_recognised" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.12" TIMESTAMP="2008-10-17 12:01:26" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0000000008" LOOPINDEX="-1" MODULETIME="0" NAME="check_special_cases" RESOURCE="GROUP2" STATUS="Passed" STEPGROUP="100.13" TIMESTAMP="2008-10-17 12:01:26" TOTALTIME="1" TYPE="TASK" />
      </GROUP>
    - <GROUP GROUPINDEX="0001900000" LOOPINDEX="-1" MODULETIME="0" NAME="TEST_END" RESOURCE="GROUP1" STATUS="Planned" STEPGROUP="" TIMESTAMP="0 00:00" TOTALTIME="0" TYPE="PS">
      <GROUP GROUPINDEX="0001900000" LOOPINDEX="-1" MODULETIME="0" NAME="DOUBLE_LINE" RESOURCE="GROUP2" STATUS="Planned" STEPGROUP="480.1" TIMESTAMP="0 00:00" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0001900001" LOOPINDEX="-1" MODULETIME="0" NAME="DOUBLE_LINE" RESOURCE="GROUP2" STATUS="Planned" STEPGROUP="480.3" TIMESTAMP="0 00:00" TOTALTIME="0" TYPE="TASK" />
      <GROUP GROUPINDEX="0001900002" LOOPINDEX="-1" MODULETIME="0" NAME="END_TEST" RESOURCE="GROUP2" STATUS="Planned" STEPGROUP="480.4" TIMESTAMP="0 00:00" TOTALTIME="0" TYPE="TASK" />
      </GROUP>
      </GROUP>
      <EXTRA LOGFILE="<a href="
      </DUT>
      </PANEL>
      </BATCH>


    I would like to read and get the value for TESTER, USER, ID and STATUS (items bold above). How can I do that?


    Existing, I'm using the below method BUT hit error on element <BATCH>

    Try

    m_xmlr = New XmlTextReader(FileName)

    m_xmlr.WhitespaceHandling = WhitespaceHandling.None

    m_xmlr.Read()

    While Not m_xmlr.EOF

    m_xmlr.Read()

    If Not m_xmlr.IsStartElement() Then

    Exit While

    End If

    SRCName = Trim(m_xmlr.ReadElementString("TESTER"))

    End While

    m_xmlr.Close()



    Please advice. Thanks in advance.



    Regards,

    Henry Han
    Monday, December 1, 2008 5:06 AM