difficulties working with xml-data
advantages of xml
Xml has become the leading technology for data-exchange because of it's advantages:
- Xml is well readable for humans and computers. It is an open standard. It can be read and written by any simple text-editor.
- Xml-files can contain complex data-structures.
- Xml-interfaces can easily be changed.
- New elements can be added.
- Programs reading this modified interface simply overread the new elements.
- The programms do not crash!
- Xml-elements have not to be positioned on a special line or column.
- The order of xml-elements is normally not relevant.
But: Standard unix-tools do not work with xml-data!
The advantages of xml turn into disadvantages, because standard unix-tools like "diff", "cmp", "sort", "join" and "comm" do not work correct with xml-files. Look at the following examples:
example 1
The following two files are contentwise equal. only the order of the elements is completely different. A standard compare-tool will be not aware of this. It will always will find differences, although the files are cotentwise equal.
file: test1a.xml |
---|
Fischer Hans 1999-10-04 Becker Claudia 1990-01-18 |
file: test1b.xml |
---|
1990-01-18 Becker Claudia Hans Fischer 1999-10-04 |
example 2
The " and "" of the person are in both files equal.
But in file "test2b.xml" there is no element "".
If you compare these two files for example with "diff"-utility, you cannot exclude element "" from comparison.
file: test2a.xml |
---|
Fischer Hans 1999-10-04 |
file: test2b.xml |
---|
Fischer Hans |