🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.programmer.codewarrior
7 messages
7 total messages Started by RK Mon, 06 Jan 2003 08:47
Xerces + Mac + unmapped memory exception
#870
Author: RK
Date: Mon, 06 Jan 2003 08:47
21 lines
1664 bytes
Hi,

I am using Xerces port for Mac from Apache. It's not an official port
though.

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.

Thanks,
RK
Re: Xerces + Mac + unmapped memory exception
#871
Author: Sandy Martel
Date: Mon, 06 Jan 2003 15:35
26 lines
2022 bytes
Can you post some code that exhibit this behavior?

"RK" <rkchats@yahoo.com> wrote in message
news:389ca595.0301060047.4034bfed@posting.google.com...
> Hi,
>
> I am using Xerces port for Mac from Apache. It's not an official port
> though.
>
> 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.
>
> Thanks,
> RK
Re: Xerces + Mac + unmapped memory exception
#872
Author: Jedidja Bourgeois
Date: Mon, 06 Jan 2003 15:48
27 lines
2281 bytes
We switched from using Xerces to expat on the pc because expat ran many
times faster. It was pretty easy to switch, actually -- the structure of the
callbacks from both libraries are pretty similar. Btw, expat runs just fine
on the mac in case you're curious :)

RK wrote:
> Hi,
>
> I am using Xerces port for Mac from Apache. It's not an official port
> though.
>
> 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.
>
> Thanks,
> RK
Re: Xerces + Mac + unmapped memory exception
#873
Author: Richard Wesley
Date: Mon, 06 Jan 2003 16:06
23 lines
1920 bytes
In article <%AhS9.1278$Af2.262617@news20.bellglobal.com>,
 "Jedidja Bourgeois" <jedidjab79@hotmail.com> wrote:

> We switched from using Xerces to expat on the pc because expat ran many
> times faster. It was pretty easy to switch, actually -- the structure of the
> callbacks from both libraries are pretty similar. Btw, expat runs just fine
> on the mac in case you're curious :)

Same here.  We are using it in a cross-platform product and it works 
just great.  Wrap it up in some C++ wrappers and it can pretty much drop 
in for your SAX implementation.

-- 

- rmgw

http://www.trustedmedianetworks.com/

----------------------------------------------------------------------------
Richard Wesley                                  Trusted Media Networks, Inc.

"Grownups have the most uninteresting explanations for things."
                 - C. S. Lewis, _The Magician's Nephew_
Re: Xerces + Mac + unmapped memory exception
#874
Author: RK
Date: Tue, 07 Jan 2003 12:12
95 lines
3732 bytes
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.
__________________________________________________________


Also, I want to be very sure about moving to expat, if I have to. Any
comments on expat for Mac are also welcome.


-rk


Richard Wesley <hawkfish@trustedmedianetworks.com> wrote in message news:<hawkfish-D6AB2B.08053806012003@tribune.sj.sys.us.xo.net>...
> In article <%AhS9.1278$Af2.262617@news20.bellglobal.com>,
>  "Jedidja Bourgeois" <jedidjab79@hotmail.com> wrote:
> 
> > We switched from using Xerces to expat on the pc because expat ran many
> > times faster. It was pretty easy to switch, actually -- the structure of the
> > callbacks from both libraries are pretty similar. Btw, expat runs just fine
> > on the mac in case you're curious :)
> 
> Same here.  We are using it in a cross-platform product and it works 
> just great.  Wrap it up in some C++ wrappers and it can pretty much drop 
> in for your SAX implementation.
> 
> -- 
> 
> - rmgw
> 
> http://www.trustedmedianetworks.com/
> 
> ----------------------------------------------------------------------------
> Richard Wesley                                  Trusted Media Networks, Inc.
> 
> "Grownups have the most uninteresting explanations for things."
>                  - C. S. Lewis, _The Magician's Nephew_
Re: Xerces + Mac + unmapped memory exception
#876
Author: Jedidja Bourgeois
Date: Tue, 07 Jan 2003 12:28
103 lines
4416 bytes
We're using expat on pc/mac to parse our own XML files that store a variety
of data. Haven't had any issues and we're using the Unicode-enabled build on
both platforms. I can't see any reason not to use it on the mac :)

RK wrote:
> 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.
> __________________________________________________________
>
>
> Also, I want to be very sure about moving to expat, if I have to. Any
> comments on expat for Mac are also welcome.
>
>
> -rk
>
>
> Richard Wesley <hawkfish@trustedmedianetworks.com> wrote in message
> news:<hawkfish-D6AB2B.08053806012003@tribune.sj.sys.us.xo.net>...
>> In article <%AhS9.1278$Af2.262617@news20.bellglobal.com>,
>>  "Jedidja Bourgeois" <jedidjab79@hotmail.com> wrote:
>>
>>> We switched from using Xerces to expat on the pc because expat ran
>>> many times faster. It was pretty easy to switch, actually -- the
>>> structure of the callbacks from both libraries are pretty similar.
>>> Btw, expat runs just fine on the mac in case you're curious :)
>>
>> Same here.  We are using it in a cross-platform product and it works
>> just great.  Wrap it up in some C++ wrappers and it can pretty much
>> drop in for your SAX implementation.
>>
>> --
>>
>> - rmgw
>>
>> http://www.trustedmedianetworks.com/
>>
>> -------------------------------------------------------------------------
---
>> Richard Wesley                                  Trusted Media
>> Networks, Inc.
>>
>> "Grownups have the most uninteresting explanations for things."
>>                  - C. S. Lewis, _The Magician's Nephew_
Re: Xerces + Mac + unmapped memory exception
#875
Author: Peter Teeson
Date: Tue, 07 Jan 2003 12:29
29 lines
2048 bytes
In article <389ca595.0301070412.70cf3c98@posting.google.com>,
 rkchats@yahoo.com (RK) wrote:

<snip> 

> Also, I want to be very sure about moving to expat, if I have to. Any
> comments on expat for Mac are also welcome.
> 
> 
> -rk
> 
<snip>

I used expat on a cross platform project a couple of years ago. I found 
it pretty easy to wrap it with the appropriate C++ code, since out app 
was in C++.

(Actually part of it also used JNI to call C++ which used expat).

At that time OS X was not stable or developed sufficiently to use it so 
we did everything under OS 8.*.

Before choosing expat I did examine and explore xerces but decided on 
expat for it's simplicity and sufficiency for our needs.

respect....


Peter
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads