cvs commit: ALFS/nALFS/src libXML-tree.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Sat Apr 3 08:23:04 PST 2004


kpfleming    04/04/03 09:23:04

  Modified:    nALFS/src libXML-tree.c
  Log:
  use proper content retrieval for parameter elements
  
  Revision  Changes    Path
  1.28      +14 -6     ALFS/nALFS/src/libXML-tree.c
  
  Index: libXML-tree.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/libXML-tree.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- libXML-tree.c	21 Mar 2004 18:50:44 -0000	1.27
  +++ libXML-tree.c	3 Apr 2004 16:23:04 -0000	1.28
  @@ -155,14 +155,23 @@
   					       (const char *) child->name);
   
   		if (param) {
  +			xmlChar *xml_content = NULL;
   			const char *content = NULL;
   			xmlNodePtr free_child;
   
  -			if (child->children && child->children->content)
  -				content = (const char *) child->children->content;
  +			if (child->children &&
  +			    child->children->type == XML_TEXT_NODE &&
  +			    child->children->next == NULL)
  +				xml_content = xmlNodeGetContent(child);
   
  -			if (content && !param->untrimmed)
  -				content = alloc_trimmed_str(content);
  +			if (xml_content) {
  +				if (param->untrimmed) {
  +					content = xstrdup(xml_content);
  +				} else {
  +					content = alloc_trimmed_str(xml_content);
  +				}
  +				xmlFree(xml_content);
  +			}
   
   			if (!param->content_optional && (!content ||
   							 (strlen(content) == 0))) {
  @@ -172,8 +181,7 @@
   				result = handler->parameter(element, param, content);
   			}
   
  -			if (content && !param->untrimmed)
  -				xfree(content);
  +			xfree(content);
   
   			if (result)
   				return result;
  
  
  



More information about the alfs-log mailing list