xml_ – XML handling

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

exception ncclient.xml_.XMLError

Bases: ncclient.NCClientError


ncclient.xml_.BASE_NS_1_0 = 'urn:ietf:params:xml:ns:netconf:base:1.0'

Base NETCONF namespace

ncclient.xml_.TAILF_AAA_1_1 = 'http://tail-f.com/ns/aaa/1.1'

Namespace for Tail-f core data model

ncclient.xml_.TAILF_EXECD_1_1 = 'http://tail-f.com/ns/execd/1.1'

Namespace for Tail-f execd data model

ncclient.xml_.CISCO_CPI_1_0 = 'http://www.cisco.com/cpi_10/schema'

Namespace for Cisco data model

ncclient.xml_.JUNIPER_1_1 = 'http://xml.juniper.net/xnm/1.1/xnm'

Namespace for Juniper data model (tested with 9.6+)

ncclient.xml_.FLOWMON_1_0 = 'http://www.liberouter.org/ns/netopeer/flowmon/1.0'

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