Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1511

SAX2 parse method starts parsing XML document and hangs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Invalid
    • 2.5.0
    • None
    • SAX/SAX2
    • None
    • Xerces-C++ version number :- xerces-c_2_5_0-hpux_11-acc_a03
      Platform :- HP-UX 11
      Operating system and version number :- HP-UX Unix Version 11.0
      Compiler and version number :- aCC compiler - HP aC++ Version A.03.37

    Description

      Xerces-C++ version number xerces-c_2_5_0-hpux_11-acc_a03
      Platform HP-UX 11
      Operating system and version number HP-UX Unix Version 11.0
      Compiler and version number aCC compiler - HP aC++ Version A.03.37
      The schema document has no issues and the the XML string also has no issues, because both work well when i used ALTOVA tool for parsing.
      The XML document (or excerpt) that failed
      <?xml version="1.0" encoding="UTF-8"?><NumberManagerXML2.0 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/opt/lnpsite/nimnm00/flat/schema/NMXMLInterface.xsd"><CreateSV><RequestHandleInfo RequestHandle="1319"></RequestHandleInfo><TnInfo
      STARTTN="1501502001" ENDTN="1501502001"></TnInfo><SVIDInfo SVID="43774"></SVIDInfo><LRNInfo LRN="4004000000"></LRNInfo><BlockHolderReturnInfo BlockHolderReturnFlag=""></BlockHolderReturnInfo><SPIDInfo SPID="SP00"></SPIDInfo><GTTDataInfo ClassDPC="222222222" ClassSSN="222" ClassGTA="1" ClassTT="111" CnamDPC="222222222" CnamSSN="222" CnamTT="111" CnamGTA="1" IsvmDPC="222222222" IsvmSSN="222" IsvmTT="111" IsvmGTA="1" LidbDPC="222222222" LidbSSN="222" LidbTT="111" LidbGTA="1" WsmscDPC="" WsmscSSN="" WsmscTT="" WsmscGTA=""></GTTDataInfo><LocationInfo Location=""></LocationInfo><LocationTypeInfo LocationType=""></LocationTypeInfo><BillingIdInfo BillingId=""></BillingIdInfo><ActivationDateInfo ActivationDate="2005-10-05"></ActivationDateInfo><ActivationTimeInfo ActivationTime="15:43:46"></ActivationTimeInfo><NPACRegionInfo NPACRegionId="1"></NPACRegionInfo><LNPTypeInfo LNPTypeIndicator="0"></LNPTypeInfo><UpdateInfo UpdateIndicator="1"></UpdateInfo><CreateDeleteInfo CreateDeleteReason="0"></CreateDeleteInfo><ContaminateStatusInfo ContaminateStatus="0"></ContaminateStatusInfo><MessageContext Indicator="0"></MessageContext></CreateSV></NumberManagerXML2.0>
      The C++ application code that failed

      parser = (SAX2XMLReader*) XMLReaderFactory::createXMLReader();
      parser->setContentHandler(this);
      parser->setErrorHandler(this);
      parser->setFeature(XMLUni::fgXercesSchema, true);

      ofstream outfile;
      RWCString msgFileName;
      RWCString uniqName(tempnam("/tmp","XML_"));
      msgFileName.append(uniqName);
      msgFileName.append(LTime::now().asString("_%Y""%m""%d",RWZone::utc()));
      msgFileName.append(LTime::now().asString("%H""%M""%S",RWZone::utc()));
      msgFileName.append(".xml");
      outfile.open (msgFileName, ofstream::out); ----> I am creating a temporary xml file here
      outfile<<XMLStringBuffer; ---> This string buffer has the XML string mentioned above
      outfile.close();
      cout<<"I am here: abt to errorReset"<<endl;
      this->resetErrors();
      cout<<"I am here: abt to parse"<<msgFileName<<endl;

      parser->parse(msgFileName); --> Sending the file to the parser (After this i am able to see the start document method call in my logs, but after that nothing)

      cout<<"I am here: Done with parse - going to remove file"<<msgFileName<<endl;
      remove(msgFileName); --> i am removing the file

      Whether you built the Xerces-C++ library yourself or used the binary distribution - NO I sued the 2_5_7 libraries.

      What happened

      I am using the SAX2 parser to parse my XML files.
      I dont use any threads here, its a single flow of events from parser creation till the parsing of the xml file.

      I observe that in my logs, once the XML string is created and sent to the piece of code mentioned above. The parser hangs in the parse method.
      As per its behaviour, it is supposed to call the "start document" "statrt element" functions whihc are overloaded in my classes.
      The last log statement that i see is the " start document " after that i dont get anything. My application proceeds with other threads where i do socket operations totally un-related to the XML logic or piece of code.

      Here are the logs

      TRACELOG_MSG : 10/05/05 09:56:51.236 : - XML string is being validated:[<?xml version="1.0" encoding="UTF-8"?>
      <NumberManagerXML2.0 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/opt/lnpsite/nimnm00/flat/schema/NMXMLInterface.xsd"><CreateSV><RequestHandleInfo RequestHandle="1319"></RequestHandleInfo><TnInfo STARTTN="1501502001" ENDTN="1501502001"></TnInfo><SVIDInfo SVID="43774"></SVIDInfo><LRNInfo LRN="4004000000"></LRNInfo><BlockHolderReturnInfo BlockHolderReturnFlag=""></BlockHolderReturnInfo><SPIDInfo SPID="SP00"></SPIDInfo><GTTDataInfo ClassDPC="222222222" ClassSSN="222" ClassGTA="1" ClassTT="111" CnamDPC="222222222" CnamSSN="222" CnamTT="111" CnamGTA="1" IsvmDPC="222222222" IsvmSSN="222" IsvmTT="111" IsvmGTA="1" LidbDPC="222222222" LidbSSN="222" LidbTT="111" LidbGTA="1" WsmscDPC="" WsmscSSN="" WsmscTT="" WsmscGTA=""></GTTDataInfo><LocationInfo Location=""></LocationInfo><LocationTypeInfoLocationType=""></LocationTypeInfo><BillingIdInfo BillingId=""></BillingIdInfo><ActivationDateInfo ActivationDate="2005-10-05"></ActivationDateInfo><ActivationTimeInfo ActivationTime="15:43:46"></ActivationTimeInfo><NPACRegionInfo NPACRegionId="1"></NPACRegionInfo><LNPTypeInfo LNPTypeIndicator="0"></LNPTypeInfo><UpdateInfo UpdateIndicator="1"></UpdateInfo><CreateDeleteInfo CreateDeleteReason="0"></CreateDeleteInfo><ContaminateStatusInfo ContaminateStatus="0"></ContaminateStatusInfo><MessageContext Indicator="0"></MessageContext></CreateSV></NumberManagerXML2.0>] (XMLConverter.C, 131)
      TRACELOG_MSG : 10/05/05 09:56:51.237 : - Xml schema file was obtained:[/opt/lnpsite/nimnm00/flat/schema/NMXMLInterface.xsd]
      (XMLConverter.C, 151)
      I am here: abt to errorReset
      I am here: abt to parse/tmp/XML_EAAa26861_20051005155651.xml
      TRACELOG_MSG : 10/05/05 09:56:51.240 : - Function entry CXMLConverter::startDocument (XMLConverter.C, 241)
      TRACELOG_MSG : 10/05/05 09:56:51.240 : - Function exit CXMLConverter::startDocument (XMLConverter.C, 242)
      TRACELOG_MSG : 10/05/05 09:56:51.598 : - Function entry ServiceBuilderSocket::PollRead (ServiceBuilderSocket.C, 160) --> other processing continues
      TRACELOG_MSG : 10/05/05 09:56:51.598 : - LOCKING Mutex 'SBSocketLock' stat=0 [???:0] (SThreadMutex.C, 167)

      Attachments

        Activity

          People

            Unassigned Unassigned
            rc_sunil Sunil Ramchandra
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: