A
A
artshelom2018-01-23 16:13:02
React
artshelom, 2018-01-23 16:13:02

How to parse comments?

I need to parse the comments, I have an object:

class Comm{
private String name;
private String text;
private List<Comm> list;
}

The site sent something like:
<div class="com">
     <div class="name"> Имя</div>
     <div class="comment">комментарий</div>
           <div class="com">
              <div class="name"> Имя</div>
              <div class="comment">комментарий</div>
           </div>
</div>

It looks something like this:
5a6734aa78dca166734903.png(Taken from a peekaboo for an example, it does not apply to it.)
How and with what help can you parse to get a normal list??
(I did through .split("...") I got separate comments, without one entering the other)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2019-11-08
@alexey-m-ukolov

I understand that you can't pass a Date object.
You can transfer, you can not render. Accordingly, you need to bring to the line where you render.

A
Alexander Yudakov, 2018-01-23
@artshelom

It makes sense to look for an HTML parser and work with the DOM model.
If there is no HTML parser, you can try the XML parser - perhaps the piece of text we need will turn out to be XML-valid.
If you can't parse the text as XML, you'll have to write your own HTML parser. Instruction here: https://www.w3.org/html/wg/spec/parsing.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question