[xml] This code unlinks too much.



The document is xhtml with <head and <body inside the <HTML tag. The 
code is pasted below the line of dashes. The problem area starts with 
the line

oldPrebSib = furbrl->prev;

curBrlNode is defined and set outside this function Itcontains a 
braille translation, in this case of a MathML 
expression. This has already been placed in transNode. curbrlNode 
follows a <math tag, with its subtree. The math expression is supposed 
to be replaced by transNode and curBrlNode removed. When I trace through 
the code with gdb it appears to work properly. However, xmlDocDump does 
not produce anything except the <head subtree within the <HTML tag 
of the xhtml document. 
In other words, the body is completely missing. Suggestions? Thanks.

--------------------

static int
finishBrlNode ()
{
  int wcLength;
  int utf8Length;
  unsigned char *transText = (unsigned char *) ud->outbuf2;
  xmlNode *transNode;
  xmlNode *linkedTransNode;
  xmlNode *oldPrevSib;
  xmlNode *oldBrlNode;
  wcLength = ud->outbuf1_len_so_far;
  utf8Length = ud->outbuf2_len;
  wc_string_to_utf8 (ud->outbuf1, &wcLength, transText, &utf8Length);
  transNode = xmlNewText (transText);
  oldPrevSib = curBrlNode->prev;
  if (oldPrevSib != NULL)
    {
      xmlUnlinkNode (oldPrevSib);
      xmlFreeNode (oldPrevSib);
    }
  linkedTransNode = xmlAddPrevSibling (curBrlNode, transNode);
  afterCurBrl = curBrlNode->next;
  useAfterCurBrl = 1;
  oldBrlNode = curBrlNode;
  xmlUnlinkNode (oldBrlNode);
  xmlFreeNode (oldBrlNode);
  return 1;
}

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]