katnip.legos.xml module

XML (tag/type-length-value) legos. Simplify template creation of XML-based protocol.

class katnip.legos.xml.XmlAttribute(name, attribute, value, fuzz_attribute=False, fuzz_value=True)

Bases: kitty.model.low_level.container.Container

XML attribute field, consists of tag and value

__init__(name, attribute, value, fuzz_attribute=False, fuzz_value=True)
Parameters:
  • name – name of the block
  • attribute – attribute
  • value (str/unicode/int) – value of the attribute
  • fuzz_attribute – should we fuzz the attribute field (default: False)
  • fuzz_value – should we fuzz the value field (default: True)
class katnip.legos.xml.XmlElement(name, element_name, attributes=[], content=None, fuzz_name=True, fuzz_content=False, delimiter='')

Bases: kitty.model.low_level.container.Container

XML element field

__init__(name, element_name, attributes=[], content=None, fuzz_name=True, fuzz_content=False, delimiter='')
Parameters:
  • name – name of the field
  • element_name – element name
  • attributes (list) – list of attributes of this element (default: [])
  • content (str/unicode/int/[XmlElement]) – content of this element (default=None)
  • fuzz_name – should we fuzz the element name
  • fuzz_content – should we fuzz the content (n/a for XmlElement)