2014-04-10 3 views
0

Есть ли выражение xpath, которое возвращает текст, доступный между двумя ключевыми словами?Извлечение текста 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 ключевых слов говорят «Квалификация/обязанность» и «Информация об объекте»

ответ

3

Да, но не ожидайте хорошо отформатированного вывода, разметка беспорядочна, и выражение может потребоваться для некоторых небольших настроек, хотите ли вы также узлы с «Основными квалификациями:» или нет (эта версия пропускает их, он принимает только «голые» текстовые узлы).

//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 
+0

Можете ли вы заглянуть в мою проблему и решить меня http://stackoverflow.com/questions/ 23189178/матч-ан-элемент-с-динамическим-атрибут-значение –

Смежные вопросы