[
https://issues.apache.org/jira/browse/XERCESC-1843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ravi Binwade reopened XERCESC-1843:
-----------------------------------
Hi,
Thanks for your suggestion , I do appriciate it.
Do you mean that "return Doc;" statement is cause of segmentation fault?
I don't think so as I tested the code without returning Doc but still same
Segmentation fault received.
Please note that , the core dump is received @ line :
DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(tempStr);
Also, I got same error when I used XercesDOMParser and XMLReader.
Below is alternative solution that I tried :
---------------------------------
DOMDocument *Doc=NULL;
XercesDOMParser* parser = new XercesDOMParser();
InputSource* inputSource = new MemBufInputSource((const XMLByte*)
buffer, length,
(const XMLCh*)"XMLbuffer", false);
parser ->parse(*inputSource); // Segmentation fault @ this line
success=(parser ->getErrorCount()==0);
if(!success)
{
return Doc;
}
Doc= parser ->getDocument();
delete parser ;
delete inputSource;
return Doc;
-----------------------------------------
All I need to do is upgrade the following code from v2.1 to v2.6 :
-------------------------------------------------------------------
DOM_Document Doc;
DOMParser *domParser= new DOMParser();
InputSource* inputSource = new MemBufInputSource((const XMLByte*)
buffer, length,
(const XMLCh*)"XMLbuffer", false);
domParser->parse(*inputSource);
success=(domParser->getErrorCount()==0);
if(!success)
{
return Doc;
}
Doc= domParser->getDocument();
delete domParser;
delete inputSource;
return Doc;
-------------------------------------------------------------------
Kindly suggest .
Thanks in advance.
~ Ravi.
> Memory fault in DOMImplementationRegistry::getDOMImplementation
> ---------------------------------------------------------------
>
> Key: XERCESC-1843
> URL: https://issues.apache.org/jira/browse/XERCESC-1843
> Project: Xerces-C++
> Issue Type: Bug
> Components: DOM
> Affects Versions: 2.6.0
> Environment: HP-UX
> Reporter: Ravi Binwade
> Priority: Blocker
>
> Hi,
> I am stuck with memory fault problem in
> DOMImplementationRegistry::getDOMImplementation for last 2 weeks :(
> First , I parse xml buffer string using SAXParser and then create a DOMTree.
> I need to return DOMDocument node from my parse function.
> Following is my code :
> DOMDocument* BaseRecord::Pars(const char* buffer, int length, bool& success)
> {
> DOMDocument* Doc=NULL;
> XMLPlatformUtils::Initialize();
> SAXParser* parser = new SAXParser();
> MemBufInputSource* inputSource = new MemBufInputSource((const
> XMLByte*)buffer,strle(buffer),"test", false);
> parser->parse(*inputSource);
> success=(parser->getErrorCount()==0);
> XMLCh tempStr[100];
> XMLString::transcode("LS", tempStr, 99);
> Wrapper4InputSource domISWrapper(inputSource,false);
> DOMImplementation *impl =
> DOMImplementationRegistry::getDOMImplementation(tempStr); // Segment fault
> here
> DOMBuilder* domparser =
> ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,
> 0);
> Doc = domparser->parse(domISWrapper);
> domparser->release();
> XMLPlatformUtils::Terminate();
> delete parser;
> delete docHandler;
> delete inputSource;
> return Doc;
> }
> Following is data in buffer :
> <KeyFields>
> <Field name="FIELD_NAME">
> <Value>event</Value>
> </Field>
> <Field name="ERROR_SWITCH">
> <Value>5</Value>
> </Field>
> </KeyFields>
> I tried using XercesDomParser but found a memory leak in its implementation.
> So , I am left with only option of using SAXParser.
> Can you please help ?
> Many thanks.
> ~ Ravi Binwade
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]