Tuesday, 15 May 2012

html - xpath for extracting text from self and child node -



html - xpath for extracting text from self and child node -

here situation

i want select "buy 2 hills feline maint lite 10kg , save farther £4.00!" bellow html

note: using xpath 1.0

<div> <a> <b> <u>multi-buy:</u> </b> <br/> purchase <b>2</b> hills feline maint lite 10kg , <b> <font color="#cc0000">save farther £4.00!</font> </b> <br/> <i>simply add together 2 basket.</i> </a> </div>

here effort

//div/a/text()

by using missing kid node text

/div/a//text()

if utilize getting text

since html not structured in way facilitate extracting in clean way, propose following:

/div/a//text()[not(. = 'multi-buy:' or contains(., 'to basket'))]

html xpath domxpath

No comments:

Post a Comment