A big thanks for your good scripts!
I've been processing data and it occurred to me that jrepl would be useful to process a text file like this:
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<pfml version="1.0">
<face>
<attribute name="translation-v-mm">-11.92</attribute>
<geometry>
<Rectangle x="256" y="216" width="132" height="158"/>
</geometry>
<eye>
<eye-bounds>
<attribute name="3d-position-z">724.04</attribute>
<attribute name="3d-position-y">-12.20</attribute>
<attribute name="3d-position-x">-35.30</attribute>
<attribute name="open-closed-state">open</attribute>
<geometry>
<Rectangle x="273" y="246" width="34" height="11"/>
</geometry>
</eye-bounds>
<lower-eyelid>
<geometry>
<Point x="289.98" y="252.91"/>
</geometry>
</lower-eyelid>
<upper-eyelid>
<geometry>
<Point x="289.98" y="242.48"/>
</geometry>
</upper-eyelid>
</eye>
<eye markedPos="1">
<eye-bounds>
<attribute name="3d-position-z">723.94</attribute>
<attribute name="3d-position-y">-11.26</attribute>
<attribute name="3d-position-x">30.69</attribute>
<attribute name="open-closed-state">open</attribute>
<geometry>
<Rectangle x="336" y="244" width="34" height="14"/>
</geometry>
</eye-bounds>
<lower-eyelid>
<geometry>
<Point x="352.91" y="253.31"/>
</geometry>
</lower-eyelid>
<upper-eyelid>
<geometry>
<Point x="352.51" y="242.28"/>
</geometry>
</upper-eyelid>
</eye>
<mouth>
<geometry>
<Rectangle x="294" y="313" width="53" height="14"/>
</geometry>
</mouth>
</face>
<person>
<attribute name="personName">Person1</attribute>
<geometry>
<Rectangle x="289.8" y="252.96" width="5.55" height="4.29"/>
</geometry>
</person>
<person>
<attribute name="personName">Person2</attribute>
<geometry>
<Rectangle x="289.98" y="242.58" width="5.55" height="4.29"/>
</geometry>
</person>
<person>
<attribute name="personName">Person3</attribute>
<geometry>
<Rectangle x="352.95" y="253.32" width="5.55" height="4.29"/>
</geometry>
</person>
<person>
<attribute name="personName">Person4</attribute>
<geometry>
<Rectangle x="352.59" y="242.23" width="5.55" height="4.29"/>
</geometry>
</person>
</pfml>
<orig-lastmodified>1497878193347</orig-lastmodified>
</image>
I need to compare the value "Rectangle x=" of first eye-bounds with the value "Rectangle x=" of second eye-bounds.
If first x < second x, then:
- replace the x value and y value of first lower-eyelid (<Point x="289.98" y="252.91"/>) with value of x and y of Person1;
- replace the x value and y value of first upper-eyelid (<Point x="289.98" y="242.48"/>) with value of x and y of Person2;
- replace the x value and y value of second lower-eyelid (<Point x="352.91" y="253.31"/>) with value of x and y of Person3;
- replace the x value and y value of second upper-eyelid (<Point x="352.51" y="242.28"/>) with value of x and y of Person4;
If first x > second x, then:
- replace the x value and y value of first lower-eyelid (<Point x="289.98" y="252.91"/>) with value of x and y of Person3;
- replace the x value and y value of first upper-eyelid (<Point x="289.98" y="242.48"/>) with value of x and y of Person4;
- replace the x value and y value of second lower-eyelid (<Point x="352.91" y="253.31"/>) with value of x and y of Person1;
- replace the x value and y value of second upper-eyelid (<Point x="352.51" y="242.28"/>) with value of x and y of Person2;
I need to replace just values, keeping the formatted text. Could you help me, please? Thank You!
Best regards,
Dan