trans=QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") + QString("\n <ar>")
+ trans + QString("\n </ar>");
- //qDebug()<<"\n\n\n\n\n\n\n\n\n before"<<trans;
trans=checkTranslation(trans);
- //qDebug()<<"\n\n after"<<trans;
trans=XslConversion(trans);
+ qDebug()<<"\n\n trans"<<trans;
+
QString head = "<html><head>";
head += "<link rel=\"stylesheet\" type=\"text/css\" " ;
head += "href=\"/usr/share/mdictionary/css/" "style.css";
/*check all "&"*/
int pos=0;
int pos2;
+ int count=0;
+
while(pos!=-1){
pos=trans.indexOf("&",pos+1);
pos2=trans.indexOf("amp;",pos);
continue;
if(pos!=-1)
trans.insert(pos+1,"amp;");
- if(pos>40)
- while(1);
}
- /*check all "<" and ">" */
+
+ /*check all "<" and ">" in key */
pos=0;
- int count=0;
- while(pos!=-1){
- pos=trans.indexOf("<",pos+1);
- pos2=trans.indexOf(">",pos+1);
- if(pos!=-1 && pos2!=-1){
- if(trans.at(pos2-1)!='/' && trans.at(pos+1)!='/')
- count++;
- if(trans.at(pos+1)=='/')
- count--;
- }
- /* else if(pos==-1 && pos2!=-1){
- qDebug()<<"pos=-1";
- trans.remove(pos2,1);
+ count=0;
+ while(pos<trans.size()){
+ if(pos==trans.indexOf("<key>",pos)){
+ qDebug()<<"key";
+ count++;
+ pos+=4;
}
- else if(pos2==-1 && pos!=-1){
- qDebug()<<"pos2=-1";
+ else if(pos==trans.indexOf("</key>",pos))
+ count--;
+ else if(count==1 && (trans.at(pos)=='<' || trans.at(pos)=='>' ))
trans.remove(pos,1);
- }
- else {
- qDebug()<<"pos i pos2 = -1";
- break;
- }
- qDebug()<<"count"<<count;
-*/
+ pos++;
}
+
/*check all """ and "'" */
pos=0;
count=0;