You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Scott Cantor (JIRA)" <xe...@xml.apache.org> on 2017/07/07 21:39:00 UTC

[jira] [Commented] (XERCESC-2025) Empty line generated when fgDOMXMLDeclaration is disabled

    [ https://issues.apache.org/jira/browse/XERCESC-2025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16078735#comment-16078735 ] 

Scott Cantor commented on XERCESC-2025:
---------------------------------------

I'll take a look, but that isn't how I interpret that code at all. The clause there is dumping the declaration conditionally, and then dumping the *document* node, i.e. the whole thing we're serializing. The printNewLine there is at the end of that, not before it.

> Empty line generated when fgDOMXMLDeclaration is disabled
> ---------------------------------------------------------
>
>                 Key: XERCESC-2025
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2025
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: DOM
>    Affects Versions: 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4
>            Reporter: Jose M. Sanchez
>            Assignee: Scott Cantor
>            Priority: Minor
>              Labels: DOMLSSerializer, empty, line
>             Fix For: 3.2.0
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org