Есть ли библиотека или метод для ввода строки с html-кодом, и у которой есть возвращаемое значение другой String без этого HTML-кода, просто информация ???
Я смотрю библиотеки таких JTidy или HtmlParser, но я не знаю, как их использовать! Что-то проще ???Html code clearner
0
A
ответ
1
0
Это позволит удалить все HTML-теги из данной строки.
String html = //...
html = html.replaceAll("</?.*?>", "");
Но если вы хотите, чтобы экран-переделку, вы можете использовать XPath вытащить конкретные части HTML:
StreamSource source = new StreamSource(new StringReader(html));
DOMResult result = new DOMResult();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.transform(source, result);
Node root = result.getNode();
XPath xpath = XPathFactory.newInstance().newXPath();
String value = xpath.evaluate("/the/xpath/expression", root);
Смежные вопросы
- 1. Включите эту группу операторов if somthing clearner
- 2. HTML - Reducing html code redundancy
- 3. WebStorm autocomplete html code
- 4. jquery accordion html code
- 5. html code in Response.Write
- 6. indenting html code
- 7. html video code
- 8. Tinymce - insert html code
- 9. xmlhttp.responseText to html code
- 10. C# HTML Code Reader
- 11. javascript inserting html code
- 12. html code возвращает false
- 13. HTML Hovering Image Code
- 14. Minify PHP/html code
- 15. проверить recaptcha html code
- 16. JQuery .post() html code
- 17. Parsing html code with html error problem
- 18. django import html code in html page
- 19. JSP java code + html table
- 20. js variable on html code
- 21. Parsing html code with jQuery
- 22. Uncomment html code with javascript
- 23. HTML code strip regexp problem
- 24. SQL HTML Code Converter/Formatter
- 25. VB.NET download html code tables
- 26. Mix html и code asp.net
- 27. Удаленный javascript html code injection
- 28. html beginner code with notepad
- 29. preg_match from some html code
- 30. JSON to HTML Table Code
На каком языке? –
Пожалуйста, исправьте все опечатки. Трудно читать –
В java, извините. – Blanca