Beispiel #1
0
DFDocument *DFParseXMLFile(const char *filename, DFError **error)
{
    DFBuffer *buf = DFBufferReadFromFile(filename,error);
    if (buf == NULL)
        return NULL;;
    DFDocument *doc = DFParseXMLString(buf->data,error);
    DFBufferRelease(buf);
    return doc;
}
static DFBuffer *readData(const char *filename, DFError **error)
{
    if ((filename == NULL) || !strcmp(filename,"-"))
        filename = "/dev/stdin";;
    DFBuffer *buffer = DFBufferReadFromFile(filename,error);
    if (buffer == NULL) {
        DFErrorFormat(error,"%s: %s",filename,DFErrorMessage(error));
        return NULL;
    }
    return buffer;
}