C
Calle78
Guest
Hi
I was hoping to get some help on geting the information I need from a XML document. My XML looks like following:
<UserName>me</UserName>
<SystemId>this</SystemId>
<InspectionType>Rework</InspectionType>
-<Panel NumberOfBoardsInPanel="5" NG_Stacker_SlotNumber="NO_SLOT_NUMBER_READ" SequenceNumber="51" LotSize="0" LotCode="2019" Barcode="686985" EndTime="09/06/2019 13:37:22" StartTime="09/06/2019 13:37:17" Category="False Fail" PanelPassed="T">
<Assembly>Mount</Assembly>
-<PanelResult>
-<Attributes>
<DefectiveLocations Value="0"/>
<DefectiveFeatures Value="0"/>
<FalseFailLocations Value="3"/>
<FalseFailFailures Value="3"/>
</Attributes>
</PanelResult>
-<Image Barcode="NO_BARCODE_READ" Category="False Fail" ImagePassed="T" Name="Board5">
-<Location Category="False Fail" Image1="Board5.SW4.jpg" ReworkError="False Fail" LocationDefective="F" Identifier3="Switch_7x6test" Identifier2="Component\13101-0078" Identifier1="SW4">
-<LocationResult>
-<Attributes>
<Mounter FeederNo="Not Specified" StationID="Not Specified" Vendor="Not Specified"/>
</Attributes>
</LocationResult>
<Feature Category="False Fail" Image1="Board5.SW4.Pins.Pin2.jpg" ReworkError="False Fail" FeatureDefective="F" Identifier="Pins.Pin2"/>
</Location>
-<Location Category="False Fail" Image1="Board5.SW5.jpg" ReworkError="False Fail" LocationDefective="F" Identifier3="Switch_7x6test" Identifier2="Component\13101-0078" Identifier1="SW5">
-<LocationResult>
-<Attributes>
<Mounter FeederNo="Not Specified" StationID="Not Specified" Vendor="Not Specified"/>
</Attributes>
</LocationResult>
<Feature Category="False Fail" Image1="Board5.SW5.Pins.Pin4.jpg" ReworkError="False Fail" FeatureDefective="F" Identifier="Pins.Pin4"/>
</Location>
</Image>
-<Image Barcode="NO_BARCODE_READ" Category="False Fail" ImagePassed="T" Name="Board3">
-<Location Category="False Fail" Image1="Board3.SW7.jpg" ReworkError="False Fail" LocationDefective="F" Identifier3="Switch_7x6test" Identifier2="Component\13101-0078" Identifier1="SW7">
-<LocationResult>
-<Attributes>
<Mounter FeederNo="Not Specified" StationID="Not Specified" Vendor="Not Specified"/>
</Attributes>
</LocationResult>
<Feature Category="False Fail" Image1="Board3.SW7.Pins.Pin1.jpg" ReworkError="False Fail" FeatureDefective="F" Identifier="Pins.Pin1"/>
</Location>
</Image>
</Panel>
From this there are certain elements I wanted to my db. For simplicity, lets say I wanted Username and Identifier1. To get that I used this code:
m_xmld = New XmlDocument()
m_xmld.Load(file)
m_nodelist = m_xmld.SelectNodes("//Location")
For Each m_node In m_nodelist
Dim bruker As String = m_node.SelectSingleNode("//UserName").InnerText
Dim ref As String = m_node.SelectSingleNode("@Identifier1").InnerText
Next
msgbox(bruker & ", " & ref)
That gave me the following result 'me, SW4', 'me, SW5' and 'me,SW7'.
But when I wanted to add /Image/@name all I got was, 'me, SW4, Board5', 'me, SW5, Board5' and 'me,SW7, Board5'. Where the last should have been 'Board3'.
I treied rewriting this code all the ways I know how. But the result is either Board5 on all returns or 'me, SW4, Board5' and 'me, SW4, Board3'.
I think I've read all documentation I can find online but just can't figure out how to get the result I want. Is there anyone who can help me out?
Carl-M
Continue reading...
I was hoping to get some help on geting the information I need from a XML document. My XML looks like following:
<UserName>me</UserName>
<SystemId>this</SystemId>
<InspectionType>Rework</InspectionType>
-<Panel NumberOfBoardsInPanel="5" NG_Stacker_SlotNumber="NO_SLOT_NUMBER_READ" SequenceNumber="51" LotSize="0" LotCode="2019" Barcode="686985" EndTime="09/06/2019 13:37:22" StartTime="09/06/2019 13:37:17" Category="False Fail" PanelPassed="T">
<Assembly>Mount</Assembly>
-<PanelResult>
-<Attributes>
<DefectiveLocations Value="0"/>
<DefectiveFeatures Value="0"/>
<FalseFailLocations Value="3"/>
<FalseFailFailures Value="3"/>
</Attributes>
</PanelResult>
-<Image Barcode="NO_BARCODE_READ" Category="False Fail" ImagePassed="T" Name="Board5">
-<Location Category="False Fail" Image1="Board5.SW4.jpg" ReworkError="False Fail" LocationDefective="F" Identifier3="Switch_7x6test" Identifier2="Component\13101-0078" Identifier1="SW4">
-<LocationResult>
-<Attributes>
<Mounter FeederNo="Not Specified" StationID="Not Specified" Vendor="Not Specified"/>
</Attributes>
</LocationResult>
<Feature Category="False Fail" Image1="Board5.SW4.Pins.Pin2.jpg" ReworkError="False Fail" FeatureDefective="F" Identifier="Pins.Pin2"/>
</Location>
-<Location Category="False Fail" Image1="Board5.SW5.jpg" ReworkError="False Fail" LocationDefective="F" Identifier3="Switch_7x6test" Identifier2="Component\13101-0078" Identifier1="SW5">
-<LocationResult>
-<Attributes>
<Mounter FeederNo="Not Specified" StationID="Not Specified" Vendor="Not Specified"/>
</Attributes>
</LocationResult>
<Feature Category="False Fail" Image1="Board5.SW5.Pins.Pin4.jpg" ReworkError="False Fail" FeatureDefective="F" Identifier="Pins.Pin4"/>
</Location>
</Image>
-<Image Barcode="NO_BARCODE_READ" Category="False Fail" ImagePassed="T" Name="Board3">
-<Location Category="False Fail" Image1="Board3.SW7.jpg" ReworkError="False Fail" LocationDefective="F" Identifier3="Switch_7x6test" Identifier2="Component\13101-0078" Identifier1="SW7">
-<LocationResult>
-<Attributes>
<Mounter FeederNo="Not Specified" StationID="Not Specified" Vendor="Not Specified"/>
</Attributes>
</LocationResult>
<Feature Category="False Fail" Image1="Board3.SW7.Pins.Pin1.jpg" ReworkError="False Fail" FeatureDefective="F" Identifier="Pins.Pin1"/>
</Location>
</Image>
</Panel>
From this there are certain elements I wanted to my db. For simplicity, lets say I wanted Username and Identifier1. To get that I used this code:
m_xmld = New XmlDocument()
m_xmld.Load(file)
m_nodelist = m_xmld.SelectNodes("//Location")
For Each m_node In m_nodelist
Dim bruker As String = m_node.SelectSingleNode("//UserName").InnerText
Dim ref As String = m_node.SelectSingleNode("@Identifier1").InnerText
Next
msgbox(bruker & ", " & ref)
That gave me the following result 'me, SW4', 'me, SW5' and 'me,SW7'.
But when I wanted to add /Image/@name all I got was, 'me, SW4, Board5', 'me, SW5, Board5' and 'me,SW7, Board5'. Where the last should have been 'Board3'.
I treied rewriting this code all the ways I know how. But the result is either Board5 on all returns or 'me, SW4, Board5' and 'me, SW4, Board3'.
I think I've read all documentation I can find online but just can't figure out how to get the result I want. Is there anyone who can help me out?
Carl-M
Continue reading...