Initial Revision

This commit is contained in:
James Clark 1998-02-02 12:40:34 +00:00
parent 332b10d36c
commit 347e19a658
2 changed files with 1485 additions and 0 deletions

1372
expat/xmlparse/xmlparse.c Executable file

File diff suppressed because it is too large Load Diff

113
expat/xmlparse/xmlparse.h Executable file
View File

@ -0,0 +1,113 @@
#ifndef XmlParse_INCLUDED
#define XmlParse_INCLUDED 1
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef XMLPARSEAPI
#define XMLPARSEAPI /* as nothing */
#endif
typedef void *XML_Parser;
/* Constructs a new parser; encoding should be the name of the charset from
the Content-Type header if the Content-Type is text/xml, or null otherwise. */
XML_Parser XMLPARSEAPI
XML_ParserCreate(const char *encoding);
/* Information is UTF-8 encoded. */
/* atts is array of name/value pairs, terminated by NULL;
names and values are '\0' terminated. */
typedef void (*XML_StartElementHandler)(void *userData,
const char *name,
const char **atts);
typedef void (*XML_EndElementHandler)(void *userData,
const char *name);
typedef void (*XML_CharacterDataHandler)(void *userData,
const char *s,
size_t len);
/* target and data are '\0' terminated */
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
const char *target,
const char *data);
void XMLPARSEAPI
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end);
void XMLPARSEAPI
XML_SetCharacterDataHandler(XML_Parser parser,
XML_CharacterDataHandler handler);
void XMLPARSEAPI
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler);
/* This value is passed as the userData argument to callbacks. */
void XMLPARSEAPI
XML_SetUserData(XML_Parser parser, void *userData);
/* Parses some input. Returns 0 if a fatal error is detected.
The last call to XML_Parse must have isFinal true;
len may be zero for this call (or any other). */
int XMLPARSEAPI
XML_Parse(XML_Parser parser, const char *s, size_t len, int isFinal);
void XMLPARSEAPI *
XML_GetBuffer(XML_Parser parser, size_t len);
int XMLPARSEAPI
XML_ParseBuffer(XML_Parser parser, size_t len, int isFinal);
/* If XML_Parser or XML_ParseEnd have returned 0, then XML_GetError*
returns information about the error. */
enum XML_Error {
XML_ERROR_NONE,
XML_ERROR_NO_MEMORY,
XML_ERROR_SYNTAX,
XML_ERROR_NO_ELEMENTS,
XML_ERROR_INVALID_TOKEN,
XML_ERROR_UNCLOSED_TOKEN,
XML_ERROR_PARTIAL_CHAR,
XML_ERROR_TAG_MISMATCH,
XML_ERROR_DUPLICATE_ATTRIBUTE,
XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
XML_ERROR_PARAM_ENTITY_REF,
XML_ERROR_UNDEFINED_ENTITY,
XML_ERROR_RECURSIVE_ENTITY_REF,
XML_ERROR_ASYNC_ENTITY,
XML_ERROR_BAD_CHAR_REF,
XML_ERROR_BINARY_ENTITY_REF,
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
XML_ERROR_MISPLACED_XML_PI,
XML_ERROR_UNKNOWN_ENCODING,
XML_ERROR_INCORRECT_ENCODING
};
int XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
int XMLPARSEAPI XML_GetErrorLineNumber(XML_Parser parser);
int XMLPARSEAPI XML_GetErrorColumnNumber(XML_Parser parser);
long XMLPARSEAPI XML_GetErrorByteIndex(XML_Parser parser);
void XMLPARSEAPI
XML_ParserFree(XML_Parser parser);
const char XMLPARSEAPI *
XML_ErrorString(int code);
#ifdef __cplusplus
}
#endif
#endif /* not XmlParse_INCLUDED */