The output file is closed when the LocalFileFormatTarget object is deleted; now you are leaking it, so this never occurs.
Try using

      LocalFileFormatTarget my_form_target(out_file_name);
      output->setByteStream(&my_form_target);


Alberto

On 12/20/2010 8:19 AM, Sharma, Gaurav wrote:
Hi All,

Can anyone tell me that how I can close the handle for output xml file that I 
open to write the document tree using the following code:

DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("LS"));
    DOMLSSerializer *writer = 
((DOMImplementationLS*)impl)->createLSSerializer();

    
writer->getDomConfig()->setParameter(XMLString::transcode("format-pretty-print"),
 true);
       DOMLSOutput *output = ((DOMImplementationLS*)impl)->createLSOutput();
       XMLFormatTarget *my_form_target = new 
LocalFileFormatTarget(out_file_name);
       output->setByteStream(my_form_target);
       writer->write(doc, output);
       output->release();
       output = NULL;
    }
    writer->release();
    writer = NULL;

Even after releasing both writer and output I am not able to close the file handle 
opened by the process. I cant delete it and even I cant reparse it using 
XMLDomParser->parse() function.

Any help would be appreciated.

With Best Regards
Gaurav Sharma
The information contained in this electronic mail transmission
may be privileged and confidential, and therefore, protected
from disclosure. If you have received this communication in
error, please notify us immediately by replying to this
message and deleting it from your computer without copying
or disclosing it.





Reply via email to