Open SCAP Library
Loading...
Searching...
No Matches
Functions | Variables
elements.c File Reference
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include "public/oscap.h"
#include "util.h"
#include "list.h"
#include "_error.h"
#include "debug_priv.h"
#include "elements.h"
#include "oscap_helpers.h"
Include dependency graph for common/elements.c:

Functions

bool oscap_to_start_element (xmlTextReaderPtr reader, int depth)
 find starting element at given depth (returns false if none found)
 
void oscap_text_consumer (char *text, void *user)
 
int oscap_parser_text_value (xmlTextReaderPtr reader, oscap_xml_value_consumer consumer, void *user)
 
char * oscap_element_string_copy (xmlTextReaderPtr reader)
 get a copy of a string contained by current element
 
const char * oscap_element_string_get (xmlTextReaderPtr reader)
 get a string contained by current element
 
int oscap_element_depth (xmlTextReaderPtr reader)
 get depth of current element
 
char * oscap_get_xml (xmlTextReaderPtr reader)
 get xml content of current element as a string
 
time_t oscap_get_date (const char *date)
 get date from a string
 
time_t oscap_get_datetime (const char *date)
 get datetime from a string
 
xmlNode * oscap_xmlstr_to_dom (xmlNode *parent, const char *elname, const char *content)
 convert a piece of XML string to DOM
 
const char * oscap_strlist_find_value (char **const kvalues, const char *key)
 In a list of key-value pairs (odd indicies are keys, even values), find a value for given key.
 
int oscap_xml_save_filename (const char *filename, xmlDocPtr doc)
 Save XML Document to the file of the given filename.
 
int oscap_xml_save_fd (int fd, xmlDocPtr doc)
 Save XML Document to the given file descriptor.
 
int oscap_xml_save_filename_free (const char *filename, xmlDocPtr doc)
 Save XML Document to the file of the given filename and dispose the document afterwards.
 
xmlNs * lookup_xsi_ns (xmlDoc *doc)
 

Variables

const struct oscap_string_map OSCAP_BOOL_MAP []
 boolean to string (and vice versa) conversion map
 

Function Documentation

◆ oscap_xml_save_fd()

int oscap_xml_save_fd ( int fd,
xmlDocPtr doc )

Save XML Document to the given file descriptor.

The file descriptor isn't closed by this function.

Parameters
fdfile descriptor
docthe XML document content
Returns
1 on success, -1 on failure (oscap_seterr is set appropriately).

◆ oscap_xml_save_filename()

int oscap_xml_save_filename ( const char * filename,
xmlDocPtr doc )

Save XML Document to the file of the given filename.

Parameters
filenamepath to the file
docthe XML document content
Returns
1 on success, -1 on failure (oscap_seterr is set appropriately).

◆ oscap_xml_save_filename_free()

int oscap_xml_save_filename_free ( const char * filename,
xmlDocPtr doc )

Save XML Document to the file of the given filename and dispose the document afterwards.

Parameters
filenamepath to the file
docthe XML document content
Returns
1 on success, -1 on failure (oscap_seterr is set appropriatly).

Variable Documentation

◆ OSCAP_BOOL_MAP

const struct oscap_string_map OSCAP_BOOL_MAP[]
Initial value:
= {
{true, "true"}, {true, "True"}, {true, "TRUE"},
{true, "yes"}, {true, "Yes"}, {true, "YES"},
{true, "1"}, {false, NULL}
}

boolean to string (and vice versa) conversion map