Menu

Child nodes ordering sequence

Help
knp
2013-12-12
2013-12-15
  • knp

    knp - 2013-12-12

    I have the following xml piece:

    https://gist.github.com/anonymous/7934085

    <list>
      <compressor tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[2]">
        <status tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[2].status">0</status>
        <status_display tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[2].s_d">On-No Response</status_display>
        <size tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[2].SZ">
          <setpoint tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[2].SZ.set">20.00</setpoint>
        </size>
      </compressor>                       
      <compressor tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[1]">
        <status tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[1].status">0</status>
        <status_display tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[1].s_d">On-No Response</status_display>
        <size tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[1].SZ">
          <setpoint tag_id="SYS.RKS.RK[1].SGS.SG[1].CPS.CP[1].SZ.set">20.00</setpoint>
        </size>
      </compressor>
    </list>
    

    The above is just a piece of the whole xml and it could be nested at any level.
    The original xml had them in the reverse sequence.

    I get a lot of not tag_id not matching because their sequence is different though values are same.
    How do I ignore the sequence errors on this? Or how do I make sure I am comparing them properly even if their sequence is different?

    This kind of a piece of xml can occur in several places in the whole xml file so there is no particular case of element name i can separate and do a different kind of processing.

    Please advise.

     

    Last edit: knp 2013-12-12

Log in to post a comment.

MongoDB Logo MongoDB