How to parse a String containing XML in Java and retrieve the value of the root node?

前端 未结 6 1000
小鲜肉
小鲜肉 2020-11-28 06:32

I have XML in the form of a String that contains

HELLO! 

How can I get the String \"Hello!\" from the XML?

6条回答
  •  伪装坚强ぢ
    2020-11-28 06:51

    There is doing XML reading right, or doing the dodgy just to get by. Doing it right would be using proper document parsing.

    Or... dodgy would be using custom text parsing with either wisuzu's response or using regular expressions with matchers.

提交回复
热议问题