java读取非闭合的XML文件数据

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<featureModel>
	<properties>
		<graphics key="legendautolayout" value="true"/>
		<graphics key="showshortnames" value="false"/>
		<graphics key="layout" value="horizontal"/>
		<graphics key="showcollapsedconstraints" value="true"/>
		<graphics key="legendhidden" value="false"/>
		<graphics key="layoutalgorithm" value="1"/>
	</properties>
	<struct>
		<and abstract="true" mandatory="true" name="abcd">
			<and name="Base">
				<and mandatory="true" name="a">
					<feature name="aa"/>
					<feature name="ab"/>
				</and>
				<or name="b">
					<feature name="ba"/>
					<feature name="bb"/>
					<feature name="bc"/>
				</or>
				<feature name="c"/>
				<feature name="d"/>
			</and>
		</and>
	</struct>
</featureModel>

怎么读取<struct>标签下所有<feature>标签的name属性

这篇博文里介绍了四种解析XML的方式,不知道能满足你的需求吗?

https://blog.csdn.net/m0_37499059/article/details/80505567

您好,我是问答小助手,你的问题已经有小伙伴为您解答了问题,您看下是否解决了您的问题。

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~