yumapro
24.10-1
YumaPro SDK
|
XML Write Utilities. More...
Data Structures | |
struct | xml_attr_t |
represents one attribute More... | |
struct | xml_node_t |
gather node data into a simple struct. More... | |
Typedefs | |
typedef dlq_hdr_t | xml_attrs_t |
queue of xml_attr_t | |
Enumerations | |
enum | xml_nodetyp_t { XML_NT_NONE , XML_NT_EMPTY , XML_NT_START , XML_NT_END , XML_NT_STRING } |
only 4 types of nodes returned More... | |
Functions | |
boolean | wr_util_check_start_depth (xml_msg_hdr_t *msg, obj_template_t *obj) |
Check if the current val value for All in One mode is the value that we should start the write for. More... | |
boolean | wr_util_fit_on_line (ses_cb_t *scb, const val_value_t *val) |
Check if the specified value will fit on the current line or if a newline is needed first. More... | |
boolean | wr_util_need_default_attr (xml_msg_hdr_t *msg) |
Check if the default attr is needed. More... | |
boolean | wr_util_need_origin_attr (xml_msg_hdr_t *msg) |
Check if the origin attr is needed. More... | |
boolean | wr_util_need_skip_any (val_value_t *out) |
Check if the output data is really an anyxml or anydata or a generic container. More... | |
xml_node_t * | xml_new_node (void) |
Malloc and init a new xml_node_t struct. More... | |
void | xml_init_node (xml_node_t *node) |
Init an xml_node_t struct. More... | |
void | xml_free_node (xml_node_t *node) |
Free an xml_node_t struct. More... | |
void | xml_clean_node (xml_node_t *node) |
Clean an xml_node_t struct. More... | |
status_t | xml_get_reader_from_buff (const xmlChar *buff, xmlTextReaderPtr *reader) |
Get a new xmlTextReader for parsing a debug test file. More... | |
status_t | xml_get_reader_from_filespec (const char *filespec, xmlTextReaderPtr *reader) |
Get a new xmlTextReader for parsing a debug test file. More... | |
status_t | xml_get_reader_for_session (xmlInputReadCallback readfn, xmlInputCloseCallback closefn, void *context, xmlTextReaderPtr *reader) |
Get a new xmlTextReader for parsing the input of a NETCONF session. More... | |
status_t | xml_reset_reader_for_session (xmlInputReadCallback readfn, xmlInputCloseCallback closefn, void *context, xmlTextReaderPtr reader) |
Reset the xmlTextReader for parsing the input of a NETCONF session. More... | |
void | xml_free_reader (xmlTextReaderPtr reader) |
Free the previously allocated xmlTextReader. More... | |
const char * | xml_get_node_name (int nodeval) |
get the node type according to the xmlElementType enum list in /usr/include/libxml/libxml/tree.h More... | |
boolean | xml_advance_reader (xmlTextReaderPtr reader) |
Advance to the next node in the specified reader. More... | |
status_t | xml_node_match (const xml_node_t *node, xmlns_id_t nsid, const xmlChar *elname, xml_nodetyp_t nodetyp) |
check if a specific node is the proper owner, name, and type More... | |
status_t | xml_endnode_match (const xml_node_t *startnode, const xml_node_t *endnode) |
check if a specific node is the proper endnode match for a given startnode More... | |
boolean | xml_docdone (xmlTextReaderPtr reader) |
check if the input is completed for a given PDU More... | |
void | xml_dump_node (const xml_node_t *node, log_debug_t lvl) |
Debug function to printf xml_node_t contents. More... | |
void | xml_init_attrs (xml_attrs_t *attrs) |
initialize an xml_attrs_t variable More... | |
xml_attr_t * | xml_new_attr (void) |
malloc and init an attribute struct More... | |
void | xml_free_attr (xml_attr_t *attr) |
free an attribute More... | |
status_t | xml_add_attr (xml_attrs_t *attrs, xmlns_id_t ns_id, const xmlChar *attr_name, const xmlChar *attr_val) |
add an attribute to an attribute list More... | |
xml_attr_t * | xml_add_qattr (xml_attrs_t *attrs, xmlns_id_t ns_id, const xmlChar *attr_qname, uint32 plen, const xmlChar *attr_val, status_t *res) |
add a qualified attribute to an attribute list with a prefix More... | |
status_t | xml_add_xmlns_attr (xml_attrs_t *attrs, xmlns_id_t ns_id, const xmlChar *pfix) |
add an xmlns decl to the attribute Queue More... | |
status_t | xml_add_xmlns_attr_string (xml_attrs_t *attrs, const xmlChar *ns, const xmlChar *pfix) |
add an xmlns decl to the attribute Queue More... | |
status_t | xml_add_inv_xmlns_attr (xml_attrs_t *attrs, xmlns_id_t ns_id, const xmlChar *pfix, const xmlChar *nsval) |
add an xmlns decl to the attribute Queue for an INVALID namespace. More... | |
xml_attr_t * | xml_first_attr (xml_attrs_t *attrs) |
get the first attribute in the list More... | |
xml_attr_t * | xml_get_first_attr (const xml_node_t *node) |
get the first attribute in the attrs list, from an xml_node_t param More... | |
xml_attr_t * | xml_next_attr (xml_attr_t *attr) |
get the next attribute in the list More... | |
void | xml_clean_attrs (xml_attrs_t *attrs) |
clean an xml_attrs_t variable More... | |
void | xml_move_attrs (xml_attrs_t *src_attrs, xml_attrs_t *dest_attrs) |
Move all the attrs from the src to the dest. More... | |
xml_attr_t * | xml_find_attr (xml_node_t *node, xmlns_id_t nsid, const xmlChar *attrname) |
Find an attribute. More... | |
xml_attr_t * | xml_find_attr_q (xml_attrs_t *attrs, xmlns_id_t nsid, const xmlChar *attrname) |
Find an attribute in a Q. More... | |
const xml_attr_t * | xml_find_ro_attr (const xml_node_t *node, xmlns_id_t nsid, const xmlChar *attrname) |
Find a read-only attribute. More... | |
uint32 | xml_strlen (const xmlChar *str) |
Get the String len for xmlChar. More... | |
uint32 | xml_strlen_sp (const xmlChar *str, boolean *sp) |
get length and check if any whitespace at the same time More... | |
uint32 | xml_strcpy (xmlChar *copyTo, const xmlChar *copyFrom) |
String copy for xmlChar. More... | |
uint32 | xml_strncpy (xmlChar *copyTo, const xmlChar *copyFrom, uint32 maxlen) |
String copy for xmlChar – checks for buffer overflow. More... | |
xmlChar * | xml_strdup (const xmlChar *copyFrom) |
String duplicate for xmlChar. More... | |
xmlChar * | xml_strcat (xmlChar *appendTo, const xmlChar *appendFrom) |
String concatenate for xmlChar. More... | |
xmlChar * | xml_strncat (xmlChar *appendTo, const xmlChar *appendFrom, uint32 maxlen) |
String concatenate for at most maxlen xmlChars. More... | |
xmlChar * | xml_strndup (const xmlChar *copyFrom, uint32 maxlen) |
String duplicate for max N xmlChars. More... | |
char * | xml_ch_strndup (const char *copyFrom, uint32 maxlen) |
String duplicate for max N chars. More... | |
int | xml_strcmp (const xmlChar *s1, const xmlChar *s2) |
String compare for xmlChar. More... | |
int | xml_stricmp (const xmlChar *s1, const xmlChar *s2) |
Case insensitive string compare for xmlChar. More... | |
int | xml_strncmp (const xmlChar *s1, const xmlChar *s2, uint32 maxlen) |
String compare for xmlChar for at most 'maxlen' xmlChars. More... | |
int | xml_strnicmp (const xmlChar *s1, const xmlChar *s2, uint32 maxlen) |
Case insensitive string compare for xmlChar for at most 'maxlen' xmlChars. More... | |
boolean | xml_isspace (uint32 ch) |
Check if an xmlChar is a space char. More... | |
boolean | xml_isspace_str (const xmlChar *str) |
Check if an xmlChar string is all whitespace chars. More... | |
int | xml_strcmp_nosp (const xmlChar *s1, const xmlChar *s2) |
String compare for xmlChar for 2 strings, but ignoring whitespace differences. More... | |
int | xml_strcmp_nosp2 (const xmlChar *s1, const xmlChar *s2) |
String compare for xmlChar for 2 strings, but completely ignoring whitespace differences. More... | |
xmlChar * | xml_copy_clean_string (const xmlChar *str) |
Get a malloced string contained the converted string from the input. More... | |
xmlChar | xml_convert_char_entity (const xmlChar *str, uint32 *used) |
Convert an XML character entity into a single xmlChar. More... | |
status_t | xml_check_ns (xmlTextReaderPtr reader, const xmlChar *elname, xmlns_id_t *id, uint32 *pfix_len, const xmlChar **badns) |
Check a namespace during parsing. More... | |
void | xml_check_qname_content (xmlTextReaderPtr reader, xml_node_t *node) |
Check if the string node content is a likely QName. More... | |
status_t | xml_get_namespace_id (xmlTextReaderPtr reader, const xmlChar *prefix, uint32 prefixlen, boolean register_missing, xmlns_id_t *retnsid) |
Get the namespace for the specified prefix (may be NULL) Use the current XML reader context to resolve the prefix. More... | |
status_t | xml_consume_node (xmlTextReaderPtr reader, xml_node_t *xmlnode, boolean nserr, boolean adv) |
parse function for YIN input More... | |
xmlChar * | xml_trim_string (xmlChar *str) |
trim leading and trailing whitespace inline in the same buffer More... | |
XML Write Utilities.
General Utilities that simplify usage of the libxml2 functions.
Contains many functions to interface to libxml2
- xml_node_t allocation - xml_new_node - xml_init_node - xml_free_node - xml_clean_node - XmlReader utilities - xml_get_reader_from_buff - xml_get_reader_from_filespec (parse debug test documents) - xml_get_reader_for_session - xml_reset_reader_for_session - xml_free_reader - xml_get_node_name (xmlparser enumeration for node type) - xml_advance_reader - xml_consume_node - xml_consume_start_node - xml_consume_end_node - xml_node_match - xml_endnode_match - xml_docdone - xml_dump_node (debug printf) - XML Attribute utilities - xml_init_attrs - xml_add_attr - xml_first_attr - xml_next_attr - xml_find_attr - xml_clean_attrs - XmlChar string utilites - xml_strlen - xml_strcpy - xml_strncpy - xml_strdup - xml_strcat - xml_strncat - xml_strndup - xml_ch_strndup - xml_strcmp - xml_strncmp - xml_isspace - xml_isspace_str - xml_copy_clean_string - xml_convert_char_entity
enum xml_nodetyp_t |
boolean wr_util_check_start_depth | ( | xml_msg_hdr_t * | msg, |
obj_template_t * | obj | ||
) |
Check if the current val value for All in One mode is the value that we should start the write for.
msg | msg to check start_level |
obj | object to check against |
boolean wr_util_fit_on_line | ( | ses_cb_t * | scb, |
const val_value_t * | val | ||
) |
Check if the specified value will fit on the current line or if a newline is needed first.
scb | session control block |
val | value to check |
boolean wr_util_need_default_attr | ( | xml_msg_hdr_t * | msg | ) |
Check if the default attr is needed.
msg | message header to use |
boolean wr_util_need_origin_attr | ( | xml_msg_hdr_t * | msg | ) |
Check if the origin attr is needed.
msg | message header to use |
boolean wr_util_need_skip_any | ( | val_value_t * | out | ) |
Check if the output data is really an anyxml or anydata or a generic container.
In this case there are no child nodes in the schema tree. The contents of the node need special processing to output the child data nodes ignoring any schema tree
out | == output node to check |
status_t xml_add_attr | ( | xml_attrs_t * | attrs, |
xmlns_id_t | ns_id, | ||
const xmlChar * | attr_name, | ||
const xmlChar * | attr_val | ||
) |
add an attribute to an attribute list
attrs | attribute queue to add attr into |
ns_id | namespace ID (use XMLNS_NONE if no prefix desired) |
attr_name | attribute name string |
attr_val | attribute value string |
status_t xml_add_inv_xmlns_attr | ( | xml_attrs_t * | attrs, |
xmlns_id_t | ns_id, | ||
const xmlChar * | pfix, | ||
const xmlChar * | nsval | ||
) |
add an xmlns decl to the attribute Queue for an INVALID namespace.
This is needed for the error-info element within the rpc-error report
attrs | attribute queue to add to |
ns_id | namespace ID of the xmlns target |
pfix | namespace prefix string assigned NULL for default namespace |
nsval | namespace URI value of invalid namespace |
xml_attr_t * xml_add_qattr | ( | xml_attrs_t * | attrs, |
xmlns_id_t | ns_id, | ||
const xmlChar * | attr_qname, | ||
uint32 | plen, | ||
const xmlChar * | attr_val, | ||
status_t * | res | ||
) |
add a qualified attribute to an attribute list with a prefix
INPUTS:
attrs | attribute queue to add attr into | |
ns_id | namespace ID (use XMLNS_NONE if no prefix desired) | |
attr_qname | attribute name string | |
plen | attribute prefix length | |
attr_val | attribute value string | |
[out] | res | address of return status
|
status_t xml_add_xmlns_attr | ( | xml_attrs_t * | attrs, |
xmlns_id_t | ns_id, | ||
const xmlChar * | pfix | ||
) |
add an xmlns decl to the attribute Queue
attrs | attribute queue to add to |
ns_id | namespace ID of the xmlns target |
pfix | namespace prefix string assigned NULL for default namespace |
status_t xml_add_xmlns_attr_string | ( | xml_attrs_t * | attrs, |
const xmlChar * | ns, | ||
const xmlChar * | pfix | ||
) |
add an xmlns decl to the attribute Queue
attrs | attribute queue to add to |
ns | namespace URI string of the xmlns target |
pfix | namespace prefix string assigned NULL for default namespace |
boolean xml_advance_reader | ( | xmlTextReaderPtr | reader | ) |
Advance to the next node in the specified reader.
reader | XmlReader already initialized from File, Memory, or whatever |
char * xml_ch_strndup | ( | const char * | copyFrom, |
uint32 | maxlen | ||
) |
String duplicate for max N chars.
copyFrom | zero-terminated char string to copy from |
maxlen | max number of non-zero chars to copy |
status_t xml_check_ns | ( | xmlTextReaderPtr | reader, |
const xmlChar * | elname, | ||
xmlns_id_t * | id, | ||
uint32 * | pfix_len, | ||
const xmlChar ** | badns | ||
) |
Check a namespace during parsing.
Used by internal parser only
reader | XmlReader already initialized from File, Memory, or whatever pfs->ns_id == element namespace to check | |
elname | element name to check | |
[out] | id | address of return id param
|
[out] | pfix_len | address of return prefix length
|
[out] | badns | address of return bad namespace string
|
void xml_check_qname_content | ( | xmlTextReaderPtr | reader, |
xml_node_t * | node | ||
) |
Check if the string node content is a likely QName.
If so, then get the namespace URI for the prefix, look it up in def_reg, and store the NSID in the node
reader | reader to use |
node | current string node in progress |
void xml_clean_attrs | ( | xml_attrs_t * | attrs | ) |
clean an xml_attrs_t variable
attrs | attribute queue to clean |
void xml_clean_node | ( | xml_node_t * | node | ) |
Clean an xml_node_t struct.
node | pointer to node to clean |
status_t xml_consume_node | ( | xmlTextReaderPtr | reader, |
xml_node_t * | xmlnode, | ||
boolean | nserr, | ||
boolean | adv | ||
) |
parse function for YIN input
reader | xmlTextReader to use | |
[in,out] | xmlnode | address of node pointer to use
|
nserr | TRUE if bad namespace should be checked; FALSE if not | |
adv | TRUE if advance reader FALSE if no advance (reget current node) |
xmlChar xml_convert_char_entity | ( | const xmlChar * | str, |
uint32 * | used | ||
) |
Convert an XML character entity into a single xmlChar.
str | string pointing to start of char entity | |
[out] | used | address of number of chars consumed
|
xmlChar * xml_copy_clean_string | ( | const xmlChar * | str | ) |
Get a malloced string contained the converted string from the input.
Get rid of the leading and trailing whilespace
Character entities have already been removed by the xmlTextReader
str | xmlChar string to check |
boolean xml_docdone | ( | xmlTextReaderPtr | reader | ) |
check if the input is completed for a given PDU
reader | xml text reader |
void xml_dump_node | ( | const xml_node_t * | node, |
log_debug_t | lvl | ||
) |
Debug function to printf xml_node_t contents.
node | node to dump |
lvl | debug level for output |
status_t xml_endnode_match | ( | const xml_node_t * | startnode, |
const xml_node_t * | endnode | ||
) |
check if a specific node is the proper endnode match for a given startnode
startnode | start node to match against |
endnode | potential end node to test |
xml_attr_t * xml_find_attr | ( | xml_node_t * | node, |
xmlns_id_t | nsid, | ||
const xmlChar * | attrname | ||
) |
Find an attribute.
Must be called after xxx_xml_consume_node Go looking for the specified attribute node
node | xml_node_t to check |
nsid | namespace ID of attribute to find |
attrname | attribute name to find |
xml_attr_t * xml_find_attr_q | ( | xml_attrs_t * | attrs, |
xmlns_id_t | nsid, | ||
const xmlChar * | attrname | ||
) |
Find an attribute in a Q.
Must be called after xxx_xml_consume_node Go looking for the specified attribute node
attrs | attribute queue to search |
nsid | namespace ID of attribute to find |
attrname | attribute name to find |
const xml_attr_t * xml_find_ro_attr | ( | const xml_node_t * | node, |
xmlns_id_t | nsid, | ||
const xmlChar * | attrname | ||
) |
Find a read-only attribute.
Must be called after xxx_xml_consume_node Go looking for the specified attribute node
node | xml_node_t to check |
nsid | namespace ID of attribute to find |
attrname | attribute name to find |
xml_attr_t * xml_first_attr | ( | xml_attrs_t * | attrs | ) |
get the first attribute in the list
attrs | attribute queue to get from |
void xml_free_attr | ( | xml_attr_t * | attr | ) |
free an attribute
attr | xml_attr_t to free |
void xml_free_node | ( | xml_node_t * | node | ) |
Free an xml_node_t struct.
node | pointer to node to free |
void xml_free_reader | ( | xmlTextReaderPtr | reader | ) |
Free the previously allocated xmlTextReader.
reader | xmlTextReader to close and deallocate |
xml_attr_t * xml_get_first_attr | ( | const xml_node_t * | node | ) |
get the first attribute in the attrs list, from an xml_node_t param
node | node with the attrQ to use |
status_t xml_get_namespace_id | ( | xmlTextReaderPtr | reader, |
const xmlChar * | prefix, | ||
uint32 | prefixlen, | ||
boolean | register_missing, | ||
xmlns_id_t * | retnsid | ||
) |
Get the namespace for the specified prefix (may be NULL) Use the current XML reader context to resolve the prefix.
reader | XML reader to use | |
prefix | prefix string to use (NULL == default namespace) | |
prefixlen | N if not a Z-terminated string 0 if it is a Z-terminated string | |
register_missing | T: register temporary NSID if valid namespace found but not registered | |
[out] | retnsid | address of return namespace ID
|
const char * xml_get_node_name | ( | int | nodeval | ) |
get the node type according to the xmlElementType enum list in /usr/include/libxml/libxml/tree.h
nodeval | integer node type from system |
status_t xml_get_reader_for_session | ( | xmlInputReadCallback | readfn, |
xmlInputCloseCallback | closefn, | ||
void * | context, | ||
xmlTextReaderPtr * | reader | ||
) |
Get a new xmlTextReader for parsing the input of a NETCONF session.
readfn | IO read function to use for this xmlTextReader | |
closefn | IO close fn to use for this xmlTextReader | |
context | the ses_cb_t pointer passes as a void * this will be passed to the read and close functions | |
[out] | reader | address of reader return value
|
status_t xml_get_reader_from_buff | ( | const xmlChar * | buff, |
xmlTextReaderPtr * | reader | ||
) |
Get a new xmlTextReader for parsing a debug test file.
buff | buffer containing XML to parse | |
[out] | reader | address of reader return value
|
status_t xml_get_reader_from_filespec | ( | const char * | filespec, |
xmlTextReaderPtr * | reader | ||
) |
Get a new xmlTextReader for parsing a debug test file.
filespec | full filename including path of the XML instance document to parse | |
[out] | reader | address of reader return value
|
void xml_init_attrs | ( | xml_attrs_t * | attrs | ) |
initialize an xml_attrs_t variable
attrs | attribute queue to init |
void xml_init_node | ( | xml_node_t * | node | ) |
Init an xml_node_t struct.
node | pointer to node to init |
boolean xml_isspace | ( | uint32 | ch | ) |
Check if an xmlChar is a space char.
ch | xmlChar to check |
boolean xml_isspace_str | ( | const xmlChar * | str | ) |
Check if an xmlChar string is all whitespace chars.
str | xmlChar string to check |
void xml_move_attrs | ( | xml_attrs_t * | src_attrs, |
xml_attrs_t * | dest_attrs | ||
) |
Move all the attrs from the src to the dest.
src_attrs | attribute queue to move from |
dest_attrs | attribute queue to move to |
xml_attr_t * xml_new_attr | ( | void | ) |
malloc and init an attribute struct
xml_node_t * xml_new_node | ( | void | ) |
Malloc and init a new xml_node_t struct.
xml_attr_t * xml_next_attr | ( | xml_attr_t * | attr | ) |
get the next attribute in the list
attr | attribute entry to get next for |
status_t xml_node_match | ( | const xml_node_t * | node, |
xmlns_id_t | nsid, | ||
const xmlChar * | elname, | ||
xml_nodetyp_t | nodetyp | ||
) |
check if a specific node is the proper owner, name, and type
node | node to match against |
nsid | namespace ID to match (0 == match any) |
elname | element name to match (NULL == match any) |
nodetyp | node type to match (XML_NT_NONE == match any) |
status_t xml_reset_reader_for_session | ( | xmlInputReadCallback | readfn, |
xmlInputCloseCallback | closefn, | ||
void * | context, | ||
xmlTextReaderPtr | reader | ||
) |
Reset the xmlTextReader for parsing the input of a NETCONF session.
readfn | IO read function to use for this xmlTextReader | |
closefn | IO close fn to use for this xmlTextReader | |
context | the ses_cb_t pointer passes as a void * this will be passed to the read and close functions | |
[out] | reader | address of reader return value
|
xmlChar * xml_strcat | ( | xmlChar * | appendTo, |
const xmlChar * | appendFrom | ||
) |
String concatenate for xmlChar.
appendTo | zero-terminated xmlChar string to append to |
appendFrom | zero-terminated xmlChar string to append from |
int xml_strcmp | ( | const xmlChar * | s1, |
const xmlChar * | s2 | ||
) |
String compare for xmlChar.
s1 | zero-terminated xmlChar string to compare |
s2 | zero-terminated xmlChar string to compare |
== -1 : string 1 is less than string 2 == 0 : strings are equal == 1 : string 1 is greater than string 2
int xml_strcmp_nosp | ( | const xmlChar * | s1, |
const xmlChar * | s2 | ||
) |
String compare for xmlChar for 2 strings, but ignoring whitespace differences.
All consecutive whitespace is treated as one space char for comparison purposes
Needed by yangdiff to compare description clauses which have been reformated
s1 | zero-terminated xmlChar string to compare |
s2 | zero-terminated xmlChar string to compare |
== -1 : string 1 is less than string 2 == 0 : strings are equal == 1 : string 1 is greater than string 2
int xml_strcmp_nosp2 | ( | const xmlChar * | s1, |
const xmlChar * | s2 | ||
) |
String compare for xmlChar for 2 strings, but completely ignoring whitespace differences.
It skips all the spaces in both strings. All consecutive whitespace is treated as one space char for comparison purposes
Needed by restconf accept header validation to compare accept header entries which may contain multiple spaces
s1 | zero-terminated xmlChar string to compare |
s2 | zero-terminated xmlChar string to compare |
== -1 : string 1 is less than string 2 == 0 : strings are equal == 1 : string 1 is greater than string 2
uint32 xml_strcpy | ( | xmlChar * | copyTo, |
const xmlChar * | copyFrom | ||
) |
String copy for xmlChar.
does not check for buffer overflow Even if return value is zero, the EOS char is copied
copyTo | buffer to copy into |
copyFrom | zero-terminated xmlChar string to copy from |
xmlChar * xml_strdup | ( | const xmlChar * | copyFrom | ) |
String duplicate for xmlChar.
copyFrom | zero-terminated xmlChar string to copy from |
int xml_stricmp | ( | const xmlChar * | s1, |
const xmlChar * | s2 | ||
) |
Case insensitive string compare for xmlChar.
s1 | zero-terminated xmlChar string to compare |
s2 | zero-terminated xmlChar string to compare |
== -1 : string 1 is less than string 2 == 0 : strings are equal == 1 : string 1 is greater than string 2
uint32 xml_strlen | ( | const xmlChar * | str | ) |
Get the String len for xmlChar.
Does not check for buffer overflow
str | buffer to check |
uint32 xml_strlen_sp | ( | const xmlChar * | str, |
boolean * | sp | ||
) |
get length and check if any whitespace at the same time
String len for xmlChar – does not check for buffer overflow Check for any whitespace in the string as well
str | buffer to check | |
[out] | sp | address of any-spaces-test output
|
xmlChar * xml_strncat | ( | xmlChar * | appendTo, |
const xmlChar * | appendFrom, | ||
uint32 | maxlen | ||
) |
String concatenate for at most maxlen xmlChars.
appendTo | zero-terminated xmlChar string to append to |
appendFrom | zero-terminated xmlChar string to append from |
maxlen | max number of chars to append |
int xml_strncmp | ( | const xmlChar * | s1, |
const xmlChar * | s2, | ||
uint32 | maxlen | ||
) |
String compare for xmlChar for at most 'maxlen' xmlChars.
s1 | zero-terminated xmlChar string to compare |
s2 | zero-terminated xmlChar string to compare |
maxlen | max number of xmlChars to compare |
== -1 : string 1 is less than string 2 == 0 : strings are equal == 1 : string 1 is greater than string 2
uint32 xml_strncpy | ( | xmlChar * | copyTo, |
const xmlChar * | copyFrom, | ||
uint32 | maxlen | ||
) |
String copy for xmlChar – checks for buffer overflow.
copyTo | buffer to copy into |
copyFrom | zero-terminated xmlChar string to copy from |
maxlen | max number of xmlChars to copy, but does include the terminating zero that is added if this max is reached |
xmlChar * xml_strndup | ( | const xmlChar * | copyFrom, |
uint32 | maxlen | ||
) |
String duplicate for max N xmlChars.
copyFrom | zero-terminated xmlChar string to copy from |
maxlen | max number of non-zero chars to copy |
int xml_strnicmp | ( | const xmlChar * | s1, |
const xmlChar * | s2, | ||
uint32 | maxlen | ||
) |
Case insensitive string compare for xmlChar for at most 'maxlen' xmlChars.
s1 | zero-terminated xmlChar string to compare |
s2 | zero-terminated xmlChar string to compare |
maxlen | max number of xmlChars to compare |
== -1 : string 1 is less than string 2 == 0 : strings are equal == 1 : string 1 is greater than string 2
xmlChar * xml_trim_string | ( | xmlChar * | str | ) |
trim leading and trailing whitespace inline in the same buffer
Adapted from the Internet:
http://stackoverflow.com/questions/122616/ how-do-i-trim-leading-trailing-whitespace-in-a-standard-way
[out] | str | string to trim
|