yumapro  24.10-1
YumaPro SDK
Loading...
Searching...
No Matches

XML Write Utilities. More...

Collaboration diagram for XML Utilities:

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_txml_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_txml_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_txml_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_txml_first_attr (xml_attrs_t *attrs)
 get the first attribute in the list More...
 
xml_attr_txml_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_txml_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_txml_find_attr (xml_node_t *node, xmlns_id_t nsid, const xmlChar *attrname)
 Find an attribute. More...
 
xml_attr_txml_find_attr_q (xml_attrs_t *attrs, xmlns_id_t nsid, const xmlChar *attrname)
 Find an attribute in a Q. More...
 
const xml_attr_txml_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...
 

Detailed Description

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

Enumeration Type Documentation

◆ xml_nodetyp_t

only 4 types of nodes returned

Enumerator
XML_NT_NONE 

not set

XML_NT_EMPTY 

standalone empty node

XML_NT_START 

start-tag of an element

XML_NT_END 

end-tag of an element

XML_NT_STRING 

string content node

Function Documentation

◆ wr_util_check_start_depth()

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.

Parameters
msgmsg to check start_level
objobject to check against
Returns
TRUE if need to process the whole val value tree
FALSE if do not reach the start depth yet
Here is the call graph for this function:

◆ wr_util_fit_on_line()

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.

Parameters
scbsession control block
valvalue to check
Returns
TRUE if value will fit on current line, FALSE if not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wr_util_need_default_attr()

boolean wr_util_need_default_attr ( xml_msg_hdr_t msg)

Check if the default attr is needed.

Parameters
msgmessage header to use
Returns
TRUE if default attr needed

◆ wr_util_need_origin_attr()

boolean wr_util_need_origin_attr ( xml_msg_hdr_t msg)

Check if the origin attr is needed.

Parameters
msgmessage header to use
Returns
TRUE if origin attr needed

◆ wr_util_need_skip_any()

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

Parameters
out== output node to check
Returns
TRUE if this is an ANY node that needs special handling; FALSE otherwise
Here is the call graph for this function:

◆ xml_add_attr()

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

Parameters
attrsattribute queue to add attr into
ns_idnamespace ID (use XMLNS_NONE if no prefix desired)
attr_nameattribute name string
attr_valattribute value string
Returns
NO_ERR if all okay
Here is the call graph for this function:

◆ xml_add_inv_xmlns_attr()

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

Parameters
attrsattribute queue to add to
ns_idnamespace ID of the xmlns target
pfixnamespace prefix string assigned
NULL for default namespace
nsvalnamespace URI value of invalid namespace
Returns
NO_ERR if all okay
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_add_qattr()

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:

Parameters
attrsattribute queue to add attr into
ns_idnamespace ID (use XMLNS_NONE if no prefix desired)
attr_qnameattribute name string
plenattribute prefix length
attr_valattribute value string
[out]resaddress of return status
  • *res return status
Returns
pointer to the attr record created
Here is the call graph for this function:

◆ xml_add_xmlns_attr()

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

Parameters
attrsattribute queue to add to
ns_idnamespace ID of the xmlns target
pfixnamespace prefix string assigned
NULL for default namespace
Returns
NO_ERR if all okay
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_add_xmlns_attr_string()

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

Parameters
attrsattribute queue to add to
nsnamespace URI string of the xmlns target
pfixnamespace prefix string assigned
NULL for default namespace
Returns
NO_ERR if all okay
Here is the call graph for this function:

◆ xml_advance_reader()

boolean xml_advance_reader ( xmlTextReaderPtr  reader)

Advance to the next node in the specified reader.

Parameters
readerXmlReader already initialized from File, Memory, or whatever
Returns
FALSE if OEF seen, or TRUE if normal

◆ xml_ch_strndup()

char * xml_ch_strndup ( const char *  copyFrom,
uint32  maxlen 
)

String duplicate for max N chars.

Parameters
copyFromzero-terminated char string to copy from
maxlenmax number of non-zero chars to copy
Returns
pointer to new malloced string or NULL if some error

◆ xml_check_ns()

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

Parameters
readerXmlReader already initialized from File, Memory, or whatever pfs->ns_id == element namespace to check
elnameelement name to check
[out]idaddress of return id param
  • *id namespace ID found or 0 if none
[out]pfix_lenaddress of return prefix length
  • *pfix_len filled in > 0 if one found real element name will start at pfix_len+1 if pfix is non-NULL
[out]badnsaddress of return bad namespace string
  • *badns pointer to unknown namespace if error returned
Returns
status; could be error if namespace specified but not supported
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_check_qname_content()

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

Parameters
readerreader to use
nodecurrent string node in progress
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_clean_attrs()

void xml_clean_attrs ( xml_attrs_t attrs)

clean an xml_attrs_t variable

Parameters
attrsattribute queue to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_clean_node()

void xml_clean_node ( xml_node_t node)

Clean an xml_node_t struct.

Parameters
nodepointer to node to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_consume_node()

status_t xml_consume_node ( xmlTextReaderPtr  reader,
xml_node_t xmlnode,
boolean  nserr,
boolean  adv 
)

parse function for YIN input

Parameters
readerxmlTextReader to use
[in,out]xmlnodeaddress of node pointer to use
  • MUST be an initialized node with xml_new_node or xml_init_node
  • *xmlnode filled in or malloced and filled-in xml node
nserrTRUE if bad namespace should be checked; FALSE if not
advTRUE if advance reader
FALSE if no advance (reget current node)
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_convert_char_entity()

xmlChar xml_convert_char_entity ( const xmlChar *  str,
uint32 *  used 
)

Convert an XML character entity into a single xmlChar.

Parameters
strstring pointing to start of char entity
[out]usedaddress of number of chars consumed
  • *used number of chars consumed
Returns
converted xmlChar
Here is the call graph for this function:

◆ xml_copy_clean_string()

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

Parameters
strxmlChar string to check
Returns
pointer to new malloced string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_docdone()

boolean xml_docdone ( xmlTextReaderPtr  reader)

check if the input is completed for a given PDU

Parameters
readerxml text reader
Returns
TRUE if document is done
FALSE if document is not done or some error If a node is read, the reader will be pointing to that node
Here is the caller graph for this function:

◆ xml_dump_node()

void xml_dump_node ( const xml_node_t node,
log_debug_t  lvl 
)

Debug function to printf xml_node_t contents.

Parameters
nodenode to dump
lvldebug level for output
Here is the caller graph for this function:

◆ xml_endnode_match()

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

Parameters
startnodestart node to match against
endnodepotential end node to test
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_find_attr()

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

Parameters
nodexml_node_t to check
nsidnamespace ID of attribute to find
attrnameattribute name to find
Returns
pointer to found xml_attr_t or NULL if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_find_attr_q()

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

Parameters
attrsattribute queue to search
nsidnamespace ID of attribute to find
attrnameattribute name to find
Returns
pointer to found xml_attr_t or NULL if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_find_ro_attr()

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

Parameters
nodexml_node_t to check
nsidnamespace ID of attribute to find
attrnameattribute name to find
Returns
const pointer to found xml_attr_t or NULL if not found
Here is the call graph for this function:

◆ xml_first_attr()

xml_attr_t * xml_first_attr ( xml_attrs_t attrs)

get the first attribute in the list

Parameters
attrsattribute queue to get from
Returns
pointer to first entry or NULL if none
Here is the caller graph for this function:

◆ xml_free_attr()

void xml_free_attr ( xml_attr_t attr)

free an attribute

Parameters
attrxml_attr_t to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_free_node()

void xml_free_node ( xml_node_t node)

Free an xml_node_t struct.

Parameters
nodepointer to node to free
Here is the call graph for this function:

◆ xml_free_reader()

void xml_free_reader ( xmlTextReaderPtr  reader)

Free the previously allocated xmlTextReader.

Parameters
readerxmlTextReader to close and deallocate
Here is the caller graph for this function:

◆ xml_get_first_attr()

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

Parameters
nodenode with the attrQ to use
Returns
pointer to first entry or NULL if none

◆ xml_get_namespace_id()

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.

Parameters
readerXML reader to use
prefixprefix string to use (NULL == default namespace)
prefixlenN if not a Z-terminated string
0 if it is a Z-terminated string
register_missingT: register temporary NSID if valid namespace found but not registered
[out]retnsidaddress of return namespace ID
  • *retnsid XMLNS ID for the namespace, 0 if none found
  • INVALID ID if unknown
Returns
status
Here is the call graph for this function:

◆ xml_get_node_name()

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

Parameters
nodevalinteger node type from system
Returns
string corresponding to the integer value
Here is the caller graph for this function:

◆ xml_get_reader_for_session()

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.

Parameters
readfnIO read function to use for this xmlTextReader
closefnIO close fn to use for this xmlTextReader
contextthe ses_cb_t pointer passes as a void * this will be passed to the read and close functions
[out]readeraddress of reader return value
  • *reader == pointer to new reader or NULL if some error
Returns
status of the operation
Here is the caller graph for this function:

◆ xml_get_reader_from_buff()

status_t xml_get_reader_from_buff ( const xmlChar *  buff,
xmlTextReaderPtr *  reader 
)

Get a new xmlTextReader for parsing a debug test file.

Parameters
buffbuffer containing XML to parse
[out]readeraddress of reader return value
  • *reader pointer to new reader or NULL if some error
Returns
status of the operation
Here is the caller graph for this function:

◆ xml_get_reader_from_filespec()

status_t xml_get_reader_from_filespec ( const char *  filespec,
xmlTextReaderPtr *  reader 
)

Get a new xmlTextReader for parsing a debug test file.

Parameters
filespecfull filename including path of the XML instance document to parse
[out]readeraddress of reader return value
  • *reader == pointer to new reader or NULL if some error
Returns
status of the operation
Here is the caller graph for this function:

◆ xml_init_attrs()

void xml_init_attrs ( xml_attrs_t attrs)

initialize an xml_attrs_t variable

Parameters
attrsattribute queue to init
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_init_node()

void xml_init_node ( xml_node_t node)

Init an xml_node_t struct.

Parameters
nodepointer to node to init
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_isspace()

boolean xml_isspace ( uint32  ch)

Check if an xmlChar is a space char.

Parameters
chxmlChar to check
Returns
TRUE if a space, FALSE otherwise
Here is the caller graph for this function:

◆ xml_isspace_str()

boolean xml_isspace_str ( const xmlChar *  str)

Check if an xmlChar string is all whitespace chars.

Parameters
strxmlChar string to check
Returns
TRUE if all whitespace, FALSE otherwise
Here is the call graph for this function:

◆ xml_move_attrs()

void xml_move_attrs ( xml_attrs_t src_attrs,
xml_attrs_t dest_attrs 
)

Move all the attrs from the src to the dest.

Parameters
src_attrsattribute queue to move from
dest_attrsattribute queue to move to
Here is the call graph for this function:

◆ xml_new_attr()

xml_attr_t * xml_new_attr ( void  )

malloc and init an attribute struct

Returns
pointer to new xml_attr_t or NULL if malloc error
Here is the caller graph for this function:

◆ xml_new_node()

xml_node_t * xml_new_node ( void  )

Malloc and init a new xml_node_t struct.

Returns
pointer to new node or NULL if malloc error
Here is the call graph for this function:

◆ xml_next_attr()

xml_attr_t * xml_next_attr ( xml_attr_t attr)

get the next attribute in the list

Parameters
attrattribute entry to get next for
Returns
pointer to the next entry or NULL if none
Here is the caller graph for this function:

◆ xml_node_match()

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

Parameters
nodenode to match against
nsidnamespace ID to match (0 == match any)
elnameelement name to match (NULL == match any)
nodetypnode type to match (XML_NT_NONE == match any)
Returns
status
Here is the call graph for this function:

◆ xml_reset_reader_for_session()

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.

Parameters
readfnIO read function to use for this xmlTextReader
closefnIO close fn to use for this xmlTextReader
contextthe ses_cb_t pointer passes as a void * this will be passed to the read and close functions
[out]readeraddress of reader return value
  • *reader == pointer to new reader or NULL if some error
Returns
status of the operation
Here is the caller graph for this function:

◆ xml_strcat()

xmlChar * xml_strcat ( xmlChar *  appendTo,
const xmlChar *  appendFrom 
)

String concatenate for xmlChar.

Parameters
appendTozero-terminated xmlChar string to append to
appendFromzero-terminated xmlChar string to append from
Returns
appendTo if no error or NULL if some error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_strcmp()

int xml_strcmp ( const xmlChar *  s1,
const xmlChar *  s2 
)

String compare for xmlChar.

Parameters
s1zero-terminated xmlChar string to compare
s2zero-terminated xmlChar string to compare
Returns
compare result
    == -1 : string 1 is less than string 2
    == 0  : strings are equal
    == 1  : string 1 is greater than string 2

◆ xml_strcmp_nosp()

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

Parameters
s1zero-terminated xmlChar string to compare
s2zero-terminated xmlChar string to compare
Returns
compare result
    == -1 : string 1 is less than string 2
    == 0  : strings are equal
    == 1  : string 1 is greater than string 2
Here is the call graph for this function:

◆ xml_strcmp_nosp2()

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

Parameters
s1zero-terminated xmlChar string to compare
s2zero-terminated xmlChar string to compare
Returns
compare result
    == -1 : string 1 is less than string 2
    == 0  : strings are equal
    == 1  : string 1 is greater than string 2
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_strcpy()

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

Parameters
copyTobuffer to copy into
copyFromzero-terminated xmlChar string to copy from
Returns
number of bytes copied to the result buffer, not including EOS

◆ xml_strdup()

xmlChar * xml_strdup ( const xmlChar *  copyFrom)

String duplicate for xmlChar.

Parameters
copyFromzero-terminated xmlChar string to copy from
Returns
pointer to new malloced string or NULL if some error
Here is the call graph for this function:

◆ xml_stricmp()

int xml_stricmp ( const xmlChar *  s1,
const xmlChar *  s2 
)

Case insensitive string compare for xmlChar.

Parameters
s1zero-terminated xmlChar string to compare
s2zero-terminated xmlChar string to compare
Returns
compare result
    == -1 : string 1 is less than string 2
    == 0  : strings are equal
    == 1  : string 1 is greater than string 2
Here is the caller graph for this function:

◆ xml_strlen()

uint32 xml_strlen ( const xmlChar *  str)

Get the String len for xmlChar.

Does not check for buffer overflow

Parameters
strbuffer to check
Returns
number of xmlChars before null terminator found

◆ xml_strlen_sp()

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

Parameters
strbuffer to check
[out]spaddress of any-spaces-test output
  • *sp TRUE if any whitespace found in the string
Returns
number of xmlChars before null terminator found
Here is the call graph for this function:

◆ xml_strncat()

xmlChar * xml_strncat ( xmlChar *  appendTo,
const xmlChar *  appendFrom,
uint32  maxlen 
)

String concatenate for at most maxlen xmlChars.

Parameters
appendTozero-terminated xmlChar string to append to
appendFromzero-terminated xmlChar string to append from
maxlenmax number of chars to append
Returns
appendTo if no error or NULL if some error
Here is the call graph for this function:

◆ xml_strncmp()

int xml_strncmp ( const xmlChar *  s1,
const xmlChar *  s2,
uint32  maxlen 
)

String compare for xmlChar for at most 'maxlen' xmlChars.

Parameters
s1zero-terminated xmlChar string to compare
s2zero-terminated xmlChar string to compare
maxlenmax number of xmlChars to compare
Returns
compare result
    == -1 : string 1 is less than string 2
    == 0  : strings are equal
    == 1  : string 1 is greater than string 2
Here is the caller graph for this function:

◆ xml_strncpy()

uint32 xml_strncpy ( xmlChar *  copyTo,
const xmlChar *  copyFrom,
uint32  maxlen 
)

String copy for xmlChar – checks for buffer overflow.

Parameters
copyTobuffer to copy into
copyFromzero-terminated xmlChar string to copy from
maxlenmax number of xmlChars to copy, but does include the terminating zero that is added if this max is reached
Returns
number of bytes copied to the result buffer
Here is the caller graph for this function:

◆ xml_strndup()

xmlChar * xml_strndup ( const xmlChar *  copyFrom,
uint32  maxlen 
)

String duplicate for max N xmlChars.

Parameters
copyFromzero-terminated xmlChar string to copy from
maxlenmax number of non-zero chars to copy
Returns
pointer to new malloced string or NULL if some error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_strnicmp()

int xml_strnicmp ( const xmlChar *  s1,
const xmlChar *  s2,
uint32  maxlen 
)

Case insensitive string compare for xmlChar for at most 'maxlen' xmlChars.

Parameters
s1zero-terminated xmlChar string to compare
s2zero-terminated xmlChar string to compare
maxlenmax number of xmlChars to compare
Returns
compare result
    == -1 : string 1 is less than string 2
    == 0  : strings are equal
    == 1  : string 1 is greater than string 2

◆ xml_trim_string()

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

Parameters
[out]strstring to trim
  • str buffer altered
Returns
pointer to str; NULL if error
Here is the call graph for this function: