Print Thread
How to setup Beautifier for XML items.
#64638 05/29/23 10:55 PM
Joined: Sep 2019
Posts: 7
R
Member
OP Offline
Member
R
Joined: Sep 2019
Posts: 7
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.

Re: How to setup Beautifier for XML items.
Randomized J #64639 05/30/23 09:30 AM
Joined: Aug 1999
Posts: 22,487
Member
Offline
Member
Joined: Aug 1999
Posts: 22,487
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


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.078s Queries: 15 (0.034s) Memory: 2.5040 MB (Peak: 3.0400 MB) Data Comp: Off Server Time: 2024-12-04 06:24:07 UTC
Valid HTML 5 and Valid CSS