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

  • Home
  • SEARCH
  • 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 interested in selectively parsing Mediawiki XML markup to generate a customized HTML page
Of course an HTML page can be parsed using any number of python parsers,
Got this error when parsing my html page using XPATH.. i am also using
Can anyone recommend a C or Objective-C library for HTML parsing? It needs to
I am making an add-on for firefox and it loads a html page using
I have a script that parses an html page for all the links within
Parsing HTML / JS codes to get info using PHP. www.asos.com/Asos/Little-Asos-Union-Jack-T-Shirt/Prod/pgeproduct.aspx?iid=1273626 Take a look
I have a project where my input files used to be XML. I'm now
I am trying to pull a page for parsing information out of it using
I am using the XML parser libxml2 with wrapper as given on the page

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.