1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

Build a new version hopefully near complete and fully documented of the

* doc/libxml2-api.xml doc/parsedecl.py: Build a new version
  hopefully near complete and fully documented of the API in XML
* HTMLtree.c SAX.c debugXML.c error.c globals.c parser.c tree.c
 xmlIO.c xmlmemory.c include/libxml/catalog.h include/libxml/hash.h
 include/libxml/list.h include/libxml/parser.h include/libxml/tree.h
 include/libxml/parserInternals.h include/libxml/valid.hi
 include/libxml/xmlIO.h include/libxml/xmlerror.hi
 include/libxml/xmlmemory.h include/libxml/xmlversion.h.ini
 include/libxml/xpath.h include/libxml/xpathInternals.h:
  Cleaned up the doc comments a lot in the process, the interface
  coverage is now 100%
Daniel
This commit is contained in:
Daniel Veillard 2002-01-22 18:15:52 +00:00
parent 2d1464fbbf
commit 9d06d300a5
25 changed files with 4134 additions and 2686 deletions

View File

@ -1,3 +1,17 @@
Tue Jan 22 19:12:06 CET 2002 Daniel Veillard <daniel@veillard.com>
* doc/libxml2-api.xml doc/parsedecl.py: Build a new version
hopefully near complete and fully documented of the API in XML
* HTMLtree.c SAX.c debugXML.c error.c globals.c parser.c tree.c
xmlIO.c xmlmemory.c include/libxml/catalog.h include/libxml/hash.h
include/libxml/list.h include/libxml/parser.h include/libxml/tree.h
include/libxml/parserInternals.h include/libxml/valid.hi
include/libxml/xmlIO.h include/libxml/xmlerror.hi
include/libxml/xmlmemory.h include/libxml/xmlversion.h.ini
include/libxml/xpath.h include/libxml/xpathInternals.h:
Cleaned up the doc comments a lot in the process, the interface
coverage is now 100%
Tue Jan 22 00:12:58 CET 2002 Daniel Veillard <daniel@veillard.com>
* doc/libxml2-api.xml doc/parsedecl.py: improved the script to

View File

@ -1123,6 +1123,7 @@ htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
* @buf: the HTML buffer output
* @cur: the document
* @encoding: the encoding string
* @format: should formatting spaces been added
*
* Dump an HTML document.
*/

8
SAX.c
View File

@ -1662,7 +1662,7 @@ cdataBlock(void *ctx, const xmlChar *value, int len)
}
/**
* xmlDefaultSAXHandlerInit:
* initxmlDefaultSAXHandler:
* @hdlr: the SAX handler
* @warning: flag if non-zero sets the handler warning procedure
*
@ -1723,9 +1723,8 @@ xmlDefaultSAXHandlerInit(void)
#ifdef LIBXML_HTML_ENABLED
/**
* inithtmlDefaultSAXHandlerInit:
* inithtmlDefaultSAXHandler:
* @hdlr: the SAX handler
* @warning: flag if non-zero sets the handler warning procedure
*
* Initialize the default HTML SAX handler
*/
@ -1782,9 +1781,8 @@ htmlDefaultSAXHandlerInit(void)
#ifdef LIBXML_DOCB_ENABLED
/**
* initdocbDefaultSAXHandlerInit:
* initdocbDefaultSAXHandler:
* @hdlr: the SAX handler
* @warning: flag if non-zero sets the handler warning procedure
*
* Initialize the default DocBook SAX handler
*/

View File

@ -1307,7 +1307,7 @@ xmlShellPrintNode(xmlNodePtr node)
/**
* xmlShellPrintXPathResult:
* list: a valid result generated by an xpath evaluation
* @list: a valid result generated by an xpath evaluation
*
* Prints result to stdout
*/
@ -1813,7 +1813,7 @@ xmlShellDu(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
* xmlShellPwd:
* @ctxt: the shell context
* @buffer: the output buffer
* @tree: a node
* @node: a node
* @node2: unused
*
* Implements the XML shell function "pwd"

File diff suppressed because it is too large Load Diff

View File

@ -58,6 +58,8 @@ def removeComments(raw):
def extractArgs(raw, function):
raw = removeComments(raw)
raw = string.replace(raw, '\n', ' ')
raw = string.replace(raw, '\r', ' ')
list = string.split(raw, ",")
ret = []
for arg in list:
@ -67,7 +69,7 @@ def extractArgs(raw, function):
i = i - 1
c = arg[i]
while string.find(string.letters, c) >= 0 or \
string.find(string.digits, c) >= 0:
string.find(string.digits, c) >= 0 or c == '_':
i = i - 1
if i < 0:
break
@ -79,8 +81,11 @@ def extractArgs(raw, function):
break
c = arg[i]
type = mormalizeTypeSpaces(arg[0:i+1], function)
# print "list: %s -> %s, %s" % (list, type, name)
ret.append((type, name))
if name == 'void' and type == '':
pass
else:
ret.append([type, name, ''])
return ret
def extractTypes(raw, function):
@ -97,6 +102,7 @@ def extractTypes(raw, function):
ret_types[type].append(function)
else:
ret_types[type] = [function]
return type
def parseMacro():
@ -114,10 +120,10 @@ def parseMacro():
line = input.readline()[:-1]
if var == 1:
variables[name] = ''
variables[name] = ['', ''] # type, info
identifiers_type[name] = "variable"
else:
macros[name] = ''
macros[name] = [[], ''] # args, info
identifiers_type[name] = "macro"
def parseStruct():
@ -187,18 +193,18 @@ def parseStaticFunction():
line = input.readline()[:-1]
type = None
signature = None
signature = ""
while line != "</USER_FUNCTION>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
type = extractTypes(line[9:-10], name)
else:
signature = line
signature = signature + line
line = input.readline()[:-1]
args = extractArgs(signature, name)
user_functions[name] = [type , args, '']
user_functions[name] = [[type, ''] , args, '']
identifiers_type[name] = "functype"
def parseFunction():
@ -207,18 +213,18 @@ def parseFunction():
line = input.readline()[:-1]
type = None
signature = None
signature = ""
while line != "</FUNCTION>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
type = extractTypes(line[9:-10], name)
else:
signature = line
signature = signature + line
line = input.readline()[:-1]
args = extractArgs(signature, name)
functions[name] = [type , args, '']
functions[name] = [[type, ''] , args, '']
identifiers_type[name] = "function"
print "Parsing: libxml-decl.txt"
@ -309,26 +315,87 @@ print "Parsed: %d files %d identifiers" % (len(files), len(identifiers_file.keys
nbcomments = 0
def insertParameterComment(id, name, value, is_param):
global nbcomments
if functions.has_key(id):
if is_param == 1:
args = functions[id][1]
found = 0
for arg in args:
if arg[1] == name:
arg[2] = value
found = 1
break
if found == 0 and name != '...':
print "Arg %s not found on function %s description" % (name, id)
return
else:
ret = functions[id][0]
ret[1] = value
elif user_functions.has_key(id):
if is_param == 1:
args = user_functions[id][1]
found = 0
for arg in args:
if arg[1] == name:
arg[2] = value
found = 1
break
if found == 0 and name != '...':
print "Arg %s not found on functype %s description" % (name, id)
print args
return
else:
ret = user_functions[id][0]
ret[1] = value
elif macros.has_key(id):
if is_param == 1:
args = macros[id][0]
found = 0
for arg in args:
if arg[0] == name:
arg[1] = value
found = 1
break
if found == 0:
args.append([name, value])
else:
print "Return info for macro %s: %s" % (id, value)
# ret = macros[id][0]
# ret[1] = value
else:
print "lost specific comment %s: %s: %s" % (id, name, value)
return
nbcomments = nbcomments + 1
def insertComment(name, title, value):
global nbcomments
if functions.has_key(name):
functions[name][2] = value
return "function"
elif typedefs.has_key(name):
typedefs[name] = value
return "typedef"
elif macros.has_key(name):
macros[name] = value
macros[name][1] = value
return "macro"
elif variables.has_key(name):
variables[name] = value
variables[name][1] = value
return "variable"
elif structs.has_key(name):
structs[name] = value
return "struct"
elif enums.has_key(name):
enums[name][1] = value
return "enum"
elif user_functions.has_key(name):
user_functions[name] = value
user_functions[name][2] = value
return "user_function"
else:
print "lost comment %s: %s" % (name, value)
return
return "unknown"
nbcomments = nbcomments + 1
import os
@ -426,10 +493,25 @@ class docParser:
self.title = None
self.descr = None
self.string = None
self.type = None
self.in_parameter = 0
self.is_parameter = 0
self.parameter = None
self.parameter_info = None
self.entry = 0
elif tag == 'para':
self._data = []
elif tag == 'title':
self._data = []
elif tag == 'tgroup':
self.in_parameter = 1
elif tag == 'row':
self._data = []
self.entry = 0
elif tag == 'entry':
self.entry = self.entry + 1
elif tag == 'parameter' and self.in_parameter == 1:
self._data = []
elif tag == 'anchor' and self.id == None:
if attrs.has_key('id'):
self.id = attrs['id']
@ -440,20 +522,44 @@ class docParser:
if debug:
print "end %s" % tag
if tag == 'refsect2':
insertComment(self.id, self.title, self.string)
elif tag == 'para':
self.type = insertComment(self.id, self.title, self.string)
self.string = None
elif tag == 'row':
if self.parameter_info != None and self.parameter_info != '':
insertParameterComment(self.id, self.parameter,
self.parameter_info, self.is_parameter)
self.parameter_info = None
self.parameter = 0
self.is_parameter = 0
elif tag == 'parameter' and self.in_parameter == 1 and self.entry == 1:
str = ''
for c in self._data:
str = str + c
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
self.parameter = str
self.is_parameter = 1
self._data = []
elif tag == 'para' or tag == 'entry':
str = ''
for c in self._data:
str = str + c
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
if self.string == None:
str = ''
for c in self._data:
str = str + c
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
self.string = str
elif self.in_parameter == 1:
self.parameter_info = str
self._data = []
elif tag == 'title':
str = ''
@ -491,8 +597,11 @@ print "Parsed: %d XML files collexting %d comments" % (xmlfiles, nbcomments)
##################################################################
def escape(raw):
raw = string.replace(raw, '&', '&amp;')
raw = string.replace(raw, '<', '&lt;')
raw = string.replace(raw, '>', '&gt;')
raw = string.replace(raw, "'", '&apos;')
raw = string.replace(raw, '"', '&quot;')
return raw
print "Saving XML description libxml2-api.xml"
@ -541,28 +650,69 @@ for i in symbols:
(ret, args, doc) = functions[i]
if doc != None and doc != '':
output.write(" <info>%s</info>\n" % (escape(doc)))
output.write(" <return type='%s'/>\n" % (ret))
if ret[1] != None and ret[1] != '':
output.write(" <return type='%s' info='%s'/>\n" % (
ret[0], escape(ret[1])))
else:
if ret[0] != 'void' and\
ret[0][0:4] != 'void': # This one is actually a bug in GTK Doc
print "Description for return on %s is missing" % (i)
output.write(" <return type='%s'/>\n" % (ret[0]))
for arg in args:
output.write(" <arg name='%s' type='%s'/>\n" % (
arg[1], arg[0]))
if arg[2] != None and arg[2] != '':
output.write(" <arg name='%s' type='%s' info='%s'/>\n" %
(arg[1], arg[0], escape(arg[2])))
else:
if arg[0] != '...':
print "Description for %s on %s is missing" % (arg[1], i)
output.write(" <arg name='%s' type='%s'/>\n" % (
arg[1], arg[0]))
output.write(" </%s>\n" % (type));
elif type == 'functype':
output.write(">\n");
(ret, args, doc) = user_functions[i]
if doc != None and doc != '':
output.write(" <info>%s</info>\n" % (escape(doc)))
if ret[1] != None and ret[1] != '':
output.write(" <return type='%s' info='%s'/>\n" % (
ret[0], escape(ret[1])))
else:
if ret[0] != 'void' and\
ret[0][0:4] != 'void': # This one is actually a bug in GTK Doc
print "Description for return on %s is missing" % (i)
output.write(" <return type='%s'/>\n" % (ret[0]))
for arg in args:
if arg[2] != None and arg[2] != '':
output.write(" <arg name='%s' type='%s' info='%s'/>\n" %
(arg[1], arg[0], escape(arg[2])))
else:
if arg[0] != '...':
print "Description for %s on %s is missing" % (arg[1], i)
output.write(" <arg name='%s' type='%s'/>\n" % (
arg[1], arg[0]))
output.write(" </%s>\n" % (type));
elif type == 'macro':
if macros[i] != None and macros[i] != '':
output.write(" info='%s'/>\n" % (escape(macros[i])))
output.write(">\n");
if macros[i][1] != None and macros[i][1] != '':
output.write(" <info>%s</info>\n" % (escape(macros[i][1])))
else:
output.write("/>\n");
print "Description for %s is missing" % (i)
args = macros[i][0]
for arg in args:
if arg[1] != None and arg[1] != '':
output.write(" <arg name='%s' info='%s'/>\n" %
(arg[0], escape(arg[1])))
else:
print "Description for %s on %s is missing" % (arg[1], i)
output.write(" <arg name='%s'/>\n" % (arg[0]))
output.write(" </%s>\n" % (type));
elif type == 'struct':
if structs[i] != None and structs[i] != '':
output.write(" info='%s'/>\n" % (escape(structs[i])))
else:
output.write("/>\n");
elif type == 'functype':
if user_functions[i] != None and user_functions[i] != '':
output.write(" info='%s'/>\n" % (escape(user_functions[i])))
else:
output.write("/>\n");
elif type == 'variable':
if variables[i] != None and variables[i] != '':
if variables[i][1] != None and variables[i][1] != '':
output.write(" info='%s'/>\n" % (escape(variables[i])))
else:
output.write("/>\n");

View File

@ -74,6 +74,12 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_end(args);
}
/**
* initGenericErrorDefaultFunc:
* @handler: the handler
*
* Set or reset (if NULL) the default handler for generic errors
*/
void
initGenericErrorDefaultFunc(xmlGenericErrorFunc * handler)
{

155
globals.c
View File

@ -52,9 +52,40 @@ xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#else
/**
* xmlFree:
* @mem: an already allocated block of memory
*
* The variable holding the libxml free() implementation
*/
xmlFreeFunc xmlFree = (xmlFreeFunc) free;
/**
* xmlMalloc:
* @size: the size requested in bytes
*
* The variable holding the libxml malloc() implementation
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
/**
* xmlRealloc:
* @mem: an already allocated block of memory
* @size: the new size requested in bytes
*
* The variable holding the libxml realloc() implementation
*
* Returns a pointer to the newly reallocated block or NULL in case of error
*/
xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
/**
* xmlMemStrdup:
* @str: a zero terminated string
*
* The variable holding the libxml strdup() implementation
*
* Returns the copy of the string or NULL in case of error
*/
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#endif
@ -88,26 +119,102 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#undef xmlMemStrdup
#undef xmlRealloc
/**
* xmlParserVersion:
*
* Constant string describing the internal version of the library
*/
const char *xmlParserVersion = LIBXML_VERSION_STRING;
/*
* Buffers stuff
/**
* xmlBufferAllocScheme:
*
* Global setting, default allocation policy for buffers, default is
* XML_BUFFER_ALLOC_EXACT
*/
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
/**
* xmlDefaultBufferSize:
*
* Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
*/
int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
/*
* Parser defaults
*/
/**
* oldXMLWDcompatibility:
*
* Global setting, DEPRECATED.
*/
int oldXMLWDcompatibility = 0; /* DEPRECATED */
/**
* xmlParserDebugEntities:
*
* Global setting, asking the parser to print out debugging informations.
* while handling entities.
* Disabled by default
*/
int xmlParserDebugEntities = 0;
/**
* xmlDoValidityCheckingDefaultValue:
*
* Global setting, indicate that the parser should work in validating mode.
* Disabled by default.
*/
int xmlDoValidityCheckingDefaultValue = 0;
/**
* xmlGetWarningsDefaultValue:
*
* Global setting, indicate that the parser should provide warnings.
* Activated by default.
*/
int xmlGetWarningsDefaultValue = 1;
/**
* xmlLoadExtDtdDefaultValue:
*
* Global setting, indicate that the parser should load DTD while not
* validating.
* Disabled by default.
*/
int xmlLoadExtDtdDefaultValue = 0;
/**
* xmlPedanticParserDefaultValue:
*
* Global setting, indicate that the parser be pedantic
* Disabled by default.
*/
int xmlPedanticParserDefaultValue = 0;
/**
* xmlLineNumbersDefaultValue:
*
* Global setting, indicate that the parser should store the line number
* in the content field of elements in the DOM tree.
* Disabled by default since this may not be safe for old classes of
* applicaton.
*/
int xmlLineNumbersDefaultValue = 0;
/**
* xmlKeepBlanksDefaultValue:
*
* Global setting, indicate that the parser should keep all blanks
* nodes found in the content
* Activated by default, this is actually needed to have the parser
* conformant to the XML Recommendation, however the option is kept
* for some applications since this was libxml1 default behaviour.
*/
int xmlKeepBlanksDefaultValue = 1;
/**
* xmlSubstituteEntitiesDefaultValue:
*
* Global setting, indicate that the parser should not generate entity
* references but replace them with the actual content of the entity
* Disabled by default, this should be activated when using XPath since
* the XPath data model requires entities replacement and the XPath
* engine does not handle entities references transparently.
*/
int xmlSubstituteEntitiesDefaultValue = 0;
/*
@ -119,16 +226,42 @@ int xmlSubstituteEntitiesDefaultValue = 0;
void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
const char *msg,
...);
/**
* xmlGenericError:
*
* Global setting: function used for generic error callbacks
*/
xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
/**
* xmlGenericErrorContext:
*
* Global setting passed to generic error callbacks
*/
void *xmlGenericErrorContext = NULL;
/*
* output defaults
*/
/**
* xmlIndentTreeOutput:
*
* Global setting, asking the serializer to indent the output tree by default
* Disabled by default
*/
int xmlIndentTreeOutput = 0;
/**
* xmlSaveNoEmptyTags:
*
* Global setting, asking the serializer to not output empty tags
* as <empty/> but <empty></empty>. those two forms are undistinguishable
* once parsed.
* Disabled by default
*/
int xmlSaveNoEmptyTags = 0;
/*
/**
* xmlDefaultSAXHandler:
*
* Default handler for XML, builds the DOM tree
*/
xmlSAXHandler xmlDefaultSAXHandler = {
@ -162,16 +295,20 @@ xmlSAXHandler xmlDefaultSAXHandler = {
0
};
/*
* The default SAX Locator.
/**
* xmlDefaultSAXLocator:
*
* The default SAX Locator
* { getPublicId, getSystemId, getLineNumber, getColumnNumber}
*/
xmlSAXLocator xmlDefaultSAXLocator = {
getPublicId, getSystemId, getLineNumber, getColumnNumber
};
#ifdef LIBXML_HTML_ENABLED
/*
/**
* htmlDefaultSAXHandler:
*
* Default handler for HTML, builds the DOM tree
*/
xmlSAXHandler htmlDefaultSAXHandler = {
@ -207,7 +344,9 @@ xmlSAXHandler htmlDefaultSAXHandler = {
#endif /* LIBXML_HTML_ENABLED */
#ifdef LIBXML_DOCB_ENABLED
/*
/**
* docbDefaultSAXHandler:
*
* Default handler for SGML DocBook, builds the DOM tree
*/
xmlSAXHandler docbDefaultSAXHandler = {

View File

@ -35,6 +35,11 @@ extern "C" {
*/
#define XML_CATALOGS_NAMESPACE \
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
/**
* XML_CATALOG_PI:
*
* the specific XML Catalog Processing Instuction name
*/
#define XML_CATALOG_PI \
(const xmlChar *) "oasis-xml-catalog"

View File

@ -33,9 +33,43 @@ typedef xmlHashTable *xmlHashTablePtr;
/*
* function types:
*/
/**
* xmlHashDeallocator:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to free data from a hash
*/
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
/**
* xmlHashCopier:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to copy data from a hash
*
* Returns a copy of the data or NULL in case of error
*/
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
typedef void *(*xmlHashScanner)(void *payload, void *data, xmlChar *name);
/**
* xmlHashScanner:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
*
* Callback when scanning data in a hash with the simple scanner
*/
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
/**
* xmlHashScannerFull:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
* @name2: the second name associated
* @name3: the third name associated
*
* Callback when scanning data in a hash with the full scanner
*/
typedef void (*xmlHashScannerFull)(void *payload, void *data,
const xmlChar *name, const xmlChar *name2,
const xmlChar *name3);

View File

@ -28,8 +28,32 @@ typedef xmlLink *xmlLinkPtr;
typedef struct _xmlList xmlList;
typedef xmlList *xmlListPtr;
/**
* xmlListDeallocator:
* @lk: the data to deallocate
*
* Callback function used to free data from a list
*/
typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
/**
* xmlListDataCompare:
* @data0: the first data
* @data1: the second data
*
* Callback function used to compare 2 data
*
* Returns 0 is equality, -1 or 1 otherwise depending on the ordering
*/
typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
/**
* xmlListWalker:
* @data: the data found in the list
* @user: extra user provided data to the walker
*
* Callback function used when walking a list with xmlListWalk()
*
* Returns 0 to stop walking the list, 1 otherwise
*/
typedef int (*xmlListWalker) (const void *data, const void *user);
/* Creation/Deletion */

View File

@ -37,7 +37,13 @@ extern "C" {
* progressive reading and I18N conversions to the internal UTF-8 format.
*/
typedef void (* xmlParserInputDeallocate)(xmlChar *);
/**
* xmlParserInputDeallocate:
* @str: the string to deallocate
*
* Callback for freeing some parser input allocations
*/
typedef void (* xmlParserInputDeallocate)(xmlChar *str);
struct _xmlParserInput {
/* Input buffer */
@ -237,52 +243,327 @@ struct _xmlSAXLocator {
* of the input generate data or structure informations.
*/
/**
* resolveEntitySAXFunc:
* @ctx: the user data (XML parser context)
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* Callback:
* The entity loader, to control the loading of external entities,
* the application can either:
* - override this resolveEntity() callback in the SAX block
* - or better use the xmlSetExternalEntityLoader() function to
* set up it's own entity resolution routine
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
const xmlChar *publicId, const xmlChar *systemId);
typedef void (*internalSubsetSAXFunc) (void *ctx, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *SystemID);
typedef void (*externalSubsetSAXFunc) (void *ctx, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *SystemID);
const xmlChar *publicId,
const xmlChar *systemId);
/**
* internalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the root element name
* @ExternalID: the external ID
* @SystemID: the SYSTEM ID (e.g. filename or URL)
*
* Callback on internal subset declaration.
*/
typedef void (*internalSubsetSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
/**
* externalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the root element name
* @ExternalID: the external ID
* @SystemID: the SYSTEM ID (e.g. filename or URL)
*
* Callback on external subset declaration.
*/
typedef void (*externalSubsetSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
/**
* getEntitySAXFunc:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* Get an entity by name
*
* Returns the xmlEntityPtr if found.
*/
typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
const xmlChar *name);
const xmlChar *name);
/**
* getParameterEntitySAXFunc:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* Get a parameter entity by name
*
* Returns the xmlEntityPtr if found.
*/
typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
const xmlChar *name);
const xmlChar *name);
/**
* entityDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the entity name
* @type: the entity type
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @content: the entity value (without processing).
*
* An entity definition has been parsed
*/
typedef void (*entityDeclSAXFunc) (void *ctx,
const xmlChar *name, int type, const xmlChar *publicId,
const xmlChar *systemId, xmlChar *content);
typedef void (*notationDeclSAXFunc)(void *ctx, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId);
typedef void (*attributeDeclSAXFunc)(void *ctx, const xmlChar *elem,
const xmlChar *name, int type, int def,
const xmlChar *defaultValue, xmlEnumerationPtr tree);
typedef void (*elementDeclSAXFunc)(void *ctx, const xmlChar *name,
int type, xmlElementContentPtr content);
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
/**
* notationDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The name of the notation
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* What to do when a notation declaration has been parsed.
*/
typedef void (*notationDeclSAXFunc)(void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
/**
* attributeDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @elem: the name of the element
* @fullname: the attribute name
* @type: the attribute type
* @def: the type of default value
* @defaultValue: the attribute default value
* @tree: the tree of enumerated value set
*
* An attribute definition has been parsed
*/
typedef void (*attributeDeclSAXFunc)(void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
/**
* elementDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the element name
* @type: the element type
* @content: the element value tree
*
* An element definition has been parsed
*/
typedef void (*elementDeclSAXFunc)(void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
/**
* unparsedEntityDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The name of the entity
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @notationName: the name of the notation
*
* What to do when an unparsed entity declaration is parsed
*/
typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
const xmlChar *name, const xmlChar *publicId,
const xmlChar *systemId, const xmlChar *notationName);
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
/**
* setDocumentLocatorSAXFunc:
* @ctx: the user data (XML parser context)
* @loc: A SAX Locator
*
* Receive the document locator at startup, actually xmlDefaultSAXLocator
* Everything is available on the context, so this is useless in our case.
*/
typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
xmlSAXLocatorPtr loc);
xmlSAXLocatorPtr loc);
/**
* startDocumentSAXFunc:
* @ctx: the user data (XML parser context)
*
* called when the document start being processed.
*/
typedef void (*startDocumentSAXFunc) (void *ctx);
/**
* endDocumentSAXFunc:
* @ctx: the user data (XML parser context)
*
* called when the document end has been detected.
*/
typedef void (*endDocumentSAXFunc) (void *ctx);
typedef void (*startElementSAXFunc) (void *ctx, const xmlChar *name,
const xmlChar **atts);
typedef void (*endElementSAXFunc) (void *ctx, const xmlChar *name);
typedef void (*attributeSAXFunc) (void *ctx, const xmlChar *name,
const xmlChar *value);
typedef void (*referenceSAXFunc) (void *ctx, const xmlChar *name);
typedef void (*charactersSAXFunc) (void *ctx, const xmlChar *ch,
int len);
/**
* startElementSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The element name, including namespace prefix
* @atts: An array of name/value attributes pairs, NULL terminated
*
* called when an opening tag has been processed.
*/
typedef void (*startElementSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar **atts);
/**
* endElementSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The element name
*
* called when the end of an element has been detected.
*/
typedef void (*endElementSAXFunc) (void *ctx,
const xmlChar *name);
/**
* attributeSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The attribute name, including namespace prefix
* @value: The attribute value
*
* Handle an attribute that has been read by the parser.
* The default handling is to convert the attribute into an
* DOM subtree and past it in a new xmlAttr element added to
* the element.
*/
typedef void (*attributeSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar *value);
/**
* referenceSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* called when an entity reference is detected.
*/
typedef void (*referenceSAXFunc) (void *ctx,
const xmlChar *name);
/**
* charactersSAXFunc:
* @ctx: the user data (XML parser context)
* @ch: a xmlChar string
* @len: the number of xmlChar
*
* receiving some chars from the parser.
*/
typedef void (*charactersSAXFunc) (void *ctx,
const xmlChar *ch,
int len);
/**
* ignorableWhitespaceSAXFunc:
* @ctx: the user data (XML parser context)
* @ch: a xmlChar string
* @len: the number of xmlChar
*
* receiving some ignorable whitespaces from the parser.
* UNUSED: by default the DOM building will use characters
*/
typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
const xmlChar *ch, int len);
const xmlChar *ch,
int len);
/**
* processingInstructionSAXFunc:
* @ctx: the user data (XML parser context)
* @target: the target name
* @data: the PI data's
*
* A processing instruction has been parsed.
*/
typedef void (*processingInstructionSAXFunc) (void *ctx,
const xmlChar *target, const xmlChar *data);
typedef void (*commentSAXFunc) (void *ctx, const xmlChar *value);
typedef void (*cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len);
typedef void (*warningSAXFunc) (void *ctx, const char *msg, ...);
typedef void (*errorSAXFunc) (void *ctx, const char *msg, ...);
typedef void (*fatalErrorSAXFunc) (void *ctx, const char *msg, ...);
const xmlChar *target,
const xmlChar *data);
/**
* commentSAXFunc:
* @ctx: the user data (XML parser context)
* @value: the comment content
*
* A comment has been parsed.
*/
typedef void (*commentSAXFunc) (void *ctx,
const xmlChar *value);
/**
* cdataBlockSAXFunc:
* @ctx: the user data (XML parser context)
* @value: The pcdata content
* @len: the block length
*
* called when a pcdata block has been parsed
*/
typedef void (*cdataBlockSAXFunc) (
void *ctx,
const xmlChar *value,
int len);
/**
* warningSAXFunc:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format a warning messages, callback
*/
typedef void (*warningSAXFunc) (void *ctx,
const char *msg, ...);
/**
* errorSAXFunc:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format an error messages, callback
*/
typedef void (*errorSAXFunc) (void *ctx,
const char *msg, ...);
/**
* fatalErrorSAXFunc:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format fatal error messages, callback
*/
typedef void (*fatalErrorSAXFunc) (void *ctx,
const char *msg, ...);
/**
* isStandaloneSAXFunc:
* @ctx: the user data (XML parser context)
*
* Is this document tagged standalone ?
*
* Returns 1 if true
*/
typedef int (*isStandaloneSAXFunc) (void *ctx);
/**
* hasInternalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
*
* Does this document has an internal subset
*
* Returns 1 if true
*/
typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
/**
* hasExternalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
*
* Does this document has an external subset
*
* Returns 1 if true
*/
typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
typedef struct _xmlSAXHandler xmlSAXHandler;
@ -328,9 +609,9 @@ struct _xmlSAXHandler {
*
* Returns the entity input parser
*/
typedef xmlParserInputPtr (*xmlExternalEntityLoader)(const char *URL,
const char *ID,
xmlParserCtxtPtr context);
typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
const char *ID,
xmlParserCtxtPtr context);
/*
* Global variables: just the default SAX interface tables and XML
@ -569,7 +850,7 @@ xmlExternalEntityLoader
xmlParserInputPtr
xmlLoadExternalEntity (const char *URL,
const char *ID,
xmlParserCtxtPtr context);
xmlParserCtxtPtr ctxt);
#ifdef __cplusplus
}

View File

@ -399,6 +399,15 @@ htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename,
* Specific function to keep track of entities references
* and used by the XSLT debugger
*/
/**
* xmlEntityReferenceFunc:
* @ent: the entity
* @firstNode: the fist node in the chunk
* @lastNode: the last nod in the chunk
*
* Callback function used when one need to be able to track back the
* provenance of a chunk of nodes inherited from an entity replacement
*/
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
xmlNodePtr firstNode,
xmlNodePtr lastNode);

View File

@ -42,6 +42,11 @@ typedef xmlParserInput *xmlParserInputPtr;
typedef struct _xmlParserCtxt xmlParserCtxt;
typedef xmlParserCtxt *xmlParserCtxtPtr;
/**
* BASE_BUFFER_SIZE:
*
* default buffer size 4000
*/
#define BASE_BUFFER_SIZE 4000
/**

View File

@ -24,12 +24,35 @@ typedef struct _xmlValidState xmlValidState;
typedef xmlValidState *xmlValidStatePtr;
/**
* xmlValidityErrorFunc:
* @ctx: an xmlValidCtxtPtr validity error context
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity error is found, this is a message
* oriented function similar to an *printf function.
*/
typedef void (*xmlValidityErrorFunc) (void *ctx,
const char *msg,
...);
/**
* xmlValidityWarningFunc:
* @ctx: an xmlValidCtxtPtr validity error context
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity warning is found, this is a message
* oriented function similar to an *printf function.
*/
typedef void (*xmlValidityWarningFunc) (void *ctx,
const char *msg,
...);
/**
* xmlValidCtxt:
* an xmlValidCtxt is used for error reporting when validating
*/
typedef void (*xmlValidityErrorFunc) (void *ctx, const char *msg, ...);
typedef void (*xmlValidityWarningFunc) (void *ctx, const char *msg, ...);
typedef struct _xmlValidCtxt xmlValidCtxt;
typedef xmlValidCtxt *xmlValidCtxtPtr;
struct _xmlValidCtxt {

View File

@ -30,9 +30,44 @@ extern "C" {
* I/O structures.
*/
/**
* xmlInputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to detect if the current handler
* can provide input fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Input module should be used
*/
typedef int (*xmlInputMatchCallback) (char const *filename);
/**
* xmlInputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to open the resource
*
* Returns an Input context or NULL in case or error
*/
typedef void * (*xmlInputOpenCallback) (char const *filename);
/**
* xmlInputReadCallback:
* @context: an Input context
* @buffer: the buffer to store data read
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Input API to read the resource
*
* Returns the number of bytes read or -1 in case of error
*/
typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
/**
* xmlInputCloseCallback:
* @context: an Input context
*
* Callback used in the I/O Input API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (*xmlInputCloseCallback) (void * context);
struct _xmlParserInputBuffer {
@ -52,10 +87,45 @@ struct _xmlParserInputBuffer {
* I/O structures.
*/
/**
* xmlOutputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to detect if the current handler
* can provide output fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Output module should be used
*/
typedef int (*xmlOutputMatchCallback) (char const *filename);
/**
* xmlOutputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to open the resource
*
* Returns an Output context or NULL in case or error
*/
typedef void * (*xmlOutputOpenCallback) (char const *filename);
/**
* xmlOutputWriteCallback:
* @context: an Output context
* @buffer: the buffer of data to write
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Output API to write to the resource
*
* Returns the number of bytes written or -1 in case of error
*/
typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
int len);
/**
* xmlOutputCloseCallback:
* @context: an Output context
*
* Callback used in the I/O Output API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (*xmlOutputCloseCallback) (void * context);
struct _xmlOutputBuffer {

View File

@ -138,11 +138,18 @@ typedef enum {
XML_ERR_NO_DTD /* 94 */
}xmlParserErrors;
/*
/**
* xmlGenericErrorFunc:
* @ctx: a parsing context
* @msg: the message
* @...: the extra arguments of the varags to format the message
*
* Signature of the function to use when there is an error and
* no parsing or validity context available
*/
typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...);
typedef void (*xmlGenericErrorFunc) (void *ctx,
const char *msg,
...);
/*
* Use the following function to reset the two global variables

View File

@ -55,10 +55,43 @@ extern "C" {
/*
* The XML memory wrapper support 4 basic overloadable functions
*/
typedef void (*xmlFreeFunc)(void *);
typedef void *(*xmlMallocFunc)(size_t);
typedef void *(*xmlReallocFunc)(void *, size_t);
typedef char *(*xmlStrdupFunc)(const char *);
/**
* xmlFreeFunc:
* @mem: an already allocated block of memory
*
* Signature for a free() implementation
*/
typedef void (*xmlFreeFunc)(void *mem);
/**
* xmlMallocFunc:
* @size: the size requested in bytes
*
* Signature for a malloc() implementation
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
typedef void *(*xmlMallocFunc)(size_t size);
/**
* xmlReallocFunc:
* @mem: an already allocated block of memory
* @size: the new size requested in bytes
*
* Signature for a realloc() implementation
*
* Returns a pointer to the newly reallocated block or NULL in case of error
*/
typedef void *(*xmlReallocFunc)(void *mem, size_t size);
/**
* xmlStrdupFunc:
* @str: a zero terminated string
*
* Signature for an strdup() implementation
*
* Returns the copy of the string or NULL in case of error
*/
typedef char *(*xmlStrdupFunc)(const char *str);
/*
* The 4 interfaces used for all memory handling within libxml

View File

@ -71,7 +71,7 @@ extern void xmlCheckVersion(int version);
#endif /* VMS */
/**
* LIBXML_THREADS_ENABLED:
* LIBXML_THREAD_ENABLED:
*
* Whether the thread support is configured in
*/

View File

@ -102,9 +102,15 @@ struct _xmlXPathObject {
int index2;
};
/*
/**
* xmlXPathConvertFunc:
* @obj: an XPath object
* @type: the number of the target type
*
* A conversion function is associated to a type and used to cast
* the new type to primitive values.
*
* Returns -1 in case of error, 0 otherwise
*/
typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
@ -152,14 +158,20 @@ struct _xmlXPathFunct {
xmlXPathEvalFunc func; /* the evaluation function */
};
/*
/**
* xmlXPathAxisFunc:
* @ctxt: the XPath interpreter context
* @cur: the previous node being explored on that axis
*
* An axis traversal function. To traverse an axis, the engine calls
* the first time with cur == NULL and repeat until the function returns
* NULL indicating the end of the axis traversal.
*
* Returns the next node in that axis or NULL if at the end of the axis
*/
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr cur);
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr cur);
/*
* Extra axis: a name and an axis function.
@ -273,9 +285,11 @@ struct _xmlXPathParserContext {
/**
* xmlXPathFunction:
* @ctxt: the XPath interprestation context
* @nargs: the number of arguments
*
* An XPath function
* The arguments (if any) are popped out of the context stack
* The arguments (if any) are popped out from the context stack
* and the result is pushed on the stack.
*/

View File

@ -324,7 +324,18 @@ void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
/*
* Variable Lookup forwarding
*/
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
/**
* xmlXPathVariableLookupFunc:
* @ctxt: an XPath context
* @name: name of the variable
* @ns_uri: the namespace name hosting this variable
*
* Prototype for callbacks used to plug variable lookup in the XPath
* engine
*
* Returns the XPath object value or NULL if not found
*/
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
@ -335,6 +346,17 @@ void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
/*
* Function Lookup forwarding
*/
/**
* xmlXPathFuncLookupFunc:
* @ctxt: an XPath context
* @name: name of the function
* @ns_uri: the namespace name hosting this function
*
* Prototype for callbacks used to plug function lookup in the XPath
* engine
*
* Returns the XPath function or NULL if not found
*/
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);

View File

@ -156,9 +156,11 @@ scope type name##Pop(xmlParserCtxtPtr ctxt) { \
/**
* inputPush:
* @ctxt: an XML parser context
* @input: the parser input
* @value: the parser input
*
* Pushes a new parser input on top of the input stack
*
* Returns 0 in case of error, the index in the stack otherwise
*/
/**
* namePop:
@ -171,9 +173,11 @@ scope type name##Pop(xmlParserCtxtPtr ctxt) { \
/**
* namePush:
* @ctxt: an XML parser context
* @name: the element name
* @value: the element name
*
* Pushes a new element name on top of the name stack
*
* Returns 0 in case of error, the index in the stack otherwise
*/
/**
* nodePop:
@ -186,9 +190,11 @@ scope type name##Pop(xmlParserCtxtPtr ctxt) { \
/**
* nodePush:
* @ctxt: an XML parser context
* @node: the element node
* @value: the element node
*
* Pushes a new element node on top of the node stack
*
* Returns 0 in case of error, the index in the stack otherwise
*/
/*
* Those macros actually generate the functions

3
tree.c
View File

@ -5036,7 +5036,8 @@ xmlBufferSetAllocationScheme(xmlBufferPtr buf,
* xmlBufferFree:
* @buf: the buffer to free
*
* Frees an XML buffer.
* Frees an XML buffer. It frees both the content and the structure which
* encapsulate it.
*/
void
xmlBufferFree(xmlBufferPtr buf) {

View File

@ -2006,7 +2006,7 @@ xmlParserInputBufferCreateIO(xmlInputReadCallback ioread,
* @iowrite: an I/O write function
* @ioclose: an I/O close function
* @ioctx: an I/O handler
* @enc: the charset encoding if known
* @encoder: the charset encoding if known
*
* Create a buffered output for the progressive saving
* to an I/O handler

View File

@ -340,7 +340,7 @@ error:
/**
* xmlMemStrdupLoc:
* @ptr: the initial string pointer
* @str: the initial string pointer
* @file: the file name or NULL
* @line: the line number
*