LabWindows/CVI

CVIXMLNewElement

CVIXMLStatus CVIXMLNewElement (CVIXMLElement parentElement, int index, char *tag, CVIXMLElement *element);

Purpose

Creates a new element at the specified position with the given tag.

Parameters

Input
Name Type Description
parentElement CVIXMLElement The element handle must be a valid CVIXMLElement.
index int The zero-based index at which the element will be inserted under the parent element. Pass –1 to append the element to the end. The index refers to the position of XML elements and does not include other XML entities.
tag char * Tag of the new element. If it is NULL, an error is returned.

Certain tags are invalid XML. These include those with white space, non-alphanumeric characters, or numbers.
Output
Name Type Description
element CVIXMLElement On output, contains the handle to the element object created in this function. This handle must be discarded using the CVIXMLDiscardElement function.

Return Value

Name Type Description
status CVIXMLStatus Indicates whether the function was successful.

A zero indicates success.

You can call CVIXMLGetErrorString to obtain textual descriptions of error codes. Among the more commonly encountered errors are:

E_OUTOFMEMORY Out of memory.
E_INVALIDARG Invalid argument to a function.

Additional Information

Library: CVIXML

Include file: toolbox\cvixml.h

LabWindows/CVI compatibility: LabWindows/CVI 7.0 and later

Example

Refer to toolbox\XMLSample.cws for an example of using the CVIXMLNewElement function.