xml_ – XML handling

Methods for creating, parsing, and dealing with XML and ElementTree objects.

exception ncclient.xml_.XMLError

Bases: ncclient.NCClientError



Base NETCONF namespace


Namespace for Tail-f core data model


Namespace for Tail-f execd data model


Namespace for Cisco data model


Namespace for Flowmon data model

ncclient.xml_.register_namespace(prefix, uri)

ElementTree’s namespace map determines the prefixes for namespace URI’s when serializing to XML. This method allows modifying this map to specify a prefix for a namespace URI.

ncclient.xml_.qualify(tag, ns='urn:ietf:params:xml:ns:netconf:base:1.0')

Qualify a tag name with a namespace, in ElementTree fashion i.e. {namespace}tagname.


ncclient.xml_.to_xml(ele, encoding='UTF-8')

Convert and return the XML for an ele (Element) with specified encoding.


Convert and return the Element for the XML document x. If x is already an Element simply returns that.


Efficiently parses the root element of a raw XML document, returning a tuple of its qualified name and attribute dictionary.

ncclient.xml_.validated_element(x, tags=None, attrs=None)

Checks if the root element of an XML document or Element meets the supplied criteria.

tags if specified is either a single allowable tag name or sequence of allowable alternatives

attrs if specified is a sequence of required attributes, each of which may be a sequence of several allowable alternatives

Raises XMLError if the requirements are not met.

Table Of Contents

Previous topic

capabilities – NETCONF Capabilities

Next topic

transport – Transport / Session layer

This Page