RAPP Platform  v0.6.0
RAPP Platform is a collection of ROS nodes and back-end processes that aim to deliver ready-to-use generic services to robots
 All Classes Namespaces Files Functions Variables Macros
rapp_html_parser.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- encode: utf-8 -*-
3 
4 #Copyright 2015 RAPP
5 
6 #Licensed under the Apache License, Version 2.0 (the "License");
7 #you may not use this file except in compliance with the License.
8 #You may obtain a copy of the License at
9 
10  #http://www.apache.org/licenses/LICENSE-2.0
11 
12 #Unless required by applicable law or agreed to in writing, software
13 #distributed under the License is distributed on an "AS IS" BASIS,
14 #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #See the License for the specific language governing permissions and
16 #limitations under the License.
17 
18 # Authors: Aris Thallas
19 # contact: aris.thallas@{iti.gr, gmail.com}
20 # Source: http://stackoverflow.com/a/925630
21 
22 from HTMLParser import HTMLParser
23 
24 
25 ## @class RappHTMLParser
26 # @brief Strips html from imput string
27 class RappHTMLParser(HTMLParser):
28 
29  ## @brief Constructor
30  def __init__(self):
31  HTMLParser.__init__(self)
32  self.reset()
33  self.fed = []
34 
35  ## @brief Handles the provided string
36  #
37  # @param input_str [string] The string containing html tags
38  def handle_data(self, input_str):
39  self.fed.append(input_str)
40 
41  ## @brief Returns the processed string
42  #
43  # @return final_str [string] The string without the html tags
44  def get_data(self):
45  final_str = ''.join(self.fed)
46  self.fed = []
47  return final_str.encode('utf-8')
def handle_data
Handles the provided string.
def get_data
Returns the processed string.
Strips html from imput string.