ss ak wrote:
I am using DOMParser to parser an xml and walk through the xml to create an
xml with data.
filling in the data....and i get segmentation fault...
try
    {
        XMLPlatformUtils::Initialize();
    }
    catch(const XMLException &toCatch)
    {
         printf ("Error during Xerces-c Initialization.\n");
         return;
  }

 printf("PARSING XML  %s\n",Filename);
 m_ConfigFileParser = new XercesDOMParser;
 m_ConfigFileParser->setDoSchema(true);
    m_ConfigFileParser->setValidationScheme(XercesDOMParser::Val_Never);
    m_ConfigFileParser->setDoNamespaces(true);
    m_ConfigFileParser->loadGrammar(Filename, Grammar::SchemaGrammarType,
true);
    m_ConfigFileParser->parse("event.xml");

 printf("PARSING XML  %s 222222 \n",Filename);
    DOMDocument* xsddoc = m_ConfigFileParser->getDocument();

if(!xsddoc)
       printf("FIRST ELEMENT  %s 222222 \n",Filename);
You check to see if the document is a null pointer and if it is, then you print this string to the standard output.



DOMElement* elementRoot = xsddoc->getDocumentElement();
You then possibly de-reference a null pointer, likely leading to a segmentation fault.


I get this

PARSING XML  event.xml

PARSING XML  event.xml
 222222
FIRST ELEMENT  event.xml
 222222
Segmentation fault

Please let me know how to solve this...thanks in advance
For some reason, the xsddoc pointer is null. Perhaps there are errors in your XML document so no document was created. Since you haven't installed an ErrorHandler in the XercesDOMParser, you'll never know.

Please look at the DOMPrint sample for more information.

Dave

Reply via email to