我想从同一XPATH的多个实例中获取文本值,这些实例出现在XML文档的不同部分中。例如:
<explanation>
<NodeExplanations>
<IDAfterSkipProcessing>/Temporary/EIC/EarnedIncomeWorksheetPP/SpouseLongSESelfEmploymentTaxAmtNotBlank</IDAfterSkipProcessing>
<NodeExplanation>
<Title>Spouse's self-employment tax</Title>
<Phrase>
<Text>your spouse does not have self-employment tax</Text>
</Phrase>
<Question>
<Text>Why doesn't my spouse have self-employment tax?</Text>
</Question>
<ExplanationText>
<Text>We can't get any more details on </Text>
<NodeName>
<Text>your spouse does not have self-employment tax</Text>
</NodeName>
<Text> right now.</Text>
</ExplanationText>
</NodeExplanation>
<NodeExplanations>
</explanation>
我想解析出来:
1. "We can't get any more details on "
2. "your spouse does not have self-employment tax"
3. " right now."
如何从提到的XPATH中获取文本值?我想避免使用DOM