我已经在我的Android应用程序的String.xml上构建了这个:
<string-array name="alerts_value_set">
<AlertValueSet>
<valueSetOid>2.16.840.1.113883.1.11.20.4</valueSetOid>
<code>106190000</code>
<codeSystem>2.16.840.1.113883.6.96</codeSystem>
<displayName>Allergy</displayName>
<codeSystemName>SNOMED CT</codeSystemName>
</AlertValueSet>
<AlertValueSet>
<valueSetOid>2.16.840.1.113883.1.11.20.4</valueSetOid>
<code>281647001</code>
<codeSystem>2.16.840.1.113883.6.96</codeSystem>
<displayName>Adverse Reaction</displayName>
<codeSystemName>SNOMED CT</codeSystemName>
</AlertValueSet>
<AlertValueSet>
<valueSetOid>2.16.840.1.113883.1.11.20.4</valueSetOid>
<code>282100009</code>
<codeSystem>2.16.840.1.113883.6.96</codeSystem>
<displayName>Adverse reaction to substance</displayName>
<codeSystemName>SNOMED CT</codeSystemName>
</AlertValueSet>
<AlertValueSet>
<valueSetOid>2.16.840.1.113883.1.11.20.4</valueSetOid>
<code>160244002</code>
<codeSystem>2.16.840.1.113883.6.96</codeSystem>
<displayName>No known allergies</displayName>
<codeSystemName>SNOMED CT</codeSystemName>
</AlertValueSet>
</string-array>
现在,有一种方法可以通过代码以编程方式获取此列表吗?
我也创建了这个类(whit getter和setter):
public class AlertValueSet {
String valueSetOid;
String code;
String codeSystem;
String displayName;
String codeSystemName;
}
答案 0 :(得分:0)
尝试使用代码从xml文件中获取对象列表
List<AlertValueSet> alertvalueset = null;
try {
XMLPullParserHandler parser = new XMLPullParserHandler();
alertvalueset = parser.parse(getAssets().open("string.xml"));
} catch (IOException e) {
e.printStackTrace();
}