How do I create an org.xml.sax.InputSource from a String?

后端 未结 2 1917
情话喂你
情话喂你 2021-02-03 17:52

I am following a guide, and it gives me the following code:

InputSource inputSource = new InputSource(new FileInputStream(new File(\"/path/to/xml/file.xml\"))));         


        
2条回答
  •  天涯浪人
    2021-02-03 18:08

    Use a StringReader instead of a FileInputStream.

    See the documentation for StringReader

    example:

    InputSource inputSource = new InputSource( new StringReader( myString ) );
    

提交回复
热议问题