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

Empty line generated when fgDOMXMLDeclaration is disabled

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 3.0.0, 3.0.1, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4
    • None
    • DOM

    Description

      The DOMLSSerializer implementation is generating a leading empty line
      in case that the generation of the XML Declaration is disabled.

      The source code looks like this:

      https://svn.apache.org/repos/asf/xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp

      if (getFeature(XML_DECLARATION))

      { // use the version and encoding resolved *fFormatter << gXMLDecl_VersionInfo << fDocumentVersion << gXMLDecl_separator; *fFormatter << gXMLDecl_EncodingDecl << fEncodingUsed << gXMLDecl_separator; const XMLCh* st = (docu->getXmlStandalone())? XMLUni::fgYesString : XMLUni::fgNoString; *fFormatter << gXMLDecl_SDDecl << st << gXMLDecl_separator; *fFormatter << gXMLDecl_endtag; }

      DOMNodeSPtr child = nodeToWrite->getFirstChild();
      while( child != 0)

      { processNode(child, level); child = child->getNextSibling(); }

      printNewLine();

      The printNewLine() method is called even if no XML declaration was written, thus generating a leading empty line.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jose.sanchez@dionglobal.com Jose M. Sanchez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: