简体   繁体   English

HTML搜索验证Android

[英]Html search validation android

I have an android app with a search functionality. 我有一个具有搜索功能的android应用。 The search functionality loops through locally stored html files and appends a span with a background color to words that equal the imputed word, the same as if you press ctrl -f on your desktop. 搜索功能会循环遍历本地存储的html文件,并在等于被推定单词的单词后附加带有背景颜色的跨度,就像在桌面上按ctrl -f一样。 The problem i am having is that if the user searches for head, body, div, span etc it adds a span to the html tags. 我遇到的问题是,如果用户搜索头部,身体,div,跨度等,它将向HTML标记添加跨度。 My question. 我的问题。 Is there an android validation library that deals with this issue or do i need to make my own blacklist? 是否有一个可解决此问题的android验证库,或者我需要制作自己的黑名单? I am aware of Android form validator's libraries but but i am not sure that they are built for what i am looking for. 我知道Android表单验证程序的库,但是我不确定它们是否针对我要的内容而构建。

I've use jsoup before to strip out unwanted html tags. 我之前使用过jsoupjsoup不需要的html标签。 You could do this in order to make the html data more "searchable". 您可以这样做以使html数据更“可搜索”。 Also look at Android's Html.escapeHtml(CharSequence) that converts html into a String. 还要看看Android的Html.escapeHtml(CharSequence) ,它将HTML转换为String。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM