Convert a string to XML input stream in java

后端 未结 3 1103
Happy的楠姐
Happy的楠姐 2021-02-02 12:14

I\'m trying to generate a PDF document using FOP and Java.

I receive the XML as a string and not as a file.

How can I convert this XML string to an XML input str

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-02 12:46

    Use ByteArrayInputStream:

    String S = ...;
    InputStream source = new ByteArrayInputStream(S.getBytes(encoding))
    

提交回复
热议问题