Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3635176
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:52:16+00:00 2026-05-19T00:52:16+00:00

i am parsing an html page using XmlSlurper and HtmlCleaner, i have the GPathResult

  • 0

i am parsing an html page using XmlSlurper and HtmlCleaner, i have the GPathResult with

def page = new XmlSlurper(false,false).parseText(xml)

now i can use GPath to access the various nodes.

In the html i have a paragraph like this one:

<p>
 some_text1
 <br />
 some_text2
 <br />
 some_text3
 <br />

 ....
 some_textN


 <br />
</p>

the problem is that now i don’t know how to parse the text in the paragraph, i need to split the text inside the paragraph using the <br /> tag as separator and get a list like

[some_text, some_text1, some_text2, .... ,some_textN]

Having the node like

def node = page.body.some_path.p[0]

if i use text() i get all the text in the paragraph but without the <br /> so i cannot use the split method, and i don’t find a way to get the real html inside the paragraph from the node.

There is some way to parse this text?

Thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:52:16+00:00Added an answer on May 19, 2026 at 12:52 am

    I’ve had this problem in the past with GPath and couldn’t really find a good way to go about it either.

    What I ended up doing is a search/replace for <br /> in this case, replacing it with something that isn’t an XML element. Call it REPLACEMENT_SEPARATOR.

    That way, you could call node.text().split(REPLACEMENT_SEPARATOR) and get your array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have trouble parsing a HTML table using Nokogiri and Ruby. My HTML table
I am using HtmlAgility pack for parsing the html page. I am able to
I'm parsing an HTML file into a well-formed XML document using NekoHTML parser. However
I am parsing an html page using the Html Agility Pack . I am
Of course an HTML page can be parsed using any number of python parsers,
I have downloaded the following page using wget and saved it in f.html http://www.ebay.com/sch/i.html?_nkw=gruen&_in_kw=1&_ex_kw=sara+quartz+embassy+bob+robert+elephants+adidas&_sacat=See-All-Categories&_okw=gruen&_oexkw=sara+quartz+embassy+bob+robert+elephants+adidas&_adv=1&_udlo=&_udhi=&_LH_Time=1&_ftrt=903&_ftrv=24&_sabdlo=&_sabdhi=&_samilow=&_samihi=&_sadis=200&_fpos=Zip+code&_fsct=&LH_SALE_CURRENCY=0&_sop=12&_dmd=1&_ipg=50
Got this error when parsing my html page using XPATH.. i am also using
I am parsing an HTML page with DOM and XPath in PHP. I have
I have a console application which is parsing HTML documents via the WebRequest method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.