Posted By: Randomized J How to setup Beautifier for XML items. - 05/29/23 10:55 PM
I'm trying to get the beautifier to format xmlelements.

I want something like this
SQL Query
xmlelement("XML1",
        xmlagg(
          xmlelement("XML2",
              xmlattributes(value1     as "title1",
                            value2     as "title2",
                            value3     as "title3",
                            value4     as "title4",
                            value5     as "title5",
                            value6     as "title6",
                            value7     as "title7",
                            value8     as "title8",
                            value9     as "title9"
              )
          )
          order by value1, value5
        )).getClobVal()

But no matter what I try it always puts everything on the same line like:

SQL Query
xmlelement("XML1", xmlagg(xmlelement("XML2", xmlattributes(value1 AS "title1", value2 AS "title2", value3 AS "title3", value4 AS "title4", value5 AS "title5", value6 AS "title6", value7 AS "title7", value8 AS "title8", value9 AS "title9")) ORDER BY value1, value5)).getclobval()

This is rather frustrating as I have one in a query that wraps for 8 lines and I have to manually fix it each time. I can't seem to get it to beautify it no matter the configuration i use. Any assistance would be apprieciated.
There is not specific formatting option for xmlelements. You can use the NoFormat Start/End comment directives to preserve your manual formatting:

Code
-- NoFormat Start
select xmlelement("xmlelement("XML1",
               xmlagg(
                 xmlelement("XML2", ....
-- NoFormat End
© Allround Automations forums