parse an xml string in java?

后端 未结 4 1861
情书的邮戳
情书的邮戳 2020-12-06 00:30

how do you parse xml stored in a java string object?

Java\'s XMLReader only parses XML documents from a URI or inputstream. is it not possible to parse from a Strin

4条回答
  •  自闭症患者
    2020-12-06 00:36

    The SAXParser can read an InputSource.

    An InputSource can take a Reader in its constructor

    So, you can put parse XML string via a StringReader

    new InputSource(new StringReader("... your xml here....")));
    

提交回复
热议问题