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

DOMWriter dose not flush the output stream

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.1.0
    • 2.2.0
    • DOM
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 15427

    Description

      When call DOMWriter::writeNode, only part of content is write to the output
      stream.
      The following is the code which will show the bug.

      void test7(DOMImplementationLS * impl, DOMDocument *doc)
      {
      cout << "test7...serialize..." << endl;

      boost::shared_ptr<DOMWriter> serializer(impl->createDOMWriter(),
      XMLRelease<DOMWriter>());
      if (serializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent,
      true))
      serializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent,
      true);
      if (serializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
      serializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);

      boost::shared_ptr<XMLFormatTarget> formTarget(new StdOutFormatTarget());

      cout << "unnormalized..." << endl;
      DOMElement * root = doc->getDocumentElement();
      try

      { serializer->writeNode(formTarget.get(), *root); }
      catch (const XMLException& toCatch) { cerr << "Exception message is: \n" << toCatch.getMessage() << endl; return; }
      catch (const DOMException& toCatch) { cerr << "Exception message is: \n" << toCatch.msg << endl; return; }
      catch (...) { cerr << "Unexpected Exception" << endl; return; }

      cout << endl << "normalized..." << endl;
      doc->normalize();
      try{ serializer->writeNode(formTarget.get(), *root); }

      catch (const XMLException& toCatch)

      { cerr << "Exception message is: \n" << toCatch.getMessage() << endl; return; }

      catch (const DOMException& toCatch)

      { cerr << "Exception message is: \n" << toCatch.msg << endl; return; }

      catch (...)

      { cerr << "Unexpected Exception" << endl; return; }

      cout << endl;

      cout << "test7..." << endl << endl;
      }

      The following content is the output of function 'test7' on my computer(Windows
      2000 + SP3, VC 6)
      test7...serialize...
      unnormalized...
      <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNames
      paceSchemaLocation="system.property.xsd">
      <licence>
      <productId/>
      <functionList>
      <function>
      <functionId/>
      <functionName/>
      <functionDescription/>
      </function>
      <function>
      <functionId/>
      <functionName/>
      <functionDescription/>
      </function>
      </functionList>
      <licenceKey/>
      </licence>
      <capability>
      <maxDevices>16</maxDevices>
      <maxTrendHours>72</maxTrendHours>
      <maxDisclosureHours>72</maxDisc
      normalized...
      losureHours>
      </capability>
      <HL7>
      <port>13130</port>
      </HL7>
      <dataExport>
      <path>d:\</path>
      </dataExport>
      </configuration><configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-insta
      nce" xsi:noNamespaceSchemaLocation="system.property.xsd">
      <licence>
      <productId/>
      <functionList>
      <function>
      <functionId/>
      <functionName/>
      <functionDescription/>
      </function>
      <function>
      <functionId/>
      <functionName/>
      <functionDescription/>
      </function>
      </functionList>
      <licenceKey
      test7...

      />
      </licence>
      <capability>
      <maxDevices>16</maxDevices>
      <maxTrendHours>72</maxTrendHours>
      <maxDisclosureHours>72</maxDisclosureHours>
      </capability>
      <HL7>
      <port>13130</port>
      </HL7>
      <dataExport>
      <path>d:\</path>
      </dataExport>
      </configuration>

      Attachments

        Activity

          People

            Unassigned Unassigned
            smartnoho@yahoo.com noho
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: