1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-04-24 18:50:07 +03:00

Updated TODO conditionnal compile of messages from the parser/tree.c code,

Updated TODO
conditionnal compile of messages from the parser/tree.c code,
Daniel
This commit is contained in:
Daniel Veillard 2000-01-15 14:20:03 +00:00
parent 0142b84bbf
commit ad8f99df6b
4 changed files with 279 additions and 12 deletions

View File

@ -1,3 +1,10 @@
Sat Jan 15 15:09:06 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* TODO: updated
* tree.c, parser.c: made sure that only memory alloc problems
and internal parser errors are allowed to write to stdout or
stderr.
Thu Jan 13 11:49:11 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org> Thu Jan 13 11:49:11 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* tree.c : restored xmlNewGlobalNs since this seems used by * tree.c : restored xmlNewGlobalNs since this seems used by

151
TODO
View File

@ -1,16 +1,149 @@
TODO for the XML parser: TODO for the XML parser and stuff:
==================================
- use libunicode ! URGENT:
- finish XPath, then XPointer, Xlink =======
- Support for UTF-8 and UTF-16 encoding (Urgent !!!). - Support for UTF-8 and UTF-16 encoding
- progressive parsing. The entity support is a first step toward => added some convertion routines provided by Martin Durst but I didn't
try to glue them in. I plan to keep everything internally as UTF-8
this is slightly more costly but more compact, and recent processors
efficiency is cache related. The key for good performances is keeping
the data set small, so will I.
=> the new progressive reading routines call the detection code which
need to be enabled, then thest the ISO->UTF-8 stuff, and add more
charset conv routines.
TODO:
=====
- Tools to produce man pages from the SGML docs.
- Finish XPath
=> attributes addressing troubles
=> defaulted attributes handling
=> namespace axis ?
- Add Xpointer recognition/API
- Add Xlink recognition/API
=> started adding an xlink.[ch] with a unified API for XML and HTML.
- Implement XSLT
=> seems that someone volunteered ?!?
- Implement XSchemas
- O2K parsing;
=> this is a somewhat ugly mix of HTML and XML, adding a specific
routine in the comment parsing code of HTML and plug the XML
parsing one in-there should not be too hard. Key point is to get
XSL to transform all this to something decent ...
- Add regression tests for all WFC errors
=> did some in test/WFC , not added to the Makefile yet.
- Optimization of tag strings allocation.
- Language identification code, productions [33] to [38]
- Conditional sections in DTDs [61] to [65]
=> should this crap be really implemented ???
- Allow parsed entities defined in the internal subset to override
the ones defined in the external subset (DtD customization).
=> This mean that the entity content should be computed only at
use time, i.e. keep the orig string only at parse time and expand
only when referenced from the external subset :-(
Needed for complete use of most DTD from Eve Maler
- maintain coherency of namespace when doing cut'n paste operations
=> the functions are coded, but need testing
- function to rebuild the ID table ?
- extend the shell with:
- edit
- load/save
- mv (yum, yum, but it's harder because directories are ordered in
our case, mvup and mvdown would be required)
- Parsing of a well balanced chunk
- Add HTML validation using the XHTML DTD
- problem: do we want to keep and maintain the code for handling
DTD/System ID cache directly in libxml ?
- Add a DTD cache prefilled with xhtml DTDs and entities and a program to
manage them -> like the /usr/bin/install-catalog from SGML
right place seems $datadir/xmldtds
- turn tester into a generic program xml-test installed with xml-devel
- Add output to XHTML in case of HTML documents.
- dynamically adapt the alloc entry point to use g_alloc()/g_free()
if the programmer wants it
Done:
=====
- External entities loading:
- allow override by client code
- make sure it is alled for all external entities referenced
Done, client code should use xmlSetExternalEntityLoader() to set
the default loading routine. It will be called each time an external
entity entity resolution is triggered.
- maintain ID coherency when removing/changing attributes
The function used to deallocate attributes now check for it being an
ID and removes it from the table.
- push mode parsing i.e. non-blocking state based parser
done, both for XML and HTML parsers. Use xmlCreatePushParserCtxt()
and xmlParseChunk() and html counterparts.
The tester program now has a --push option to select that parser
front-end. Douplicated tests to use both and check results are similar.
- Most of XPath, still see some troubles and occasionnal memleaks.
- an XML shell, allowing to traverse/manipulate an XML document with
a shell like interface, and using XPath for the anming syntax
- use of readline and history added when available
- the shell interface has been cleanly separated and moved to debugXML.c
- HTML parser, should be fairly stable now
- API to search the lang of an attribute
- Collect IDs at parsing and maintain a table.
PBM: maintain the table coherency
PBM: how to detect ID types in absence of DtD !
- Use it for XPath ID support
- Add validity checking
Should be finished now !
- Add regression tests with entity substitutions
- External Parsed entities, either XML or external Subset [78] and [79]
parsing the xmllang DtD now works, so it should be sufficient for
most cases !
- progressive reading. The entity support is a first step toward
asbtraction of an input stream. A large part of the context is still asbtraction of an input stream. A large part of the context is still
located on the stack, moving to a state machine and putting everyting located on the stack, moving to a state machine and putting everyting
in the parsing context should provide an adequate solution. in the parsing context should provide an adequate solution.
=> Rather than progressive parsing, give more power to the SAX-like
interface. Currently the DOM-like representation is built but
=> it should be possible to define that only as a set of SAX callbacks
and remove the tree creation from the parser code.
DONE
- DOM support, instead of using a proprietary in memory
format for the document representation, the parser should
call a DOM API to actually build the resulting document.
Then the parser becomes independent of the in-memory
representation of the document. Even better using RPC's
the parser can actually build the document in another
program.
=> Work started, now the internal representation is by default
very near a direct DOM implementation. The DOM glue is implemented
as a separate module. See the GNOME gdome module.
Done:
- Improve the support for SAX
- C++ support : John Ehresman <jehresma@dsg.harvard.edu> - C++ support : John Ehresman <jehresma@dsg.harvard.edu>
- Updated code to follow more recent specs, added compatibility flag - Updated code to follow more recent specs, added compatibility flag
- Better error handling, use a dedicated, overridable error - Better error handling, use a dedicated, overridable error
@ -18,5 +151,7 @@ Done:
- Support for CDATA. - Support for CDATA.
- Keep track of line numbers for better error reporting. - Keep track of line numbers for better error reporting.
- Support for PI (SAX one). - Support for PI (SAX one).
- Support for Comments (bad, should be in ASAP, they are parsed
but not stored), should be configurable.
- Improve the support of entities on save (+SAX).
$Id$

View File

@ -795,7 +795,6 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
int val = 0; int val = 0;
if (ctxt->token != 0) { if (ctxt->token != 0) {
fprintf(stderr, "xmlParseCharRef : ctxt->token != 0\n");
val = ctxt->token; val = ctxt->token;
ctxt->token = 0; ctxt->token = 0;
return(val); return(val);
@ -994,7 +993,6 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) {
xmlEntityPtr ent = NULL; xmlEntityPtr ent = NULL;
if (ctxt->token != 0) { if (ctxt->token != 0) {
fprintf(stderr, "xmlParserHandleReference : ctxt->token != 0\n");
return; return;
} }
if (CUR != '&') return; if (CUR != '&') return;
@ -1229,7 +1227,6 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
xmlParserInputPtr input; xmlParserInputPtr input;
if (ctxt->token != 0) { if (ctxt->token != 0) {
fprintf(stderr, "xmlParserHandlePEReference : ctxt->token != 0\n");
return; return;
} }
if (CUR != '%') return; if (CUR != '%') return;

130
tree.c
View File

@ -48,6 +48,9 @@ static int xmlCheckDTD = 1;
(n)->last = ulccur; \ (n)->last = ulccur; \
}} }}
/* #define DEBUG_BUFFER */
/* #define DEBUG_TREE */
/************************************************************************ /************************************************************************
* * * *
* Allocation and deallocation of basic structures * * Allocation and deallocation of basic structures *
@ -95,7 +98,9 @@ xmlUpgradeOldNs(xmlDocPtr doc) {
if ((doc == NULL) || (doc->oldNs == NULL)) return; if ((doc == NULL) || (doc->oldNs == NULL)) return;
if (doc->root == NULL) { if (doc->root == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlUpgradeOldNs: failed no root !\n"); fprintf(stderr, "xmlUpgradeOldNs: failed no root !\n");
#endif
return; return;
} }
@ -126,7 +131,9 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
xmlNsPtr cur; xmlNsPtr cur;
if (href == NULL) { if (href == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewNs: href == NULL !\n"); fprintf(stderr, "xmlNewNs: href == NULL !\n");
#endif
return(NULL); return(NULL);
} }
@ -248,7 +255,9 @@ xmlNewGlobalNs(xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix) {
void void
xmlSetNs(xmlNodePtr node, xmlNsPtr ns) { xmlSetNs(xmlNodePtr node, xmlNsPtr ns) {
if (node == NULL) { if (node == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlSetNs: node == NULL\n"); fprintf(stderr, "xmlSetNs: node == NULL\n");
#else
return; return;
} }
node->ns = ns; node->ns = ns;
@ -263,7 +272,9 @@ xmlSetNs(xmlNodePtr node, xmlNsPtr ns) {
void void
xmlFreeNs(xmlNsPtr cur) { xmlFreeNs(xmlNsPtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlFreeNs : ns == NULL\n"); fprintf(stderr, "xmlFreeNs : ns == NULL\n");
#endif
return; return;
} }
if (cur->href != NULL) xmlFree((char *) cur->href); if (cur->href != NULL) xmlFree((char *) cur->href);
@ -282,7 +293,9 @@ void
xmlFreeNsList(xmlNsPtr cur) { xmlFreeNsList(xmlNsPtr cur) {
xmlNsPtr next; xmlNsPtr next;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlFreeNsList : ns == NULL\n"); fprintf(stderr, "xmlFreeNsList : ns == NULL\n");
#endif
return; return;
} }
while (cur != NULL) { while (cur != NULL) {
@ -308,9 +321,12 @@ xmlNewDtd(xmlDocPtr doc, const xmlChar *name,
xmlDtdPtr cur; xmlDtdPtr cur;
if ((doc != NULL) && (doc->extSubset != NULL)) { if ((doc != NULL) && (doc->extSubset != NULL)) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewDtd(%s): document %s already have a DTD %s\n", fprintf(stderr, "xmlNewDtd(%s): document %s already have a DTD %s\n",
/* !!! */ (char *) name, doc->name, /* !!! */ (char *) name, doc->name,
/* !!! */ (char *)doc->extSubset->name); /* !!! */ (char *)doc->extSubset->name);
#endif
return(NULL);
} }
/* /*
@ -360,9 +376,11 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
xmlDtdPtr cur; xmlDtdPtr cur;
if ((doc != NULL) && (doc->intSubset != NULL)) { if ((doc != NULL) && (doc->intSubset != NULL)) {
#ifdef DEBUG_TREE
fprintf(stderr, fprintf(stderr,
"xmlCreateIntSubset(): document %s already have an internal subset\n", "xmlCreateIntSubset(): document %s already have an internal subset\n",
doc->name); doc->name);
#endif
return(NULL); return(NULL);
} }
@ -406,7 +424,9 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
void void
xmlFreeDtd(xmlDtdPtr cur) { xmlFreeDtd(xmlDtdPtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlFreeDtd : DTD == NULL\n"); fprintf(stderr, "xmlFreeDtd : DTD == NULL\n");
#endif
return; return;
} }
if (cur->name != NULL) xmlFree((char *) cur->name); if (cur->name != NULL) xmlFree((char *) cur->name);
@ -435,7 +455,9 @@ xmlNewDoc(const xmlChar *version) {
xmlDocPtr cur; xmlDocPtr cur;
if (version == NULL) { if (version == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewDoc : version == NULL\n"); fprintf(stderr, "xmlNewDoc : version == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -544,8 +566,10 @@ xmlStringLenGetNodeList(xmlDocPtr doc, const xmlChar *value, int len) {
q = cur; q = cur;
while ((*cur != 0) && (cur - value < len) && (*cur != ';')) cur++; while ((*cur != 0) && (cur - value < len) && (*cur != ';')) cur++;
if ((*cur == 0) || (cur - value >= len)) { if ((*cur == 0) || (cur - value >= len)) {
#ifdef DEBUG_TREE
fprintf(stderr, fprintf(stderr,
"xmlStringLenGetNodeList: unterminated entity %30s\n", q); "xmlStringLenGetNodeList: unterminated entity %30s\n", q);
#endif
return(ret); return(ret);
} }
if (cur != q) { if (cur != q) {
@ -655,8 +679,10 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
q = cur; q = cur;
while ((*cur != 0) && (*cur != ';')) cur++; while ((*cur != 0) && (*cur != ';')) cur++;
if (*cur == 0) { if (*cur == 0) {
#ifdef DEBUG_TREE
fprintf(stderr, fprintf(stderr,
"xmlStringGetNodeList: unterminated entity %30s\n", q); "xmlStringGetNodeList: unterminated entity %30s\n", q);
#endif
return(ret); return(ret);
} }
if (cur != q) { if (cur != q) {
@ -804,7 +830,9 @@ xmlNewProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
xmlAttrPtr cur; xmlAttrPtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewProp : name == NULL\n"); fprintf(stderr, "xmlNewProp : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -871,7 +899,9 @@ xmlNewNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
xmlAttrPtr cur; xmlAttrPtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewProp : name == NULL\n"); fprintf(stderr, "xmlNewProp : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -928,7 +958,9 @@ xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value) {
xmlAttrPtr cur; xmlAttrPtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewProp : name == NULL\n"); fprintf(stderr, "xmlNewProp : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -967,7 +999,9 @@ void
xmlFreePropList(xmlAttrPtr cur) { xmlFreePropList(xmlAttrPtr cur) {
xmlAttrPtr next; xmlAttrPtr next;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlFreePropList : property == NULL\n"); fprintf(stderr, "xmlFreePropList : property == NULL\n");
#endif
return; return;
} }
while (cur != NULL) { while (cur != NULL) {
@ -986,7 +1020,9 @@ xmlFreePropList(xmlAttrPtr cur) {
void void
xmlFreeProp(xmlAttrPtr cur) { xmlFreeProp(xmlAttrPtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlFreeProp : property == NULL\n"); fprintf(stderr, "xmlFreeProp : property == NULL\n");
#endif
return; return;
} }
/* Check for ID removal -> leading to invalid references ! */ /* Check for ID removal -> leading to invalid references ! */
@ -1012,11 +1048,14 @@ int
xmlRemoveProp(xmlAttrPtr cur) { xmlRemoveProp(xmlAttrPtr cur) {
xmlAttrPtr tmp; xmlAttrPtr tmp;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlRemoveProp : cur == NULL\n"); fprintf(stderr, "xmlRemoveProp : cur == NULL\n");
#endif
return(-1); return(-1);
} }
if (cur->node == NULL) { if (cur->node == NULL) {
fprintf(stderr, "xmlRemoveProp : cur->node == NULL\n"); fprintf(stderr, "xmlRemoveProp : cur->node == NULL\n");
#endif
return(-1); return(-1);
} }
tmp = cur->node->properties; tmp = cur->node->properties;
@ -1033,7 +1072,9 @@ xmlRemoveProp(xmlAttrPtr cur) {
} }
tmp = tmp->next; tmp = tmp->next;
} }
#ifdef DEBUG_TREE
fprintf(stderr, "xmlRemoveProp : attribute not owned by its node\n"); fprintf(stderr, "xmlRemoveProp : attribute not owned by its node\n");
#endif
return(-1); return(-1);
} }
@ -1050,7 +1091,9 @@ xmlNewPI(const xmlChar *name, const xmlChar *content) {
xmlNodePtr cur; xmlNodePtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewPI : name == NULL\n"); fprintf(stderr, "xmlNewPI : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1107,7 +1150,9 @@ xmlNewNode(xmlNsPtr ns, const xmlChar *name) {
xmlNodePtr cur; xmlNodePtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewNode : name == NULL\n"); fprintf(stderr, "xmlNewNode : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1308,12 +1353,16 @@ xmlNewTextChild(xmlNodePtr parent, xmlNsPtr ns,
xmlNodePtr cur, prev; xmlNodePtr cur, prev;
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewTextChild : parent == NULL\n"); fprintf(stderr, "xmlNewTextChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewTextChild : name == NULL\n"); fprintf(stderr, "xmlNewTextChild : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1642,12 +1691,16 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
xmlNodePtr cur, prev; xmlNodePtr cur, prev;
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewChild : parent == NULL\n"); fprintf(stderr, "xmlNewChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNewChild : name == NULL\n"); fprintf(stderr, "xmlNewChild : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1693,11 +1746,15 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
xmlNodePtr xmlNodePtr
xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) { xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddNextSibling : cur == NULL\n"); fprintf(stderr, "xmlAddNextSibling : cur == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (elem == NULL) { if (elem == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddNextSibling : elem == NULL\n"); fprintf(stderr, "xmlAddNextSibling : elem == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1728,11 +1785,15 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
xmlNodePtr xmlNodePtr
xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) { xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddPrevSibling : cur == NULL\n"); fprintf(stderr, "xmlAddPrevSibling : cur == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (elem == NULL) { if (elem == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddPrevSibling : elem == NULL\n"); fprintf(stderr, "xmlAddPrevSibling : elem == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1765,12 +1826,16 @@ xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) {
xmlNodePtr parent; xmlNodePtr parent;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddSibling : cur == NULL\n"); fprintf(stderr, "xmlAddSibling : cur == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (elem == NULL) { if (elem == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddSibling : elem == NULL\n"); fprintf(stderr, "xmlAddSibling : elem == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1815,18 +1880,24 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
xmlNodePtr prev; xmlNodePtr prev;
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddChild : parent == NULL\n"); fprintf(stderr, "xmlAddChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAddChild : child == NULL\n"); fprintf(stderr, "xmlAddChild : child == NULL\n");
#endif
return(NULL); return(NULL);
} }
if ((cur->doc != NULL) && (parent->doc != NULL) && if ((cur->doc != NULL) && (parent->doc != NULL) &&
(cur->doc != parent->doc)) { (cur->doc != parent->doc)) {
#ifdef DEBUG_TREE
fprintf(stderr, "Elements moved to a different document\n"); fprintf(stderr, "Elements moved to a different document\n");
#endif
} }
/* /*
@ -1884,7 +1955,9 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
xmlNodePtr xmlNodePtr
xmlGetLastChild(xmlNodePtr parent) { xmlGetLastChild(xmlNodePtr parent) {
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlGetLastChild : parent == NULL\n"); fprintf(stderr, "xmlGetLastChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
return(parent->last); return(parent->last);
@ -1901,7 +1974,9 @@ void
xmlFreeNodeList(xmlNodePtr cur) { xmlFreeNodeList(xmlNodePtr cur) {
xmlNodePtr next; xmlNodePtr next;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlFreeNodeList : node == NULL\n"); fprintf(stderr, "xmlFreeNodeList : node == NULL\n");
#endif
return; return;
} }
while (cur != NULL) { while (cur != NULL) {
@ -1920,7 +1995,9 @@ xmlFreeNodeList(xmlNodePtr cur) {
void void
xmlFreeNode(xmlNodePtr cur) { xmlFreeNode(xmlNodePtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlFreeNode : node == NULL\n"); fprintf(stderr, "xmlFreeNode : node == NULL\n");
#endif
return; return;
} }
cur->doc = NULL; cur->doc = NULL;
@ -1950,7 +2027,9 @@ xmlFreeNode(xmlNodePtr cur) {
void void
xmlUnlinkNode(xmlNodePtr cur) { xmlUnlinkNode(xmlNodePtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlUnlinkNode : node == NULL\n"); fprintf(stderr, "xmlUnlinkNode : node == NULL\n");
#endif
return; return;
} }
if ((cur->parent != NULL) && (cur->parent->childs == cur)) if ((cur->parent != NULL) && (cur->parent->childs == cur))
@ -1979,7 +2058,9 @@ xmlUnlinkNode(xmlNodePtr cur) {
xmlNodePtr xmlNodePtr
xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) { xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
if (old == NULL) { if (old == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlReplaceNode : old == NULL\n"); fprintf(stderr, "xmlReplaceNode : old == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (cur == NULL) { if (cur == NULL) {
@ -2033,7 +2114,9 @@ xmlCopyNamespace(xmlNsPtr cur) {
ret = xmlNewNs(NULL, cur->href, cur->prefix); ret = xmlNewNs(NULL, cur->href, cur->prefix);
break; break;
default: default:
#ifdef DEBUG_TREE
fprintf(stderr, "xmlCopyNamespace: unknown type %d\n", cur->type); fprintf(stderr, "xmlCopyNamespace: unknown type %d\n", cur->type);
#endif
return(NULL); return(NULL);
} }
return(ret); return(ret);
@ -2645,7 +2728,9 @@ xmlNodeGetContent(xmlNodePtr cur) {
void void
xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) { xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNodeSetContent : node == NULL\n"); fprintf(stderr, "xmlNodeSetContent : node == NULL\n");
#endif
return; return;
} }
switch (cur->type) { switch (cur->type) {
@ -2712,7 +2797,9 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
void void
xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) { xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNodeSetContentLen : node == NULL\n"); fprintf(stderr, "xmlNodeSetContentLen : node == NULL\n");
#endif
return; return;
} }
switch (cur->type) { switch (cur->type) {
@ -2778,7 +2865,9 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
void void
xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) { xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNodeAddContentLen : node == NULL\n"); fprintf(stderr, "xmlNodeAddContentLen : node == NULL\n");
#endif
return; return;
} }
if (len <= 0) return; if (len <= 0) return;
@ -2851,7 +2940,9 @@ xmlNodeAddContent(xmlNodePtr cur, const xmlChar *content) {
int len; int len;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNodeAddContent : node == NULL\n"); fprintf(stderr, "xmlNodeAddContent : node == NULL\n");
#endif
return; return;
} }
if (content == NULL) return; if (content == NULL) return;
@ -3445,7 +3536,9 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) {
if ((node->type != XML_TEXT_NODE) && if ((node->type != XML_TEXT_NODE) &&
(node->type != XML_CDATA_SECTION_NODE)) { (node->type != XML_CDATA_SECTION_NODE)) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlTextConcat: node is not text nor cdata\n"); fprintf(stderr, "xmlTextConcat: node is not text nor cdata\n");
#endif
return; return;
} }
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
@ -3534,7 +3627,9 @@ void
xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferSetAllocationScheme(xmlBufferPtr buf,
xmlBufferAllocationScheme scheme) { xmlBufferAllocationScheme scheme) {
if (buf == NULL) { if (buf == NULL) {
#ifdef DEBUG_BUFFER
fprintf(stderr, "xmlBufferSetAllocationScheme: buf == NULL\n"); fprintf(stderr, "xmlBufferSetAllocationScheme: buf == NULL\n");
#endif
return; return;
} }
@ -3550,7 +3645,9 @@ xmlBufferSetAllocationScheme(xmlBufferPtr buf,
void void
xmlBufferFree(xmlBufferPtr buf) { xmlBufferFree(xmlBufferPtr buf) {
if (buf == NULL) { if (buf == NULL) {
#ifdef DEBUG_BUFFER
fprintf(stderr, "xmlBufferFree: buf == NULL\n"); fprintf(stderr, "xmlBufferFree: buf == NULL\n");
#endif
return; return;
} }
if (buf->content != NULL) { if (buf->content != NULL) {
@ -3611,11 +3708,15 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
int ret; int ret;
if (buf == NULL) { if (buf == NULL) {
#ifdef DEBUG_BUFFER
fprintf(stderr, "xmlBufferDump: buf == NULL\n"); fprintf(stderr, "xmlBufferDump: buf == NULL\n");
#endif
return(0); return(0);
} }
if (buf->content == NULL) { if (buf->content == NULL) {
#ifdef DEBUG_BUFFER
fprintf(stderr, "xmlBufferDump: buf->content == NULL\n"); fprintf(stderr, "xmlBufferDump: buf->content == NULL\n");
#endif
return(0); return(0);
} }
if (file == NULL) file = stdout; if (file == NULL) file = stdout;
@ -3715,11 +3816,15 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
int l, needSize; int l, needSize;
if (str == NULL) { if (str == NULL) {
#ifdef DEBUG_BUFFER
fprintf(stderr, "xmlBufferAdd: str == NULL\n"); fprintf(stderr, "xmlBufferAdd: str == NULL\n");
#endif
return; return;
} }
if (len < -1) { if (len < -1) {
#ifdef DEBUG_BUFFER
fprintf(stderr, "xmlBufferAdd: len < 0\n"); fprintf(stderr, "xmlBufferAdd: len < 0\n");
#endif
return; return;
} }
if (len == 0) return; if (len == 0) return;
@ -3730,7 +3835,12 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
else else
for (l = 0;l < len;l++) for (l = 0;l < len;l++)
if (str[l] == 0) break; if (str[l] == 0) break;
if (l < len){ len = l; printf("xmlBufferAdd bad length\n"); } if (l < len){
len = l;
#ifdef DEBUG_BUFFER
printf("xmlBufferAdd bad length\n");
#endif
}
/* CJN 11.18.99 okay, now I'm using the length */ /* CJN 11.18.99 okay, now I'm using the length */
if(len == -1) len = l; if(len == -1) len = l;
@ -3776,7 +3886,9 @@ xmlBufferCCat(xmlBufferPtr buf, const char *str) {
const char *cur; const char *cur;
if (str == NULL) { if (str == NULL) {
#ifdef DEBUG_BUFFER
fprintf(stderr, "xmlBufferAdd: str == NULL\n"); fprintf(stderr, "xmlBufferAdd: str == NULL\n");
#endif
return; return;
} }
for (cur = str;*cur != 0;cur++) { for (cur = str;*cur != 0;cur++) {
@ -3830,8 +3942,10 @@ void
xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) { xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
if (xmlStrchr(string, '"')) { if (xmlStrchr(string, '"')) {
if (xmlStrchr(string, '\'')) { if (xmlStrchr(string, '\'')) {
#ifdef DEBUG_BUFFER
fprintf(stderr, fprintf(stderr,
"xmlBufferWriteQuotedString: string contains quote and double-quotes !\n"); "xmlBufferWriteQuotedString: string contains quote and double-quotes !\n");
#endif
} }
xmlBufferCCat(buf, "'"); xmlBufferCCat(buf, "'");
xmlBufferCat(buf, string); xmlBufferCat(buf, string);
@ -3854,7 +3968,9 @@ xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
static void static void
xmlGlobalNsDump(xmlBufferPtr buf, xmlNsPtr cur) { xmlGlobalNsDump(xmlBufferPtr buf, xmlNsPtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlGlobalNsDump : Ns == NULL\n"); fprintf(stderr, "xmlGlobalNsDump : Ns == NULL\n");
#endif
return; return;
} }
if (cur->type == XML_GLOBAL_NAMESPACE) { if (cur->type == XML_GLOBAL_NAMESPACE) {
@ -3897,7 +4013,9 @@ xmlGlobalNsListDump(xmlBufferPtr buf, xmlNsPtr cur) {
static void static void
xmlNsDump(xmlBufferPtr buf, xmlNsPtr cur) { xmlNsDump(xmlBufferPtr buf, xmlNsPtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNsDump : Ns == NULL\n"); fprintf(stderr, "xmlNsDump : Ns == NULL\n");
#endif
return; return;
} }
if (cur->type == XML_LOCAL_NAMESPACE) { if (cur->type == XML_LOCAL_NAMESPACE) {
@ -3940,7 +4058,9 @@ xmlDtdDump(xmlBufferPtr buf, xmlDocPtr doc) {
xmlDtdPtr cur = doc->intSubset; xmlDtdPtr cur = doc->intSubset;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlDtdDump : no internal subset\n"); fprintf(stderr, "xmlDtdDump : no internal subset\n");
#endif
return; return;
} }
xmlBufferWriteChar(buf, "<!DOCTYPE "); xmlBufferWriteChar(buf, "<!DOCTYPE ");
@ -3986,7 +4106,9 @@ xmlAttrDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
xmlChar *value; xmlChar *value;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAttrDump : property == NULL\n"); fprintf(stderr, "xmlAttrDump : property == NULL\n");
#endif
return; return;
} }
xmlBufferWriteChar(buf, " "); xmlBufferWriteChar(buf, " ");
@ -4016,7 +4138,9 @@ xmlAttrDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
static void static void
xmlAttrListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) { xmlAttrListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlAttrListDump : property == NULL\n"); fprintf(stderr, "xmlAttrListDump : property == NULL\n");
#endif
return; return;
} }
while (cur != NULL) { while (cur != NULL) {
@ -4048,7 +4172,9 @@ xmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
int i; int i;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNodeListDump : node == NULL\n"); fprintf(stderr, "xmlNodeListDump : node == NULL\n");
#endif
return; return;
} }
while (cur != NULL) { while (cur != NULL) {
@ -4081,7 +4207,9 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
xmlNodePtr tmp; xmlNodePtr tmp;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlNodeDump : node == NULL\n"); fprintf(stderr, "xmlNodeDump : node == NULL\n");
#endif
return; return;
} }
if (cur->type == XML_TEXT_NODE) { if (cur->type == XML_TEXT_NODE) {