Hi,

I am new to this mailing list. I am facing the following problem/issue with
Xerces on Mac.

--
I am extracting DOMNodeLists for 4 different tags from a DOM document.
I know these DOMNodeLists are "live" (pointers to the DOM tree). I am
not changing anything, and am just getting some information out of
those lists.

But, the behaviour is not as expected. I get "unmapped memory
exception" on the 2nd "doc->getElementByTagName(tag)" statement. I
don't know why that (memory corruption) happens. Either there is a
problem with my understanding of the usage of Xerces or there's a
serious problem with Xerces on Mac.

Could someone please help me here? I had decided to use Xerces for XML
parsing in my project and it would be hard to back out.

Here is some of the code I wrote. It's pretty simple.
---------------------------------------------------------------------
int ParserMain()
{
.......
 doc = parser->parseURI(xmlFile);
.......
    if(doc)
        {
          ParseHeader(doc);
          ParseFontTable(doc);
          ParsePreferences(doc);
        }
.....
    parser->release();
    XMLPlatformUtils::Terminate();
}
---------------------------------------------------------------------

void ParseHeader(DOMDocument *doc)
{
  XMLCh tag[] = L"header";
  unsigned int nH = 0, len = 0;

  DOMNodeList *HList = doc->getElementsByTagName(tag);

  if((nH = HList->getLength()) >= 1)
  {
        for(unsigned int i=0; i<nH; i++)
        {
          DOMNode *firstChild = HList->item(i);
          firstChild = (HList->item(i))->getFirstChild();

          while(firstChild!=NULL)
          {
            bool bHasCNodes = firstChild->hasChildNodes();

            if(bHasCNodes==true)
            {
                DOMNode *tmp = firstChild->getFirstChild();
                if(tmp!=NULL)
                {
                  if(strcmp(tempNodeName, "id")==0)
                  {
                    XMLString::copyString(stHeader.id,
XMLString::transcode(tmp->getNodeValue()));
                  }
                  else if(strcmp(tempNodeName, "title")==0)
                  {
                    XMLString::copyString(stHeader.title,
XMLString::transcode(tmp->getNodeValue()));
                  }
                }
            }
            firstChild = firstChild->getNextSibling();
          }//while ends
        }//for ends
     }//if ends
}
---------------------------------------------------------------------

I have a few routines which are doing similar things. And execution of
2nd/3rd such routine gives me an exception.

Thanks,
RK


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to