我知道如何显示AbstractText
但是如何仅显示Label="Conclusion"
?
我试过了:
$abstract=$text->MedlineCitation->Article->Abstract->AbstractText['Conclusion'];
或
$abstract=(string) $text->MedlineCitation->Article->Abstract->AbstractText['Conclusion'];
XML:
<Abstract>
<AbstractText Label="Purpose" NlmCategory="UNASSIGNED">We report on an accelerated and effective way of assimilating a new leader into a team at a large academic dental school department.</AbstractText>
<AbstractText Label="Methods" NlmCategory="UNASSIGNED">At University of California, San Francisco (UCSF), a new Chair was recruited through a national search to lead its largest department in the School of Dentistry. Two months after arrival, the new Chair embarked on a process of leadership assimilation among her executive team, facilitated by a professional consultant. Within four weeks, team members participated in one-on-one interviews with the professional facilitator consultant and then completed the leadership assimilation questionnaire and returned it electronically to the facilitator. The facilitator then summarized all answers into themes and met with the team members without the Chair to debrief. Thereafter, the facilitator met with the Chair to discuss the major themes. Next, the Chair met with the team members in a facilitated session to discuss the results and negotiate a path forward.</AbstractText>
<AbstractText Label="Results" NlmCategory="UNASSIGNED">Approximately half of the feedback described the "how" of leadership: comments on communication, building relationships, building trust, and understanding UCSF history. The remaining half described the "what": comments on vision, strategy, and operations. Team members indicated that the first debriefing session was helpful to alleviate initial anxiety and to start building team spirit. The session with the Chair was perceived as open and fruitful in which team members were able to express their concerns and hopes for the Department, while the Chair showed commitment to the team and the communication process.</AbstractText>
<AbstractText Label="Conclusion" NlmCategory="UNASSIGNED">Leader assimilation allows teams to share their expectations and anxieties with the new leader early in the relationship in an open way, before new habits and beliefs are formed. Conversely, for the leader, it effectively and efficiently allows a window into the team members' thinking at a critical time period when otherwise first impressions occur. With a safe space created for open communication, the process allowed siloed individual division leaders to move toward a cohesive group while at the same time solidifying a commitment to the success of the new leader. </AbstractText>
</Abstract>
答案 0 :(得分:2)
您可以将XPath与路径AbstractText[@Label='Conclusion']
一起使用。
使用给定的XML,您可以执行以下操作:
$xml = '<Abstract>
<AbstractText Label="Purpose" NlmCategory="UNASSIGNED">We report on an accelerated and effective way of assimilating a new leader into a team at a large academic dental school department.</AbstractText>
<AbstractText Label="Methods" NlmCategory="UNASSIGNED">At University of California, San Francisco (UCSF), a new Chair was recruited through a national search to lead its largest department in the School of Dentistry. Two months after arrival, the new Chair embarked on a process of leadership assimilation among her executive team, facilitated by a professional consultant. Within four weeks, team members participated in one-on-one interviews with the professional facilitator consultant and then completed the leadership assimilation questionnaire and returned it electronically to the facilitator. The facilitator then summarized all answers into themes and met with the team members without the Chair to debrief. Thereafter, the facilitator met with the Chair to discuss the major themes. Next, the Chair met with the team members in a facilitated session to discuss the results and negotiate a path forward.</AbstractText>
<AbstractText Label="Results" NlmCategory="UNASSIGNED">Approximately half of the feedback described the "how" of leadership: comments on communication, building relationships, building trust, and understanding UCSF history. The remaining half described the "what": comments on vision, strategy, and operations. Team members indicated that the first debriefing session was helpful to alleviate initial anxiety and to start building team spirit. The session with the Chair was perceived as open and fruitful in which team members were able to express their concerns and hopes for the Department, while the Chair showed commitment to the team and the communication process.</AbstractText>
<AbstractText Label="Conclusion" NlmCategory="UNASSIGNED">Leader assimilation allows teams to share their expectations and anxieties with the new leader early in the relationship in an open way, before new habits and beliefs are formed. Conversely, for the leader, it effectively and efficiently allows a window into the team members\' thinking at a critical time period when otherwise first impressions occur. With a safe space created for open communication, the process allowed siloed individual division leaders to move toward a cohesive group while at the same time solidifying a commitment to the success of the new leader. </AbstractText>
</Abstract>';
$xml = simplexml_load_string($xml);
$result = $xml->xpath("//Abstract/AbstractText[@Label='Conclusion']");
echo (string)$result[0];
输出:
领导者同化允许团队分享他们的期望......