Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21292

[RESOLVED] wrong value returned out of XML-Doc

$
0
0
Hi,

I have a little Problem. I m seqrching through a XML document for certain Values, its working fine for every Values but this single value is giving me a headache. I dont see why its returning the wrong value.

Maybe someone of you is able to help. I stared 2 hours at it tried different variations but at the moment I miss the forest for the trees.

this is the part of the XML document (the Value I like to get is highlighted):

Code:

          <LDevice desc="Ln1" inst="Ln1">
              <Private type="Siemens-MasterId">5ae1baf0-203a-448d-8234-c53d11df5fdf</Private>
              <LN0 desc="General" lnClass="LLN0" lnType="SIPROTEC5_LNType_LLN0_LDevice_Generic" inst="">
                  <Private type="Siemens-MasterId">a9e4482c-fe2f-48d2-9e18-8142042c1b36</Private>
                  <DOI name="Mod" desc="Mode (controllable)">
                    <DAI name="stVal"/>
                  </DOI>
                  <DOI name="Beh" desc="Behavior"/>
                  <DOI name="Health" desc="Health"/>
                  <DOI name="NamPlt" desc="Name plate">
                    <DAI name="configRev">
                        <Val>635107142092235325</Val>
                    </DAI>
                    <DAI name="ldNs">
                        <Val>IEC61850-7-4:2007</Val>
                    </DAI>
                  </DOI>
                  <DOI name="GrRef" desc="GrRef">
                    <DAI name="setSrcRef">
                        <Val>@Application/LLN0</Val>
                    </DAI>
                  </DOI>
              </LN0>
              <LN desc="General" lnClass="ZLIN" lnType="SIPROTEC5_LNType_ZLIN_FB0_FGLine" inst="1" prefix="">
                  <Private type="Siemens-MasterId">07243640-b0fe-4384-920b-a3b39e19bc99</Private>
                  <DOI name="Mod" desc="Mode (controllable)">
                    <DAI name="stVal"/>
                  </DOI>
                  <DOI name="Beh" desc="Behavior"/>
                  <DOI name="Health" desc="Health"/>
                  <DOI name="NamPlt" desc="Name plate">
                    <DAI name="configRev">
                        <Val>635107142091373347</Val>
                    </DAI>
                  </DOI>
                  <DOI name="ZPsAng" desc="Line angle">
                    <SDI name="setMag">
                        <DAI name="f">
                          <Val>85</Val>
                        </DAI>
                    </SDI>
                    <SDI name="units">
                        <DAI name="SIUnit">
                          <Val>deg</Val>
                        </DAI>
                        <DAI name="multiplier">
                          <Val></Val>
                        </DAI>
                    </SDI>
                    <SDI name="minVal">
                        <DAI name="f">
                          <Val>10</Val>
                        </DAI>
                    </SDI>
                    <SDI name="maxVal">
                        <DAI name="f">
                          <Val>89</Val>
                        </DAI>
                    </SDI>
                    <SDI name="stepSize">
                        <DAI name="f">
                          <Val>0</Val>
                        </DAI>
                    </SDI>
                  </DOI>

and this is my code. The Part that isnt working as it is supposed to do is highlighted.

Code:

                For Each NodeLN In NodeListLN

                        '-->Siemens Relais

                        If Manufacturer.getAttribute("manufacturer")= "SIEMENS" Then

                                '-->Find all PTOC-Zones in the SCL File
                                If NodeLN.getAttribute("lnClass") = "PTOC" Then

                                        PTOC.Threshold = CDbl(NodeLN.selectSingleNode("DOI[@name='StrVal']/SDI[@name='setMag']").lastChild.Text)/TransRatio
                                        PTOC.Modus = NodeLN.selectSingleNode("DOI[@name='Mode']").lastChild.Text
                                        PTOC.Delay = CDbl(NodeLN.selectSingleNode("DOI[@name='OpDlTmms']/DAI[@name='setVal']").lastChild.Text)/1000
                                        PTOC.DropOutRate = CDbl(NodeLN.selectSingleNode("DOI[@name='DrpoutRat']/SDI[@name='setMag']").lastChild.Text)

                                        Set NodeLNParent = NodeLN.parentNode

                                        PTOC.desc = NodeLNParent.getAttribute("inst")
                                        PTOC.Zone = NodeLN.getAttribute("inst")

                                        PTOC.ModuleName = "PTOC"


                                        ObjTmpArray(i)=PTOC
                                        i=i+1

                                ElseIf NodeLN.getAttribute("lnClass") = "PDIS" Then

                                        PDISFound = True


                                        PDISZone.Name = NodeLN.getAttribute("desc")
                                        PDISinst = NodeLN.getAttribute("inst")

                                        PDISZone.XR=CDbl(NodeLN.selectSingleNode("DOI[@name='X1']/SDI[@name='setMag']").lastChild.Text)
                                        PDISZone.RPh=CDbl(NodeLN.selectSingleNode("DOI[@name='RisGndRch']/SDI[@name='setMag']").lastChild.Text)
                                        PDISZone.RGnd=CDbl(NodeLN.selectSingleNode("DOI[@name='RisPhRch']/SDI[@name='setMag']").lastChild.Text)
                                        PDISZone.Angle=CDbl(NodeLN.selectSingleNode("DOI[@name='ZnRedAng']/SDI[@name='setMag']").lastChild.Text)

                                        PDISZone.Reversed = NodeLN.selectSingleNode("DOI[@name='DirMod']").lastChild.Text
                                        PDISZone.DelaytimePh = CDbl(NodeLN.selectSingleNode("DOI[@name='PhDlTmms']/DAI[@name='setVal']").lastChild.Text)
                                        PDISZone.DelaytimeGnd = CDbl(NodeLN.selectSingleNode("DOI[@name='GndDlTmms']/DAI[@name='setVal']").lastChild.Text)
                                        PDISZone.KFactor = CDbl(NodeLN.selectSingleNode("DOI[@name='K0Fact']/SDI[@name='setMag']").lastChild.Text)

                                        PDIS.Zones(j) = PDISZone
                                        j=j+1

                                Else
                                        If PDISFound = True Then

                                                PDIS.Manufacturer = "SIEMENS"
                                                PDIS.ModuleName = "PDIS"
                                                PDIS.ZoneCount = j

                                                '--> Protected Object
                                                Set ProtectedObject = xDoc.documentElement.selectSingleNode("//LDevice[@inst='Ln1']/LN[lnClass='ZLIN']")
                                                PDIS.LineAngle = CDbl(ProtectedObject.selectSingleNode("DOI[@name='ZPsAng']/SDI[@name='setMag']").lastChild.Text)




                                                MsgBox(CStr(PDIS.LineAngle))



                                                ObjTmpArray(i)=PDIS

                                                i=i+1
                                                j=0

                                                PDISFound = False
                                        End If
                                End If
Next

MsgBox is a private class of the Programm i m programming in, and Protected object is a MSXML2.IXMLDOMElement.

I appreciate any help.

best regards

Sascha

Viewing all articles
Browse latest Browse all 21292

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>