xml-vym.cpp
author insilmaril
Tue, 04 Sep 2007 13:53:33 +0000
changeset 595 0bd62e09d061
parent 585 a8e9eae855f4
child 596 97b9507f5e2b
permissions -rw-r--r--
Fixed broken xLink handling
     1 #include "xml-vym.h"
     2 
     3 #include <QMessageBox>
     4 #include <QColor>
     5 #include <QTextStream>
     6 #include <iostream>
     7 
     8 #include "misc.h"
     9 #include "settings.h"
    10 #include "linkablemapobj.h"
    11 #include "version.h"
    12 
    13 static BranchObj *lastBranch;
    14 static FloatObj *lastFloat;
    15 static OrnamentedObj *lastOO;
    16 
    17 extern Settings settings;
    18 extern QString vymVersion;
    19 
    20 /*
    21 parseVYMHandler::parseVYMHandler() {}
    22 
    23 parseVYMHandler::~parseVYMHandler() {}
    24 
    25 QString parseVYMHandler::errorProtocol() { return errorProt; }
    26 
    27 */
    28 
    29 bool parseVYMHandler::startDocument()
    30 {
    31     errorProt = "";
    32     state = StateInit;
    33     laststate = StateInit;
    34 	stateStack.clear();
    35 	stateStack.append(StateInit);
    36     branchDepth=0;
    37 	htmldata="";
    38 	isVymPart=false;
    39     return true;
    40 }
    41 
    42 
    43 /*
    44 QString parseVYMHandler::parseHREF(QString href)
    45 {
    46 	QString type=href.section(":",0,0);
    47 	QString path=href.section(":",1,1);
    48 	if (!tmpDir.endsWith("/"))
    49 		return tmpDir + "/" + path;
    50 	else	
    51 		return tmpDir + path;
    52 }
    53 */
    54 bool parseVYMHandler::startElement  ( const QString&, const QString&,
    55                     const QString& eName, const QXmlAttributes& atts ) 
    56 {
    57     QColor col;
    58 	/* Testing
    59 	cout << "startElement <"<< eName.ascii()
    60 		<<">  state="<<state 
    61 		<<"  laststate="<<stateStack.last()
    62 		<<"   loadMode="<<loadMode
    63 		<<"       line="<<QXmlDefaultHandler::lineNumber()
    64 		<<endl;
    65 	*/	
    66 	stateStack.append (state);	
    67     if ( state == StateInit && (eName == "vymmap")  ) 
    68 	{
    69         state = StateMap;
    70 		if (!atts.value( "version").isEmpty() ) 
    71 		{
    72 			if (!checkVersion(atts.value("version")))
    73 				QMessageBox::warning( 0, "Warning: Version Problem" ,
    74 				   "<h3>Map is newer than VYM</h3>"
    75 				   "<p>The map you are just trying to load was "
    76 				   "saved using vym " +atts.value("version")+". "
    77 				   "The version of this vym is " + vymVersion + 
    78 				   ". If you run into problems after pressing "
    79 				   "the ok-button below, updating vym should help.");
    80 			else	   
    81 				mc->setVersion(atts.value( "version" ));
    82 
    83 		}
    84 		if (loadMode==NewMap || 
    85 			(loadMode==ImportReplace && me->getSelection()==mc))
    86 		{
    87 			if (!atts.value( "author").isEmpty() )
    88 			{
    89 				mc->setAuthor(atts.value( "author" ) );
    90 			}
    91 			if (!atts.value( "comment").isEmpty() )
    92 			{
    93 				mc->setComment (atts.value( "comment" ) );
    94 			}
    95 			if (!atts.value( "backgroundColor").isEmpty() )
    96 			{
    97 				col.setNamedColor(atts.value("backgroundColor"));
    98 				mc->getScene()->setBackgroundBrush(col);
    99 			}	    
   100 			if (!atts.value( "selectionColor").isEmpty() )
   101 			{
   102 				col.setNamedColor(atts.value("selectionColor"));
   103 				me->setSelectionColor(col);
   104 			}	    
   105 			if (!atts.value( "linkColorHint").isEmpty() ) 
   106 			{
   107 				if (atts.value("linkColorHint")=="HeadingColor")
   108 					me->setMapLinkColorHint(LinkableMapObj::HeadingColor);
   109 				else
   110 					me->setMapLinkColorHint(LinkableMapObj::DefaultColor);
   111 			}
   112 			if (!atts.value( "linkStyle").isEmpty() ) 
   113 			{
   114 				me->setMapLinkStyle(atts.value("linkStyle"));
   115 			}	
   116 			if (!atts.value( "linkColor").isEmpty() ) 
   117 			{
   118 				col.setNamedColor(atts.value("linkColor"));
   119 				me->setMapDefLinkColor(col);
   120 			}	
   121 			if (!atts.value( "defXLinkColor").isEmpty() ) 
   122 			{
   123 				col.setNamedColor(atts.value("defXLinkColor"));
   124 				me->setMapDefXLinkColor(col);
   125 			}	
   126 			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   127 			{
   128 				me->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   129 			}	
   130 		}	
   131 	} else if ( eName == "select" && state == StateMap ) 
   132 	{
   133 		state=StateMapSelect;
   134 	} else if ( eName == "setting" && state == StateMap ) 
   135 	{
   136 		state=StateMapSetting;
   137 		if (loadMode==NewMap)
   138 			readSettingAttr (atts);
   139 	} else if ( eName == "mapcenter" && state == StateMap ) 
   140 	{
   141 		state=StateMapCenter;
   142 		if (loadMode==NewMap)
   143 		{	
   144 			// Really use the found mapcenter as MCO in a new map
   145 			lastBranch=mc;	// avoid empty pointer
   146 		} else
   147 		{
   148 			// Treat the found mapcenter as a branch 
   149 			// in an existing map
   150 			LinkableMapObj* lmo=me->getSelection();
   151 			if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   152 			        || (typeid(*lmo) == typeid(MapCenterObj) ) )
   153 			{
   154 				lastBranch=(BranchObj*)lmo;
   155 				if (loadMode==ImportAdd)
   156 				{
   157 					lastBranch->addBranch();
   158 					lastBranch=lastBranch->getLastBranch();
   159 				} else
   160 					lastBranch->clear();
   161 			} else
   162 				return false;
   163 		}
   164 		readBranchAttr (atts);
   165 	} else if ( 
   166 		(eName == "standardflag" ||eName == "standardFlag") && 
   167 		(state == StateMapCenter || state==StateBranch)) 
   168 	{
   169 		state=StateStandardFlag;
   170 	} else if ( eName == "heading" && (state == StateMapCenter||state==StateBranch)) 
   171 	{
   172 		laststate=state;
   173 		state=StateHeading;
   174 		if (!atts.value( "textColor").isEmpty() ) 
   175 		{
   176 			col.setNamedColor(atts.value("textColor"));
   177 			lastBranch->setColor(col );
   178 		}	    
   179 	} else if ( eName == "note" && 
   180 				(state == StateMapCenter ||state==StateBranch))
   181 	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   182 		state=StateNote;
   183 		if (!readNoteAttr (atts) ) return false;
   184 	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   185 	{
   186 		laststate=state;
   187 		state=StateHtmlNote;
   188     } else if ( eName == "floatimage" && 
   189 				(state == StateMapCenter ||state==StateBranch)) 
   190 	{
   191 		state=StateFloatImage;
   192         lastBranch->addFloatImage();
   193 		lastFloat=lastBranch->getLastFloatImage();
   194 		if (!readFloatImageAttr(atts)) return false;
   195 	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   196 	{
   197 		// This is used in vymparts, which have no mapcenter!
   198 		isVymPart=true;
   199 		LinkableMapObj* lmo=me->getSelection();
   200 		if (!lmo)
   201 		{
   202 			// If a vym part is _loaded_ (not imported), 
   203 			// selection==lmo==NULL
   204 			// Treat it like ImportAdd then...
   205 			loadMode=ImportAdd;
   206 			lmo=mc;
   207 		}	
   208 		if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   209 				|| (typeid(*lmo) == typeid(MapCenterObj) ) )
   210 		{
   211 			lastBranch=(BranchObj*)(lmo);
   212 			if (eName=="branch")
   213 			{
   214 				state=StateBranch;
   215 				if (loadMode==ImportAdd)
   216 				{
   217 					lastBranch->addBranch();
   218 					lastBranch=lastBranch->getLastBranch();
   219 					
   220 				} else
   221 					lastBranch->clear();
   222 				branchDepth=1;
   223 				readBranchAttr (atts);
   224 			} else if (eName=="floatimage")
   225 			{
   226 				state=StateFloatImage;
   227 				lastBranch->addFloatImage();
   228 				lastFloat=lastBranch->getLastFloatImage();
   229 				if (!readFloatImageAttr(atts)) return false;
   230 			} else return false;
   231 		} else return false;
   232 	} else if ( eName == "branch" && state == StateMapCenter) 
   233 	{
   234 		state=StateBranch;
   235 		branchDepth=1;
   236 		lastBranch->addBranch();
   237 		lastBranch=lastBranch->getLastBranch();
   238 		readBranchAttr (atts);
   239 	} else if ( eName == "htmlnote" && state == StateBranch) 
   240 	{
   241 		laststate=state;
   242 		state=StateHtmlNote;
   243 		no.clear();
   244 		if (!atts.value( "fonthint").isEmpty() ) 
   245 			no.setFontHint(atts.value ("fonthint") );
   246 	} else if ( eName == "frame" && (state == StateBranch||state==StateMapCenter)) 
   247 	{
   248 		laststate=state;
   249 		state=StateFrame;
   250 		if (!readFrameAttr(atts)) return false;
   251     } else if ( eName == "xlink" && state == StateBranch ) 
   252 	{
   253 		state=StateBranchXLink;
   254 		if (!readXLinkAttr (atts)) return false;
   255     } else if ( eName == "branch" && state == StateBranch ) 
   256 	{
   257         lastBranch->addBranch();
   258 		lastBranch=lastBranch->getLastBranch();		
   259         branchDepth++;
   260 		readBranchAttr (atts);
   261     } else if ( eName == "html" && state == StateHtmlNote ) 
   262 	{
   263 		state=StateHtml;
   264 		htmldata="<"+eName;
   265 		readHtmlAttr(atts);
   266 		htmldata+=">";
   267     } else if ( state == StateHtml ) 
   268 	{
   269 		// accept all while in html mode,
   270 		htmldata+="<"+eName;
   271 		readHtmlAttr(atts);
   272 		htmldata+=">";
   273     } else
   274         return false;   // Error
   275     return true;
   276 }
   277 
   278 bool parseVYMHandler::endElement  ( const QString&, const QString&, const QString &eName)
   279 {
   280 	/* Testing
   281 	cout << "endElement </" <<eName.ascii()
   282 		<<">  state=" <<state 
   283 		<<"  laststate=" <<laststate
   284 		<<"  stateStack="<<stateStack.last() 
   285 		<<endl;
   286 	*/
   287     switch ( state ) 
   288 	{
   289         case StateBranch: 
   290 			lastBranch=(BranchObj*)(lastBranch->getParObj());
   291             break;
   292         case StateHtml: 
   293 			htmldata+="</"+eName+">";
   294 			if (eName=="html")
   295 			{
   296 				state=StateHtmlNote;  
   297 				htmldata.replace ("<br></br>","<br />");
   298 				no.setNote (htmldata);
   299 				lastBranch->setNote (no);
   300 			}	
   301 			break;
   302 		default: 
   303 			break;
   304     }  
   305 	state=stateStack.takeLast();	
   306 	return true;
   307 }
   308 
   309 bool parseVYMHandler::characters   ( const QString& ch)
   310 {
   311 	//cout << "characters \""<<ch<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
   312 
   313 	QString ch_org=quotemeta (ch);
   314     QString ch_simplified=ch.simplifyWhiteSpace();
   315     if ( ch_simplified.isEmpty() ) return true;
   316 
   317     switch ( state ) 
   318     {
   319         case StateInit: break;
   320         case StateMap: break; 
   321 		case StateMapSelect:
   322 			me->select(ch_simplified);
   323 			break;
   324 		case StateMapSetting:break;
   325         case StateMapCenter: break;
   326         case StateNote:
   327 			lastBranch->setNote(ch_simplified);
   328 			break;
   329         case StateBranch: break;
   330         case StateStandardFlag: 
   331             lastBranch->activateStandardFlag(ch_simplified); 
   332             break;
   333         case StateFloatImage: break;
   334         case StateHtmlNote: break;
   335         case StateHtml:
   336 			htmldata+=ch_org;
   337 			break;
   338         case StateHeading: 
   339             lastBranch->setHeading(ch_simplified);
   340             break;
   341         default: 
   342 			return false;
   343     }
   344     return true;
   345 }
   346 
   347 QString parseVYMHandler::errorString() 
   348 {
   349     return "the document is not in the VYM file format";
   350 }
   351 
   352 /*
   353 bool parseVYMHandler::fatalError( const QXmlParseException& exception ) 
   354 {
   355     errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n")
   356     .arg( exception.message() )
   357     .arg( exception.lineNumber() )
   358     .arg( exception.columnNumber() );
   359 	// Try to read the bogus line
   360 	errorProt+=QString("File is: %1\n").arg(inputFile);
   361 	QString s;
   362 	if (loadStringFromDisk (inputFile,s))
   363 	{
   364 		QStringList sl=QStringList::split ("\n",s);
   365 		int i=1;
   366 		QStringList::Iterator it = sl.begin();
   367 		while (i<exception.lineNumber()-1)
   368 		{
   369 			it++;
   370 			i++;
   371 		}
   372 		s=*it;
   373 		s.insert (exception.columnNumber()-1,"<ERROR>");
   374 		errorProt+=s;
   375     }
   376     return QXmlDefaultHandler::fatalError( exception );
   377 }
   378 
   379 void parseVYMHandler::setMapEditor (MapEditor* e)
   380 {
   381     me=e;
   382 	mc=me->getMapCenter();
   383 }
   384 
   385 void parseVYMHandler::setTmpDir (QString tp)
   386 {
   387 	tmpDir=tp;
   388 }
   389 
   390 void parseVYMHandler::setInputFile (QString f)
   391 {
   392 	inputFile=f;
   393 }
   394 
   395 void parseVYMHandler::setLoadMode (const LoadMode &lm)
   396 {
   397 	loadMode=lm;
   398 }
   399 */
   400 bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)
   401 {
   402 	lastOO=lastBranch;
   403 	if (!readOOAttr(a)) return false;
   404 
   405 	if (!a.value( "scrolled").isEmpty() )
   406 		lastBranch->toggleScroll();
   407 	if (!a.value( "frameType").isEmpty() ) 
   408 		lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
   409 
   410 	if (!a.value( "incImgV").isEmpty() ) 
   411 	{	
   412 		if (a.value("incImgV")=="true")
   413 			lastBranch->setIncludeImagesVer(true);
   414 		else	
   415 			lastBranch->setIncludeImagesVer(false);
   416 	}	
   417 	if (!a.value( "incImgH").isEmpty() ) 
   418 	{	
   419 		if (a.value("incImgH")=="true")
   420 			lastBranch->setIncludeImagesHor(true);
   421 		else	
   422 			lastBranch->setIncludeImagesHor(false);
   423 	}	
   424 	return true;	
   425 }
   426 
   427 bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)
   428 {
   429 	bool ok;
   430 	int x;
   431 	if (lastOO)
   432 	{
   433 		if (!a.value( "frameType").isEmpty() ) 
   434 			lastOO->setFrameType (a.value("frameType"));
   435 		if (!a.value( "penColor").isEmpty() ) 
   436 			lastOO->setFramePenColor (a.value("penColor"));
   437 		if (!a.value( "brushColor").isEmpty() ) 
   438 			lastOO->setFrameBrushColor (a.value("brushColor"));
   439 		if (!a.value( "padding").isEmpty() ) 
   440 		{
   441 			x=a.value("padding").toInt(&ok);
   442 			if (ok) lastOO->setFramePadding(x);
   443 		}	
   444 		if (!a.value( "borderWidth").isEmpty() ) 
   445 		{
   446 			x=a.value("borderWidth").toInt(&ok);
   447 			if (ok) lastOO->setFrameBorderWidth(x);
   448 		}	
   449 	}		
   450 	return true;
   451 }
   452 
   453 bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
   454 {
   455 	if (lastOO)
   456 	{
   457 		bool okx,oky;
   458 		float x,y;
   459 		if (!a.value( "relPosX").isEmpty() ) 
   460 		{
   461 			if (!a.value( "relPosY").isEmpty() ) 
   462 			{
   463 				x=a.value("relPosX").toFloat (&okx);
   464 				y=a.value("relPosY").toFloat (&oky);
   465 				if (okx && oky  )
   466 				{
   467 					lastOO->setUseRelPos (true);
   468 					lastOO->move2RelPos (x,y);
   469 				}	
   470 				else
   471 					return false;   // Couldn't read relPos
   472 			}           
   473 		}           
   474 		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
   475 		{
   476 			if (!a.value( "absPosY").isEmpty() ) 
   477 			{
   478 				x=a.value("absPosX").toFloat (&okx);
   479 				y=a.value("absPosY").toFloat (&oky);
   480 				if (okx && oky  )
   481 					lastOO->move(x,y);
   482 				else
   483 					return false;   // Couldn't read absPos
   484 			}           
   485 		}           
   486 		if (!a.value( "id").isEmpty() ) 
   487 			lastOO->setID (a.value ("id"));
   488 		if (!a.value( "url").isEmpty() ) 
   489 			lastOO->setURL (a.value ("url"));
   490 		if (!a.value( "vymLink").isEmpty() ) 
   491 			lastOO->setVymLink (a.value ("vymLink"));
   492 		if (!a.value( "hideInExport").isEmpty() ) 
   493 			if (a.value("hideInExport")=="true")
   494 				lastOO->setHideInExport(true);
   495 
   496 		if (!a.value( "hideLink").isEmpty()) 
   497 		{
   498 			if (a.value ("hideLink") =="true")
   499 				lastOO->setHideLinkUnselected(true);
   500 			else	
   501 				lastOO->setHideLinkUnselected(false);
   502 		}	
   503 	}
   504 	return true;	
   505 }
   506 
   507 bool parseVYMHandler::readNoteAttr (const QXmlAttributes& a)
   508 {	// only for backward compatibility (<1.4.6). Use htmlnote now.
   509 	no.clear();
   510 	QString fn;
   511 	if (!a.value( "href").isEmpty() ) 
   512 	{
   513 		// Load note
   514 		fn=parseHREF(a.value ("href") );
   515 		QFile file (fn);
   516 		QString s;						// Reading a note
   517 
   518 		if ( !file.open( QIODevice::ReadOnly) )
   519 		{
   520 			qWarning ("parseVYMHandler::readNoteAttr:  Couldn't load "+fn);
   521 			return false;
   522 		}	
   523 		QTextStream stream( &file );
   524 		QString lines;
   525 		while ( !stream.atEnd() ) {
   526 			lines += stream.readLine()+"\n"; 
   527 		}
   528 		file.close();
   529 
   530 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   531 		no.setNote (lines);
   532 	}		
   533 	if (!a.value( "fonthint").isEmpty() ) 
   534 		no.setFontHint(a.value ("fonthint") );
   535 	lastBranch->setNote(no);
   536 	return true;
   537 }
   538 
   539 bool parseVYMHandler::readFloatImageAttr (const QXmlAttributes& a)
   540 {
   541 	lastOO=lastFloat;
   542 	
   543 	//if (!readOOAttr(a)) return false;
   544 
   545 	if (!a.value( "useOrientation").isEmpty() ) 
   546 	{
   547 		if (a.value ("useOrientation") =="true")
   548 			lastFloat->setUseOrientation (true);
   549 		else	
   550 			lastFloat->setUseOrientation (false);
   551 	}	
   552 	if (!a.value( "href").isEmpty() )
   553 	{
   554 		// Load FloatImage
   555 		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
   556 		{
   557 			QMessageBox::warning( 0, "Warning: " ,
   558 				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
   559 			lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
   560 			lastFloat=NULL;
   561 			return true;
   562 		}
   563 		
   564 	}	
   565 	if (!a.value( "floatExport").isEmpty() ) 
   566 	{
   567 		// Only for compatibility. THis is not used since 1.7.11 
   568 		if (a.value ("floatExport") =="true")
   569 			lastFloat->setFloatExport(true);
   570 		else	
   571 			lastFloat->setFloatExport (false);
   572 	}	
   573 	if (!a.value( "zPlane").isEmpty() ) 
   574 		lastFloat->setZValue (a.value("zPlane").toInt ());
   575     int x,y;
   576     bool okx,oky;
   577 	if (!a.value( "relPosX").isEmpty() ) 
   578 	{
   579 		if (!a.value( "relPosY").isEmpty() ) 
   580 		{
   581 			// read relPos
   582 			x=a.value("relPosX").toFloat (&okx);
   583 			y=a.value("relPosY").toFloat (&oky);
   584 			if (okx && oky) 
   585 				
   586 				{
   587 					lastFloat->setRelPos (QPoint (x,y) );
   588 					// make sure floats in mapcenter are repositioned to relative pos
   589 					if (mc==lastBranch) mc->positionContents();
   590 				}
   591 			else
   592 				// Couldn't read relPos
   593 				return false;  
   594 		}           
   595 	}	
   596 	
   597 	if (!readOOAttr(a)) return false;
   598 
   599 	if (!a.value ("orgName").isEmpty() )
   600 	{
   601 		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
   602 	}
   603 	return true;
   604 }
   605 
   606 bool parseVYMHandler::readXLinkAttr (const QXmlAttributes& a)
   607 {
   608 	QColor col;
   609 	bool okx;
   610 	bool success=false;
   611 	XLinkObj *xlo=new XLinkObj (mc->getScene());
   612 	if (!a.value( "color").isEmpty() ) 
   613 	{
   614 		col.setNamedColor(a.value("color"));
   615 		xlo->setColor (col);
   616 	}
   617 
   618 	if (!a.value( "width").isEmpty() ) 
   619 	{
   620 		xlo->setWidth(a.value ("width").toInt (&okx, 10));
   621 	}
   622 
   623 	// Connecting by select string for compatibility with version < 1.8.76
   624 	if (!a.value( "beginBranch").isEmpty() ) 
   625 	{ 
   626 		if (!a.value( "endBranch").isEmpty() ) 
   627 		{
   628 			LinkableMapObj *lmo=mc->findObjBySelect (a.value( "beginBranch"));
   629 			if (lmo && typeid (*lmo)==typeid (BranchObj))
   630 			{
   631 				xlo->setBegin ((BranchObj*)lmo);
   632 				lmo=mc->findObjBySelect (a.value( "endBranch"));
   633 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   634 				{
   635 					xlo->setEnd ((BranchObj*)(lmo));
   636 					xlo->activate();
   637 				}
   638 			}
   639 			success=true; // Not all branches there yet, no error
   640 		}           
   641 	}	
   642 
   643 	// object ID is used starting in version 1.8.76
   644 	if (!a.value( "beginID").isEmpty() ) 
   645 	{ 
   646 		if (!a.value( "endID").isEmpty() ) 
   647 		{
   648 			LinkableMapObj *lmo=mc->findID (a.value( "beginBranch"));
   649 			if (lmo && typeid (*lmo)==typeid (BranchObj))
   650 			{
   651 				xlo->setBegin ((BranchObj*)lmo);
   652 				lmo=mc->findID (a.value( "endID"));
   653 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   654 				{
   655 					xlo->setEnd ((BranchObj*)(lmo));
   656 					xlo->activate();
   657 				}
   658 			}
   659 			success=true; // Not all branches there yet, no error
   660 		}           
   661 	}	
   662 	if (!success) delete (xlo);
   663 	return success;
   664 }
   665 
   666 bool parseVYMHandler::readHtmlAttr (const QXmlAttributes& a)
   667 {
   668 	for (int i=1; i<=a.count(); i++)
   669 		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
   670 	return true;
   671 }
   672 
   673 bool parseVYMHandler::readSettingAttr (const QXmlAttributes& a)
   674 {
   675 	if (!a.value( "key").isEmpty() ) 
   676 	{
   677 		if (!a.value( "value").isEmpty() ) 
   678 			settings.setLocalEntry (me->getDestPath(), a.value ("key"), a.value ("value"));
   679 		else
   680 			return false;
   681 		
   682 	} else
   683 		return false;
   684 	
   685 	return true;
   686 }