Badly formatted XML forms - InfoPath Dev
in

InfoPath Dev

Badly formatted XML forms

Last post 02-03-2017 08:57 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-03-2017 08:33 AM

    • AlainG
    • Not Ranked
    • Joined on 02-03-2017
    • Posts 2

    Badly formatted XML forms

    Hello,

    I'm using Infopath 2013. It happens that Infopath xml forms are not well formatted with long lines that includes lot of fields. It makes it painful to make a diff with a previous version of the file. I fix the formatting and indentation with command "xmllint --format". Formatting is kept after edition in Infopath when the form is in sync with the version of the template. When editing a form that is not in sync with the template file, then saving the file (automatically updated to the last version of the template) will break again the formatting.

    One way to fix this behavior is to change line 3 of upgrade.xsl in the template file from
    <xsl:output encoding="UTF-8" method="xml"/>
    to
    <xsl:output encoding="UTF-8" indent="yes" method="xml"/>

    then the formatting is always kept. Unfortunately, editing the template file overwrites upgrade.xsl and remove the setting for "indent".

    Is there any way to preserve formatting in Infopath XML forms ?

    Thanks for your support,
    Alain
    Filed under: ,
  • 02-03-2017 08:41 AM In reply to

    Re: Badly formatted XML forms

    Hi, Alain - there isn't an InfoPath 2016, so I'm guessing you are talking about IP 2013. I always read XML files in Notepad ++ and simply use the XML plugin to format the XML to make it more readable - Visual Studio will do the same. Can you give that a try? Or are you working in a restrictive environment where you aren't allowed to install additional software? If so - you can always use an online tool like http://codebeautify.org/xmlviewer
    Hilary Stoupa

  • 02-03-2017 08:50 AM In reply to

    • AlainG
    • Not Ranked
    • Joined on 02-03-2017
    • Posts 2

    Re: Badly formatted XML forms

    Hi Hilary,

    you're right, I meant Infopath 2013, I fixed my message.

    My issue is not so much to fix the formatting when I need, I can do it with an editor as you propose or xmllint command. The point is that we manage several tens of xml forms in version control.

    We can't ask people in our team to re-format XML files after editing forms in Infopath but would like Infopath to preserve a good multiline formatting. Long lines Infopath format makes diff but also merge operations very difficult.

    Alain

  • 02-03-2017 08:57 AM In reply to

    Re: Badly formatted XML forms

    Ah, I see - yeah, I don't know of a way to force InfoPath to do what you are asking - I mean, if you are finding that manually modifying the upgrade.xsl does what you need, perhaps consider using a custom code upgrade event?
    Hilary Stoupa

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.