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 8402911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:12:11+00:00 2026-06-09T22:12:11+00:00

There was some XML parsed text that looked like this: 06:00 Vesti<br>07:15 Something Else<br>09:10

  • 0

There was some XML parsed text that looked like this:

06:00 Vesti<br>07:15 Something Else<br>09:10 Movie<a href="..."> ... <br>15:45 Something..

and there was a lot of it..

Well, I have done this:

String mim =ses.replaceAll("(?s)\\<.*?\\>", " \n");

there was no other way to show text nicely.
Now, after few showings, and some time, I need that same text separated into alone strings like this:

06:00 Vesti   

… or

07:15 Something Else

I’ve tried something like this, but it does not work:

char[] rast = description.toCharArray();
    int brojac = 0;
    for(int q=0; q<description.length(); q++){
        if(rast[q]=='\\' && rast[q+1]=='n' ) brojac++;
    }
    String[] niz = new String[brojac];

    int bf1=0;
    int bf2=0;
    int bf3=0;
    int oo=0;

    for(int q=0; q<description.length(); q++){
        if(rast[q]=='\\'&& rast[q+1]=='n'){
            bf3=bf1;
            bf1=q;

            String lol = description.substring(bf3, bf1);
            niz[oo]=lol;
            oo++;
        }
    }

I know that in description.substring(bf3,bf1) are not set as they should be but I think that this:

if(rast[q]=='\\' && rast[q+1]=='n) 

does not work that way.. is there any other solution?

Note. there is no other way to get that resource. , It must be through this.

  • 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-06-09T22:12:13+00:00Added an answer on June 9, 2026 at 10:12 pm

    Calling Html.fromHtml(String) will properly translate the <br> into \n.

    String html = "06:00 Vesti<br>07:15 Something Else<br>09:10 Movie<a href=\"...\"> ... <br>15:45 Something..";
    String str = Html.fromHtml(html).toString();
    String[] arr = str.split("\n");
    

    Then, just split it on a line basis – no need for regexps (which you shouldn’t be using to parse HTML in the first case).

    Edit: Turning everything into a bunch of Dates

    // Used to find the HH:mm, in case the input is wonky
    Pattern p = Pattern.compile("([0-2][0-9]:[0-5][0-9])");
    SimpleDateFormat fmt = new SimpleDateFormat("HH:mm");
    SortedMap<Date, String> programs = new TreeMap<Date, String>();
    for (String row : arr) {
        Matcher m = p.matcher(row);
        if (m.find()) {
            // We found a time in this row
            ParsePosition pp = new ParsePosition(m.start(0));
            Date when = fmt.parse(row, pp);
            String title = row.substring(pp.getIndex()).trim();
            programs.put(when, title);
        }
    }
    // Now programs contain the sorted list of programs. Unfortunately, since
    // SimpleDateFormat is stupid, they're all placed back in 1970 :-D.
    // This would give you an ordered printout of all programs *AFTER* 08:00
    Date filter = fmt.parse("08:00");
    SortedMap<Date, String> after0800 = programs.tailMap(filter);
    // Since this is a SortedMap, after0800.values() will return the program names in order.
    // You can also iterate over each entry like so:
    for (Map.Entry<Date,String> program : after0800.entrySet()) {
        // You can use the SimpleDateFormat to pretty-print the HH:mm again.
        System.out.println("When:" + fmt.format(program.getKey()));
        System.out.println("Title:" + program.getValue());            
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some XML files of this form: <?xml version=1.0 encoding=utf-8?> <?xml-stylesheet type=text/xsl href=biomirror.xsl?>
I have some XML code that looks like this <SEARCHRESULTS> <FUNCTION name=BarGraph> <PARAMETER name=numList></PARAMETER>
Is there some Eclipse tooling that would allow the comparison of XML files as
I am having some problems parsing this piece of XML using SimpleXML. There is
I'm working on some code that deals with parsing files (mainly XML, but there
I have some word templates(dot/dotx) files that contain xml tags along with plain text.
in a xml/non-xml File there may exist some XML Block that I need to
I have a php page that parses some xml text. That text comes from
I am using ElementTree to parse a XML file. In some fields, there will
I parse some values from an xml file. There is a @25-12-2010'T'23:40:00 string with

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.