是否有一个xpath表达式返回两个关键字之间可用的文本?
例如,我们有一个如下所示的范围:
<b>Specialty: </b>PO<br/><b>Job Function: </b>RN<br/><br/><b>Qualifications/Duties</b><br/>Texas Health Presbyterian Allen is currently in search of a Registered Nurse to help meet the growing needs of our Day Surgery Department to work PRN in Day Surgery and also float to PACU.<br/><br/><b>Basic Qualifications:</b><br/><br/>*Graduate of an accredited school of nursing<br/>*Valid RN license in the state of Texas<br/>*BLS<br/>*ACLS<br/>*PALS within 6 months of hire<br/>*Minimum of 1 - 3 years experience as RN in Day Surgery, PACU, Outpatient Surgery, or ICU<br/>*Strong organizational skills and ability to function in a fast paced work environment<br/>*Ability to accept responsibility and show initiative to work without direct supervision<br/>*A high degree of confidentiality, positive interpersonal skills and ability to function in a fast-paced environment<br/><br/><b>Preferred Qualifications:</b><br/><br/>*Three years RN experience in Outpatient Surgery along with some ICU experience.<br/>*PALS<br/>*PACU , Endoscopy or Ambulatory setting<br/>*IV Conscious Sedation<br/><br/><b>Hours/Schedule:</b><br/><br/>*Variable<br/><br/>J2WPeriop<br/><br/><b>Entity Information</b><br/>Texas Health Presbyterian Hospital Allen is a 73-bed, acute-care hospital serving the northern Collin County area since 2000. Hospital services include women’s care, a Level II neonatal intensive care unit, orthopedics, pediatrics, wound care and sleep medicine. Texas Health Allen, a Pathway to Excellence® designated hospital by the American Nurses Credentialing Center, has more than 500 physicians on its medical staff practicing in more than 25 specialties. Texas Health Allen is a World Health Organization-designated "Baby-Friendly Hospital" and was the first hospital in Texas to receive the distinction. The hospital is a Level IV trauma center and an Accredited Chest Pain Center by the Society of Chest Pain Centers, which makes our facility intensely qualified to serve our community and your professional aspirations.<br/>
我想知道我们是否可以定义一个xpath来返回2个关键字之间可用的所有文本,并说出#34; Qualifications / Duties&#34;和&#34;实体信息&#34;
答案 0 :(得分:3)
是的,但是不要期望格式很好的输出,标记很乱,表达式可能需要稍微调整,以确定您是否还希望节点具有&#34;基本资格:&#34;或不(这个版本跳过它们,它只需要#34;裸体&#34;文本节点)。
//text()[preceding-sibling::*[text()='Qualifications/Duties'] and following-sibling::*[text()='Entity Information']]
这意味着:
//text()
SELECT EVERY TEXT NODE
[
THAT
preceding-sibling::*[text()='Qualifications/Duties']
IS PRECEDED BY A NODE WITH TEXT = "Qualifications/Duties"
and following-sibling::*[text()='Entity Information'
AND FOLLOWED BY A NODE WITH TEXT = "Entity Information"
]
示例的输出:
Texas Health Presbyterian Allen is currently in search of a Registered Nurse to help meet the growing needs of our Day Surgery Department to work PRN in Day Surgery and also float to PACU.
*Graduate of an accredited school of nursing
*Valid RN license in the state of Texas
*BLS
*ACLS
*PALS within 6 months of hire
*Minimum of 1 - 3 years experience as RN in Day Surgery, PACU, Outpatient Surgery, or ICU
*Strong organizational skills and ability to function in a fast paced work environment
*Ability to accept responsibility and show initiative to work without direct supervision
*A high degree of confidentiality, positive interpersonal skills and ability to function in a fast-paced environment
*Three years RN experience in Outpatient Surgery along with some ICU experience.
*PALS
*PACU , Endoscopy or Ambulatory setting
*IV Conscious Sedation
*Variable
J2WPeriop