Highlighted

Creating AEM xml Programmatically

Avatar

Avatar

James_R_Green

Avatar

James_R_Green

James_R_Green

09-08-2018

Hi,

I have automated the creation of some AEM xml files E.g _rep_policy.xml

This works fine and is processed by AEM, the only problem is the formatting is different to the way xml files are formatted.

For example my code would output:

<element variable1="value" variable2="value"/>

Where as AEM xml files are like this:

<element

                 variable1="value"

                 variable2="value"/>

Does anyone know how I can format the xml in java code so that the attributes are formatted like AEM formats xml? It will make it a lot easier to diff and version control.

Thanks,

James

Replies

Highlighted

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

09-08-2018

Hi,

I think It is only possible If you create XML from String.

e.g.

Screen Shot 2018-08-10 at 12.52.28 AM.png

Thanks

Arun

Highlighted

Avatar

Avatar

edubey

Total Posts

1.5K

Likes

264

Correct Answer

392

Avatar

edubey

Total Posts

1.5K

Likes

264

Correct Answer

392
edubey

10-08-2018

You have to provide \n element to go to next line for output

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

10-08-2018

Nice answers Arun and Praveen!