You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Renin Jegadeesan <re...@smarts.com> on 2003/03/21 00:29:54 UTC

XercesDOMParser::parse() - Is this Recursive?

Hi,
I am a newbie at using Xerces C++. I have written a multi-threaded program
that uses the XercesDOMParser to parse my xml document.

I am wondering if the XercesDOMParser::parse() is recursive? I looked 
at the source code, and it appears to be non-recursive. But the source
code is really complicated, and i would appreciate it, if one of the 
experts on this mailing list can answer this question for me.

Thank you in advance,
- Renin
(914) 798-8561
 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: XercesDOMParser::parse() - Is this Recursive?

Posted by Renin Jegadeesan <re...@smarts.com>.
Hi Dave,
Thanks a lot for the answer.
I figured as much as, the reading the xml document and creating the
DOM Tree would be non-recursive, but i was concerned about the
Validation part. 
Unfortunately, my program is crashing if the depth of the DOM Tree
is around 3000. I was thinking this would be a stack overflow.
But if it is not, then i need to build a debug library and debug
it.

Thanks again.
renin.


> -----Original Message-----
> From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]
> Sent: Friday, March 21, 2003 12:25 PM
> To: xerces-c-dev@xml.apache.org
> Subject: RE: XercesDOMParser::parse() - Is this Recursive?
> 
> 
> 
> 
> 
> 
> Hi Renin,
> 
> The parser doesn't traverse a DOM tree.  It parses an XML stream 
> and builds
> a DOM from that stream.  Most of the information that maintains the state
> of the parse is not kept on the stack, and the parser is not implemented
> using recursive descent -- it's a state machine.
> 
> Dave
> 
> 
> 
>                                                                   
>                                                          
>                       "Renin Jegadeesan"                          
>                                                          
>                       <renin.jegadeesan@         To:      
> <xe...@xml.apache.org>                                    
>                       smarts.com>                cc:      (bcc: 
> David N Bertoni/Cambridge/IBM)                             
>                                                  Subject: RE: 
> XercesDOMParser::parse() - Is this Recursive?                
>                       03/21/2003 07:20                            
>                                                          
>                       AM                                          
>                                                          
>                       Please respond to                           
>                                                          
>                       xerces-c-dev                                
>                                                          
>                                                                   
>                                                          
> 
> 
> 
> I am sorry i wasn't clear. I understood from the code that it's not
> re-entrant.
> 
> what i meant was, does the XercesDOMParser::parse() traverse the DOM
> Tree in a recursive manner?
> 
> since my program is multi-threaded, i am worried if this traversing
> is done in a recursive manner, the depth of the DOM tree would be
> constrained by the stack size for this thread, and if the DOM Tree
>  is deep enough, then my program would crash.
> 
> Thanks again, for any help.
> renin.
> 
> 
> > -----Original Message-----
> > From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]
> > Sent: Thursday, March 20, 2003 7:05 PM
> > To: xerces-c-dev@xml.apache.org
> > Subject: Re: XercesDOMParser::parse() - Is this Recursive?
> >
> >
> >
> >
> >
> >
> > HI Renin,
> >
> > If you mean "re-entrant" the answer is no -- a single instance of a
> parser
> > can only parse one document at a time.  See:
> >
> >    http://xml.apache.org/xerces-c/faq-parse.html#faq-7
> >
> > Dave
> >
> >
> >
> >
> >
> >                       "Renin Jegadeesan"
> >
> >                       <renin.jegadeesan@         To:
> > <xe...@xml.apache.org>
> >                       smarts.com>                cc:      (bcc:
> > David N Bertoni/Cambridge/IBM)
> >                                                  Subject:
> > XercesDOMParser::parse() - Is this Recursive?
> >                       03/20/2003 03:29
> >
> >                       PM
> >
> >                       Please respond to
> >
> >                       xerces-c-dev
> >
> >
> >
> >
> >
> >
> >
> > Hi,
> > I am a newbie at using Xerces C++. I have written a multi-threaded
> program
> > that uses the XercesDOMParser to parse my xml document.
> >
> > I am wondering if the XercesDOMParser::parse() is recursive? I looked
> > at the source code, and it appears to be non-recursive. But the source
> > code is really complicated, and i would appreciate it, if one of the
> > experts on this mailing list can answer this question for me.
> >
> > Thank you in advance,
> > - Renin
> > (914) 798-8561
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: XercesDOMParser::parse() - Is this Recursive?

Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.



Hi Renin,

The parser doesn't traverse a DOM tree.  It parses an XML stream and builds
a DOM from that stream.  Most of the information that maintains the state
of the parse is not kept on the stack, and the parser is not implemented
using recursive descent -- it's a state machine.

Dave



                                                                                                                           
                      "Renin Jegadeesan"                                                                                   
                      <renin.jegadeesan@         To:      <xe...@xml.apache.org>                                    
                      smarts.com>                cc:      (bcc: David N Bertoni/Cambridge/IBM)                             
                                                 Subject: RE: XercesDOMParser::parse() - Is this Recursive?                
                      03/21/2003 07:20                                                                                     
                      AM                                                                                                   
                      Please respond to                                                                                    
                      xerces-c-dev                                                                                         
                                                                                                                           



I am sorry i wasn't clear. I understood from the code that it's not
re-entrant.

what i meant was, does the XercesDOMParser::parse() traverse the DOM
Tree in a recursive manner?

since my program is multi-threaded, i am worried if this traversing
is done in a recursive manner, the depth of the DOM tree would be
constrained by the stack size for this thread, and if the DOM Tree
 is deep enough, then my program would crash.

Thanks again, for any help.
renin.


> -----Original Message-----
> From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]
> Sent: Thursday, March 20, 2003 7:05 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: XercesDOMParser::parse() - Is this Recursive?
>
>
>
>
>
>
> HI Renin,
>
> If you mean "re-entrant" the answer is no -- a single instance of a
parser
> can only parse one document at a time.  See:
>
>    http://xml.apache.org/xerces-c/faq-parse.html#faq-7
>
> Dave
>
>
>
>
>
>                       "Renin Jegadeesan"
>
>                       <renin.jegadeesan@         To:
> <xe...@xml.apache.org>
>                       smarts.com>                cc:      (bcc:
> David N Bertoni/Cambridge/IBM)
>                                                  Subject:
> XercesDOMParser::parse() - Is this Recursive?
>                       03/20/2003 03:29
>
>                       PM
>
>                       Please respond to
>
>                       xerces-c-dev
>
>
>
>
>
>
>
> Hi,
> I am a newbie at using Xerces C++. I have written a multi-threaded
program
> that uses the XercesDOMParser to parse my xml document.
>
> I am wondering if the XercesDOMParser::parse() is recursive? I looked
> at the source code, and it appears to be non-recursive. But the source
> code is really complicated, and i would appreciate it, if one of the
> experts on this mailing list can answer this question for me.
>
> Thank you in advance,
> - Renin
> (914) 798-8561
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: XercesDOMParser::parse() - Is this Recursive?

Posted by Renin Jegadeesan <re...@smarts.com>.
I am sorry i wasn't clear. I understood from the code that it's not
re-entrant.

what i meant was, does the XercesDOMParser::parse() traverse the DOM
Tree in a recursive manner?

since my program is multi-threaded, i am worried if this traversing
is done in a recursive manner, the depth of the DOM tree would be
constrained by the stack size for this thread, and if the DOM Tree
 is deep enough, then my program would crash.

Thanks again, for any help.
renin.


> -----Original Message-----
> From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]
> Sent: Thursday, March 20, 2003 7:05 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: XercesDOMParser::parse() - Is this Recursive?
>
>
>
>
>
>
> HI Renin,
>
> If you mean "re-entrant" the answer is no -- a single instance of a parser
> can only parse one document at a time.  See:
>
>    http://xml.apache.org/xerces-c/faq-parse.html#faq-7
>
> Dave
>
>
>
>
>
>                       "Renin Jegadeesan"
>
>                       <renin.jegadeesan@         To:
> <xe...@xml.apache.org>
>                       smarts.com>                cc:      (bcc:
> David N Bertoni/Cambridge/IBM)
>                                                  Subject:
> XercesDOMParser::parse() - Is this Recursive?
>                       03/20/2003 03:29
>
>                       PM
>
>                       Please respond to
>
>                       xerces-c-dev
>
>
>
>
>
>
>
> Hi,
> I am a newbie at using Xerces C++. I have written a multi-threaded program
> that uses the XercesDOMParser to parse my xml document.
>
> I am wondering if the XercesDOMParser::parse() is recursive? I looked
> at the source code, and it appears to be non-recursive. But the source
> code is really complicated, and i would appreciate it, if one of the
> experts on this mailing list can answer this question for me.
>
> Thank you in advance,
> - Renin
> (914) 798-8561
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: XercesDOMParser::parse() - Is this Recursive?

Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.



HI Renin,

If you mean "re-entrant" the answer is no -- a single instance of a parser
can only parse one document at a time.  See:

   http://xml.apache.org/xerces-c/faq-parse.html#faq-7

Dave



                                                                                                                           
                      "Renin Jegadeesan"                                                                                   
                      <renin.jegadeesan@         To:      <xe...@xml.apache.org>                                    
                      smarts.com>                cc:      (bcc: David N Bertoni/Cambridge/IBM)                             
                                                 Subject: XercesDOMParser::parse() - Is this Recursive?                    
                      03/20/2003 03:29                                                                                     
                      PM                                                                                                   
                      Please respond to                                                                                    
                      xerces-c-dev                                                                                         
                                                                                                                           




Hi,
I am a newbie at using Xerces C++. I have written a multi-threaded program
that uses the XercesDOMParser to parse my xml document.

I am wondering if the XercesDOMParser::parse() is recursive? I looked
at the source code, and it appears to be non-recursive. But the source
code is really complicated, and i would appreciate it, if one of the
experts on this mailing list can answer this question for me.

Thank you in advance,
- Renin
(914) 798-8561


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org