【发布时间】:2012-05-05 22:39:11
【问题描述】:
在下面的xml结构中。我需要在 perl 中解析大小值的下限值和上限值,并且需要解析子标签中的 type 属性
<definition>
<attributes>
<children>
<attributes>
<children xsi:type="C_COMPLEX_OBJECT" >
<attributes>
<children>
<attributes>
<children><list><magnitude><lower>100</lower><upper>200</upper></magnitude></list></children>
<children><list><magnitude><lower>200</lower><upper>400</upper></magnitude></list></children>
<children><list><magnitude><lower>400</lower><upper>750</upper></magnitude></list></children>
<children><list><magnitude><lower>250</lower><upper>500</upper></magnitude></list></children>
<children><list><magnitude><lower>350</lower><upper>1000</upper></magnitude></list></children>
</attributes>
</children>
</attributes>
</children>
<children></children>
</attributes>
</children>
</attributes>
</definition>
【问题讨论】:
-
您可以使用 xPath 和 XML 解析来检索需求信息。如果您需要代码,请告诉我。你可以考虑使用 XML-Twig 和 libxml 进行 xml 解析。
-
你已经在上一篇文章中问过同样的问题,stackoverflow.com/questions/10295506/…
-
@Nikil 该问题的解决方案已解决,这是我们无法解决的另一个问题
标签: perl xml-parsing