XML
<Galaxy> <name>Milky Way</name> <CelestialObject name="Earth" type="planet"/> <CelestialObject name="Sun" type="star"/> </Galaxy>
路径
/Galaxy/*[contains(@name,'Ear')]
要么
//*[contains(@name,'Ear')]
双引号也可以用来代替单引号:
/Galaxy/*[contains(@name, "Ear")]
输出
<CelestialObject name="Earth" type="planet" />