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 Elliott Perkins <el...@avid.com> on 2001/08/17 22:17:51 UTC

xerces c++ parser does not parse new xml after reset

I instantiate a DOMParser object and call its parse method on the XML.
I perform an operation where I ask for a list of children on a node,
which is successful.  Then, I call the DOMParser reset method, and once
again call the parse method on a new XML.  I then perform an operation
to ask for a list of children on a similar node, which has children and
query the DOM_NodeList object for a count of its children, which
indicates it has 0 children.

The documentation indicates that the reset method "resets the state of
the DOM driver and makes it ready for a fresh parse run".  The question
is "how do you use DOMParser to parse multiple XMLs within the same
session"?  Other than the call to XMLPlatformUtils::Initialize(), are
there other initialization calls that are required in order to setup the
DOMParser?  I have not found where this is addressed in the
documentation or in the samples.

Thanks for any information you can give in this matter.

Elliott Perkins
elliott_perkins@avid.com



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


Thousand thanks

Posted by Jordan C N Chong <ch...@cs.utwente.nl>.
Dear Tinny

It works perfect :D

Thousand thanks for your help
and also your precious time!!

Wish you all the best


Best regards,
--------------------------------------------
Jordan Cheun Ngen, Chong
Room 4067
Distributed and Embeded Systems Group
Centre for Telematics and Information Technology
University of Twente
Faculty Informatica
7522 NB Enschede
The Netherlands
--------------------------------------------
Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: chong@cs.utwente.nl
============================================


> -----Original Message-----
> From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
> Sent: Monday, August 20, 2001 3:38 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: xerces c++ parser does not parse new xml after reset
>
>
> XMLPlatformUtils::Initialize()/Terminate(); should be OUTSIDE the body of
> "function".  The XMLPlatformUtils::Initalize()/Terminate(); can
> only be called
> once within the entire application.
>
> Tinny
>
> Jordan C N Chong wrote:
>
> > Dear Tinny
> >
> > Thanks again for your valuable time and help...
> >
> > This is the code:
> >
> > // path: the path and the file name
> > void function(char *path)
> > {
> >
> >         // Parse the license with XML4C
> >         XMLPlatformUtils::Initialize();
> >         DOMParser parser;
> >         parser.parse(path);
> >
> >         doc = parser.getDocument();
> >         root = doc.getDocumentElement();
> >
> >         ... ...
> >
> >         parser.reset();
> >         XMLPlatformUtils::Terminate();
> > }
> >
> > Still the problem happens. I have checked, the problem happens at the
> > DOMParser parser;
> > Please help. Thanks.
> >
> > Best regards,
> > --------------------------------------------
> > Jordan Cheun Ngen, Chong
> > Room 4067
> > Distributed and Embeded Systems Group
> > Centre for Telematics and Information Technology
> > University of Twente
> > Faculty Informatica
> > 7522 NB Enschede
> > The Netherlands
> > --------------------------------------------
> > Office Phone: +31 53 4894655
> > Web site: http://www.cs.utwente.nl/~chong
> > Email Add.: chong@cs.utwente.nl
> > ============================================
> >
> > > -----Original Message-----
> > > From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
> > > Sent: Monday, August 20, 2001 3:09 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: Re: xerces c++ parser does not parse new xml after reset
> > >
> > >
> > >
> > >
> > > Elliott Perkins wrote:
> > >
> > > > [snipped] The question
> > > > is "how do you use DOMParser to parse multiple XMLs within the same
> > > > session"?  Other than the call to
> XMLPlatformUtils::Initialize(), are
> > > > there other initialization calls that are required in order
> to setup the
> > > > DOMParser?
> > >
> > > You cannot call XMLPlatformUtils::Initialize(); again after
> > > XMLPlatformUtils::Terminate(); within the same
> > > process.  See http://xml.apache.org/xerces-c/faq-parse.html#faq-25 for
> > > further detail.
> > >
> > > To parse multiple XMLs using the same parser, just loop the
> parse method
> > > like:
> > >
> > > for (i=0, i<numOfFiles; i++) {
> > >    parser.parse(xmlFile[i]);
> > > }
> > >
> > > You can optionally call DOMParser::reset() to reset the
> parser state as
> > > documented, although, the scanner will also call this method
> internally to
> > > reset the states.
> > >
> > > But please remember, don't call
> > > XMLPlatformUtils::Initialize/Terminate pair
> > > multiple times.
> > >
> > > Tinny.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: xerces c++ parser does not parse new xml after reset

Posted by Jordan C N Chong <ch...@cs.utwente.nl>.
Dear Tinny

Thousand thanks. I will try it out :D...

You have helped me much than I expected... Wish you all the best

Best regards,
--------------------------------------------
Jordan Cheun Ngen, Chong
Room 4067
Distributed and Embeded Systems Group
Centre for Telematics and Information Technology
University of Twente
Faculty Informatica
7522 NB Enschede
The Netherlands
--------------------------------------------
Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: chong@cs.utwente.nl
============================================


> -----Original Message-----
> From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
> Sent: Monday, August 20, 2001 3:38 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: xerces c++ parser does not parse new xml after reset
>
>
> XMLPlatformUtils::Initialize()/Terminate(); should be OUTSIDE the body of
> "function".  The XMLPlatformUtils::Initalize()/Terminate(); can
> only be called
> once within the entire application.
>
> Tinny
>
> Jordan C N Chong wrote:
>
> > Dear Tinny
> >
> > Thanks again for your valuable time and help...
> >
> > This is the code:
> >
> > // path: the path and the file name
> > void function(char *path)
> > {
> >
> >         // Parse the license with XML4C
> >         XMLPlatformUtils::Initialize();
> >         DOMParser parser;
> >         parser.parse(path);
> >
> >         doc = parser.getDocument();
> >         root = doc.getDocumentElement();
> >
> >         ... ...
> >
> >         parser.reset();
> >         XMLPlatformUtils::Terminate();
> > }
> >
> > Still the problem happens. I have checked, the problem happens at the
> > DOMParser parser;
> > Please help. Thanks.
> >
> > Best regards,
> > --------------------------------------------
> > Jordan Cheun Ngen, Chong
> > Room 4067
> > Distributed and Embeded Systems Group
> > Centre for Telematics and Information Technology
> > University of Twente
> > Faculty Informatica
> > 7522 NB Enschede
> > The Netherlands
> > --------------------------------------------
> > Office Phone: +31 53 4894655
> > Web site: http://www.cs.utwente.nl/~chong
> > Email Add.: chong@cs.utwente.nl
> > ============================================
> >
> > > -----Original Message-----
> > > From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
> > > Sent: Monday, August 20, 2001 3:09 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: Re: xerces c++ parser does not parse new xml after reset
> > >
> > >
> > >
> > >
> > > Elliott Perkins wrote:
> > >
> > > > [snipped] The question
> > > > is "how do you use DOMParser to parse multiple XMLs within the same
> > > > session"?  Other than the call to
> XMLPlatformUtils::Initialize(), are
> > > > there other initialization calls that are required in order
> to setup the
> > > > DOMParser?
> > >
> > > You cannot call XMLPlatformUtils::Initialize(); again after
> > > XMLPlatformUtils::Terminate(); within the same
> > > process.  See http://xml.apache.org/xerces-c/faq-parse.html#faq-25 for
> > > further detail.
> > >
> > > To parse multiple XMLs using the same parser, just loop the
> parse method
> > > like:
> > >
> > > for (i=0, i<numOfFiles; i++) {
> > >    parser.parse(xmlFile[i]);
> > > }
> > >
> > > You can optionally call DOMParser::reset() to reset the
> parser state as
> > > documented, although, the scanner will also call this method
> internally to
> > > reset the states.
> > >
> > > But please remember, don't call
> > > XMLPlatformUtils::Initialize/Terminate pair
> > > multiple times.
> > >
> > > Tinny.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: xerces c++ parser does not parse new xml after reset

Posted by Tinny Ng <tn...@ca.ibm.com>.
XMLPlatformUtils::Initialize()/Terminate(); should be OUTSIDE the body of
"function".  The XMLPlatformUtils::Initalize()/Terminate(); can only be called
once within the entire application.

Tinny

Jordan C N Chong wrote:

> Dear Tinny
>
> Thanks again for your valuable time and help...
>
> This is the code:
>
> // path: the path and the file name
> void function(char *path)
> {
>
>         // Parse the license with XML4C
>         XMLPlatformUtils::Initialize();
>         DOMParser parser;
>         parser.parse(path);
>
>         doc = parser.getDocument();
>         root = doc.getDocumentElement();
>
>         ... ...
>
>         parser.reset();
>         XMLPlatformUtils::Terminate();
> }
>
> Still the problem happens. I have checked, the problem happens at the
> DOMParser parser;
> Please help. Thanks.
>
> Best regards,
> --------------------------------------------
> Jordan Cheun Ngen, Chong
> Room 4067
> Distributed and Embeded Systems Group
> Centre for Telematics and Information Technology
> University of Twente
> Faculty Informatica
> 7522 NB Enschede
> The Netherlands
> --------------------------------------------
> Office Phone: +31 53 4894655
> Web site: http://www.cs.utwente.nl/~chong
> Email Add.: chong@cs.utwente.nl
> ============================================
>
> > -----Original Message-----
> > From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
> > Sent: Monday, August 20, 2001 3:09 PM
> > To: xerces-c-dev@xml.apache.org
> > Subject: Re: xerces c++ parser does not parse new xml after reset
> >
> >
> >
> >
> > Elliott Perkins wrote:
> >
> > > [snipped] The question
> > > is "how do you use DOMParser to parse multiple XMLs within the same
> > > session"?  Other than the call to XMLPlatformUtils::Initialize(), are
> > > there other initialization calls that are required in order to setup the
> > > DOMParser?
> >
> > You cannot call XMLPlatformUtils::Initialize(); again after
> > XMLPlatformUtils::Terminate(); within the same
> > process.  See http://xml.apache.org/xerces-c/faq-parse.html#faq-25 for
> > further detail.
> >
> > To parse multiple XMLs using the same parser, just loop the parse method
> > like:
> >
> > for (i=0, i<numOfFiles; i++) {
> >    parser.parse(xmlFile[i]);
> > }
> >
> > You can optionally call DOMParser::reset() to reset the parser state as
> > documented, although, the scanner will also call this method internally to
> > reset the states.
> >
> > But please remember, don't call
> > XMLPlatformUtils::Initialize/Terminate pair
> > multiple times.
> >
> > Tinny.
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: xerces c++ parser does not parse new xml after reset

Posted by Jordan C N Chong <ch...@cs.utwente.nl>.
Dear Tinny

Thanks again for your valuable time and help...

This is the code:

// path: the path and the file name
void function(char *path)
{

	// Parse the license with XML4C
	XMLPlatformUtils::Initialize();
	DOMParser parser;
	parser.parse(path);

	doc = parser.getDocument();
	root = doc.getDocumentElement();

	... ...

	parser.reset();
	XMLPlatformUtils::Terminate();
}

Still the problem happens. I have checked, the problem happens at the
DOMParser parser;
Please help. Thanks.


Best regards,
--------------------------------------------
Jordan Cheun Ngen, Chong
Room 4067
Distributed and Embeded Systems Group
Centre for Telematics and Information Technology
University of Twente
Faculty Informatica
7522 NB Enschede
The Netherlands
--------------------------------------------
Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: chong@cs.utwente.nl
============================================


> -----Original Message-----
> From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
> Sent: Monday, August 20, 2001 3:09 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: xerces c++ parser does not parse new xml after reset
>
>
>
>
> Elliott Perkins wrote:
>
> > [snipped] The question
> > is "how do you use DOMParser to parse multiple XMLs within the same
> > session"?  Other than the call to XMLPlatformUtils::Initialize(), are
> > there other initialization calls that are required in order to setup the
> > DOMParser?
>
> You cannot call XMLPlatformUtils::Initialize(); again after
> XMLPlatformUtils::Terminate(); within the same
> process.  See http://xml.apache.org/xerces-c/faq-parse.html#faq-25 for
> further detail.
>
> To parse multiple XMLs using the same parser, just loop the parse method
> like:
>
> for (i=0, i<numOfFiles; i++) {
>    parser.parse(xmlFile[i]);
> }
>
> You can optionally call DOMParser::reset() to reset the parser state as
> documented, although, the scanner will also call this method internally to
> reset the states.
>
> But please remember, don't call
> XMLPlatformUtils::Initialize/Terminate pair
> multiple times.
>
> Tinny.
>
>
>
> ---------------------------------------------------------------------
> 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: xerces c++ parser does not parse new xml after reset

Posted by Tinny Ng <tn...@ca.ibm.com>.

Elliott Perkins wrote:

> [snipped] The question
> is "how do you use DOMParser to parse multiple XMLs within the same
> session"?  Other than the call to XMLPlatformUtils::Initialize(), are
> there other initialization calls that are required in order to setup the
> DOMParser?

You cannot call XMLPlatformUtils::Initialize(); again after
XMLPlatformUtils::Terminate(); within the same
process.  See http://xml.apache.org/xerces-c/faq-parse.html#faq-25 for
further detail.

To parse multiple XMLs using the same parser, just loop the parse method
like:

for (i=0, i<numOfFiles; i++) {
   parser.parse(xmlFile[i]);
}

You can optionally call DOMParser::reset() to reset the parser state as
documented, although, the scanner will also call this method internally to
reset the states.

But please remember, don't call XMLPlatformUtils::Initialize/Terminate pair
multiple times.

Tinny.



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