我想解析具有嵌套標籤集合的xml文件。我嘗試使用perl XML ::簡單的API來解析並且單個標籤值被完全解析,但無法解析嵌套標籤值。在perl中使用嵌套標籤解析
<archetype>
<original_language></original_language>
<description></description>
<archetype_id>
<definition></definition>
<ontology></ontology>
</archetype>
在定義部分
包含該項目的詳細信息
例如
<definition>
.
.
<node_id>at0004</node_id>
<attributes xsi:type="C_SINGLE_ATTRIBUTE">
<rm_attribute_name>value</rm_attribute_name>
+<existence> </existence>
<children xsi:type="C_DV_QUANTITY">
<rm_type_name>DV_QUANTITY</rm_type_name>
+<occurrences></occurrences>
<node_id/>
+<property></property>
<list>
<magnitude>
<lower_included>true</lower_included>
<upper_included>false</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>0.0</lower>
<upper>1000.0</upper>
</magnitude>
<units>mm[Hg]</units>
</list>
</children>
</attributes>
.
.
</definition>
從上面的例子文件格式我想喜歡
node_id - > at0004
magnitude -> lower -> 0.0
magnitude -> higher -> 1000.0
請指導的內容過濾器我過濾內容。
如果您包含當前的代碼,它可能會很有用。這樣我們就可以指出你出錯的地方,而不僅僅是給你完整的答案。 – 2012-04-24 10:36:14