Giter Club home page Giter Club logo

sortxml's Introduction

sortxml

dotnet-core-build dotnet-core-release

Simple utility that sorts (and prettifies) xml files. It uses the Microsoft XML .NET namespace.

Click here for the latest release.


Build

dotnet build .\sortxml.csproj -c Debug
dotnet publish .\sortxml.csproj -c Debug -r win-x64

Code Format

There is an .editorconfig and matching omnisharp.json file included.

Installing and using the dotnet format tool.

dotnet tool install -g dotnet-format
dotnet format -w sortxml.csproj

Usage

USAGE: sortxml.exe [options] infile [outfile]

  infile        The name of the file to sort, etc.

  outfile       The name of the file to save the output to.
                If outfile is omitted, the output is written to stdout,
                unless `--overwrite` is specified, in which case the
                output is written back to infile, overwriting it.

OPTIONS:

  /p --pause    Pauses when finished.

  --pretty      Ignores the input format and makes the output look nice.
                This is the default.

  /s --sort     Sort both the nodes and attributes.
  --sort-node   Sort the nodes.
  --sort-attr   Sort the attributes.
                If a sort is specified, '--pretty' is assumed.
                If a sort is NOT is specified, both nodes and attributes
                will be sorted.

  /i --case-insensitive
                Sorts node and attributes without regard to letter case.
  !i --case-sensitive
                Sorts node and attributes case-sensitively.
                If neither option is specified, uses case-sensitive sort.

  --overwrite   Writes back to the infile.
                Only used if outfile is not specified.

Prefix an option with '!' to turn it off.
The '!' can be applied with or without one of the other prefixes.
The '/' and '--' prefixes are interchangable.

The default is to output pretty and sorted nodes and attributes:

> type sample.xml
<?xml version="1.0" encoding="utf-8" ?><root><node value="one" attr="name"/><node2 attr="name" value="two" /></root>

> sortxml.exe sample.xml
<?xml version="1.0" encoding="utf-8"?>
<root>
  <node attr="name" value="one" />
  <node2 attr="name" value="two" />
</root>

sortxml's People

Contributors

kodybrown avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.