我创建了这个XML文件,但我不知道如何使用Lazarus Pascal读取它:
<?xml version="1.0"?>
<ship>
<name>Ship1</name>
<ship_hull_1 hp="100" cost="0" x="0" y="0" width="650" height="430" img="ship1_hull_bsc.png" />
<ship_hull_2 hp="1000" cost="600" x="0" y="0" width="650" height="430" img="ship1_hull_adv.png" />
<offsets>
<floor x="" y="" img=""></floor>
<cloak x="" y="" img=""></cloak>
</offsets>
<weaponMounts>
<mount id="" x="" y="" />
<mount id="" x="" y="" />
<mount id="" x="" y="" />
</weaponMounts>
<systems>
<reactor x="" y="" width="" height="" img="reactor.png">
<title>Reactor</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>30</cost>
<upgrade_cost>200</upgrade_cost>
<startPower>8</startPower>
<maxPower>20</maxPower>
<damage>0</damage>
</reactor>
<shields x="" y="" width="" height="" img="shields.png">
<title>Shields</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>60</cost>
<upgrade_cost>400</upgrade_cost>
<startPower>2</startPower>
<maxPower>8</maxPower>
<damage>0</damage>
</shields>
<oxygen_generator x="" y="" width="" height="" img="oxygen_generator.png">
<title>Oxygen Generator</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>20</cost>
<upgrade_cost>0</upgrade_cost>
<startPower>1</startPower>
<maxPower>3</maxPower>
<damage>0</damage>
</oxygen_generator>
<medbay x="" y="" width="" height="" img="medbay.png">
<title>Medical Station</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>40</cost>
<upgrade_cost>0</upgrade_cost>
<startPower>1</startPower>
<maxPower>3</maxPower>
<damage>0</damage>
</medbay>
<engines x="" y="" width="" height="" img="engines.png">
<title>Engines</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>20</cost>
<upgrade_cost>100</upgrade_cost>
<startPower>1</startPower>
<maxPower>8</maxPower>
<damage>0</damage>
</engines>
<clonebay x="" y="" width="" height="" img="clonebay.png">
<title>Clone Bay</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>50</cost>
<upgrade_cost>0</upgrade_cost>
<startPower>1</startPower>
<maxPower>3</maxPower>
<damage>0</damage>
</clonebay>
<cloak x="" y="" width="" height="" img="cloak.png">
<title>Cloaking</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>80</cost>
<upgrade_cost>0</upgrade_cost>
<startPower>1</startPower>
<maxPower>3</maxPower>
<damage>0</damage>
</cloak>
<weaponPC x="" y="" width="" height="" img="weapon_pc.png">
<title>Weapons Computer</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>75</cost>
<upgrade_cost>0</upgrade_cost>
<startPower>4</startPower>
<maxPower>12</maxPower>
<damage>0</damage>
</weaponPC>
</systems>
<subsystems>
<bridge x="" y="" width="" height="" img="bridge.png">
<title>Bridge</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>25</cost>
<upgrade_cost>0</upgrade_cost>
<damage>0</damage>
</bridge>
<sensors x="" y="" width="" height="" img="sensors.png">
<title>Sensors</title>
<desc></desc>
<type>1</type>
<tier>1</tier>
<cost>25</cost>
<upgrade_cost>0</upgrade_cost>
<damage>0</damage>
</sensors>
</subsystems>
<augments>
<augment_1 id=""/>
<augment_2 id=""/>
<augment_3 id=""/>
</augments>
</ship>
这里有一些方法可以独立于其内容读取XML并将其放入某些变量/数组中吗?如果XML发生变化,我的代码就不必改变。