Xml file line break

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Don Jones 4 years, 1 month ago.

  • Author
    Posts
  • #8530

    Robin16
    Participant

    Hi,

    i'm trying to add a node and save the xml file. We have a standard xml template for our sql database restore ( which we use third party for sql backups and restore ).

    i will show the example how the template looks and how template changes when adding a node..

    template looks like this..

    
    < ?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    
    
    
    
    
    
    
    
    
    false
    
    
    
    DATA_PROTECTION
    
    IMMEDIATE
    
    COMMANDLINE
    
    
    
    
    
    
    
    
    
    
    
    defaultBackupSet
    
    
    
    
    
    SQL Server
    
    
    
    
    
    

    In the above file, on first line there is a space after 'no'  and no space in clientname and instancename

    After saving the xml file...it changes like this...

    
    < ?xml version="1.0" encoding="UTF-8" standalone="no"?>
    
    
    
    
    
    
    
    
    
    false
    
    
    
    DATA_PROTECTION
    
    IMMEDIATE
    
    COMMANDLINE
    
    
    
    
    
    
    
    
    
    
    
    
    
    defaultBackupSet
    
    
    
    
    
    
    
    
    
    SQL Server
    
    
    
    
    
    
    
    

    After saving the xml file...client name ,instance name broke into two line and when i put them in one line there is huge space and no space after 'no' in first line..

         

         

    do we have any issue if there is a line break or more space between the nodes ?

    Please let me know

    Thanks in advance

  • #8531

    Don Jones
    Keymaster

    There should not be an issue, no. This isn't PowerShell doing it, per se; it's the underlying .NET Framework XML parser. XML isn't sensitive to carriage returns; any carriage returns are just to help make the file easier for a human to read, and the .NET parser does tend to try and keep the file "pretty looking." But any software that reads the file shouldn't care about line breaks, or extra white space between elements.

You must be logged in to reply to this topic.