UniRegensburg / unsere-app-fur-die-universitat-regensburg-bib-buddy

Bib Buddy - deine App für eine konzentrierte, offene Literaturarbeit!
0 stars 0 forks source link

Note output as text gives the entire xml element #84

Closed silvia-ivanova-github-rep closed 3 years ago

silvia-ivanova-github-rep commented 3 years ago

The method public String findTextById(Long id) {...} from the class NoteDao.java gives as output the entire xml element and not the note's text value. Is it supposed to give the entire xml element or only the text of the note?

Here is my console output: 2021-02-25 16:36:34.982 25571-25571/de.bibbuddy I/System.out: NoteText <p dir="ltr" style="margin-top:0; margin-bottom:0;">my text note</p>

Please take a look into this method.

LuisMossburger commented 3 years ago

As far as I can tell the best solution to this would be to implement a new method or a flag and use a regex to strip all tags?

silvia-ivanova-github-rep commented 3 years ago

The problem is not directly related to this method, because this method retrieves the stored note values from the database. The entire XML code for a current note is stored in the database. So, a solution only for this method does not give us a general solution.

There is why we need to take a look into the database.

LuisMossburger commented 3 years ago

As discussed in the team meeting, storing the text inside the database with tags is the desired behaviour, as only this will ensure proper formatting for the notes in the views. Suggestion: create separate method that strips all tags for export function. Will do this and let you review :)

LuisMossburger commented 3 years ago

I see that I have forgotten some of the possible elements in the regex - will add them & do another PR.

LuisMossburger commented 3 years ago

Hey @xSabrina, the elements I forgot here are the "align" buttons and respective markup (align left, center, right). When I try to test this, alignment is not saved. The next time I open the note there is no alignment. If I export the note, there is no markup as well. Why is that?

LuisMossburger commented 3 years ago

To write that down: We discussed in the team meeting that @xSabrina will have another look at this.