You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Chris Cheung <ch...@clc.cuhk.edu.hk> on 2004/06/22 17:19:02 UTC

Re: {Spam?} Re: Memory Leak?

Hi Jason,

  Sorry for my late reply.
  I am very pleased to hear that -- NO MEMORY LEAK. And we want to express 
our appreciation to you again -- Thanks a lot!

  My project uses both DOM parsing and SAX parsing. DOM parsing is for 
some small-scale XML configuration file and the application will 
traverse the DOM Tree directly using the API of XML-Xerces. We use SAX 
for parsing some VERY LARGE XML data file which transform the XML data 
into some Perl data structure with filtering.

  I will try to list all API we are currently as soon as possible.

best regards,

Chris

On Tue, 22 Jun 2004, Jason E. Stewart wrote:

> Hi Chris,
> 
> There are two MAJOR core issues with XML-Xerces at the moment:
> 1) Memory leaks
> 2) Multiple Inheritance strangeness with the DOMNode hierarchy
> 
> Because I've been unable to debug these in the past, I've taken a new
> approach - completely re-build XML-Xerces from the ground up. This is
> not a code rewrite because all I am doing is constructing a SWIG
> interface file, Xerces.i, which enables SWIG to autowrap Xerces-C. 
> 
> Xerces is a rather large API - at last count I am wrapping 108
> different header files. 
> 
> So to make debugging simple I am starting over from scratch - only
> wrapping the barest minimum of files to get working tests - and then
> testing all aspects of the system - including memory leaks.
> 
> With only 10 headers wrapped, I get the basic XercesDOMParser
> implementation, and the good news is:
> 
>   NO MEMORY LEAKS!!
> 
> So I am going to slowly add the other DOM components and check my
> progress until I have recreated the complete API and located the
> problems.
> 
> I am building this against the Xerces-C-2.6 from CVS, and I am happy
> to make my intermediate builds available for your testing. What are
> the API's which you desperately need for your application - I will be
> happy to include them in my testing.
> 
> Cheers,
> jas.
> 



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


Re: {Spam?} Re: Memory Leak?

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
Chris Cheung <ch...@clc.cuhk.edu.hk> writes:

> Dear Jason,
>
> On Tue, 22 Jun 2004, Jason E. Stewart wrote:
>
>> Chris Cheung <ch...@clc.cuhk.edu.hk> writes:
>> 
>> > My project uses both DOM parsing and SAX parsing. DOM parsing is for
>> > some small-scale XML configuration file and the application will
>> > traverse the DOM Tree directly using the API of XML-Xerces. We use
>> > SAX for parsing some VERY LARGE XML data file which transform the
>> > XML data into some Perl data structure with filtering.
>> >
>> > I will try to list all API we are currently as soon as possible.
>> 
>> There are 5 major API's that I need to consider:
>> 
>> * XercesDOMParser
>> * DOMBuilder 
>> * SAXParser
>> * SAX2XMLReader
>> * DOMWriter
>> 
>
> Thank you very much for your help.
>
> The APIs which our project uses are listed as follows. 
> (Sorry that I just grep them from source code, but the class and method 
> name should be obvious)
> If you find that we used Xerces-Perl inappropreately somewhere or have 
> some better suggestion, please kindly let us know.

Ok, it looks like you're using XercesDOMParser and not the new DOM
Level 3 system, DOMBuilder. You are using the DOM Level 3
serialization, DOMWriter. And you are using SAX Level 2, XMLReader. 

Cheers,
jas.

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


Re: {Spam?} Re: Memory Leak?

Posted by Chris Cheung <ch...@clc.cuhk.edu.hk>.
Dear Jason,

On Tue, 22 Jun 2004, Jason E. Stewart wrote:

> Chris Cheung <ch...@clc.cuhk.edu.hk> writes:
> 
> > My project uses both DOM parsing and SAX parsing. DOM parsing is for
> > some small-scale XML configuration file and the application will
> > traverse the DOM Tree directly using the API of XML-Xerces. We use
> > SAX for parsing some VERY LARGE XML data file which transform the
> > XML data into some Perl data structure with filtering.
> >
> > I will try to list all API we are currently as soon as possible.
> 
> There are 5 major API's that I need to consider:
> 
> * XercesDOMParser
> * DOMBuilder 
> * SAXParser
> * SAX2XMLReader
> * DOMWriter
> 

Thank you very much for your help.

The APIs which our project uses are listed as follows. 
(Sorry that I just grep them from source code, but the class and method 
name should be obvious)
If you find that we used Xerces-Perl inappropreately somewhere or have 
some better suggestion, please kindly let us know.


DOM parsing:
------------

1. my $parser = XML::Xerces::XercesDOMParser->new();

2. $parser->setDoNamespaces(1);

3. $parser->setCreateEntityReferenceNodes(1);

4. $parser->setDoSchema(1);

5. $parser->setErrorHandler(...);

6. $parser->setValidationScheme($XML::Xerces::AbstractDOMParser::Val_Auto);

7. $parser->parse(XML::Xerces::MemBufInputSource->new($xmlString));

8. $parser->parse($xmlFile);

9. my $doc = $parser->getDocument();

SAX parsing:
------------

1. my $parser = XML::Xerces::XMLReaderFactory::createXMLReader();

2. $parser->setFeature("$XML::Xerces::XMLUni::fgSAX2CoreNameSpaces", 1);

3. $parser->setFeature("$XML::Xerces::XMLUni::fgSAX2CoreValidation",1);

4. $parser->setFeature("$XML::Xerces::XMLUni::fgXercesDynamic", 1);

5. $parser->setFeature("$XML::Xerces::XMLUni::fgXercesSchema", 1);

6. $parser->setErrorHandler(...);

7. $parser->setContentHandler(...);

8. $parser->parse(XML::Xerces::MemBufInputSource->new($xmlString));

9. $parser->parse(XML::Xerces::LocalFileInputSource->new($xmlFile));

XML Serialization:
------------------

1. my $domImpl = 
     XML::Xerces::DOMImplementationRegistry::getDOMImplementation('LS');

2. my $writer = $domImpl->createDOMWriter();

3. $writer->canSetFeature('format-pretty-print',1);

4. $writer->setFeature('format-pretty-print',1);

5. my $target = XML::Xerces::MemBufFormatTarget->new();

6. $writer->writeNode($target, $doc);

7. $target->getRawBuffer();


-- 
Best Regards,

Chris Cheung




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


Re: {Spam?} Re: Memory Leak?

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
Chris Cheung <ch...@clc.cuhk.edu.hk> writes:

> My project uses both DOM parsing and SAX parsing. DOM parsing is for
> some small-scale XML configuration file and the application will
> traverse the DOM Tree directly using the API of XML-Xerces. We use
> SAX for parsing some VERY LARGE XML data file which transform the
> XML data into some Perl data structure with filtering.
>
> I will try to list all API we are currently as soon as possible.

There are 5 major API's that I need to consider:

* XercesDOMParser
* DOMBuilder 
* SAXParser
* SAX2XMLReader
* DOMWriter

Let me know which of these you are most concerned with. 

Cheers,
jas.

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