LibInsult - Python
Public Member Functions | Public Attributes | List of all members
insult.NotQuiteXml Class Reference

Parses strings with flat xml elements intermixed with text Only a very minimal subset of xml/sgml is supported. More...

Inheritance diagram for insult.NotQuiteXml:
[legend]
Collaboration diagram for insult.NotQuiteXml:
[legend]

Public Member Functions

def __init__ (self, contents=None, to_string=lambda x:"")
 
def element_by_id (self, id)
 Returns the element matching the given id. More...
 
def elements_by_tag_name (self, name)
 Returns a list of elements with the given tag name. More...
 
def elements_by_attribute (self, name, value)
 Returns a list of elements having the given attribute with the given value. More...
 
def __str__ (self)
 Converts the document to a string (using self.to_string for elements) More...
 
def __repr__ (self)
 
def parse_string (self, string)
 Parses a string into self.contents. More...
 

Public Attributes

 contents
 List mixing strings and NotQuiteXmlElement elements. More...
 
 elements_with_id
 Elements with an ID. More...
 
 to_string
 Functor to convert NotQuiteXmlElement objects to a string. More...
 

Detailed Description

Parses strings with flat xml elements intermixed with text Only a very minimal subset of xml/sgml is supported.

Definition at line 259 of file insult.py.

Constructor & Destructor Documentation

def insult.NotQuiteXml.__init__ (   self,
  contents = None,
  to_string = lambda x: "" 
)
Parameters
contentsNone or a sting to be parsed
to_stringA functor to convert NotQuiteXmlElement objects to a string

Definition at line 270 of file insult.py.

Member Function Documentation

def insult.NotQuiteXml.__repr__ (   self)

Definition at line 321 of file insult.py.

def insult.NotQuiteXml.__str__ (   self)

Converts the document to a string (using self.to_string for elements)

Definition at line 315 of file insult.py.

def insult.NotQuiteXml.element_by_id (   self,
  id 
)

Returns the element matching the given id.

Definition at line 286 of file insult.py.

def insult.NotQuiteXml.elements_by_attribute (   self,
  name,
  value 
)

Returns a list of elements having the given attribute with the given value.

Definition at line 303 of file insult.py.

def insult.NotQuiteXml.elements_by_tag_name (   self,
  name 
)

Returns a list of elements with the given tag name.

Definition at line 292 of file insult.py.

def insult.NotQuiteXml.parse_string (   self,
  string 
)

Parses a string into self.contents.

Definition at line 327 of file insult.py.

Member Data Documentation

insult.NotQuiteXml.contents
insult.NotQuiteXml.elements_with_id

Elements with an ID.

Definition at line 279 of file insult.py.

Referenced by insult.NotQuiteXml.element_by_id(), and insult.NotQuiteXml.parse_string().

insult.NotQuiteXml.to_string

Functor to convert NotQuiteXmlElement objects to a string.

Definition at line 281 of file insult.py.


The documentation for this class was generated from the following file: