JWS C Library
C language utility library
xml.c File Reference

Read, write, and access XML documents. More...

#include <jwsc/config.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <inttypes.h>
#include "jwsc/base/error.h"
#include "jwsc/base/xml.h"
Include dependency graph for xml.c:

Go to the source code of this file.

Functions

void create_xml_doc (xmlDoc **doc_out)
 Creates an empty xml document.
void free_xml_doc (xmlDoc *doc)
 Frees an xml document.
Errorread_xml_doc (xmlDoc **doc_out, const char *fname)
 Reads an xml document from a file.
Errorread_xml_dtd (xmlDtd **dtd_out, const char *fname)
 Reads an xml dtd from a file.
void free_xml_dtd (xmlDtd *dtd)
 Frees an xml dtd.
int validate_xml_doc (xmlDoc *doc, xmlDtd *dtd)
 Validates an xml document against a dtd.

Detailed Description

Read, write, and access XML documents.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

The XML data structures are documented at http://xmlsoft.org/html

Definition in file xml.c.


Function Documentation

void create_xml_doc ( xmlDoc **  doc_out)

Creates an empty xml document.

Parameters:
doc_outAn empty XML document.

Definition at line 70 of file xml.c.

void free_xml_doc ( xmlDoc doc)

Frees an xml document.

Parameters:
docThe XML document to free.

Definition at line 81 of file xml.c.

Error* read_xml_doc ( xmlDoc **  doc_out,
const char *  fname 
)

Reads an xml document from a file.

Parameters:
doc_outThe XML document.
fnameThe file to read from.

Definition at line 91 of file xml.c.

Error* read_xml_dtd ( xmlDtd **  dtd_out,
const char *  fname 
)

Reads an xml dtd from a file.

Parameters:
dtd_outThe XML DTD.
fnameThe file to read from.

Definition at line 119 of file xml.c.

void free_xml_dtd ( xmlDtd dtd)

Frees an xml dtd.

Parameters:
dtdThe XML DTD.

Definition at line 133 of file xml.c.

int validate_xml_doc ( xmlDoc doc,
xmlDtd dtd 
)

Validates an xml document against a dtd.

Parameters:
docThe XML document to validate.
dtdThe DTD to validate against.
Returns:
1 if valid; 0 otherwise.

Definition at line 145 of file xml.c.