xmlstarlet
This commit is contained in:
parent
c7c9b9f9ec
commit
7a1219c05e
1
bash/xml/xmlstarlet/test.sh
Executable file
1
bash/xml/xmlstarlet/test.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
g++ xmlattrsort.cpp -o xmlattrsort && cat klimov6.xml | iconv -f cp1251 -t utf-8 | ./xmlattrsort
|
BIN
bash/xml/xmlstarlet/xmlattrsort
Executable file
BIN
bash/xml/xmlstarlet/xmlattrsort
Executable file
Binary file not shown.
30
bash/xml/xmlstarlet/xmlattrsort.cpp
Normal file
30
bash/xml/xmlstarlet/xmlattrsort.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <cstdlib>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Читаем xml файл в переменную xml
|
||||||
|
*/
|
||||||
|
|
||||||
|
string xml;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
while ((c = getc(stdin)) != EOF)
|
||||||
|
xml += c;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* В цикле просматриваем всю xml
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (size_t i = 0, max_i = xml.length(); i < max_i; i++) {
|
||||||
|
cout << xml[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
13
bash/xml/xmlstarlet/xmlattrsort.sh
Executable file
13
bash/xml/xmlstarlet/xmlattrsort.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SRC=$1
|
||||||
|
|
||||||
|
str=str
|
||||||
|
while [[ "$str" != "" ]]; do
|
||||||
|
read str
|
||||||
|
tag_name=`sed "s~^[\t,\ ]*\(<[^\t,^\ ]*\)\(.*\)~\1~g"`
|
||||||
|
|
||||||
|
#~ echo $str
|
||||||
|
done
|
||||||
|
|
||||||
|
#~ cat $1 | iconv -f cp1251 -t utf-8 | grep -v '<Ch '
|
Loading…
x
Reference in New Issue
Block a user