xmlstarlet

This commit is contained in:
Kolan Sh 2011-04-07 14:37:48 +04:00
parent c7c9b9f9ec
commit 7a1219c05e
4 changed files with 44 additions and 0 deletions

1
bash/xml/xmlstarlet/test.sh Executable file
View 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

Binary file not shown.

View 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;
}

View 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 '