TiXI  3.3.0
Attribute Handling Functions

Functions

DLL_EXPORT ReturnCode tixiGetTextAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName, char **text)
 Retrieves value of an element's attribute as a string. More...
 
DLL_EXPORT ReturnCode tixiGetIntegerAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName, int *number)
 Retrieves value of an element's attribute as an integer. More...
 
DLL_EXPORT ReturnCode tixiGetBooleanAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName, int *boolean)
 Retrieves value of an element's attribute as an boolean. More...
 
DLL_EXPORT ReturnCode tixiGetDoubleAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName, double *number)
 Retrieves value of an element's attribute as a floating point number. More...
 
DLL_EXPORT ReturnCode tixiAddTextAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName, const char *attributeValue)
 Adds an attribute with a string value to an element. More...
 
DLL_EXPORT ReturnCode tixiAddDoubleAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName, double number, const char *format)
 Adds an attribute with a floating point number value to an element. More...
 
DLL_EXPORT ReturnCode tixiAddIntegerAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName, int number, const char *format)
 Adds an attribute with an integer number value to an element. More...
 
DLL_EXPORT ReturnCode tixiRemoveAttribute (const TixiDocumentHandle handle, const char *elementPath, const char *attributeName)
 Removes an attribute. More...
 
DLL_EXPORT ReturnCode tixiGetNumberOfAttributes (const TixiDocumentHandle handle, const char *elementPath, int *nAttributes)
 Returns the number of attributes of a given node. More...
 
DLL_EXPORT ReturnCode tixiGetAttributeName (const TixiDocumentHandle handle, const char *elementPath, int attrIndex, char **attrName)
 Returns the name of an attribute beneath a given path. More...
 

Detailed Description

Functions to get the content of an element attribute as a string or a number, functions to create and manipulate attributes, and a function to remove attributes are described in this section.

Function Documentation

DLL_EXPORT ReturnCode tixiAddDoubleAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName,
double  number,
const char *  format 
)

Adds an attribute with a floating point number value to an element.

Adds an attribute with name attributeName and a floating point number value to an element specified by the elementPath expression. If the attribute already exists its previous value is replaced.

Fortran syntax:

tixi_add_double_attribute( integer handle, character*n element_path, character*n attribute_name, real number, character*n format, integer error )

Parameters
[in]handlefile handle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element. The name can also consist of a namespace prefix + ":" + the attribute name.
[in]numberfloating point value to be assigned to the attribute. If number is NULL an error is return and the attribute is not created.
[in]formatformat string used to convert number into a string. The format string usage is identical to format strings in printf. If format is NULL "%g" will be used to format the string.
Returns
  • SUCCESS if successfully retrieve the text content
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • NO_NUMBER if number is NULL
  • NO_ATTRIBUTE_NAME if attributeName is NULL
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • INVALID_NAMESPACE_PREFIX if the prefix in attributeName does not match to a namespace
DLL_EXPORT ReturnCode tixiAddIntegerAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName,
int  number,
const char *  format 
)

Adds an attribute with an integer number value to an element.

Adds an attribute with name attributeName and a integer number value to an element specified by the elementPath expression. If the attribute already exists its previous value is replaced.

Fortran syntax:

tixi_add_integer_attribute( integer handle, character*n element_path, character*n attribute_name, integer number, character*n format, integer error )

Parameters
[in]handlefile handle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element. The name can also consist of a namespace prefix + ":" + the attribute name.
[in]numberinteger value to be assigned to the attribute. If number is NULL an error is return and the attribute is not created.
[in]formatformat string used to convert number into a string. The format string usage is identical to format strings in printf. If format is NULL "%g" will be used to format the string.
Returns
  • SUCCESS if successfully retrieve the text content
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • NO_NUMBER if number is NULL
  • NO_ATTRIBUTE_NAME if attributeName is NULL
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • INVALID_NAMESPACE_PREFIX if the prefix in attributeName does not match to a namespace
DLL_EXPORT ReturnCode tixiAddTextAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName,
const char *  attributeValue 
)

Adds an attribute with a string value to an element.

Adds an attribute with name attributeName and value attributeValue to an element specified by the elementPath expression. If the attribute already exists its previous value is replaced by text.

Fortran syntax:

tixi_add_text_attribute( integer handle, character*n element_path, character*n attribute_name, character*n attribute_value, integer error )

Parameters
[in]handlefile handle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element. The name can also consist of a namespace prefix + ":" + the attribute name.
[in]attributeValuetext to assigned to the attribute. If attributeValue is NULL the empty string will be assigned to the attribute.
Returns
  • SUCCESS if successfully retrieve the text content
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • NO_ATTRIBUTE_NAME if attributeName is NULL
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • ALREADY_SAVED if element should be added to an already saved document
  • INVALID_XML_NAME if attributeName is not a valid XML-element name
  • INVALID_NAMESPACE_PREFIX if the prefix in attributeName does not match to a namespace
DLL_EXPORT ReturnCode tixiGetAttributeName ( const TixiDocumentHandle  handle,
const char *  elementPath,
int  attrIndex,
char **  attrName 
)

Returns the name of an attribute beneath a given path.

Fortran syntax:

tixi_get_attribute_name( integer handle, character*n element_path, int* index, character*n attr_name_array, integer error )

Parameters
[in]handlehandle as returned by tixiCreateDocument, tixiOpenDocumentRecursive or tixiOpenDocumentFromHTTP
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attrIndexnumber index of the attribute of the given path (counting from 1...tixiGetNumberOfAttributes)
[out]attrNameString containing the attribute name.
Returns
  • SUCCESS if a count is computed
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
DLL_EXPORT ReturnCode tixiGetBooleanAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName,
int *  boolean 
)

Retrieves value of an element's attribute as an boolean.

Returns the value of an attribute specified by attributeName of the element, specified by elementPath, in the document specified by handle. On successful return the memory used for value is allocated internally and must not be released by the user. The memory is deallocated when the document referred to by handle is closed.

Fortran syntax:

tixi_get_boolean_attribute( integer handle, character*n element_path, character*n attribute_name, integer boolean, integer error )

Parameters
[in]handlehandle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element. The name can also consist of a namespace prefix + ":" + the attribute name.
[out]booleanvalue of the specified attribute as an boolean value
Returns
  • SUCCESS if successfully retrieve the text content of a single element
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ATTRIBUTE_NOT_FOUND if the element has no attribute attributeName
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • INVALID_NAMESPACE_PREFIX if the prefix in attributeName does not match to a namespace
DLL_EXPORT ReturnCode tixiGetDoubleAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName,
double *  number 
)

Retrieves value of an element's attribute as a floating point number.

Returns the value of an attribute specified by attributeName of the element, specified by elementPath, in the document specified by handle. On successful return the memory used for value is allocated internally and must not be released by the user. The memory is deallocated when the document referred to by handle is closed.

Fortran syntax:

tixi_get_double_attribute( integer handle, character*n element_path, character*n attribute_name, real *number, integer error )

Parameters
[in]handlehandle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element. The name can also consist of a namespace prefix + ":" + the attribute name.
[out]numbervalue of the specified attribute as a floating point value
Returns
  • SUCCESS if successfully retrieve the text content of a single element
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ATTRIBUTE_NOT_FOUND if the element has no attribute attributeName
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • INVALID_NAMESPACE_PREFIX if the prefix in attributeName does not match to a namespace
DLL_EXPORT ReturnCode tixiGetIntegerAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName,
int *  number 
)

Retrieves value of an element's attribute as an integer.

Returns the value of an attribute specified by attributeName of the element, specified by elementPath, in the document specified by handle. On successful return the memory used for value is allocated internally and must not be released by the user. The memory is deallocated when the document referred to by handle is closed.

Fortran syntax:

tixi_get_integer_attribute( integer handle, character*n element_path, character*n attribute_name, integer *number, integer error )

Parameters
[in]handlehandle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element. The name can also consist of a namespace prefix + ":" + the attribute name.
[out]numbervalue of the specified attribute as an integer value
Returns
  • SUCCESS if successfully retrieve the text content of a single element
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ATTRIBUTE_NOT_FOUND if the element has no attribute attributeName
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • INVALID_NAMESPACE_PREFIX if the prefix in attributeName does not match to a namespace
DLL_EXPORT ReturnCode tixiGetNumberOfAttributes ( const TixiDocumentHandle  handle,
const char *  elementPath,
int *  nAttributes 
)

Returns the number of attributes of a given node.

Fortran syntax:

tixi_get_number_of_attributes( integer handle, character*n element_path, int* nattr, integer error )

Parameters
[in]handlehandle as returned by tixiCreateDocument, tixiOpenDocumentRecursive or tixiOpenDocumentFromHTTP
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[out]nAttributesNumber of attributes of a given node.
Returns
  • SUCCESS if a count is computed
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
DLL_EXPORT ReturnCode tixiGetTextAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName,
char **  text 
)

Retrieves value of an element's attribute as a string.

Returns the value of an attribute specified by attributeName of the element, specified by elementPath, in the document specified by handle. On successful return the memory used for value is allocated internally and must not be released by the user. The memory is deallocated when the document referred to by handle is closed.

Fortran syntax:

tixi_get_text_attribute( integer handle, character*n element_path, character*n attribute_name, character*n text, integer error )

Parameters
[in]handlehandle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element. The name can also consist of a namespace prefix + ":" + the attribute name.
[out]textvalue of the specified attribute as a string
Returns
  • SUCCESS if successfully retrieve the text content of a single element
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ATTRIBUTE_NOT_FOUND if the element has no attribute attributeName
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • INVALID_NAMESPACE_PREFIX if the prefix in attributeName does not match to a namespace
DLL_EXPORT ReturnCode tixiRemoveAttribute ( const TixiDocumentHandle  handle,
const char *  elementPath,
const char *  attributeName 
)

Removes an attribute.

Removes an attribute from an element. It is not an error to remove an non existing attribute.

Fortran syntax:

tixi_remove_attribute( integer handle, character*n element_path, character*n attribute_name, integer error )

Parameters
[in]handlefile handle as returned by tixiOpenDocument or tixiCreateDocument
[in]elementPathan XPath compliant path to an element in the document specified by handle (see section XPath Examples above).
[in]attributeNamename of the attribute to be added to the element
Returns
  • SUCCESS if successfully removed the attribute
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist
  • INVALID_XPATH if elementPath is not a well-formed XPath-expression
  • ELEMENT_NOT_FOUND if elementPath does not point to a node in the XML-document
  • NO_ATTRIBUTE_NAME if attributeName is NULL
  • ELEMENT_PATH_NOT_UNIQUE if elementPath resolves not to a single element but to a list of elements
  • ATTRIBUTE_NOT_FOUND, if the attribute could not be removed (i.e. if it does not exist)
  • INVALID_NAMESPACE_PREFIX, if the prefix in attributeName is invalid.

Generated Tue Mar 8 2022 14:11:54, by Martin Siggel DLR