foreach ($files as $file) {
$counter++;
$rootNode = getXMLRootNode($file);
$rootNodeArray[$file] = $rootNode;
$tag = '/'.$rootNode;
$xml = simplexml_load_file($file);
$xmlNodeObject = $xml->xpath($tag);
}
$xmlNodeObject
存储xml文件的xpath。
更新
示例xml文件:
<Scenario>
<scenario_txt>
<audioText img_a="Anita_ss.jpg" img_b="Sarah_ss.jpg">
<text>
<![CDATA[Sarita is working on a high impact and confidential bid for the IT department. Her team is working on tight timelines. To overcome stress, Sarita takes a coffee break with Swati, a friend and colleague.]]>
</text>
</audioText>
</scenario_txt>
<branching>
<step stepID="0" stepType="conv" speakerName="a" audioFile="">
<audioText>
<text>
</text>
</audioText>
</step>
<step stepID="1" stepType="conv" speakerName="a" audioFile="step1.mp3" endScenario="false">
<audioText>
<text><![CDATA[Hi Sarita! How are you doing? You've been working really hard, lately. Is everything fine? ]]>
</text>
</audioText>
</step>
<step stepID="2" stepType="conv" speakerName="b" audioFile="step2.mp3">
<audioText>
<text><![CDATA[Hi Swati! Yeah, I've been deep into work preparing the proposal for the IT bid.]]>
</text>
</audioText>
</step>
<step stepID="3" stepType="conv" speakerName="a" audioFile="step3.mp3">
<audioText>
<text>
<![CDATA[So how is the proposal shaping up?]]>
</text>
</audioText>
</step>
</branching>
</Scenario>
我还有另一个与此相同的xml文件,但唯一的区别是它具有其他语言的可查看内容。我想要做的是映射这两个xml文件,以便我可以提取其他xml文件的可查看内容。