[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    Please help me out in this function
From:       "Sree Harsha" <sree.harsha.sn () gmail ! com>
Date:       2008-02-25 5:41:18
Message-ID: 4ba3dbf80802242129g5ccbc0c2mbde5e953e99a132b () mail ! gmail ! com
[Download RAW message or body]

/* this function loads an xml and divides the xml into smaller xmls of 4k
size and processes it so that the memory consumption does not increase but
when i parsed a xml file of 380MB size it consumed all the memory and ran
out of memory.. i got a message in the notification area that i had run out
of all the virtual memory...Please look at the code ... I know it is quite
long...but please help me out in this .. i dont know what to release()...
none of the example programs use the
domelement/domnodeiterator/parser object in a loop*/

 void load()
  throw( std::runtime_error )
 {
  std::cout<<"in load"<<std::endl;
  DWORD dw;
  DWORD dwErrorCount=0;
  LPDWORD lpFileSize;
  HANDLE hSourceFile;
  HANDLE hDestFile;
  HANDLE hTempFile;
  DWORD  dwBytesRead=0, dwBytesWritten=0, dwBufSize=BUFSIZE;
  char szDestFile[MAX_PATH];
  const char *szSourceFile=InXMLFile_.c_str();
  char szTempName[MAX_PATH];
  char lpPathBuffer[BUFSIZE];
  char buffer[BUFSIZE];
  char lbuffer[BUFSIZE];
  char lEndLineBuffer[BUFSIZE];
  int i=0,j=0,k=0;
  int found=0;
  int EventType;
  char szLineEndings[3];
  szLineEndings[0]=13;
  szLineEndings[1]=10;
  szLineEndings[2]=0;
  char szStartLine[42]="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
  strcat_s(szStartLine,sizeof(szStartLine),szLineEndings);
  char szEventlistTag[14]="<eventlist>";
  strcat_s(szEventlistTag,sizeof(szEventlistTag),szLineEndings);
  char szEventlistEndTag[]="</eventlist>";
  xercesc::DOMDocumentType* outXmlDoctype = NULL;
  xercesc::DOMDocument* outXmlDoc = NULL;
  xercesc::DOMNode *pNode = NULL;
  xercesc::DOMImplementation *pImplement = NULL;

  // these two are needed to display DOM output.
  xercesc::DOMWriter *pSerializer = NULL;
  xercesc::XMLFormatTarget *pTarget = new
LocalFileFormatTarget(dsOutXMLFile_.asXMLString());;

  // get a serializer, an instance of DOMWriter (the "LS" stands for
load-save).
  pImplement =
DOMImplementationRegistry::getDOMImplementation(XercesString("LS"));
  pSerializer = ( (DOMImplementationLS*)pImplement )->createDOMWriter();

  // set user specified end of line sequence and output encoding
  pSerializer->setNewLine( XercesString("\n") );

  // set feature if the serializer supports the feature/mode
  if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, false)
)
   pSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, false);

  if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent,
false) )
   pSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, false);
  if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false)
)
   pSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false);
  if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTBOM, false) )
   pSerializer->setFeature(XMLUni::fgDOMWRTBOM, false);

  // create a document
  outXmlDoctype = pImplement->createDocumentType(XercesString("LS"
),NULL,NULL);
  //creates a root tag called <Product>
  outXmlDoc = pImplement->createDocument( NULL, XercesString("Product"),NULL
);
  if (outXmlDoc)
  {
   // output related nodes are prefixed with "svg"
   // to distinguish them from input nodes.
   outXmlDoc->setEncoding( XercesString("UTF-8") );
   outXmlDoc->setStandalone(true);
   outXmlDoc->setVersion( XercesString("1.0") );
   DOMElement *pRoot = outXmlDoc->getDocumentElement();
   DOMAttr* attrName    = outXmlDoc->createAttribute( XercesString("name")
);
   attrName->setValue( XercesString("Name") );
   pRoot->setAttributeNode(attrName);
   DOMAttr* attrVersion= outXmlDoc->createAttribute( XercesString("version")
);
   attrVersion->setValue( XercesString("Version") );
   pRoot->setAttributeNode(attrVersion);
   // Create a root element
   DOMElement* pFiles = outXmlDoc->createElement(XercesString("Files") );
   pRoot->appendChild(pFiles);
   DOMElement* pAddedFiles=outXmlDoc->createElement(XercesString("Added"));
   pFiles->appendChild(pAddedFiles);
   DOMElement*
pUpdatedFiles=outXmlDoc->createElement(XercesString("Updated"));
   pFiles->appendChild(pUpdatedFiles);
   DOMElement*
pDeletedFiles=outXmlDoc->createElement(XercesString("Deleted"));
   pFiles->appendChild(pDeletedFiles);

   DOMElement* pDirs = outXmlDoc->createElement( XercesString("Dirs") );
   pRoot->appendChild(pDirs);
   DOMElement*  pAddedDirs = outXmlDoc->createElement( XercesString("Added")
);
   pDirs->appendChild(pAddedDirs);
   DOMElement*  pUpdatedDirs = outXmlDoc->createElement(
XercesString("Updated") );
   pDirs->appendChild(pUpdatedDirs);
   DOMElement*  pDeletedDirs = outXmlDoc->createElement(
XercesString("Deleted") );
   pDirs->appendChild(pDeletedDirs);

 DOMElement* pRegKey = outXmlDoc->createElement( XercesString("RegistryKey")
);
    pRoot->appendChild(pRegKey);
    DOMElement*  pAddedRegKey = outXmlDoc->createElement(
XercesString("Added") );
    pRegKey->appendChild(pAddedRegKey);
 DOMElement*  pUpdatedRegKey = outXmlDoc->createElement(
XercesString("Updated") );
    pRegKey->appendChild(pUpdatedRegKey);
 DOMElement*  pDeletedRegKey = outXmlDoc->createElement(
XercesString("Deleted") );
    pRegKey->appendChild(pDeletedRegKey);

 DOMElement* pRegValue = outXmlDoc->createElement(
XercesString("RegistryValue") );
    pRoot->appendChild(pRegValue);
    DOMElement*  pAddedRegValue = outXmlDoc->createElement(
XercesString("Added") );
    pRegValue->appendChild(pAddedRegValue);
 DOMElement*  pUpdatedRegValue = outXmlDoc->createElement(
XercesString("Updated") );
    pRegValue->appendChild(pUpdatedRegValue);
 DOMElement*  pDeletedRegValue = outXmlDoc->createElement(
XercesString("Deleted") );
    pRegValue->appendChild(pDeletedRegValue);

 DOMElement* pServices = outXmlDoc->createElement( XercesString("Services")
);
    pRoot->appendChild(pServices);
    DOMElement*  pAddedServices = outXmlDoc->createElement(
XercesString("Added") );
    pServices->appendChild(pAddedServices);
 DOMElement*  pUpdatedServices = outXmlDoc->createElement(
XercesString("Updated") );
    pServices->appendChild(pUpdatedServices);
 DOMElement*  pDeletedServices = outXmlDoc->createElement(
XercesString("Deleted") );
    pServices->appendChild(pDeletedServices);


  parser_.setValidationScheme( xercesc::XercesDOMParser::Val_Never ) ;
  parser_.setDoNamespaces( false ) ;
  parser_.setDoSchema( false ) ;
  parser_.setLoadExternalDTD( false ) ;

  hSourceFile = CreateFile(szSourceFile,    // file name
        GENERIC_READ,                   // open for reading
        FILE_SHARE_READ,                // Enables subsequent open
operations on an object to request read access
        NULL,                           // default security
        OPEN_EXISTING,                  // existing file only
        FILE_ATTRIBUTE_NORMAL,          // normal file
        NULL);                          // no template
  if (hSourceFile == INVALID_HANDLE_VALUE)
  {
   std::cout<<"Error: "<<GetLastError()<<std::endl<<"Could not open source
File"<<std::endl;
   return;
  }
  GetTempPath(dwBufSize,   // length of the buffer
   lpPathBuffer);      // buffer for path
  // Create a temporary file.
  GetTempFileName(lpPathBuffer, // directory for temp files
   "NEW",                    // temp file name prefix
   0,                        // create unique name
   szTempName);              // buffer for name
  XercesString src(szTempName);


  std::cout<<"szTempName: "<<szTempName<<std::endl;

  do
  {

   i=0;
   ReadFile(hSourceFile, buffer, BUFSIZE,&dwBytesRead, NULL);
   found=0;
   do
   {
    k=GetLine(buffer+i, lbuffer,&i,dwBytesRead);
    i+=k;
    if(i>dwBytesRead)
    {
     SetFilePointer(hSourceFile,-k,NULL,FILE_CURRENT);
     break;
    }
    if(strstr(lbuffer,TEXT("<eventlist>")))
    {
     found=1;
    }
   }while((i<dwBytesRead)&&(found==0));
  }while((dwBytesRead==BUFSIZE)&&(found==0));

  SetFilePointer(hSourceFile,-(BUFSIZE-i),NULL,FILE_CURRENT);

  do{
   {
    LocalFileInputSource source(src);
   hTempFile = CreateFile((LPTSTR) szTempName,  // file name
    GENERIC_READ | GENERIC_WRITE, // open for read/write
    FILE_SHARE_READ,              // Enables subsequent open operations on
an object to request read access
    NULL,                         // default security
    CREATE_ALWAYS,                // overwrite existing file
    FILE_ATTRIBUTE_NORMAL,        // normal file
    NULL);                        // no template
   if (hTempFile == INVALID_HANDLE_VALUE)
   {
    std::cout<<"Error: "<<GetLastError()<<std::endl<<"Could not open temp
File"<<std::endl;
    return;
   }

   WriteFile(hTempFile,szStartLine,sizeof(szStartLine)-2,&dwBytesWritten,NULL);
   WriteFile(hTempFile,szEventlistTag,sizeof(szEventlistTag)-1,&dwBytesWritten,NULL);
   i=0;
   ReadFile(hSourceFile, buffer, BUFSIZE,&dwBytesRead, NULL);
   do
   {
    j=0;
    k=GetCurEvent(buffer+i,lbuffer,&j,&i,&dwBytesRead);
    i+=k;
    if((i>dwBytesRead)||(j==1))
    {

     k=dwBytesRead-(i-k);
     SetFilePointer(hSourceFile,-k,NULL,FILE_CURRENT);
     break;
    }
    if(j==-1)
    {
     break;
    }
    WriteFile(hTempFile,lbuffer,k,&dwBytesWritten,NULL);

   }while(i<BUFSIZE);
   WriteFile(hTempFile,szEventlistEndTag,sizeof(szEventlistEndTag)-1,&dwBytesWritten,NULL);
   CloseHandle(hTempFile);
   //Event Handle functions here...
   //

   try{
    parser_.parse(source);
    dwErrorCount+=parser_.getErrorCount();
    //std::cout<<"parser_getErrorCount()
"<<parser_.getErrorCount()<<std::endl;
    if(!(parser_.getErrorCount()))
    {
     xercesc::DOMDocument* xmlDoc = parser_.getDocument() ;
     xercesc::DOMElement* elementConfig = xmlDoc->getDocumentElement() ;
     if( NULL == elementConfig ){
      throw( std::runtime_error( "empty XML document" ) ) ;
     }
     xercesc::DOMNodeList* children = elementConfig->getElementsByTagName
(tags_.TAG_event.asXMLString());

     const XMLSize_t nodeCount = children->getLength() ;

     for( XMLSize_t ix = 0 ; ix < nodeCount ; ++ix ){
      xercesc::DOMNode* currentNode = children->item( ix ) ;
      if( NULL == currentNode ){
       // null node...
       continue ;
      }
      if( xercesc::DOMNode::ELEMENT_NODE != currentNode->getNodeType() ){
       // not an element node -> not of interest here
       continue ;
      }
      xercesc::DOMElement* currentElement = (xercesc::DOMElement*)(
currentNode ) ;
      EventType=handleEvent( currentElement ) ;

      switch(EventType)
      {
      case 10:
       {
        DOMNodeIterator* iterator =
outXmlDoc->createNodeIterator(pAddedFiles, DOMNodeFilter::SHOW_TEXT, NULL,
true);
        DOMNode* pCurrent = NULL;
        // use the tree walker to print out the text nodes.
        for ( pCurrent = iterator->nextNode();pCurrent != 0; pCurrent =
iterator->nextNode())
        {
         char *strValue = XMLString::transcode( pCurrent->getNodeValue() );
         if(!strcmp(strValue,Path_.c_str()))
         {
          EventType=0;
         }
         //XMLString::release(&strValue);
        }
        if(EventType)
        {
         DOMElement* pPath = outXmlDoc->createElement( XercesString("Path")
);
         pAddedFiles->appendChild(pPath);
         DOMText* pPathnode=outXmlDoc->createTextNode(
XercesString(Path_.c_str()) );
         pPath->appendChild(pPathnode);
        }
        iterator->release();

        break;
       }//case 10;
      case 11:
       {
        DOMNodeIterator* iterator=
outXmlDoc->createNodeIterator(pAddedFiles, DOMNodeFilter::SHOW_TEXT, NULL,
true);
        DOMNodeIterator* uiterator =
outXmlDoc->createNodeIterator(pUpdatedFiles, DOMNodeFilter::SHOW_TEXT, NULL,
true);
        DOMNode* pCurrent = NULL;
        // use the tree walker to print out the text nodes.
        for ( pCurrent = iterator->nextNode();pCurrent != 0; pCurrent =
iterator->nextNode())
        {
         char *strValue = XMLString::transcode( pCurrent->getNodeValue() );
         if(!strcmp(strValue,Path_.c_str()))
         {
          EventType=0;
         }
         //XMLString::release(&strValue);
        }
        if(EventType){
        for ( pCurrent = uiterator->nextNode();pCurrent != 0; pCurrent =
uiterator->nextNode())
        {
         char *strValue = XMLString::transcode( pCurrent->getNodeValue() );
         if(!strcmp(strValue,Path_.c_str()))
         {
          EventType=0;
         }
         //XMLString::release(&strValue);
        }}
        if(EventType)
        {
         //XMLString::release(&strValue);
         DOMElement* pPath = outXmlDoc->createElement( XercesString("Path")
);
         pUpdatedFiles->appendChild(pPath);
         DOMText* pPathnode=outXmlDoc->createTextNode(
XercesString(Path_.c_str()) );
         pPath->appendChild(pPathnode);
        }
        uiterator->release();
        iterator->release();
          break;
       }// case(11)...
      case(12):
       {
        DOMElement* pPath = outXmlDoc->createElement( XercesString("Path")
);
         pDeletedFiles->appendChild(pPath);
         DOMText* pPathnode=outXmlDoc->createTextNode(
XercesString(Path_.c_str()) );
         pPath->appendChild(pPathnode);
        break;
       }
      case (20):
       {
        DOMNodeIterator* iterator =
outXmlDoc->createNodeIterator(pAddedDirs, DOMNodeFilter::SHOW_TEXT, NULL,
true);
        DOMNode* pCurrent = NULL;
        // use the tree walker to print out the text nodes.
        for ( pCurrent = iterator->nextNode();pCurrent != 0; pCurrent =
iterator->nextNode())
        {
         char *strValue = XMLString::transcode( pCurrent->getNodeValue() );
         if(!strcmp(strValue,Path_.c_str()))
         {
          EventType=0;
         }
         //XMLString::release(&strValue);
        }
        if(EventType)
        {

         DOMElement* pPath = outXmlDoc->createElement( XercesString("Path")
);
         pAddedDirs->appendChild(pPath);
         DOMText* pPathnode=outXmlDoc->createTextNode(
XercesString(Path_.c_str()) );
         pPath->appendChild(pPathnode);
        }
        iterator->release();
        break;

       }
      case (21):
       {
        break;
       }
      case (22):
       {
        DOMElement* pPath = outXmlDoc->createElement( XercesString("Path")
);
        pDeletedDirs->appendChild(pPath);
        DOMText* pPathnode=outXmlDoc->createTextNode(
XercesString(Path_.c_str()) );
        pPath->appendChild(pPathnode);
        break;
       }
      case (30):
       {
        DOMNodeIterator* iterator =
outXmlDoc->createNodeIterator(pAddedRegKey, DOMNodeFilter::SHOW_TEXT, NULL,
true);
        DOMNode* pCurrent = NULL;
        // use the tree walker to print out the text nodes.
        for ( pCurrent = iterator->nextNode();pCurrent != 0; pCurrent =
iterator->nextNode())
        {
         char *strValue = XMLString::transcode( pCurrent->getNodeValue() );
         if(!strcmp(strValue,Path_.c_str()))
         {
          EventType=0;
         }
         //XMLString::release(&strValue);
        }
        if(EventType)
        {

         DOMElement* pPath = outXmlDoc->createElement( XercesString("Path")
);
         pAddedRegKey->appendChild(pPath);
         DOMText* pPathnode=outXmlDoc->createTextNode(
XercesString(Path_.c_str()) );
         pPath->appendChild(pPathnode);
        }
        iterator->release();
        break;
       }
      }//end of switch
     }//for loop..
     xmlDoc->release();
     //std::cin>>dwBytesWritten;
    }
   }
   catch( xercesc::XMLException& e ){

   // believe it or not, XMLException is not
   // a parent class of DOMException
    char* message = xercesc::XMLString::transcode( e.getMessage() ) ;
    std::ostringstream buf ;
    buf << "Error parsing file: "
     << message
     << std::flush;
    xercesc::XMLString::release( &message ) ;
    throw( std::runtime_error( buf.str() ) ) ;
   }
   catch( const xercesc::DOMException& e ){

    char* message = xercesc::XMLString::transcode( e.getMessage() ) ;
    std::ostringstream buf ;
    buf << "Encountered DOM Exception: "
     << message<< std::flush;
    xercesc::XMLString::release( &message ) ;
    throw( std::runtime_error( buf.str() ) ) ;
   }
   if((j==-1))
   {
    break;
   }

   }
    DOMRange* range = outXmlDoc->createRange();
    range->release();
    parser_.resetDocument();

  }while(dwBytesRead==BUFSIZE);

  //Here should be write file...

  pSerializer->writeNode(pTarget, *outXmlDoc);

  if(dwErrorCount)
  {
   std::cout<<"Number of errors in file = "<<dwErrorCount<<std::endl<<":-(";
  }
  else
  {
   std::cout<<"No Errors found in file ;-)"<<std::endl;
   std::cout<<"Number of Files Created= "<<CreateFileCount<<std::endl;
   std::cout<<"Number of Files Deleted= "<<DeleteFileCount<<std::endl;
   std::cout<<"Number of Folders Created= "<<CreateFolderCount<<std::endl;

  }
  //std::cin>>dwBytesWritten;

  }//if (outXmlFile)...end

  delete pTarget;
  delete pSerializer;
  delete outXmlDoc;
  delete outXmlDoctype;

  DeleteFile(szTempName);
  CloseHandle(hSourceFile);
  return ;
 } // load()


-- 
Regards
Sree Harsha Vardhana S.N
"When you want something, all the universe conspires in helping you to
achieve it."

[Attachment #3 (text/html)]

<div>/* this function loads&nbsp;an xml and divides the xml into smaller xmls of 4k \
size and processes it so that the memory consumption does not increase but when i \
parsed a xml file of 380MB size it consumed all the memory and ran out of memory.. i \
got a message in the notification area that&nbsp;i had run out of all the virtual \
memory...Please look at the code&nbsp;... I know it is quite long...but please help \
me out in this .. i&nbsp;dont know&nbsp;what&nbsp;to release()... none of the \
example&nbsp;programs use the domelement/domnodeiterator/parser&nbsp;object in a \
loop*/</div>

<div><br>&nbsp;void load()<br>&nbsp;&nbsp;throw( std::runtime_error \
)<br>&nbsp;{<br>&nbsp;&nbsp;std::cout&lt;&lt;&quot;in \
load&quot;&lt;&lt;std::endl;<br>&nbsp;&nbsp;DWORD \
dw;&nbsp;&nbsp;<br>&nbsp;&nbsp;DWORD \
dwErrorCount=0;&nbsp;&nbsp;<br>&nbsp;&nbsp;LPDWORD \
lpFileSize;&nbsp;&nbsp;<br>&nbsp;&nbsp;HANDLE hSourceFile;&nbsp;&nbsp;<br> \
&nbsp;&nbsp;HANDLE hDestFile;&nbsp;&nbsp;<br>&nbsp;&nbsp;HANDLE \
hTempFile;&nbsp;&nbsp;<br>&nbsp;&nbsp;DWORD&nbsp; dwBytesRead=0, dwBytesWritten=0, \
dwBufSize=BUFSIZE;&nbsp;&nbsp;<br>&nbsp;&nbsp;char \
szDestFile[MAX_PATH];&nbsp;&nbsp;<br>&nbsp;&nbsp;const char \
*szSourceFile=InXMLFile_.c_str();&nbsp;&nbsp;<br>&nbsp;&nbsp;char \
szTempName[MAX_PATH];&nbsp;&nbsp;<br> &nbsp;&nbsp;char \
lpPathBuffer[BUFSIZE];&nbsp;&nbsp;<br>&nbsp;&nbsp;char \
buffer[BUFSIZE];&nbsp;&nbsp;<br>&nbsp;&nbsp;char \
lbuffer[BUFSIZE];&nbsp;&nbsp;<br>&nbsp;&nbsp;char \
lEndLineBuffer[BUFSIZE];&nbsp;&nbsp;<br>&nbsp;&nbsp;int \
i=0,j=0,k=0;&nbsp;&nbsp;<br>&nbsp;&nbsp;int found=0;<br>&nbsp;&nbsp;int \
EventType;&nbsp;&nbsp;<br>&nbsp;&nbsp;char szLineEndings[3];&nbsp;&nbsp;<br> \
&nbsp;&nbsp;szLineEndings[0]=13;<br>&nbsp;&nbsp;szLineEndings[1]=10;<br>&nbsp;&nbsp;szLineEndings[2]=0;<br>&nbsp;&nbsp;char \
szStartLine[42]=&quot;&lt;?xml version=\&quot;1.0\&quot; \
encoding=\&quot;UTF-8\&quot;?&gt;&quot;;<br>&nbsp;&nbsp;strcat_s(szStartLine,sizeof(szStartLine),szLineEndings);<br>
 &nbsp;&nbsp;char szEventlistTag[14]=&quot;&lt;eventlist&gt;&quot;;<br>&nbsp;&nbsp;strcat_s(szEventlistTag,sizeof(szEventlistTag),szLineEndings);<br>&nbsp;&nbsp;char \
szEventlistEndTag[]=&quot;&lt;/eventlist&gt;&quot;; \
<br>&nbsp;&nbsp;xercesc::DOMDocumentType* outXmlDoctype = NULL;<br> \
&nbsp;&nbsp;xercesc::DOMDocument* outXmlDoc = NULL;<br>&nbsp;&nbsp;xercesc::DOMNode \
*pNode = NULL;<br>&nbsp;&nbsp;xercesc::DOMImplementation *pImplement = \
NULL;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;// these two are needed to display DOM \
output.<br>&nbsp;&nbsp;xercesc::DOMWriter *pSerializer = NULL;&nbsp;&nbsp;<br> \
&nbsp;&nbsp;xercesc::XMLFormatTarget *pTarget = new \
LocalFileFormatTarget(dsOutXMLFile_.asXMLString());; \
<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;// get a serializer, an instance of DOMWriter (the \
&quot;LS&quot; stands for load-save).<br>&nbsp;&nbsp;pImplement = \
DOMImplementationRegistry::getDOMImplementation(XercesString(&quot;LS&quot;));<br> \
&nbsp;&nbsp;pSerializer = ( (DOMImplementationLS*)pImplement \
)-&gt;createDOMWriter();<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;// set user specified end of \
line sequence and output encoding<br>&nbsp;&nbsp;pSerializer-&gt;setNewLine( \
XercesString(&quot;\n&quot;) );</div> <p>&nbsp;&nbsp;// set feature if the serializer \
supports the feature/mode<br>&nbsp;&nbsp;if ( \
pSerializer-&gt;canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, false) \
)<br>&nbsp;&nbsp;&nbsp;pSerializer-&gt;setFeature(XMLUni::fgDOMWRTSplitCdataSections, \
false);<br> &nbsp;&nbsp;<br>&nbsp;&nbsp;if ( \
pSerializer-&gt;canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, false) \
)<br>&nbsp;&nbsp;&nbsp;pSerializer-&gt;setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, \
false);<br>&nbsp;&nbsp;if ( \
pSerializer-&gt;canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false) )<br> \
&nbsp;&nbsp;&nbsp;pSerializer-&gt;setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, \
false);<br>&nbsp;&nbsp;if ( pSerializer-&gt;canSetFeature(XMLUni::fgDOMWRTBOM, false) \
)<br>&nbsp;&nbsp;&nbsp;pSerializer-&gt;setFeature(XMLUni::fgDOMWRTBOM, \
false);<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;// create a document<br> \
&nbsp;&nbsp;outXmlDoctype = \
pImplement-&gt;createDocumentType(XercesString(&quot;LS&quot; \
),NULL,NULL);<br>&nbsp;&nbsp;//creates a root tag called \
&lt;Product&gt;<br>&nbsp;&nbsp;outXmlDoc = pImplement-&gt;createDocument( NULL, \
XercesString(&quot;Product&quot;),NULL );<br> &nbsp;&nbsp;if \
(outXmlDoc)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;// output related nodes are \
prefixed with &quot;svg&quot;<br>&nbsp;&nbsp;&nbsp;// to distinguish them from input \
nodes.<br>&nbsp;&nbsp;&nbsp;outXmlDoc-&gt;setEncoding( \
XercesString(&quot;UTF-8&quot;) \
);<br>&nbsp;&nbsp;&nbsp;outXmlDoc-&gt;setStandalone(true);<br> \
&nbsp;&nbsp;&nbsp;outXmlDoc-&gt;setVersion( XercesString(&quot;1.0&quot;) \
);<br>&nbsp;&nbsp;&nbsp;DOMElement *pRoot = \
outXmlDoc-&gt;getDocumentElement();<br>&nbsp;&nbsp;&nbsp;DOMAttr* \
attrName&nbsp;&nbsp;&nbsp; = outXmlDoc-&gt;createAttribute( \
XercesString(&quot;name&quot;) );<br> &nbsp;&nbsp;&nbsp;attrName-&gt;setValue( \
XercesString(&quot;Name&quot;) \
);<br>&nbsp;&nbsp;&nbsp;pRoot-&gt;setAttributeNode(attrName);<br>&nbsp;&nbsp;&nbsp;DOMAttr* \
attrVersion= outXmlDoc-&gt;createAttribute( XercesString(&quot;version&quot;) \
);<br>&nbsp;&nbsp;&nbsp;attrVersion-&gt;setValue( XercesString(&quot;Version&quot;) \
);<br> &nbsp;&nbsp;&nbsp;pRoot-&gt;setAttributeNode(attrVersion);<br>&nbsp;&nbsp;&nbsp;// \
Create a root element<br>&nbsp;&nbsp;&nbsp;DOMElement* pFiles = \
outXmlDoc-&gt;createElement(XercesString(&quot;Files&quot;) \
);<br>&nbsp;&nbsp;&nbsp;pRoot-&gt;appendChild(pFiles);<br>&nbsp;&nbsp;&nbsp;DOMElement* \
pAddedFiles=outXmlDoc-&gt;createElement(XercesString(&quot;Added&quot;));<br> \
&nbsp;&nbsp;&nbsp;pFiles-&gt;appendChild(pAddedFiles);<br>&nbsp;&nbsp;&nbsp;DOMElement* \
pUpdatedFiles=outXmlDoc-&gt;createElement(XercesString(&quot;Updated&quot;));<br>&nbsp \
;&nbsp;&nbsp;pFiles-&gt;appendChild(pUpdatedFiles);<br>&nbsp;&nbsp;&nbsp;DOMElement* \
pDeletedFiles=outXmlDoc-&gt;createElement(XercesString(&quot;Deleted&quot;));<br> \
&nbsp;&nbsp;&nbsp;pFiles-&gt;appendChild(pDeletedFiles);</p> \
<p>&nbsp;&nbsp;&nbsp;DOMElement* pDirs = outXmlDoc-&gt;createElement( \
XercesString(&quot;Dirs&quot;) \
);<br>&nbsp;&nbsp;&nbsp;pRoot-&gt;appendChild(pDirs);<br>&nbsp;&nbsp;&nbsp;DOMElement*&nbsp; \
pAddedDirs = outXmlDoc-&gt;createElement( XercesString(&quot;Added&quot;) );<br> \
&nbsp;&nbsp;&nbsp;pDirs-&gt;appendChild(pAddedDirs);<br>&nbsp;&nbsp;&nbsp;DOMElement*&nbsp; \
pUpdatedDirs = outXmlDoc-&gt;createElement( XercesString(&quot;Updated&quot;) \
);<br>&nbsp;&nbsp;&nbsp;pDirs-&gt;appendChild(pUpdatedDirs);<br>&nbsp;&nbsp;&nbsp;DOMElement*&nbsp; \
pDeletedDirs = outXmlDoc-&gt;createElement( XercesString(&quot;Deleted&quot;) );<br> \
&nbsp;&nbsp;&nbsp;pDirs-&gt;appendChild(pDeletedDirs);</p> <p>&nbsp;DOMElement* \
pRegKey = outXmlDoc-&gt;createElement( XercesString(&quot;RegistryKey&quot;) \
);<br>&nbsp;&nbsp;&nbsp; pRoot-&gt;appendChild(pRegKey);<br>&nbsp;&nbsp;&nbsp; \
DOMElement*&nbsp; pAddedRegKey = outXmlDoc-&gt;createElement( \
XercesString(&quot;Added&quot;) );<br> &nbsp;&nbsp;&nbsp; \
pRegKey-&gt;appendChild(pAddedRegKey);<br>&nbsp;DOMElement*&nbsp; pUpdatedRegKey = \
outXmlDoc-&gt;createElement( XercesString(&quot;Updated&quot;) \
);<br>&nbsp;&nbsp;&nbsp; \
pRegKey-&gt;appendChild(pUpdatedRegKey);<br>&nbsp;DOMElement*&nbsp; pDeletedRegKey = \
outXmlDoc-&gt;createElement( XercesString(&quot;Deleted&quot;) );<br> \
&nbsp;&nbsp;&nbsp; pRegKey-&gt;appendChild(pDeletedRegKey);</p> <p>&nbsp;DOMElement* \
pRegValue = outXmlDoc-&gt;createElement( XercesString(&quot;RegistryValue&quot;) \
);<br>&nbsp;&nbsp;&nbsp; pRoot-&gt;appendChild(pRegValue);<br>&nbsp;&nbsp;&nbsp; \
DOMElement*&nbsp; pAddedRegValue = outXmlDoc-&gt;createElement( \
XercesString(&quot;Added&quot;) );<br> &nbsp;&nbsp;&nbsp; \
pRegValue-&gt;appendChild(pAddedRegValue);<br>&nbsp;DOMElement*&nbsp; \
pUpdatedRegValue = outXmlDoc-&gt;createElement( XercesString(&quot;Updated&quot;) \
);<br>&nbsp;&nbsp;&nbsp; \
pRegValue-&gt;appendChild(pUpdatedRegValue);<br>&nbsp;DOMElement*&nbsp; \
pDeletedRegValue = outXmlDoc-&gt;createElement( XercesString(&quot;Deleted&quot;) \
);<br> &nbsp;&nbsp;&nbsp; pRegValue-&gt;appendChild(pDeletedRegValue);</p>
<p>&nbsp;DOMElement* pServices = outXmlDoc-&gt;createElement( \
XercesString(&quot;Services&quot;) );<br>&nbsp;&nbsp;&nbsp; \
pRoot-&gt;appendChild(pServices);<br>&nbsp;&nbsp;&nbsp; DOMElement*&nbsp; \
pAddedServices = outXmlDoc-&gt;createElement( XercesString(&quot;Added&quot;) );<br> \
&nbsp;&nbsp;&nbsp; pServices-&gt;appendChild(pAddedServices);<br>&nbsp;DOMElement*&nbsp; \
pUpdatedServices = outXmlDoc-&gt;createElement( XercesString(&quot;Updated&quot;) \
);<br>&nbsp;&nbsp;&nbsp; \
pServices-&gt;appendChild(pUpdatedServices);<br>&nbsp;DOMElement*&nbsp; \
pDeletedServices = outXmlDoc-&gt;createElement( XercesString(&quot;Deleted&quot;) \
);<br> &nbsp;&nbsp;&nbsp; \
pServices-&gt;appendChild(pDeletedServices);&nbsp;<br>&nbsp;</p> \
<p>&nbsp;&nbsp;parser_.setValidationScheme( xercesc::XercesDOMParser::Val_Never ) \
;<br>&nbsp;&nbsp;parser_.setDoNamespaces( false ) \
;<br>&nbsp;&nbsp;parser_.setDoSchema( false ) \
;<br>&nbsp;&nbsp;parser_.setLoadExternalDTD( false ) \
;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;hSourceFile = \
CreateFile(szSourceFile,&nbsp;&nbsp;&nbsp; // file name <br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
GENERIC_READ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// open for reading <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
FILE_SHARE_READ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// Enables subsequent open operations on an object to request read \
access<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// default security <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
OPEN_EXISTING,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// existing file only <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
FILE_ATTRIBUTE_NORMAL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // \
normal file <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
NULL);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// no template <br>&nbsp;&nbsp;if (hSourceFile == INVALID_HANDLE_VALUE)<br> \
&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;std::cout&lt;&lt;&quot;Error: \
&quot;&lt;&lt;GetLastError()&lt;&lt;std::endl&lt;&lt;&quot;Could not open source \
File&quot;&lt;&lt;std::endl;<br>&nbsp;&nbsp;&nbsp;return;<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;GetTempPath(dwBufSize,&nbsp;&nbsp; \
// length of the buffer<br> \
&nbsp;&nbsp;&nbsp;lpPathBuffer);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // buffer for path \
<br>&nbsp;&nbsp;// Create a temporary file. \
<br>&nbsp;&nbsp;GetTempFileName(lpPathBuffer, // directory for temp files \
<br>&nbsp;&nbsp;&nbsp;&quot;NEW&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// temp file name prefix<br>&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// create unique name<br> \
&nbsp;&nbsp;&nbsp;szTempName);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// buffer for name<br>&nbsp;&nbsp;XercesString src(szTempName);<br>&nbsp;&nbsp;</p> \
<p>&nbsp;&nbsp;std::cout&lt;&lt;&quot;szTempName: \
&quot;&lt;&lt;szTempName&lt;&lt;std::endl;&nbsp;&nbsp;</p> \
<p>&nbsp;&nbsp;do<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;i=0;<br>&nbsp;&nbsp;&nbsp;ReadFile(hSourceFile, \
buffer, BUFSIZE,&amp;dwBytesRead, \
NULL);<br>&nbsp;&nbsp;&nbsp;found=0;<br>&nbsp;&nbsp;&nbsp;do<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;k=GetLine(buffer+i, \
lbuffer,&amp;i,dwBytesRead);<br>&nbsp;&nbsp;&nbsp;&nbsp;i+=k;<br>&nbsp;&nbsp;&nbsp;&nbsp;if(i&gt;dwBytesRead)<br>
 &nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetFilePointer(hSourceFile \
,-k,NULL,FILE_CURRENT);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;& \
nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;if(strstr(lbuffer,TEXT(&quot;&lt;eventlist&gt;&quot; \
)))<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;found=1;<br>&nbsp;&n \
bsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}while((i&lt;dwBytesRead)&amp;&amp;(found==0));<br>
 &nbsp;&nbsp;}while((dwBytesRead==BUFSIZE)&amp;&amp;(found==0));</p>
<p>&nbsp;&nbsp;SetFilePointer(hSourceFile,-(BUFSIZE-i),NULL,FILE_CURRENT);<br>&nbsp;&n \
bsp;<br>&nbsp;&nbsp;do{<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;LocalFileInputSource \
source(src);<br>&nbsp;&nbsp;&nbsp;hTempFile = CreateFile((LPTSTR) szTempName,&nbsp; \
// file name<br>&nbsp;&nbsp;&nbsp;&nbsp;GENERIC_READ | GENERIC_WRITE, // open for \
read/write <br> &nbsp;&nbsp;&nbsp;&nbsp;FILE_SHARE_READ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// Enables subsequent open operations on an object to request read \
access<br>&nbsp;&nbsp;&nbsp;&nbsp;NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// default security <br>&nbsp;&nbsp;&nbsp;&nbsp;CREATE_ALWAYS,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// overwrite existing file<br> \
&nbsp;&nbsp;&nbsp;&nbsp;FILE_ATTRIBUTE_NORMAL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// normal file <br>&nbsp;&nbsp;&nbsp;&nbsp;NULL);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
// no template<br>&nbsp;&nbsp;&nbsp;if (hTempFile == \
INVALID_HANDLE_VALUE)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cout&lt;&lt;&quot;Error: \
&quot;&lt;&lt;GetLastError()&lt;&lt;std::endl&lt;&lt;&quot;Could not open temp \
File&quot;&lt;&lt;std::endl;<br> \
&nbsp;&nbsp;&nbsp;&nbsp;return;<br>&nbsp;&nbsp;&nbsp;}</p> \
<p>&nbsp;&nbsp;&nbsp;WriteFile(hTempFile,szStartLine,sizeof(szStartLine)-2,&amp;dwByte \
sWritten,NULL);<br>&nbsp;&nbsp;&nbsp;WriteFile(hTempFile,szEventlistTag,sizeof(szEvent \
listTag)-1,&amp;dwBytesWritten,NULL);<br>&nbsp;&nbsp;&nbsp;i=0;<br>&nbsp;&nbsp;&nbsp;ReadFile(hSourceFile, \
buffer, BUFSIZE,&amp;dwBytesRead, NULL);<br> \
&nbsp;&nbsp;&nbsp;do<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;j=0;<br>&nbsp;& \
nbsp;&nbsp;&nbsp;k=GetCurEvent(buffer+i,lbuffer,&amp;j,&amp;i,&amp;dwBytesRead);<br>&n \
bsp;&nbsp;&nbsp;&nbsp;i+=k;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;if((i&g \
t;dwBytesRead)||(j==1))<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k=dwBytesRead-(i-k);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetFilePointer(hSourceFile,-k,NULL,FILE_CURRENT);<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbs \
p;&nbsp;if(j==-1)<br>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;<br \
>&nbsp;&nbsp;&nbsp;&nbsp;WriteFile(hTempFile,lbuffer,k,&amp;dwBytesWritten,NULL);&nbsp \
> ;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;}while(i&lt;BUF \
> SIZE);<br>&nbsp;&nbsp;&nbsp;WriteFile(hTempFile,szEventlistEndTag,sizeof(szEventlistEndTag)-1,&amp;dwBytesWritten,NULL);<br>
> 
&nbsp;&nbsp;&nbsp;CloseHandle(hTempFile);&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;//Event \
Handle functions here...<br>&nbsp;&nbsp;&nbsp;//<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp; \
&nbsp;try{<br>&nbsp;&nbsp;&nbsp;&nbsp;parser_.parse(source);<br>&nbsp;&nbsp;&nbsp;&nbs \
p;dwErrorCount+=parser_.getErrorCount();<br>&nbsp;&nbsp;&nbsp;&nbsp;//std::cout&lt;&lt;&quot;parser_getErrorCount() \
&quot;&lt;&lt;parser_.getErrorCount()&lt;&lt;std::endl;<br> \
&nbsp;&nbsp;&nbsp;&nbsp;if(!(parser_.getErrorCount()))<br>&nbsp;&nbsp;&nbsp;&nbsp;{&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xercesc::DOMDocument* \
xmlDoc = parser_.getDocument() \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xercesc::DOMElement* elementConfig = \
xmlDoc-&gt;getDocumentElement() ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( NULL == \
elementConfig ){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw( std::runtime_error( \
&quot;empty XML document&quot; ) ) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xercesc::DOMNodeList* \
children = elementConfig-&gt;getElementsByTagName \
(tags_.TAG_event.asXMLString());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const \
XMLSize_t nodeCount = children-&gt;getLength() ;<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for( XMLSize_t ix = 0 \
; ix &lt; nodeCount ; ++ix \
){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xercesc::DOMNode* currentNode = \
children-&gt;item( ix ) ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( NULL == \
currentNode ){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// null \
node...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( xercesc::DOMNode::ELEMENT_NODE != \
currentNode-&gt;getNodeType() ){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// not \
an element node -&gt; not of interest \
here<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xercesc::DOMElement* \
currentElement = (xercesc::DOMElement*)( currentNode ) ;<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EventType=handleEvent( currentElement ) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switc \
h(EventType)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case \
10:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNodeIterator* \
iterator = outXmlDoc-&gt;createNodeIterator(pAddedFiles, DOMNodeFilter::SHOW_TEXT, \
NULL, true);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNode* pCurrent = \
NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// use the tree walker to \
print out the text nodes.&nbsp; \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ( pCurrent = \
iterator-&gt;nextNode();pCurrent != 0; pCurrent = \
iterator-&gt;nextNode())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char \
*strValue = XMLString::transcode( pCurrent-&gt;getNodeValue() );<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!strcmp(strValue,Path_.c_str( \
)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EventType=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;//XMLString::release(&amp;strValue);<br>&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(EventType)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMElement* pPath = \
outXmlDoc-&gt;createElement( XercesString(&quot;Path&quot;) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pAddedFiles-&gt;appendChild(pPath);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMText* \
pPathnode=outXmlDoc-&gt;createTextNode( XercesString(Path_.c_str()) );<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pPath-&gt;appendChild(pPathnode) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iterator-&gt;release();</p>
 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}//case \
10;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case \
11:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNodeIterator* \
iterator= outXmlDoc-&gt;createNodeIterator(pAddedFiles, DOMNodeFilter::SHOW_TEXT, \
NULL, true);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNodeIterator* \
uiterator = outXmlDoc-&gt;createNodeIterator(pUpdatedFiles, DOMNodeFilter::SHOW_TEXT, \
NULL, true);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNode* pCurrent = \
NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// use the tree walker to \
print out the text nodes.&nbsp; \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ( pCurrent = \
iterator-&gt;nextNode();pCurrent != 0; pCurrent = \
iterator-&gt;nextNode())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char \
*strValue = XMLString::transcode( pCurrent-&gt;getNodeValue() );<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!strcmp(strValue,Path_.c_str( \
)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EventType=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}< \
br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//XMLString::release(&amp;str \
Value);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(EventType){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for \
( pCurrent = uiterator-&gt;nextNode();pCurrent != 0; pCurrent = \
uiterator-&gt;nextNode())<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char \
*strValue = XMLString::transcode( pCurrent-&gt;getNodeValue() \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!strcmp(strValue,Path_. \
c_str()))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EventType=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//XMLString::release(&amp;strValue);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;if(EventType)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br \
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//XMLString::release(&amp;strValue);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMElement* \
> pPath = outXmlDoc-&gt;createElement( XercesString(&quot;Path&quot;) \
> );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pUpdatedFiles-&gt;appendChild(pPath);<br>
> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMText* \
pPathnode=outXmlDoc-&gt;createTextNode( XercesString(Path_.c_str()) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pPath-&gt;appendChild(pPat \
hnode);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;uiterator-&gt;release();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iterator-&gt;release();<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}// \
case(11)...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case(12):<br>&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMElement* \
pPath = outXmlDoc-&gt;createElement( XercesString(&quot;Path&quot;) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pDeletedFiles-&gt;appendChild(pPath);<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMText* \
pPathnode=outXmlDoc-&gt;createTextNode( XercesString(Path_.c_str()) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pPath-&gt;appendChild(pPat \
hnode);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case \
(20):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNodeIterator* \
iterator = outXmlDoc-&gt;createNodeIterator(pAddedDirs, DOMNodeFilter::SHOW_TEXT, \
NULL, true);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNode* pCurrent = \
NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// use the tree walker to \
print out the text nodes.&nbsp; \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ( pCurrent = \
iterator-&gt;nextNode();pCurrent != 0; pCurrent = \
iterator-&gt;nextNode())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char \
*strValue = XMLString::transcode( pCurrent-&gt;getNodeValue() );<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!strcmp(strValue,Path_.c_str( \
)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EventType=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;//XMLString::release(&amp;strValue);<br>&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(EventType)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</p>


<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMElement* pPath = \
outXmlDoc-&gt;createElement( XercesString(&quot;Path&quot;) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pAddedDirs-&gt;appendChild(pPath);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMText* \
pPathnode=outXmlDoc-&gt;createTextNode( XercesString(Path_.c_str()) );<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pPath-&gt;appendChild(pPathnode) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;iterator-&gt;release();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</p>
 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case \
(21):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case \
(22):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMElement* \
pPath = outXmlDoc-&gt;createElement( XercesString(&quot;Path&quot;) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pDeletedDirs-&gt;appendChild(pPath);<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMText* \
pPathnode=outXmlDoc-&gt;createTextNode( XercesString(Path_.c_str()) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pPath-&gt;appendChild(pPathnode) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case \
(30):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNodeIterator* \
iterator = outXmlDoc-&gt;createNodeIterator(pAddedRegKey, DOMNodeFilter::SHOW_TEXT, \
NULL, true);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMNode* pCurrent = \
NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// use the tree walker to \
print out the text nodes.&nbsp; \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ( pCurrent = \
iterator-&gt;nextNode();pCurrent != 0; pCurrent = \
iterator-&gt;nextNode())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char \
*strValue = XMLString::transcode( pCurrent-&gt;getNodeValue() );<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!strcmp(strValue,Path_.c_str( \
)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EventType=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;//XMLString::release(&amp;strValue);<br>&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(EventType)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</p>


<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMElement* pPath = \
outXmlDoc-&gt;createElement( XercesString(&quot;Path&quot;) \
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pAddedRegKey-&gt;appendChild(pPath);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMText* \
pPathnode=outXmlDoc-&gt;createTextNode( XercesString(Path_.c_str()) );<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pPath-&gt;appendChild(pPathnode) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;iterator-&gt;release();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}//end \
of switch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}//for \
loop..<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlDoc-&gt;release();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//std::cin&gt;&gt;dwBytesWritten;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
 &nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;catch( \
xercesc::XMLException&amp; e ){</p> <p>&nbsp;&nbsp;&nbsp;// believe it or not, \
XMLException is not<br>&nbsp;&nbsp;&nbsp;// a parent class of \
DOMException<br>&nbsp;&nbsp;&nbsp;&nbsp;char* message = \
xercesc::XMLString::transcode( e.getMessage() ) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;std::ostringstream buf ;<br>&nbsp;&nbsp;&nbsp;&nbsp;buf \
&lt;&lt; &quot;Error parsing file: &quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt; \
message<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt; \
std::flush;<br>&nbsp;&nbsp;&nbsp;&nbsp;xercesc::XMLString::release( &amp;message ) \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;throw( std::runtime_error( buf.str() ) ) \
;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;catch( const xercesc::DOMException&amp; \
e ){</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;char* message = xercesc::XMLString::transcode( \
e.getMessage() ) ;<br>&nbsp;&nbsp;&nbsp;&nbsp;std::ostringstream buf \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;buf &lt;&lt; &quot;Encountered DOM Exception: \
&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt; message&lt;&lt; \
std::flush;<br>&nbsp;&nbsp;&nbsp;&nbsp;xercesc::XMLString::release( &amp;message ) \
;<br> &nbsp;&nbsp;&nbsp;&nbsp;throw( std::runtime_error( buf.str() ) ) \
;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;if((j==-1))<br>&nbsp;&nbsp;&nbsp;{&nbsp; \
&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp; \
DOMRange* range = outXmlDoc-&gt;createRange();<br>&nbsp;&nbsp;&nbsp; \
range-&gt;release();&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; \
parser_.resetDocument();<br> \
&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;}while(dwBytesRead==BUFSIZE);</p> \
<p>&nbsp;&nbsp;//Here should be write file...</p> \
<p>&nbsp;&nbsp;pSerializer-&gt;writeNode(pTarget, *outXmlDoc);</p> \
<p>&nbsp;&nbsp;if(dwErrorCount)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;std::cout&lt;&lt;&quot;Number \
of errors in file = &quot;&lt;&lt;dwErrorCount&lt;&lt;std::endl&lt;&lt;&quot;:-(&quot; \
;<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;else<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;std::cout&lt;&lt;&quot;No \
Errors found in file ;-)&quot;&lt;&lt;std::endl;<br> \
&nbsp;&nbsp;&nbsp;std::cout&lt;&lt;&quot;Number of Files Created= \
&quot;&lt;&lt;CreateFileCount&lt;&lt;std::endl;<br>&nbsp;&nbsp;&nbsp;std::cout&lt;&lt;&quot;Number \
of Files Deleted= &quot;&lt;&lt;DeleteFileCount&lt;&lt;std::endl;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;std::cout&lt;&lt;&quot;Number \
of Folders Created= &quot;&lt;&lt;CreateFolderCount&lt;&lt;std::endl;<br> \
&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;//std::cin&gt;&gt;dwBytesWritten;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;}//if \
(outXmlFile)...end<br>&nbsp;&nbsp;<br>&nbsp; delete pTarget;<br>&nbsp; delete \
pSerializer;<br>&nbsp; delete outXmlDoc;<br>&nbsp; delete outXmlDoctype;</p> \
<p>&nbsp;&nbsp;DeleteFile(szTempName);<br>&nbsp;&nbsp;CloseHandle(hSourceFile);&nbsp;&nbsp;<br>&nbsp;&nbsp;return \
;<br>&nbsp;} // load()</p><br clear="all"><br>-- <br>Regards<br>Sree Harsha Vardhana \
S.N<br>&quot;When you want something, all the universe conspires in helping you \
to<br> achieve it.&quot; 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic