KDE 4.7 PyKDE API Reference

- KDE's Python API

# Element Class Reference

`from PyKDE4.kparts import *`

Namespace: KParts.SelectorInterface

## Detailed Description

Returns all (in document order) elements in this fragment matching the given CSS selector query and querying method method.

Note that since the returned list is static snapshot, i.e. not live, it will not be updated when the document changes.

If the quering method specified by method is not supported or cannot be handled, then an empty list is returned.

See also:
  supportedQueryMethods

See also:
  QueryMethod

## Methods
| __init__ (self)
| __init__ (self, KParts.SelectorInterface.Element other)
QString | attribute (self, QString name, QString defaultValue=QString())
QStringList | attributeNames (self)
bool | hasAttribute (self, QString name)
bool | isNull (self)
| setAttribute (self, QString name, QString value)
| setTagName (self, QString tag)
| swap (self, KParts.SelectorInterface.Element other)
QString | tagName (self)

## Method Documentation

__init__ | ( |  | self ) |

Constructor

__init__ | ( | self, |
|  | KParts.SelectorInterface.Element | other
| ) |  |  |

Copy constructor

QString attribute | ( | self, |
|  | QString | name,
|  | QString | defaultValue=QString()
| ) |  |  |

Returns the attribute with the given name. If the attribute does not exist, defaultValue is returned.

QStringList attributeNames | ( |  | self ) |

Returns the list of attributes in this element.

bool hasAttribute | ( | self, |
|  | QString | name
| ) |  |  |

Returns true if the attribute with the given name exists.

bool isNull | ( |  | self ) |

Returns true if the element is null ; otherwise returns false.

setAttribute | ( | self, |
|  | QString | name,
|  | QString | value
| ) |  |  |

Adds an attribute with the given name and value. If an attribute with the same name exists, its value is replaced by value.

setTagName | ( | self, |
|  | QString | tag
| ) |  |  |

Sets the tag name of this element.

swap | ( | self, |
|  | KParts.SelectorInterface.Element | other
| ) |  |  |

Swaps the contents of other with the contents of this.

QString tagName | ( |  | self ) |

Returns the tag name of this element.