Loading...
Searching...
No Matches
common/elements.h
Go to the documentation of this file.
/*
* Copyright 2009--2014 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Maros Barabas <mbarabas@redhat.com>
*/
#ifndef OSCAP_ELEMENTS_H_
#define OSCAP_ELEMENTS_H_
#include <libxml/xmlreader.h>
#include <libxml/xmlwriter.h>
#include <stdbool.h>
#include <time.h>
#include "public/oscap.h"
#include "util.h"
#define OSCAP_XMLNS_XSI BAD_CAST "http://www.w3.org/2001/XMLSchema-instance"
extern const struct oscap_string_map OSCAP_BOOL_MAP[];
typedef void (*oscap_xml_value_consumer) (char *, void *);
int oscap_parser_text_value(xmlTextReaderPtr reader, oscap_xml_value_consumer consumer, void *user);
void oscap_text_consumer(char *text, void *user);
bool oscap_to_start_element(xmlTextReaderPtr reader, int depth);
char *oscap_element_string_copy(xmlTextReaderPtr reader);
const char *oscap_element_string_get(xmlTextReaderPtr reader);
int oscap_element_depth(xmlTextReaderPtr reader);
char *oscap_get_xml(xmlTextReaderPtr reader);
time_t oscap_get_date(const char *date);
time_t oscap_get_datetime(const char *date);
xmlNode *oscap_xmlstr_to_dom(xmlNode *parent, const char *elname, const char *content);
int oscap_xml_save_filename(const char *filename, xmlDocPtr doc);
int oscap_xml_save_fd(int fd, xmlDocPtr doc);
int oscap_xml_save_filename_free(const char *filename, xmlDocPtr doc);
xmlNs *lookup_xsi_ns(xmlDoc *doc);
#endif
OSCAP_BOOL_MAP
const struct oscap_string_map OSCAP_BOOL_MAP[]
boolean to string (and vice versa) conversion map
Definition common/elements.c:49
oscap_element_string_copy
char * oscap_element_string_copy(xmlTextReaderPtr reader)
get a copy of a string contained by current element
Definition common/elements.c:122
oscap_element_depth
int oscap_element_depth(xmlTextReaderPtr reader)
get depth of current element
Definition common/elements.c:148
oscap_xmlstr_to_dom
xmlNode * oscap_xmlstr_to_dom(xmlNode *parent, const char *elname, const char *content)
convert a piece of XML string to DOM
Definition common/elements.c:196
oscap_to_start_element
bool oscap_to_start_element(xmlTextReaderPtr reader, int depth)
find starting element at given depth (returns false if none found)
Definition common/elements.c:56
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.
Definition common/elements.c:275
oscap_xml_save_filename
int oscap_xml_save_filename(const char *filename, xmlDocPtr doc)
Save XML Document to the file of the given filename.
Definition common/elements.c:221
oscap_get_xml
char * oscap_get_xml(xmlTextReaderPtr reader)
get xml content of current element as a string
Definition common/elements.c:161
oscap_get_date
time_t oscap_get_date(const char *date)
get date from a string
Definition common/elements.c:166
oscap_element_string_get
const char * oscap_element_string_get(xmlTextReaderPtr reader)
get a string contained by current element
Definition common/elements.c:138
oscap_xml_save_fd
int oscap_xml_save_fd(int fd, xmlDocPtr doc)
Save XML Document to the given file descriptor.
Definition common/elements.c:253
oscap_get_datetime
time_t oscap_get_datetime(const char *date)
get datetime from a string
Definition common/elements.c:180
oscap.h
General OpenScap functions and types.
oscap_string_map
Define mapping between symbolic constant and its string representation.
Definition util.h:296