xml_ – XML handling

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

exception ncclient.xml_.XMLError
Bases: ncclient.NCClientError

Namespaces

ncclient.xml_.BASE_NS_1_0
Base NETCONF namespace
ncclient.xml_.TAILF_AAA_1_1
Namespace for Tail-f core data model
ncclient.xml_.TAILF_EXECD_1_1
Namespace for Tail-f execd data model
ncclient.xml_.CISCO_CPI_1_0
Namespace for Cisco data model
ncclient.xml_.JUNIPER_1_1
Namespace for Juniper 9.6R4. Tested with Junos 9.6R4+
ncclient.xml_.FLOWMON_1_0
Namespace for Flowmon data model
ncclient.xml_.register_namespace(prefix, 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.

Conversion

ncclient.xml_.to_xml(ele, encoding='UTF-8', pretty_print=False)
Convert and return the XML for an ele (Element) with specified encoding.
ncclient.xml_.to_ele(x)
Convert and return the Element for the XML document x. If x is already an Element simply returns that.
ncclient.xml_.parse_root(raw)
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