UTF-16BE编码的xml文件提取数据并做平滑曲线图

最近老板给了个xml文件想把里面的数据提取出来做个平滑曲线图,因为xml文件是utf-16be编码的,在notpad++编辑器打开是一堆乱码,哎,没办法先用perl进行转码然后提取数据再调用R作图,
xml文件如下:

<?xml version="1.0" encoding="UTF-16BE"?>

<!DOCTYPE oif_file SYSTEM "http://www.dcs.warwick.ac.uk/~gmb/oifml.dtd">

<oif_file>

<odmg_object oid="T2904">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="Id"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><string val="2020.07.17_16.21.03_460529-1"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2912">

  <class>jyd.collection.StorableList

  </class>

  <contents>

      <value><string val="History"/>

      </value>

      <value><string val="2020"/>

      </value>

      <value><string val="2020.07"/>

      </value>

      <value><string val="2020.07.17_16.21.03_460529-1"/>

      </value>

  </contents>

</odmg_object>

<odmg_object oid="T2905">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="path"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><jyd.collection.StorableList val="T2912"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2973">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="0.9066799879074097"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="12.680500030517578"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2976">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="0.9900199770927429"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="13.222900390625"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2977">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="1.0066800117492676"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="13.636899948120117"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2983">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="1.190019965171814"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="16.09630012512207"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2985">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="1.2066899538040161"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="16.07390022277832"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2987">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="1.7900300025939941"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="15.82040023803711"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2989">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="1.806689977645874"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="15.722599983215332"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2992">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="1.9566999673843384"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="15.974300384521484"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2993">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="2.4066898822784424"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="14.015399932861328"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2995">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="2.573349952697754"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="13.376500129699707"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2997">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="2.5941898822784424"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="13.413700103759766"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3000">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="3.031680107116699"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="12.785200119018555"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3001">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="3.156680107116699"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="13.788000106811523"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3003">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="3.2608399391174316"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="15.78499984741211"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3014">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="3.3858399391174316"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="19.47610092163086"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3015">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="3.5108399391174316"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="24.384700775146484"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3017">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="3.7608399391174316"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="35.85879898071289"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3020">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="3.781670093536377"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="36.89830017089844"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3021">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="4.073329925537109"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="49.42060089111328"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3023">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="4.239999771118164"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="54.8745002746582"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3025">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="4.260829925537109"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="55.41279983520508"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3027">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="4.656660079956055"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="65.78250122070312"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3029">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="4.989980220794678"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="70.53820037841797"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3031">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="5.010819911956787"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="70.7146987915039"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3033">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="5.260809898376465"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="73.77010345458984"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3035">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="5.71914005279541"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="79.31770324707031"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3037">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="6.198299884796143"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="86.40470123291016"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3039">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="6.406630039215088"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="89.64070129394531"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3041">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="6.844120025634766"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="96.05110168457031"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3043">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="7.114950180053711"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="99.3812026977539"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3045">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="7.406610012054443"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="102.03600311279297"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3047">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="7.823269844055176"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="104.0009994506836"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3049">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="8.010769844055176"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="103.7979965209961"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3051">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="8.031599998474121"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="103.66500091552734"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3053">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="8.344099998474121"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="102.625"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3055">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="9.156590461730957"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="97.98429870605469"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3061">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="10.844099998474121"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="89.39859771728516"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3063">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="10.864899635314941"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="89.39459991455078"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3065">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="11.948200225830078"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="85.28610229492188"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3067">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="11.968999862670898"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="85.3228988647461"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3073">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="12.760700225830078"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="83.31430053710938"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3076">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="12.781499862670898"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="83.37680053710938"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3077">

  <class>com.smallplanet.jyd.JYDPoint

  </class>

  <contents>

    <attribute name="x">

      <value><double val="13.381500244140625"/>

      </value>

    </attribute>

    <attribute name="y">

      <value><double val="82.31729888916016"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2914">

  <class>jyd.collection.StorableList

  </class>

  <contents>

      <value><com.smallplanet.jyd.JYDPoint val="T2973"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2976"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2977"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2983"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2985"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2987"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2989"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2992"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2993"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2995"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T2997"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3000"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3001"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3003"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3014"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3015"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3017"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3020"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3021"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3023"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3025"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3027"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3029"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3031"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3033"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3035"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3037"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3039"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3041"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3043"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3045"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3047"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3049"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3051"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3053"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3055"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3061"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3063"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3065"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3067"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3073"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3076"/>

      </value>

      <value><com.smallplanet.jyd.JYDPoint val="T3077"/>

      </value>

  </contents>

</odmg_object>

<odmg_object oid="T2906">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="rawData"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><jyd.collection.StorableList val="T2914"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="N1">

  <class>java.lang.Double

  </class>

  <contents>

    <attribute name="value">

      <value><double val="188.75160217285156"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3006">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="ACT"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><java.lang.Double val="N1"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="N2">

  <class>java.lang.Double

  </class>

  <contents>

    <attribute name="value">

      <value><double val="42.068599700927734"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3007">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="ClotRate"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><java.lang.Double val="N2"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="N3">

  <class>java.lang.Double

  </class>

  <contents>

    <attribute name="value">

      <value><double val="3.245349884033203"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3069">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="PlateletFunction"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><java.lang.Double val="N3"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2916">

  <class>jyd.collection.StorableDictionary

  </class>

  <contents>

      <value><jyd.collection.KVPair val="T3006"/>

      </value>

      <value><jyd.collection.KVPair val="T3007"/>

      </value>

      <value><jyd.collection.KVPair val="T3069"/>

      </value>

  </contents>

</odmg_object>

<odmg_object oid="T2907">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="results"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><jyd.collection.StorableDictionary val="T2916"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2933">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="application"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><string val="Normal Range"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2934">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="operatorId"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><string val=""/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2935">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="patientId"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><string val=""/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2936">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="serialNumber"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><string val="460529-1"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T3057">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="testComment"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><string val="2-3"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="N4">

  <class>java.lang.Long

  </class>

  <contents>

    <attribute name="value">

      <value><long val="1594974063914"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2937">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="timeStamp"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><java.lang.Long val="N4"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2918">

  <class>jyd.collection.StorableDictionary

  </class>

  <contents>

      <value><jyd.collection.KVPair val="T2933"/>

      </value>

      <value><jyd.collection.KVPair val="T2934"/>

      </value>

      <value><jyd.collection.KVPair val="T2935"/>

      </value>

      <value><jyd.collection.KVPair val="T2936"/>

      </value>

      <value><jyd.collection.KVPair val="T3057"/>

      </value>

      <value><jyd.collection.KVPair val="T2937"/>

      </value>

  </contents>

</odmg_object>

<odmg_object oid="T2908">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="tagsMap"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><jyd.collection.StorableDictionary val="T2918"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="T2909">

  <class>jyd.collection.KVPair

  </class>

  <contents>

    <attribute name="key">

      <value><string val="typeOfTest"/>

      </value>

    </attribute>

    <attribute name="value">

      <value><string val="gbACT+"/>

      </value>

    </attribute>

  </contents>

</odmg_object>

<odmg_object oid="JYDObject">

  <class>jyd.collection.StorableDictionary

  </class>

  <contents>

      <value><jyd.collection.KVPair val="T2904"/>

      </value>

      <value><jyd.collection.KVPair val="T2905"/>

      </value>

      <value><jyd.collection.KVPair val="T2906"/>

      </value>

      <value><jyd.collection.KVPair val="T2907"/>

      </value>

      <value><jyd.collection.KVPair val="T2908"/>

      </value>

      <value><jyd.collection.KVPair val="T2909"/>

      </value>

  </contents>

</odmg_object>

</oif_file>

然后呢就写了个perl脚本处理了下,脚本代码如下

use strict;
use warnings;
use File::Basename;
use Encode;
#use utf8;
use Getopt::Long;
#定义程序用法
my $help = <<USAGE;
Note:   program_for_xml V1.0 用于提取xml文件数据,可视化
USAGE:
    -xml  参数xml为输入xml文件,这个参数必须有,否则不能运行脚本;
    -d    参数d为输出对应的图示文件,图示文件为pdf,默认输出路径为程序存放路径
     usage example: perl $0 -xml aaa.xml -d /genesmile/work/project/××
USAGE
#定义程序涉及的参数
my $xml;
my $dir = dirname($0);
my $cash=$dir.'/'.'cash';
my $coordinate_txt=$dir.'/'.'coordinate_txt';
GetOptions(
    "xml:s"  => \$xml,
    "d:s"  => \$dir,
);
die "$help" unless defined $xml;
#读取xml文件生成cash文本
&readxml($xml);
#处理cash文本提取数据
my @xuhao=();
my @x;
my @y;
&exact_data();
#if(-s $coordinate_txt){die "$xml has no date!\n";}
my $act;
my $clotrate;
my $plateletfunction;
#从xml中提取ACT值
my $num1 = `grep -a -n '<odmg_object oid=\"N1\">' $cash`;
my $num2 = `grep -a -n '<value><java.lang.Double val="N1"/>' $cash`;
my @a = split(/:/, $num1);
my @b = split(/:/, $num2);
my $act_cash_txt=`sed -n '$a[0],$b[0]p' $cash|grep '<value><double val="'`;
if($act_cash_txt =~/\<value\>\<double val\=\"(.*)\"\/\>/){$act=$1;}
my $act_n =sprintf("%.2f",$act);
#从xml中提取ClotRate值
$num1 = `grep -a -n '<odmg_object oid=\"N2\">' $cash`;
$num2 = `grep -a -n '<value><java.lang.Double val="N2"/>' $cash`;
@a = split(/:/, $num1);
@b = split(/:/, $num2);
my $clotrate_txt=`sed -n '$a[0],$b[0]p' $cash|grep '<value><double val="'`;
if($clotrate_txt =~/\<value\>\<double val\=\"(.*)\"\/\>/){$clotrate=$1;}
my $clotrate_n =sprintf("%.2f",$clotrate);
#从xml中提取plateletfunction值
$num1 = `grep -a -n '<odmg_object oid=\"N3\">' $cash`;
$num2 = `grep -a -n '<value><java.lang.Double val="N3"/>' $cash`;
@a = split(/:/, $num1);
@b = split(/:/, $num2);
my $plateletfunction_txt=`sed -n '$a[0],$b[0]p' $cash|grep '<value><double val="'`;
if($plateletfunction_txt =~/\<value\>\<double val\=\"(.*)\"\/\>/){$plateletfunction=$1;}
my $plateletfunction_n =sprintf("%.2f",$plateletfunction);
#采用R程序画图
my $plot=$xml.'.r';
my $filename=$xml.'.pdf';
open PLOT,">$plot";
print PLOT 'pdf(file="'.$filename.'")
x<-c('.join(",",@x).')
y<-c('.join(",",@y).')
sp=spline(x,y,n=1000)
plot(sp,col="red",type="l",xlim=c(0,15),ylim=c(0,120),lwd=2,xlab="Minutes",ylab="Clot Signal",main="Signature",sub="画图",col.main="green",font.main=2)
legend("topright",legend=c("ACT='.$act_n.'","ClotRate='.$clotrate_n.'","PlateletFunction='.$plateletfunction_n.'"),col=c("red","red","gray"),lwd=2,lty=c(1,1,1))',"\n";
close PLOT;
system("Rscript \.\/$plot");

#定义读取xml文件的函数read_xml
sub readxml
{
    my $file =shift;
    open(IN,'<:encoding(utf-16)',$file);
    open(OUT,'>:encoding(utf-8)',$cash);
    while(<IN>) 
    {
        print OUT $_,"\n";
    }
    close IN;
    close OUT;
    system("fromdos $cash;sed -i '/^\$/d' $cash");
}
#定义函数用于提取xml文件中的坐标数据
sub exact_data
{
    `grep '<value><com.smallplanet.jyd.JYDPoint val=' $cash > $coordinate_txt`;
    my $num=0;
    if(-s $coordinate_txt)
    {
        open IN,"<$coordinate_txt";
        while(<IN>)
        {
            chomp;
            $_=~/val\=\"(.*)\"\/\>/;
            $xuhao[$num] = $1;
            $num++;
        }
        close IN;
    }
    my $i=0;
    $num=0;
    my $pointer='x';
    open CASH,"<$cash";
    while(<CASH>)
    {
        chomp;
        if($_=~/\<value\>\<double\sval\=\"(.*)\"\/\>/)
        {
            if($pointer eq 'x'){$x[$num]=$1;$pointer='y';}
            elsif($pointer eq 'y'){$y[$num]=$1;$pointer='x';$num++;}
        }
        elsif($_=~/\<value\>\<com\.smallplanet\.jyd\.JYDPoint/){last;}
    }
    close CASH;
}

做出的图示效果如下:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值