Java – which method in jsoup can return modified HTML?
                                        
                    •
                    Java                                    
                When I use jsoup to parse HTML files (stored locally) I modified some elements in the HTML file, so I want to save the modified HTML and replace the old?
Solution
You can write down anything
document.toString()
or
document.outerHtml()
To file, where does the file come from
Document document = Jsoup.connect("http://...").get();
// any document modifications...
like this:
BufferedWriter htmlWriter = 
     new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile),"UTF-8"));
htmlWriter.write(document.toString());
                
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        