createrepo_c library  0.9.1
C library for metadata manipulation
XML dump API.

Data Structures

struct  cr_XmlStruct
 

Macros

#define CR_XML_COMMON_NS   "http://linux.duke.edu/metadata/common"
 
#define CR_XML_FILELISTS_NS   "http://linux.duke.edu/metadata/filelists"
 
#define CR_XML_OTHER_NS   "http://linux.duke.edu/metadata/other"
 
#define CR_XML_REPOMD_NS   "http://linux.duke.edu/metadata/repo"
 
#define CR_XML_RPM_NS   "http://linux.duke.edu/metadata/rpm"
 

Functions

void cr_xml_dump_init ()
 
void cr_xml_dump_cleanup ()
 
char * cr_xml_dump_primary (cr_Package *package, GError **err)
 
char * cr_xml_dump_filelists (cr_Package *package, GError **err)
 
char * cr_xml_dump_other (cr_Package *package, GError **err)
 
struct cr_XmlStruct cr_xml_dump (cr_Package *package, GError **err)
 
char * cr_xml_dump_repomd (cr_Repomd *repomd, GError **err)
 
char * cr_xml_dump_updateinfo (cr_UpdateInfo *updateinfo, GError **err)
 
char * cr_xml_dump_updaterecord (cr_UpdateRecord *rec, GError **err)
 
char * cr_xml_dump_deltapackage (cr_DeltaPackage *dpkg, GError **err)
 
void cr_latin1_to_utf8 (const unsigned char *in, unsigned char *out) __attribute__((hot))
 
gboolean cr_hascontrollchars (const unsigned char *str)
 

Detailed Description

Example:

struct cr_XmlStruct xml;
pkg = cr_package_from_rpm_base("path/to/rpm.rpm", 5, CR_HDRR_NONE, NULL);
xml = cr_xml_dump(pkg, NULL);
printf("Primary XML chunk:\n%s\n", xml.primary);
printf("Filelists XML chunk:\n%s\n", xml.filelists);
printf("Other XML chunk:\n%s\n", xml.other);
free(xml.primary);
free(xml.filelists);
free(xml.other);

Macro Definition Documentation

#define CR_XML_COMMON_NS   "http://linux.duke.edu/metadata/common"

Default namespace for primary.xml

Definition at line 66 of file xml_dump.h.

#define CR_XML_FILELISTS_NS   "http://linux.duke.edu/metadata/filelists"

Default namespace for filelists.xml

Definition at line 68 of file xml_dump.h.

#define CR_XML_OTHER_NS   "http://linux.duke.edu/metadata/other"

Default namespace for other.xml

Definition at line 70 of file xml_dump.h.

#define CR_XML_REPOMD_NS   "http://linux.duke.edu/metadata/repo"

Default namespace for repomd.xml

Definition at line 72 of file xml_dump.h.

#define CR_XML_RPM_NS   "http://linux.duke.edu/metadata/rpm"

Namespace for rpm (used in primary.xml and repomd.xml)

Definition at line 74 of file xml_dump.h.

Function Documentation

gboolean cr_hascontrollchars ( const unsigned char *  str)

Check if string contains chars with value <32 (except 9, 10 and 13).

Parameters
strString (NOT NULL!!!!)
Returns
TRUE if at leas one char with value <32 (except the 9, 10, 13) is present in the string.
void cr_latin1_to_utf8 ( const unsigned char *  in,
unsigned char *  out 
)

Prepare string to xml dump. If string is not utf8 it is converted (source encoding is supposed to be iso-8859-1). Control chars (chars with value <32 except 9, 10 and 13) are excluded.

Parameters
ininput string.
outoutput string. space of output string must be at least (strlen(in) * 2 + 1) * sizeof(char)
struct cr_XmlStruct cr_xml_dump ( cr_Package package,
GError **  err 
)

Generate all three xml chunks (primary, filelists, other) from cr_Package.

Parameters
packagecr_Package
err**GError
Returns
cr_XmlStruct
void cr_xml_dump_cleanup ( )

Cleanup initialized dumping part of library

char* cr_xml_dump_deltapackage ( cr_DeltaPackage dpkg,
GError **  err 
)

Generate xml representation of cr_DeltaPackage

Parameters
dpkgcr_DeltaPackage
err**GError
Returns
xml chunk string or NULL on error
char* cr_xml_dump_filelists ( cr_Package package,
GError **  err 
)

Generate filelists xml chunk from cr_Package.

Parameters
packagecr_Package
err**GError
Returns
xml chunk string or NULL on error
void cr_xml_dump_init ( )

Initialize dumping part of library (Initialize libxml2).

char* cr_xml_dump_other ( cr_Package package,
GError **  err 
)

Generate other xml chunk from cr_Package.

Parameters
packagecr_Package
err**GError
Returns
xml chunk string or NULL on error
char* cr_xml_dump_primary ( cr_Package package,
GError **  err 
)

Generate primary xml chunk from cr_Package.

Parameters
packagecr_Package
err**GError
Returns
xml chunk string or NULL on error
char* cr_xml_dump_repomd ( cr_Repomd repomd,
GError **  err 
)

Generate xml representation of cr_Repomd.

Parameters
repomdcr_Repomd
err**GError
Returns
repomd.xml content
char* cr_xml_dump_updateinfo ( cr_UpdateInfo updateinfo,
GError **  err 
)

Generate xml representation of cr_UpdateInfo.

Parameters
updateinfocr_UpdateInfo
err**GError
Returns
repomd.xml content
char* cr_xml_dump_updaterecord ( cr_UpdateRecord rec,
GError **  err 
)

Generate xml representation of cr_UpdateRecord

Parameters
reccr_UpdateRecord
err**GError
Returns
xml chunk string or NULL on error