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

后端 未结 2 1914
情话喂你
情话喂你 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:03

    InputSource inputSource = new InputSource(new java.io.StringReader(string)); if it is org.xml.sax.InputSource.

    0 讨论(0)
  • 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 ) );
    
    0 讨论(0)
提交回复
热议问题