Creating AEM xml Programmatically | Community
Skip to main content
James_R_Green
Level 6
Aug 9, 2018 9:09 PM UTC

Creating AEM xml Programmatically

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

edubey
Level 10
Aug 10, 2018 7:10 AM UTC

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

Translate
smacdonald2008
Level 10
Aug 10, 2018 3:00 PM UTC

Nice answers Arun and Praveen!

Translate
arunpatidar
New Participant
Aug 9, 2018 10:52 PM UTC

Hi,

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

e.g.

Thanks

Arun

Translate
Arun Patidar