我在从XML文件中提取一些数据时遇到问题.我仍然有问题要弄清楚如果有多个但是输出应该看起来像不喜欢如何处理ph:Attributea .也许是if-then案例!?ph:Element(s_rel0 = 5, par_s_rel0 = 5)(s_rel0 = 5)(par_s_rel0 = 5)
第二个连接应该由flange_b而不是flange_a.我在搜索错误时却找不到它.
你知道我哪里弄错了吗??谢谢你的帮助.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<ph:Graphs xmlns:ph="http://www.merge.something.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ph:Graph name="mass_spring_mo">
<ph:Element id="0" type="Fixed">
<ph:Port id="1" type="port">
<ph:Attribute>
<ph:AttributeField name="type" value="string"/>
<ph:AttributeField name="name" value="type"/>
<ph:AttributeField name="value" value="flange"/>
</ph:Attribute>
</ph:Port>
</ph:Element>
<ph:Element id="2" type="Spring">
<ph:Attribute>
<ph:AttributeField name="type" value="int"/>
<ph:AttributeField name="name" value="s_rel0"/>
<ph:AttributeField name="value" value="5"/>
</ph:Attribute>
<ph:Attribute>
<ph:AttributeField name="type" value="int"/>
<ph:AttributeField name="name" value="par_s_rel0"/>
<ph:AttributeField name="value" value="5"/>
</ph:Attribute>
<ph:Port id="3" type="port">
<ph:Attribute>
<ph:AttributeField …Run Code Online (Sandbox Code Playgroud)