I am making a forum posting web application using Java and I want to know :
- What are the xml tags that should be parsed and removed when posting
like the
<script>
tag ? - Should i remove the tag and keep the content, or remove the tags with the content ?
- what are the regular express开发者_开发技巧ion to remove them ?
You want to allow users to use HTML to format their posts?
- Don't make a list of unsafe tags; make a list of safe tags and only accept those
- This is up to you
- The subject of parsing HTML/XML with regular expressions has been covered before
You can beter ask yourself, which tags to allow. Not which to remove.
You should just keep enough tags so users can express theirself without compromising the site. And maybe you should have a look at BB code, this is designed for this purpose.
精彩评论