Class: QgsXmlUtils

class qgis.core.QgsXmlUtils

Bases: sip.wrapper

Assorted helper methods for reading and writing chunks of XML

Methods

readMapUnits

Decodes a distance unit from a DOM element.

readRectangle

param element

readVariant

Read a QVariant from a QDomElement.

writeMapUnits

Encodes a distance unit to a DOM element.

writeRectangle

Encodes a rectangle to a DOM element.

writeVariant

Write a QVariant to a QDomElement.

readMapUnits(element: QDomElement)QgsUnitTypes.DistanceUnit

Decodes a distance unit from a DOM element.

Parameters

element (QDomElement) – DOM element to decode

Return type

QgsUnitTypes.DistanceUnit

Returns

distance units

See also

writeMapUnits()

readRectangle(element: QDomElement)QgsRectangle
Parameters

element (QDomElement) –

Return type

QgsRectangle

readVariant(element: QDomElement)Any

Read a QVariant from a QDomElement.

Parameters

element (QDomElement) –

Return type

Any

writeMapUnits(units: QgsUnitTypes.DistanceUnit, doc: QDomDocument)QDomElement

Encodes a distance unit to a DOM element.

Parameters
Return type

QDomElement

Returns

element containing encoded units

See also

readMapUnits()

writeRectangle(rect: QgsRectangle, doc: QDomDocument, elementName: str = '')QDomElement

Encodes a rectangle to a DOM element.

Parameters
  • rect (QgsRectangle) – rectangle to encode

  • doc (QDomDocument) – DOM document

  • elementName (str = '') – name of the DOM element

Return type

QDomElement

Returns

element containing encoded rectangle

writeVariant(value: Any, doc: QDomDocument)QDomElement

Write a QVariant to a QDomElement.

Supported types are

Parameters
  • value (Any) –

  • doc (QDomDocument) –

Return type

QDomElement