我有一个描述了成千上万条道路的XML。如果另一个元素等于某个特定值,我该如何更改一个元素的值?XML如果元素更换
<edge id="a" from="823472303" to="1157679486" priority="2" type="highway.service" shape="71013.78,70416.19 71009.26,70418.36 71004.38,70417.75 70998.91,70412.27">
<lane id="-100151810_0" index="0" allow="delivery" speed="5.56" length="17.67" shape="71013.24,70418.28 71009.54,70420.06 71003.61,70419.32 70997.74,70413.44"/>
</edge>
<edge id="b" from="1158231870" to="1158231886" priority="2" type="highway.service" shape="66981.74,70626.70 66973.61,70322.61 66985.21,70284.19">
<lane id="-100203601_0" index="0" allow="delivery" speed="5.56" length="344.33" shape="66980.09,70626.74 66971.95,70322.39 66981.11,70292.05"/>
</edge>
<edge id="c" from="2149636885" to="349236976" priority="5" type="highway.unclassified" shape="20785.34,49337.55 20786.22,49280.50 20785.67,49194.22 20783.27,49173.44">
<lane id="-100271410_0" index="0" speed="22.22" length="164.26" shape="20783.69,49337.52 20784.57,49280.47 20784.02,49194.23 20781.65,49173.77"/>
</edge>
<edge id="d" from="1142559441" to="1162085213" priority="2" type="highway.service" shape="70850.72,62133.69 70847.59,62151.63 70820.27,62173.78 70787.71,62211.29 70774.77,62228.21">
<lane id="-100528728_0" index="0" allow="delivery" speed="5.56" length="124.35" shape="70852.35,62133.97 70849.11,62152.52 70821.42,62174.97 70788.96,62212.37 70776.18,62229.09"/>
</edge>
例如,使用上面的示例,
我想与A,C和E的“边缘ID”改变所有边缘的“优先级”值;然后将结果保存到新文件。
感谢
我们不知道您用于处理XML的内容。你是否试图在XSLT中做到这一点? Java的? C#? C? PHP? Perl的? – 2015-02-06 17:05:16
XML只是一种数据格式。如果你想操纵它,你需要一种编程语言。 – Quentin 2015-02-06 17:05:24
对不起,我很乐意提供关于如何处理它的建议。我一直在尝试使用SED/AWK,XMLstartlet,但迄今为止进展甚微。 – BenP 2015-02-06 17:17:13