Skip to content

XML formatting simplified in Java using regex

Notifications You must be signed in to change notification settings

wiztools/jxmlfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jxmlfmt

This is a Java library to format XML using regex. Library is inspired from xmlfmt.

Originally developed for RESTClient, where we wanted formatting support without modifying XML content.

Usage

import org.wiztools.jxmlfmt.XMLFmt;
...
String formatted = XMLFmt.fmt("<root><this><is>a</is><test /><message><org><cn>Some org-or-other</cn><ph>Wouldnt you like to know</ph></org><contact><fn>Pat</fn><ln>Califia</ln></contact></message></this></root>");

Result would be:

<root>
  <this>
    <is>
    a
    </is>
    <test />
    <message>
      <org>
        <cn>
        Some org-or-other
        </cn>
        <ph>
        Wouldnt you like to know
        </ph>
      </org>
      <contact>
        <fn>
        Pat
        </fn>
        <ln>
        Califia
        </ln>
      </contact>
    </message>
  </this>
</root>

About

XML formatting simplified in Java using regex

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages