04-29-2013 08:40 AM
Hi,
I am able to parse XML successfully but not able to print all the values which i want.....I have attached the VI, XML file...pls let me know the solutions.
I am able to print contents under group 1 i.e. G1 But fails to print G2, G3, G4 contents...please let me know what is wrong in my VI file
Ex:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<MonitorSession Version="2.4.0" ActiveScreen="Screen 0">
<Dotnetbarlayouts><dotnetbarlayout version="6" zorder="3,4,0,2"><docksite size="0" dockingside="Top" /><docksite size="0" dockingside="Bottom" /><documents><dockcontainer orientation="0" w="0" h="0"><barcontainer w="1012" h="360"><bar name="Screen 0" dockline="0" layout="2" dockoffset="0" state="2" dockside="5" visible="true" seldocktab="0"><items><item name="Screen 0" origBar="" origPos="-1" pos="0" /><item name="Screen 2" origBar="" origPos="-1" pos="1" /></items></bar></barcontainer></dockcontainer></documents><docksite size="0" dockingside="Right" /><documents><dockcontainer orientation="0" w="0" h="0"><barcontainer w="1012" h="360"><bar name="Screen 0" dockline="0" layout="2" dockoffset="0" state="2" dockside="5" visible="true" seldocktab="0"><items><item name="Screen 0" origBar="" origPos="-1" pos="0" /><item name="Screen 2" origBar="" origPos="-1" pos="1" /></items></bar></barcontainer></dockcontainer></documents><bars /></dotnetbarlayout></Dotnetbarlayouts>
<Screen Name="Screen 0" DataRefreshRate="250" BAMRefreshRate="25" UIRefreshRate="200" EDMRefreshRate="20" DataRefreshUnits="Milliseconds" UIRefreshUnits="Milliseconds" MonitorType="RequestReceive" BAMTrigger="Clock" IDLTrigger="Clock" Radix="Decimal" ScreenType="Normal" Status="Active" LogMode="Any Data" LogRate="1" LogUnit="ms" LogPrefix="Screen 0" PCTimestamp="false" ActiveFaults="false" InactiveFaults="false" StartCondition="" StopCondition="" PreTrigger="5" PostTrigger="60" RepeatCount="0" Dock="Document">
<Group Name="Group" Comment="Comment" ShowUnits="true" ShowSourceAddress="true" ColumnWidths="Addr=54,Name=231,Value=75,Unit=46,Comment=46"> --> G1
<Parameter>
<SourceAddress>00</SourceAddress>
<Name>ECM_Run_Time</Name>
<Units>s</Units>
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
<Parameter>
<SourceAddress>00</SourceAddress>
<Name>Net_Brake_Torque</Name>
<Units>N_m</Units>
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
</Group>
<Group Name="Group" Comment="Comment" ShowUnits="true" ShowSourceAddress="true" ColumnWidths="Addr=54,Name=200,Value=230,Unit=46,Comment=46"> --> G2
<Parameter>
<SourceAddress>00</SourceAddress>
<Name>Engine_Run_Time</Name>
<Units>s</Units>
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
<Parameter>
<SourceAddress>0</SourceAddress>
<Name />
<Units />
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
</Group>
</Screen>
<Screen Name="Screen 2" DataRefreshRate="250" BAMRefreshRate="25" UIRefreshRate="200" EDMRefreshRate="20" DataRefreshUnits="Milliseconds" UIRefreshUnits="Milliseconds" MonitorType="RequestReceive" BAMTrigger="Clock" IDLTrigger="Clock" Radix="Decimal" ScreenType="Normal" Status="Active" LogMode="Any Data" LogRate="1" LogUnit="ms" LogPrefix="Screen 2_0" PCTimestamp="false" ActiveFaults="false" InactiveFaults="false" StartCondition="" StopCondition="" PreTrigger="5" PostTrigger="60" RepeatCount="0" Dock="Document">
<Group Name="Group" Comment="Comment" ShowUnits="true" ShowSourceAddress="true" ColumnWidths="Addr=54,Name=200,Value=75,Unit=46,Comment=46"> - G3
<Parameter>
<SourceAddress>0</SourceAddress>
<Name />
<Units />
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
<Parameter>
<SourceAddress>0</SourceAddress>
<Name />
<Units />
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
</Group>
<Group Name="Group" Comment="Comment" ShowUnits="true" ShowSourceAddress="true" ColumnWidths="Addr=54,Name=200,Value=75,Unit=46,Comment=46"> - G4
<Parameter>
<SourceAddress>0</SourceAddress>
<Name />
<Units />
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
<Parameter>
<SourceAddress>0</SourceAddress>
<Name />
<Units />
<ViewType>Normal</ViewType>
<IsBroadcast>false</IsBroadcast>
</Parameter>
</Group>
</Screen>
</MonitorSession>
</NewDataSet>
04-30-2013 01:57 PM
Mandya,
Have you been able to narrow down at all where the problem occurs (using highlight execution to try and figure out where things are going wrong for example)? Are there any errors that occur or does your program simply not perform as expected?
05-01-2013 04:59 AM
Hi,
it took me some time to understand what the code should do.
First of all please let me say, that wiring trough the error cluster is immanent for debugging. One problem I see is that the refnum from the document element is zero, so that all other calls for childs are failing. You will only notice this by debugging or execution highlighting (see James hint). You will also see a hint for a problem in this region of the code when you look at your indicator loadXml. This once was always False.
I have changed two things:
LoadXml.vi -> Read from Text File instead of binary
Main.vi -> Using the read text for input of the LoadXml invoke method and not the pretty printed one.
Now LoadXml performs the action and your 2D array is filling in some stuff. My advice would be to carefully debug your code and look, where references get lost and where errors occur.
Good Luck
Tyler
05-03-2013 02:30 PM
Let me know how to delete paricular node