# Input Output Management APIs for Python

The Input Output (I/O) element in Python is represented by the NaElement class. The I/O elements are similar to XML containers; they have a name-value pair. You can nest them arbitrarily within other I/O elements.

The I/O Management APIs are used to create I/O elements, and to set the value to or retrieve the value from the I/O elements.

This page contains information about the Input Output Management APIs for Python, including the description and syntax, and the input, input types, input description, and input return values.

## NaElement

### Prototype

NaElement(name, value = None)

### Description

Constructs a new I/O element with the given name and value.

Input | Description
name | The name of the element.
value | The value of the element to be created. This parameter is optional for the typedefs and the API names.

### Return value

The NaElement object

[top]

## NaElement.child_add

### Prototype

child_add(elt)

### Description

Adds the element elt to the children list of the current object of the type NaElement.

This can be used to add any input element, its typedef, and the elements of the typedef.

Input | Description
elt | The object of NaElement.

### Return value

void

[top]

## NaElement.child_add_string

### Prototype

child_add_string(name, value)

### Description

- Creates a new object of NaElement for the given name and value.

- Adds the new object as a child element to the current object of the type NaElement.

####

Input | Description
name | The name of the element.
value | The value to be assigned to the element.

### Return value

void

[top]

## NaElement.child_add_string_encrypted

### Prototype

child_add_string_encrypted(name, value, key = None)

### Description

- Creates a new object of NaElement for the given name.

- Encrypts value with the key and adds it to the new object.

- Adds the new object as a child element to the current object of type NaElement.

Both the client-side and the server-side should know the key to encrypt and decrypt value appropriately. You use the API child_get_string_encrypted to decrypt the value.

- The default key is used if the given key is None.

Input | Description
name | The name of the element.
value | The value to be assigned to the element.
key | The decryption key.

### Return value

void

[top]

## NaElement.set_content

### Prototype

set_content(content)

### Description

Sets the value of an element to content.

Input | Description
content | The value to be set to the current object.

### Return value

void

[top]

## NaElement.child_get

### Prototype

child_get(name)

### Description

Gets the child element named name from the current object.

You can nest the elements arbitrarily and the returned element can have other child elements.

Input | Description
name | The name of the child element.

### Return value

- The NaElement named name

- None if no child element is found

[top]

## NaElement.child_get_int

### Prototype

child_get_int(name)

### Description

Gets the child name from the current object and returns its value as an integer.

Input | Description
name | The name of the child element.

### Return value

- The integer value of the child element

- None if no child element is found

[top]

## NaElement.child_get_string

### Prototype

child_get_string(name)

### Description

Gets the child named name from the current object and returns its value.

Input | Description
name | The name of the child element.

### Return value

- The value of the child element

- None if no child element is found

[top]

## NaElement.child_get_string_encrypted

### Prototype

child_get_string_encrypted(name, key = None)

### Description

- Gets the child named name from the current object.

- Retrieves its value and decrypts it with the key key.

- The default key is used if the given key is None.

- Returns the decrypted value.

Input | Description
name | The name of the child element.
key | The decryption key.

### Return value

- The decrypted value of the child element

- None if no child element is found

[top]

## NaElement.children_get

### Prototype

children_get()

### Description

Returns the list of children as an array.

### Return value

The array of objects of the type NaElement

[top]

## NaElement.has_children

### Prototype

has_children()

### Description

Checks whether the current element has any child element.

### Return value

- 1 if the element has a child element

- 0 if no child element is found

[top]

## NaElement.sprintf

### Prototype

sprintf()

### Description

Prints the current element and its child elements recursively in XML format.

You can use this API for debugging purposes.

### Return value

The XML string containing the element and its child elements

[top]

## NaElement.parse_raw_xml

### Prototype

parse_raw_xml(xml_str)

### Description

Retrieves the API element from raw XML input.

Return value

Input | Description
xml_str | The raw XML input string.

### Return value

- The NaElement object containing the API input data on success

- The NaElement object containing the reason for failure

[top]

## NaElement.toEncodedString

### Prototype

toEncodedString()

### Description

Encodes a string containing special characters such as ampersand (&), less than (<), greater than (>), single quote ('), and double quote (").

This is mainly useful while passing string values containing special characters such as '&' and '<','>' to any core API. The special characters can result in unexpected parsing of XML data; therefore, they need to be handled appropriately.

### Return value

The encoded string in XML format

[top]