-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.txt
73 lines (55 loc) · 2.61 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
xmlsort: swiss army knife xml ordering utility
==============================================
Goal
----
Sort an xml file or parts of it to avoid false positive differences comparing it with a previous version (stored in a version control system like GIT or Mercurial).
Did you have some experience changing 1 thing only in a server, dump again data and obtain dozens of changed files like this ?
---------------------------------------------------------
diff --git a/geonode.xml b/geonode.xml
index f4fc60f..ffcdbfc 100644
--- a/geonode.xml 2012-10-24 09:25:42.198961002 +0200
+++ b/geonode.xml 2012-10-24 09:26:58.034957830 +0200
@@ -19,12 +19,12 @@
<entry key="namespace">http://geonode.org/</entry>
<entry key="schema">the_schema</entry>
<entry key="Loose bbox">true</entry>
- <entry key="Expose primary keys">false</entry>
<entry key="fetch size">1000</entry>
<entry key="Max open prepared statements">50</entry>
+ <entry key="Expose primary keys">false</entry>
+ <entry key="user">MYUSER</entry>
<entry key="preparedStatements">false</entry>
<entry key="Estimated extends">true</entry>
- <entry key="user">MYUSER</entry>
<entry key="min connections">1</entry>
</connectionParameters>
<__default>false</__default>
---------------------------------------------------------
xmlsort helps you to avoid this very annoing situations.
Dependencies
------------
xmlsort depends from libxml2 and argparse libraries.
The program
-----------
xmlsort is a single python program.
It can work in some different ways:
* called without filtering arguments sort all elements of the xml file
* called with <-i|--include> <xpath> <depth> argument[s] sort matching <xpath> elements only and their children recurring <depth> times
* called with <-x|--exclude> <xpath> argument[s] sort all elements except elements matching <xpath> and their children
How it works
------------
xmlsort follow few simple steps.
For each node matching –include <xpath> arguments or all if –include is not defined:
* sort alphabetically attributes of the starting tag
* if there are sub-elements:
- recure into each of them (accordingly with the <depth> and with –exclude arguments)
- sort all sub-elements following the rules:
+ sort all sub-elements comparing tag names
+ if equal comparing attributes name
+ if equal comparing attribute contents
+ if equal comparing sub-elements
Limitations
-----------
* All kind of implicit sorted lists are not supported (defined by xml schema)
* Standard input is not supported
* Packaging is still missing