For example, I have such a structure

<Element1>Text1</Element1> <Element2>Text2</Element2> 

So how can I raise the second element so that it is above the first one?

  • Well ... Create new items in the right order based on the available ones. Delete the old ones, replace the new ones instead. I won't help with the code - I don't remember how it is there, but it will work this way. - Yuriy SPb
  • in general, it’s strange, as for me, to use JSOUP to edit HTML ... Write better, why do you need it, I think there is an easier way ... - Vladyslav Matviienko
  • @metalurgus I save the files via xml, and for reading and editing I use jsoup, I have an array that I save through the cycle in xml, sometimes I have to edit it, for example, change the name, then I find this element through jsoup and delete it and add it element with a new name, and overwrite xml. But this very element is added at the bottom of the list, and I would like it to remain in the same place as the old element. I hope normally explained: D - Andrew
  • @Fasd, changing the name of the tag is simple, you do not need to delete anything: element.tagName("newTagName"); - Yuriy SPb
  • You can also add an element to the front / rear of the specified Element.prependElement(String tag) and Element.appendElement(String tag) respectively - YuriyPb

0