axl main logo
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
axlDtd * axl_dtd_parse_from_file ( const char *  file_path,
axlError **  error 
)

Allows to parse the provided DTD definition, which is found on the provided file path.

Parameters
file_pathThe file path where it is expected to receive a DTD file.
errorAn optional axlError reference where all errors found will be reported.
Returns
A newly allocated axlDtd instance or NULL if it fails.

Making a DTD to be inline loaded:

It may be helpful to make the DTD definition available at your binary, inline compiled, to avoid distributing DTD files along with libraries, etc. This also solves installation problems like provisioning a default location to make your application to find such files.

With the following command you can create an inline representation from your DTD file:

1 >> axl-knife --input your-file.dtd --dtd-to-c --output your-file.dtd.h --ifnewer

This will create a header with an C-macro style definition of your DTD. Now, you can include it using:

1 #include <your-file.dtd.h>

In the case you are developing a library, it is recommended to do such include at the body implementation (usually .c or .cpp files, to avoid requiring your API consumers to also include your DTD inline definition).

Now, to load your DTD file, use the following:

1 axlError * err = NULL;
2 axlDtd * dtd = axl_dtd_parse (YOUR_FILE_DTD, -1, &err);
3 if (dtd == NULL) {
4  // This won't happen unless axl-runtime error found, since axl-knife
5  // checks your dtd file before producing the in-line definition.
6  // However, bug happens! check this.
7 }