Skip to content

Output of toPrettyString is broken #10

@andre2007

Description

@andre2007

The output of this code

import kxml.xml;
import std.stdio: writeln;

XmlNode nodeAttributes = new XmlNode("attributes");
nodeAttributes.addChild(new XmlNode("divisions").setCData("1"));
        
nodeAttributes.addChild(new XmlNode("key").addChild( 
  new XmlNode("fifths").setCData("0")));
    
nodeAttributes.addChild(new XmlNode("time").addChildren([
  new XmlNode("beats").setCData("4"),
  new XmlNode("beats-type").setCData("4") ]));

writeln(nodeAttributes.toPrettyString());

is

<attributes>
        <divisions>
                1
        </divisions>
        <key>
                <fifths>
                        0
                </fifths>
        </key>
        <time>
                <beats>
                        4
                </beats>
                <beats-type>
                        4
                </beats-type>
        </time>
</attributes>

The unecessary line breaks for the tag contents causes issues for other xml parsers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions