PHP XPath 查询:
$query = $xpathvar->query('//siri:Service');
foreach($query as $service) {
echo $service->textContent;
// Here I need to also echo this Vehicle's reg
}
目标 XML:
<Vehicle>
<CategoryA>
<Service>123123123</Service>
</CategoryA>
<CategoryB>
<SubCategoryA>
<Reg>ASDF_XC1</Reg>
</SubCategoryA>
</CategoryB>
</Vehicle>
// Imagine many more vehicles here each with a service and reg
我怎样才能改变 PHP 以便我也检索每个 Reg 呢?检索时服务和注册必须在同一车辆内(不是随机对)。