Write-xml method (seems to) insert additional blank lines. - Forum - OpenEdge Development - Progress Community

Write-xml method (seems to) insert additional blank lines.

 Forum

Write-xml method (seems to) insert additional blank lines.

  • In our app, we allow our customers' users to modifiy and then save UltraGrid DisplayLayout settings. If the user has saved settings for a paticular grid, then when the grid is loading, we replace the current (design-time) DisplayLayout with the saved one. This works well except when there has been a design-time change to the grid, or in a few cases, an Infragistics version change. These latter changes have caused some not-so-nice exceptions.

    Because of this, I'm looking at saving the design-time DisplayLayout along with the modified DisplayLayout and then, when the grid is loading, testing to see if the saved design-time DisplayLayout matches the current design-time DisplayLayout before allowing the saved settings to be applied.

    To write the grid's DisplayLayout out I do the following:

    • I use the grid's DisplayLayout:SaveAsXML method to write the settings to a file and then COPY-LOB into a LONGCHAR variable.
    • I then assign the LONGCHAR value to a temp-table buffer-field of type CLOB. The temp-table is part of a larger dataset structure that contains additional tables/fields for other grid settings.
    • I then write the dataset to an XML file using myDataSet:WRITE-XML.
    • I create a database record with some key fields and use COPY-LOB to load the XML file into a CLOB field in the record.

    What I've found is that the WRITE-XML (I assume) has inserted additional line breaks between each existing line of the grid's XML stored in the Clob. When I use the grid's SaveAsXML to a file, the file looks like this:

    <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

    <SOAP-ENV:Body>

    <a1:UltraGridDisplayLayout id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/Infragistics.Win.UltraWinGrid/Infragistics2.Win.UltraWinGrid.v9.2">

    <BorderStyle>10</BorderStyle>

    <AutoFitStyle>2</AutoFitStyle>

    <_x0030_ href="#ref-5"/>

    .

    .

    .

    However, if I look at the file once it's been assigned to and then exported from the dataset, it looks like this:

    <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

    <SOAP-ENV:Body>

    <a1:UltraGridDisplayLayout id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/Infragistics.Win.UltraWinGrid/Infragistics2.Win.UltraWinGrid.v9.2">

    <BorderStyle>10</BorderStyle>

    <AutoFitStyle>2</AutoFitStyle>

    Obviously, using a compare on these fails. I'm using   COMPARE(OrigSettings,"NE",CurrentSettings,"RAW") to test where OrigSettings and CurrentSettings are LONGCHAR variables that have been loaded with the appropriate XML file.

    Has anyone seen this behavior before and if so, how have you been able to fix the problem.

    Thanks,

    Jim

    <_x0030_ href="#ref-5"/>

    .

    .

    .

  • Anyone?

    As a work-around (hack), I take the original DisplayLayout, put it into a temp-table Clob field, perform a WRITE-XML, perform a LOAD-XML into a separate LONGCHAR variable, and then compare the two versions (which now both have the additional blank lines).

    It's not pretty, but so far it's working. I'd rather figure out if there's better way though.

    Jim