Salome HOME
8f3a223dd17c00804690b27c5499e3574df4db5d
[modules/superv.git] / src / GraphBase / DataFlowBase_XmlHandler.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : DataFlowBase_XmlHandler.cxx
25 //  Author : Arnaud RES
26 //  Module : SUPERV
27 //  $Header$
28
29 using namespace std;
30 #include "DataFlowBase_XmlHandler.hxx"
31
32 #include <qstring.h>
33 //#include <qxmlattributes.h>
34 #include <qxml.h>
35
36 #define TRACE 0
37
38 //static string NULLSTRING = string("") ;
39
40 GraphBase::XmlHandler::XmlHandler( CORBA::ORB_ptr Orb ,
41                                    const bool aConstructor ) :
42   _Orb( Orb ) , dataflowxml(false), depth(0), constructor(aConstructor) {
43   int i ;
44   for ( i = 0 ; i < maxlevel ; i++ ) {
45     fieldname[i] = NULLSTRING ;
46     fieldvalue[i] = NULLSTRING ;
47     step[i] = 0 ;
48   }
49   VXSize = 0 ;
50   GraphsNumber = 0 ;
51
52   aLinkValue = CORBA::Any();
53 }
54
55 GraphBase::XmlHandler::XmlHandler() {}
56
57 GraphBase::XmlHandler::~XmlHandler() {}
58
59 QString GraphBase::XmlHandler::errorProtocol() {
60   return errorProt;
61 }
62
63 bool GraphBase::XmlHandler::startDocument() {
64   MESSAGE( "====================startDocument " ) ;
65 // at the beginning of parsing: do some initialization
66   errorProt = "";
67   return TRUE;
68 }
69
70 bool GraphBase::XmlHandler::endDocument() {
71   MESSAGE( "====================endDocument " ) ;
72   return TRUE;
73 }
74
75 bool GraphBase::XmlHandler::startElement( const QString&, const QString&, 
76                                           const QString& qName, 
77                                           const QXmlAttributes& atts ) {
78   // do different actions depending on the name of the tag and the
79   // state you are in
80
81 #if TRACE
82   MESSAGE( "====================startElement " << depth << " " << qName)
83    
84 #endif
85
86   if ( ( qName == "dataflow" || qName == "supergraph" ) && depth == 0 ) {
87     // Dataflow detected
88     aListOfDataFlows.resize( GraphsNumber + 1 ) ;
89     int i ;
90     for ( i = 0 ; i < maxlevel ; i++ ) {
91       fieldname[i] = NULLSTRING ;
92       fieldvalue[i] = NULLSTRING ;
93       step[i] = 0 ;
94     }
95     VXSize = 0 ;
96     dataflowxml = TRUE;
97   }
98   if ( dataflowxml ) {
99     if ( qName == "supergraph" ) {
100       fieldname[depth] = qName.latin1() ;
101     }
102     else {
103       fieldname[depth++] = qName.latin1() ;
104     }
105   }
106   if ( depth == maxlevel+1 )
107     return false ;
108   return dataflowxml ;
109
110 }
111
112 static bool returnfalse( GraphBase::XmlHandler *myXmlHandler ,
113                          const char *msg ,
114                          const QString& qName ) {
115   MESSAGE( "returnfalse ERROR qName " << qName << " " << msg
116            << " fieldname " << myXmlHandler->getfieldname(myXmlHandler->getdepth())
117            << " fieldvalue '"
118            << myXmlHandler->getfieldvalue(myXmlHandler->getdepth()) << "'" )
119   return false ;
120 }
121
122 bool GraphBase::XmlHandler::endElement( const QString&,
123                                         const QString&,
124                                         const QString& qName) {
125
126   if ( qName == "supergraph" ) {
127 #if TRACE
128     MESSAGE( " ====================endElement supergraph" ) ;
129 #endif
130     return TRUE ;
131   }
132
133 // ERRORs :
134 // * On a eu endElement(dataflow)
135 // * Ou bien on a eu uniquement startElement(dataflow) et qName != fieldname et fieldvalue != NULLSTRING
136   if ( !dataflowxml ||
137        ( qName != QString( fieldname[depth].c_str() ) &&
138          fieldvalue[depth] != NULLSTRING ) ) {
139     MESSAGE( "endElement ERROR dataflowxml " << dataflowxml << " qName " << qName
140              << " fieldname[" << depth << "] "<< fieldname[depth] << " fieldvalue "
141              << fieldvalue[depth] )
142     return returnfalse( this , "top" , qName ) ;
143   }
144   if ( fieldvalue[depth] == NULLSTRING ) {
145     depth -= 1 ;
146   }
147
148 #if TRACE
149   MESSAGE( " ====================endElement step[" << depth << "]="
150            << step[depth] << " qName " << qName << " fieldvalue '"
151            << fieldvalue[depth] << "'")
152 #endif
153   switch ( depth ) {
154     case 0 : {
155       if ( step[depth] == 0 && qName == "dataflow" ) {
156         GraphsNumber += 1 ;
157         dataflowxml = false ;
158       }
159       else
160         return returnfalse( this , "depth0" , qName ) ;
161       break ;
162     }
163
164     case 1 : {
165       switch ( step[depth] ) {
166         case 0 :
167           if ( qName == "info-list" ) {
168 //            aListOfDataFlows[ GraphsNumber ].Info = aNode ;
169             step[depth]++ ;
170           }
171           else
172             return returnfalse( this , "depth1-0" , qName ) ;
173           break ;
174         case 1 :
175           if ( qName == "node-list" ) {
176 // node-list ok
177             step[depth]++ ;
178             step[3] = 16 ;
179             step[4] = 3 ;
180           }
181           else
182             return returnfalse( this , "depth1-1" , qName ) ;
183           break ;
184         case 2 :
185           if ( qName == "link-list" ) {
186             step[depth]++ ;
187           }
188           else
189             return returnfalse( this , "depth1-2" , qName ) ;
190           break ;
191         case 3 :
192           if ( qName == "data-list" ) {
193             step[depth]++ ;
194           }
195           else
196             return returnfalse( this , "depth1-3" , qName ) ;
197           break ;
198         default:
199           return returnfalse( this , "depth1-d" , qName ) ;
200           break ;
201         }
202       break ;
203     }
204
205     case 2 : {
206       switch ( step[depth] ) {
207         case 0 :
208           if ( qName == "node" ) {
209 // Node ok
210             if ( step[1] == 0 ) {
211               aListOfDataFlows[ GraphsNumber ].Info = aNode ;
212             }
213             else if ( step[1] == 1 ) {
214               int sizenode = aListOfDataFlows[ GraphsNumber ].Nodes.size() ;
215               aListOfDataFlows[ GraphsNumber ].Nodes.resize( sizenode+1 ) ;                
216               aListOfDataFlows[ GraphsNumber ].Nodes[ sizenode ] = aNode ;               
217             }
218             step[3] = 0 ;
219             aNode.theService.ServiceinParameter.length( 0 ) ;
220             aNode.theService.ServiceoutParameter.length( 0 ) ;
221             aNode.theListOfInDataStreams.resize( 0 ) ;
222             aNode.theListOfOutDataStreams.resize( 0 ) ;
223             aNode.theListOfFuncName.resize( 0 ) ;
224             aNode.theListOfPythonFunctions.resize( 0 ) ;
225             break ;
226           }
227           else if ( qName == "link" || qName == "data" ) {
228             step[depth]++ ;
229           }
230           else {
231             return returnfalse( this , "depth2-0" , qName ) ;
232             break ;
233           }
234         case 1 :
235           if ( qName == "link" ) {
236             int sizelink = aListOfDataFlows[ GraphsNumber ].Links.size() ;
237             aListOfDataFlows[ GraphsNumber ].Links.resize( sizelink+1 ) ;                
238             aListOfDataFlows[ GraphsNumber ].Links[ sizelink ] = aLink ;               
239             if ( VXSize ) {
240               aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords.resize( VXSize ) ;
241               int ic ;
242               for ( ic = 0 ; ic < VXSize ; ic++ ) {
243                 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theX = VX[ic] ;
244                 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theY = VY[ic] ;
245               }
246             }
247             VXSize = 0 ;
248             step[3] = 16 ;
249             break ;
250           }
251           else if ( qName == "data" ) {
252             step[depth]++ ;
253           }
254           else {
255             return returnfalse( this , "depth2-1" , qName ) ;
256             break ;
257           }
258         case 2 :
259           if ( qName == "data" ) {
260 // Data ok
261             if ( constructor ) {
262               int sizedata = aListOfDataFlows[ GraphsNumber ].Datas.size() ;
263               aListOfDataFlows[ GraphsNumber ].Datas.resize( sizedata+1 ) ;                
264
265               if ( aLinkValue.type()->kind() == CORBA::tk_double )
266                 aLink.aLinkValue = *aLinkDoubleValue ;
267
268               aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ] = aLink ;               
269
270               if ( VXSize ) {
271                 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords.resize( VXSize ) ;
272                 int ic ;
273                 for ( ic = 0 ; ic < VXSize ; ic++ ) {
274                   aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theX = VX[ic] ;
275                   aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theY = VY[ic] ;
276                 }
277               }
278             }
279             VXSize = 0 ;
280             step[3] = 16 ;
281           }
282           else
283             return returnfalse( this , "depth2-2" , qName ) ;
284           break ;
285         default:
286           return returnfalse( this , "depth2-d" , qName ) ;
287           break ;
288         }
289       break ;
290     }
291
292     case 3 : {
293       switch ( step[depth] ) {
294         case 0 :
295           if ( qName == "component-name" ) {
296             if ( fieldvalue[depth] == NULLSTRING )
297               return returnfalse( this , "depth3-0" , qName ) ;
298             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
299               aNode.theComponentName = fieldvalue[depth].c_str() ;
300             else
301               aNode.theComponentName = "" ;
302             fieldvalue[depth] = NULLSTRING ;
303             step[depth]++ ;
304           }
305           else
306             return returnfalse( this , "depth3-0" , qName ) ;
307           break ;
308         case 1 :
309           if ( qName == "interface-name" ) {
310             if ( fieldvalue[depth] == NULLSTRING )
311               return returnfalse( this , "depth3-1" , qName ) ;
312             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
313               aNode.theInterfaceName = fieldvalue[depth].c_str() ;
314             else
315               aNode.theInterfaceName = "" ;
316             fieldvalue[depth] = NULLSTRING ;
317             step[depth]++ ;
318           }
319           else
320             return returnfalse( this , "depth3-1" , qName ) ;
321           break ;
322         case 2 :
323           if ( qName == "node-name" ) {
324             if ( fieldvalue[depth] == NULLSTRING )
325               return returnfalse( this , "depth3-2" , qName ) ;
326             aNode.theName = fieldvalue[depth].c_str() ;
327             fieldvalue[depth] = NULLSTRING ;
328             step[depth]++ ;
329           }
330           else
331             return returnfalse( this , "depth3-2" , qName ) ;
332           break ;
333         case 3 :
334           if ( qName == "kind" ) {
335             if ( fieldvalue[depth] == NULLSTRING )
336               return returnfalse( this , "depth3-3" , qName ) ;
337 // kind ok
338             sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ;
339             fieldvalue[depth] = NULLSTRING ;
340             if ( aNode.theKind != SUPERV::DataStreamGraph ) {
341               step[depth]++ ;
342               step[4] = 0 ;
343             }
344             break ;
345           }
346           else if ( qName == "streamgraph-timeout" ) {
347             if ( fieldvalue[depth] == NULLSTRING )
348               return returnfalse( this , "depth3-3" , qName ) ;
349             sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theTimeout ) ;
350             fieldvalue[depth] = NULLSTRING ;
351 //              step[depth]++ ;
352 //              step[4] = 0 ;
353             break ;
354           }
355           else if ( qName == "streamgraph-datastreamtrace" ) {
356             if ( fieldvalue[depth] == NULLSTRING )
357               return returnfalse( this , "depth3-3" , qName ) ;
358             sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theDataStreamTrace ) ;
359             fieldvalue[depth] = NULLSTRING ;
360 //              step[depth]++ ;
361 //              step[4] = 0 ;
362             break ;
363           }
364           else if ( qName == "streamgraph-deltatime" ) {
365             if ( fieldvalue[depth] == NULLSTRING )
366               return returnfalse( this , "depth3-3" , qName ) ;
367             sscanf( fieldvalue[depth].c_str() ,"%lf" , (double * ) &aNode.theDeltaTime ) ;
368             fieldvalue[depth] = NULLSTRING ;
369             step[depth]++ ;
370             step[4] = 0 ;
371             break ;
372           }
373           else {
374             step[depth]++ ;
375             step[4] = 0 ;
376           }
377 //            return returnfalse( this , "depth3-3" , qName ) ;
378 //          break ;
379         case 4 :
380           if ( qName == "coupled-node" ) {
381             if ( fieldvalue[depth] == NULLSTRING )
382               return returnfalse( this , "depth3-4" , qName ) ;
383             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
384               aNode.theCoupledNode = fieldvalue[depth].c_str() ;
385             else
386               aNode.theCoupledNode = "" ;
387             fieldvalue[depth] = NULLSTRING ;
388             step[depth]++ ;
389             break ;
390           }
391           else
392             step[depth]++ ;
393 //            return returnfalse( this , "depth3-4" , qName ) ;
394 //          break ;
395         case 5 :
396           if ( qName == "service" ) {
397             if ( fieldvalue[depth] != NULLSTRING )
398               return returnfalse( this , "depth3-5" , qName ) ;
399             fieldvalue[depth] = NULLSTRING ;
400             step[depth]++ ;
401             step[4] = 6;
402             step[5] = 4 ;
403 // service ok
404           }
405           else
406             return returnfalse( this , "depth3-5" , qName ) ;
407           break ;
408         case 6 :
409           if ( qName == "DataStream-list" || qName == "Parameter-list" ) {
410             if ( fieldvalue[depth] != NULLSTRING )
411               return returnfalse( this , "depth3-6" , qName ) ;
412             fieldvalue[depth] = NULLSTRING ;
413             step[depth]++ ;
414             step[4] = 8 ;
415             step[5] = 8 ;
416 // Parameter-list ok
417           break ;
418           }
419           else
420             step[depth]++ ;
421             step[5] = 0 ;
422             step[6] = 0 ;
423 // NO Parameter-list
424 //            return returnfalse( this , "depth3-6" , qName ) ;
425 //          break ;
426         case 7 :
427           if ( qName == "PyFunction-list" ) {
428             if ( fieldvalue[depth] != NULLSTRING )
429               return returnfalse( this , "depth3-7" , qName ) ;
430             fieldvalue[depth] = NULLSTRING ;
431             step[depth]++ ;
432             step[5] = 0 ;
433             step[6] = 0 ;
434 // Parameter-list ok
435           break ;
436           }
437           else
438             step[depth]++ ;
439             step[5] = 0 ;
440             step[6] = 0 ;
441 // NO PyFunction-list
442 //            return returnfalse( this , "depth3-7" , qName ) ;
443 //          break ;
444         case 8 :
445           if ( qName == "creation-date" ) {
446             SUPERV::SDate D ;
447             char Date[23] ;
448             strcpy( Date , fieldvalue[depth].c_str() ) ;
449             int i ;
450             for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
451               if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
452                 Date[i] = ' ' ;
453             }
454 //            MESSAGE( "Date(" << Date << ")" );
455             int Day , Month , Year , Hour , Minute , Second ;
456             sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
457                                            &Month ,
458                                            &Year ,
459                                            &Hour ,
460                                            &Minute ,
461                                            &Second ) ;
462             D.Day = Day ;
463             D.Month = Month ;
464             D.Year = Year ;
465             D.Hour = Hour ;
466             D.Minute = Minute ;
467             D.Second = Second ;
468             aNode.theFirstCreation = D ;
469             fieldvalue[depth] = NULLSTRING ;
470             step[depth]++ ;
471           }
472           else
473             return returnfalse( this , "depth3-8" , qName ) ;
474           break ;
475         case 9 :
476           if ( qName == "lastmodification-date" ) {
477             SUPERV::SDate D ;
478             char Date[23] ;
479             strcpy( Date , fieldvalue[depth].c_str() ) ;
480             int i ;
481             for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
482               if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
483                 Date[i] = ' ' ;
484             }
485 //            MESSAGE( "Date(" << Date << ")" );
486             int Day , Month , Year , Hour , Minute , Second ;
487             sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
488                                            &Month ,
489                                            &Year ,
490                                            &Hour ,
491                                            &Minute ,
492                                            &Second ) ;
493             D.Day = Day ;
494             D.Month = Month ;
495             D.Year = Year ;
496             D.Hour = Hour ;
497             D.Minute = Minute ;
498             D.Second = Second ;
499             aNode.theLastModification = D ;
500             fieldvalue[depth] = NULLSTRING ;
501             step[depth]++ ;
502           }
503           else
504             return returnfalse( this , "depth3-9" , qName ) ;
505           break ;
506         case 10 :
507           if ( qName == "editor-release" ) {
508             aNode.theEditorRelease = fieldvalue[depth].c_str() ;
509             fieldvalue[depth] = NULLSTRING ;
510             step[depth]++ ;
511           }
512           else
513             return returnfalse( this , "depth3-10" , qName ) ;
514           break ;
515         case 11 :
516           if ( qName == "author" ) {
517             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
518               aNode.theAuthor = fieldvalue[depth].c_str() ;
519             else
520               aNode.theAuthor = "" ;
521             fieldvalue[depth] = NULLSTRING ;
522             step[depth]++ ;
523           }
524           else
525             return returnfalse( this , "depth3-11" , qName ) ;
526           break ;
527         case 12 :
528           if ( qName == "container" ) {
529             if ( fieldvalue[depth] == NULLSTRING )
530               return returnfalse( this , "depth3-12" , qName ) ;
531 // computer ok
532             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
533               aNode.theContainer = fieldvalue[depth].c_str() ;
534             else
535               aNode.theContainer = "" ;
536             fieldvalue[depth] = NULLSTRING ;
537             step[depth]++ ;
538           }
539           else
540             return returnfalse( this , "depth3-12" , qName ) ;
541           break ;
542         case 13 :
543           if ( qName == "comment" ) {
544             if ( fieldvalue[depth] == NULLSTRING )
545               return returnfalse( this , "depth3-13" , qName ) ;
546 // comment ok
547             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
548               aNode.theComment = fieldvalue[depth].c_str() ;
549             else
550               aNode.theComment = "" ;
551             fieldvalue[depth] = NULLSTRING ;
552             step[depth]++ ;
553           }
554           else
555             return returnfalse( this , "depth3-13" , qName ) ;
556           break ;
557         case 14 :
558           if ( qName == "x-position" ) {
559             if ( fieldvalue[depth] == NULLSTRING )
560               return returnfalse( this , "depth3-14" , qName ) ;
561             sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theX ) ;
562             fieldvalue[depth] = NULLSTRING ;
563             step[depth]++ ;
564 // x-position ok
565           }
566           else
567             return returnfalse( this , "depth3-14" , qName ) ;
568           break ;
569         case 15 :
570           if ( qName == "y-position" ) {
571             if ( fieldvalue[depth] == NULLSTRING )
572               return returnfalse( this , "depth3-15" , qName ) ;
573             sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theY ) ;
574             fieldvalue[depth] = NULLSTRING ;
575             step[depth]++ ;
576 // y-position ok
577           }
578           else
579             return returnfalse( this , "depth3-15" , qName ) ;
580           break ;
581         case 16 :
582           if ( qName == "fromnode-name" ) {
583             if ( fieldvalue[depth] == NULLSTRING )
584               return returnfalse( this , "depth3-16" , qName ) ;
585             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
586               aLink.FromNodeName = fieldvalue[depth].c_str() ;
587             else
588               aLink.FromNodeName = "" ;
589             fieldvalue[depth] = NULLSTRING ;
590             step[depth]++ ;
591             step[4] = 3 ;
592           }
593           else
594             return returnfalse( this , "depth3-16" , qName ) ;
595           break ;
596         case 17 :
597           if ( qName == "fromserviceparameter-name" ) {
598             if ( fieldvalue[depth] == NULLSTRING )
599               return returnfalse( this , "depth3-17" , qName ) ;
600             aLink.FromServiceParameterName = fieldvalue[depth].c_str() ;
601             fieldvalue[depth] = NULLSTRING ;
602             step[depth]++ ;
603           }
604           else
605             return returnfalse( this , "depth3-17" , qName ) ;
606           break ;
607         case 18 :
608           if ( qName == "tonode-name" ) {
609             if ( fieldvalue[depth] == NULLSTRING )
610               return returnfalse( this , "depth3-18" , qName ) ;
611             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
612               aLink.ToNodeName = fieldvalue[depth].c_str() ;
613             else
614               aLink.ToNodeName = "" ;
615             fieldvalue[depth] = NULLSTRING ;
616             step[depth]++ ;
617           }
618           else
619             return returnfalse( this , "depth3-18" , qName ) ;
620           break ;
621         case 19 :
622           if ( qName == "toserviceparameter-name" ) {
623             if ( fieldvalue[depth] == NULLSTRING )
624               return returnfalse( this , "depth3-19" , qName ) ;
625             aLink.ToServiceParameterName = fieldvalue[depth].c_str() ;
626             fieldvalue[depth] = NULLSTRING ;
627             step[depth]++ ;
628           }
629           else
630             return returnfalse( this , "depth3-19" , qName ) ;
631           step[5] = 2 ;
632           break ;
633         case 20 :
634           if ( qName == "data-value" ) {
635             if ( fieldvalue[depth] != NULLSTRING )
636               return returnfalse( this , "depth3-20" , qName ) ;
637 // data-value ok
638             step[depth]++ ;
639 //            step[4] = 3 ;
640             break ;
641           }
642           else
643             step[depth]++ ;
644 //            return returnfalse( this , "depth3-20" , qName ) ;
645 //          break ;
646         case 21 :
647           if ( qName == "coord-list" ) {
648             if ( fieldvalue[depth] != NULLSTRING )
649               return returnfalse( this , "depth3-21" , qName ) ;
650 // coord-list ok
651             step[depth] = 14 ;
652             step[4] = 5 ;
653           }
654           else
655             return returnfalse( this , "depth3-21" , qName ) ;
656           break ;
657         default:
658           return returnfalse( this , "depth3-d" , qName ) ;
659           break ;
660         }
661       break ;
662     }
663
664
665     case 4 : {
666       switch ( step[depth] ) {
667         case 0 :
668           if ( qName == "service-name" ) {
669             if ( fieldvalue[depth] == NULLSTRING )
670               return returnfalse( this , "depth4-0" , qName ) ;
671             if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
672               aNode.theService.ServiceName = fieldvalue[depth].c_str() ;
673             else
674               aNode.theService.ServiceName = "" ;
675             aNode.theService.ServiceinParameter.length( 0 ) ;
676             aNode.theService.ServiceoutParameter.length( 0 ) ;
677             fieldvalue[depth] = NULLSTRING ;
678             step[depth]++ ;
679           }
680           else
681             return returnfalse( this , "depth4-0" , qName ) ;
682           break ;
683         case 1 :
684           if ( qName == "inParameter-list" ) {
685             if ( fieldvalue[depth] != NULLSTRING )
686               return returnfalse( this , "depth4-1" , qName ) ;
687             fieldvalue[depth] = NULLSTRING ;
688             step[depth]++ ;
689             step[5] = 1 ;
690             step[6] = 2 ; // First outParameter
691 // inParameterlist ok
692           }
693           else
694             return returnfalse( this , "depth4-1" , qName ) ;
695           break ;
696         case 2 :
697           if ( qName == "outParameter-list" ) {
698             if ( fieldvalue[depth] != NULLSTRING )
699               return returnfalse( this , "depth4-2" , qName ) ;
700             fieldvalue[depth] = NULLSTRING ;
701             step[depth] = 0 ;
702 // outParameterlist ok
703             step[5] = 0 ;
704             step[6] = 0 ;
705           }
706           else
707             return returnfalse( this , "depth4-2" , qName ) ;
708           break ;
709         case 3 :
710           if ( qName == "value-type" ) {
711             if ( fieldvalue[depth] == NULLSTRING )
712               return returnfalse( this , "depth4-3" , qName ) ;
713             int Kind ;
714             sscanf( fieldvalue[depth].c_str() , "%d" , &Kind ) ;
715 //            switch ( D.Value.type()->kind() ) {
716             aLink.aLinkValue = CORBA::Any() ;
717             switch ( Kind ) {
718             case CORBA::tk_string: {
719 //Mandrake 10.1/Salome 3              aLink.aLinkValue <<= (char *) NULL ;
720               aLink.aLinkValue <<= (char *) "" ;
721               char * t;
722               aLink.aLinkValue >>= t;
723 #if TRACE
724               MESSAGE( t << " (string)" );
725 #endif
726               break;
727             }
728             case CORBA::tk_double: {
729               //aLink.aLinkValue <<= (double ) 0. ;
730               double d = 0.;
731               aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
732               aLink.aLinkValue >>= d;
733 #if TRACE
734               MESSAGE( d << " (double)" );
735 #endif
736               break;
737             }
738             case CORBA::tk_long: {
739               aLink.aLinkValue <<= (long ) 0 ;
740               long l;
741               aLink.aLinkValue >>= l;
742 #if TRACE
743               MESSAGE( l << " (long)" );
744 #endif
745               break;
746             }
747             case CORBA::tk_objref: {
748 //              aLink.aLinkValue.replace(CORBA::_tc_Object, NULL);
749               aLink.aLinkValue <<= CORBA::Object::_nil() ;
750 #if TRACE
751               MESSAGE( " (object reference)" );
752 #endif
753               break;
754             }
755             default:
756               MESSAGE( "(other ERROR)" );
757             }
758             fieldvalue[depth] = NULLSTRING ;
759             step[depth]++ ;
760             break ;
761           }
762           else
763             step[depth]++ ;
764 //            return returnfalse( this , "depth4-3" , qName ) ;
765 //          break ;
766         case 4 :
767           if ( qName == "value" ) {
768             if ( fieldvalue[depth] == NULLSTRING )
769               return returnfalse( this , "depth4-4" , qName ) ;
770             if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
771               aLink.aLinkValue <<= "" ;
772             }
773             else {
774               switch ( aLink.aLinkValue.type()->kind() ) {
775               case CORBA::tk_string: {
776                 aLink.aLinkValue <<= fieldvalue[depth].c_str() ;
777                 char * t;
778                 aLink.aLinkValue >>= t;
779 #if TRACE
780                 MESSAGE( t << " (string)" );
781 #endif
782                 break;
783               }
784               case CORBA::tk_double: {
785                 double d;
786                 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
787                 //aLink.aLinkValue <<= d;
788                 aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
789                 aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
790                 aLinkDoubleValue = new CORBA::Any( aLinkValue );
791 #if TRACE
792                 MESSAGE( d << " (double)" );
793 #endif
794                 break;
795               }
796               case CORBA::tk_long: {
797                 long l;
798                 sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ;
799                 aLink.aLinkValue <<= l;
800 #if TRACE
801                 MESSAGE( l << " (long)" );
802 #endif
803                 break;
804               }
805               case CORBA::tk_objref: {
806                 CORBA::Object_ptr ObjRef ;
807                 const char * IORObjRef = fieldvalue[depth].c_str() ;
808                 ObjRef = _Orb->string_to_object( IORObjRef ) ;
809                 aLink.aLinkValue <<= ObjRef;
810 #if TRACE
811                 MESSAGE( IORObjRef << "(object reference)" );
812 #endif
813                 break;
814               }
815               default: {
816                 aLink.aLinkValue <<= _Orb->string_to_object( fieldvalue[depth].c_str() ) ;
817                 MESSAGE( "(other ERROR)" );
818               }
819               }
820             }
821             fieldvalue[depth] = NULLSTRING ;
822             step[depth]++ ;
823             step[5] = 2 ;
824           break ;
825           }
826           else
827             step[depth]++ ;
828 //            return returnfalse( this , "depth4-4" , qName ) ;
829 //          break ;
830         case 5 :
831           if ( qName == "coord" ) {
832             if ( fieldvalue[depth] != NULLSTRING )
833               return returnfalse( this , "depth4-5" , qName ) ;
834             if ( VXSize == (int ) VX.size() ) {
835               VX.resize( VX.size() + 10 ) ;
836               VY.resize( VY.size() + 10 ) ;
837             }
838             VX[ VXSize ] = X ;
839             VY[ VXSize ] = Y ;
840             VXSize++ ;
841             step[5] = 2 ;
842           }
843           else
844             return returnfalse( this , "depth4-5" , qName ) ;
845           break ;
846         case 6 :
847           if ( qName == "inParameter" ) {
848             if ( fieldvalue[depth] != NULLSTRING )
849               return returnfalse( this , "depth4-6" , qName ) ;
850             int size = aNode.theListOfInDataStreams.size() ;
851             aNode.theListOfInDataStreams.resize( size+1 ) ;
852             aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
853             break ;
854 // One more aParameter input
855           }
856           else
857             step[depth]++ ;
858 //            return returnfalse( this , "depth4-6" , qName ) ;
859 //          break ;
860         case 7 :
861           if ( qName == "outParameter" ) {
862             if ( fieldvalue[depth] != NULLSTRING )
863               return returnfalse( this , "depth4-7" , qName ) ;
864             int size = aNode.theListOfOutDataStreams.size() ;
865             aNode.theListOfOutDataStreams.resize( size+1 ) ;
866             aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
867 // One more aParameter output
868             step[4] = 6 ;
869             step[5] = 4 ;
870           }
871           else
872             return returnfalse( this , "depth4-7" , qName ) ;
873           break ;
874         case 8 :
875           if ( qName == "PyFunction" ) {
876             if ( fieldvalue[depth] != NULLSTRING )
877               return returnfalse( this , "depth4-8" , qName ) ;
878 // One more PyFunction
879             step[4] = 8 ;
880             step[5] = 8 ;
881           }
882           else
883             return returnfalse( this , "depth4-8" , qName ) ;
884           break ;
885         default:
886           return returnfalse( this , "depth4-d" , qName ) ;
887           break ;
888         }
889       break ;
890     }
891
892
893     case 5 : {
894       switch ( step[depth] ) {
895         case 0 :
896           if ( qName == "inParameter" ) {
897             if ( fieldvalue[depth] != NULLSTRING )
898               return returnfalse( this , "depth5-0" , qName ) ;
899             fieldvalue[depth] = NULLSTRING ;
900             int size = aNode.theService.ServiceinParameter.length() ;
901             aNode.theService.ServiceinParameter.length( size+1 ) ;
902             aNode.theService.ServiceinParameter[size] = aParameter ;
903 // One more aParameter input
904             step[6] = 0 ; // Next one
905           }
906           else
907             return returnfalse( this , "depth5-0" , qName ) ;
908           break ;
909         case 1 :
910           if ( qName == "outParameter" ) {
911             if ( fieldvalue[depth] != NULLSTRING )
912               return returnfalse( this , "depth5-1" , qName ) ;
913             fieldvalue[depth] = NULLSTRING ;
914             int size = aNode.theService.ServiceoutParameter.length() ;
915             aNode.theService.ServiceoutParameter.length( size+1 ) ;
916             aNode.theService.ServiceoutParameter[size] = aParameter ;
917 // One more aParameter Output
918             step[6] = 2 ; // Next one
919           }
920           else
921             return returnfalse( this , "depth5-1" , qName ) ;
922           break ;
923         case 2 :
924           if ( qName == "x" ) {
925             if ( fieldvalue[depth] == NULLSTRING )
926               return returnfalse( this , "depth5-2" , qName ) ;
927             sscanf( fieldvalue[depth].c_str() , "%d" , &X ) ;
928             fieldvalue[depth] = NULLSTRING ;
929             step[depth]++ ;
930           }
931           else
932             return returnfalse( this , "depth5-2" , qName ) ;
933           break ;
934         case 3 :
935           if ( qName == "y" ) {
936             if ( fieldvalue[depth] == NULLSTRING )
937               return returnfalse( this , "depth5-3" , qName ) ;
938             sscanf( fieldvalue[depth].c_str() , "%d" , &Y ) ;
939             fieldvalue[depth] = NULLSTRING ;
940           }
941           else
942             return returnfalse( this , "depth5-3" , qName ) ;
943           break ;
944         case 4 :
945           if ( qName == "inParameter-type" ) {
946             if ( fieldvalue[depth] == NULLSTRING )
947               return returnfalse( this , "depth5-4" , qName ) ;
948             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ;
949             fieldvalue[depth] = NULLSTRING ;
950             step[depth]++ ;
951 #if TRACE
952   //cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ;
953 #endif
954             break ;
955           }
956           else
957             step[depth] = 6 ;
958 //            return returnfalse( this , "depth5-4" , qName ) ;
959 //          break ;
960         case 5 :
961           if ( qName == "inParameter-name" ) {
962             if ( fieldvalue[depth] == NULLSTRING )
963               return returnfalse( this , "depth5-5" , qName ) ;
964             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
965               anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
966             }
967             else {
968               anInDataStreamParameter.theDataStreamParameter.Parametername = "" ;
969             }
970             fieldvalue[depth] = NULLSTRING ;
971 #if TRACE
972   //cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
973 #endif
974 //            step[depth]++ ;
975 //            step[depth] = 4 ;
976             break ;
977           }
978           else if ( qName == "inParameter-dependency" ) {
979             if ( fieldvalue[depth] == NULLSTRING )
980               return returnfalse( this , "depth5-5" , qName ) ;
981             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
982             fieldvalue[depth] = NULLSTRING ;
983 #if TRACE
984   //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
985   //               << step[depth] << endl ;
986 #endif
987 //            step[depth]++ ;
988 //            step[depth] = 4 ;
989             break ;
990           }
991           else if ( qName == "inParameter-schema" ) {
992             if ( fieldvalue[depth] == NULLSTRING )
993               return returnfalse( this , "depth5-5" , qName ) ;
994             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ;
995             fieldvalue[depth] = NULLSTRING ;
996 #if TRACE
997   //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
998   //               << step[depth] << endl ;
999 #endif
1000 //            step[depth]++ ;
1001 //            step[depth] = 4 ;
1002             break ;
1003           }
1004           else if ( qName == "inParameter-interpolation" ) {
1005             if ( fieldvalue[depth] == NULLSTRING )
1006               return returnfalse( this , "depth5-5" , qName ) ;
1007             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ;
1008             fieldvalue[depth] = NULLSTRING ;
1009 #if TRACE
1010   //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
1011   //               << step[depth] << endl ;
1012 #endif
1013 //            step[depth]++ ;
1014 //            step[depth] = 4 ;
1015             break ;
1016           }
1017           else if ( qName == "inParameter-extrapolation" ) {
1018             if ( fieldvalue[depth] == NULLSTRING )
1019               return returnfalse( this , "depth5-5" , qName ) ;
1020             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ;
1021             fieldvalue[depth] = NULLSTRING ;
1022 //            step[depth]++ ;
1023             step[depth] = 4 ;
1024 #if TRACE
1025   //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
1026   //               << step[depth] << endl ;
1027 #endif
1028             break ;
1029           }
1030 //          else
1031 //            return returnfalse( this , "depth5-5" , qName ) ;
1032 //          break ;
1033         case 6 :
1034           if ( qName == "outParameter-type" ) {
1035             if ( fieldvalue[depth] == NULLSTRING )
1036               return returnfalse( this , "depth5-6" , qName ) ;
1037             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ;
1038             fieldvalue[depth] = NULLSTRING ;
1039 //            step[depth]++ ;
1040             step[depth] = 7 ;
1041 #if TRACE
1042   //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
1043   //               << step[depth] << endl ;
1044 #endif
1045           }
1046           else
1047             return returnfalse( this , "depth5-6" , qName ) ;
1048           break ;
1049         case 7 : 
1050           if ( qName == "outParameter-name" ) {
1051             if ( fieldvalue[depth] == NULLSTRING )
1052               return returnfalse( this , "depth5-7" , qName ) ;
1053             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1054               anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
1055             }
1056             else {
1057               anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ;
1058             }
1059             fieldvalue[depth] = NULLSTRING ;
1060 #if TRACE
1061   //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
1062   //               << step[depth] << endl ;
1063 #endif
1064 //            step[depth]++ ;
1065 //            step[depth] = 6 ;
1066           }
1067           else if ( qName == "outParameter-dependency" ) {
1068             if ( fieldvalue[depth] == NULLSTRING )
1069               return returnfalse( this , "depth5-7" , qName ) ;
1070             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
1071             fieldvalue[depth] = NULLSTRING ;
1072 #if TRACE
1073   //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
1074   //               << step[depth] << endl ;
1075 #endif
1076 //            step[depth]++ ;
1077 //            step[depth] = 6 ;
1078           }
1079           else if ( qName == "outParameter-values" ) {
1080             if ( fieldvalue[depth] == NULLSTRING )
1081               return returnfalse( this , "depth5-7" , qName ) ;
1082             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ;
1083             fieldvalue[depth] = NULLSTRING ;
1084 //            step[depth]++ ;
1085             step[depth] = 6 ;
1086 #if TRACE
1087   //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
1088   //               << step[depth] << endl ;
1089 #endif
1090           }
1091           else
1092             return returnfalse( this , "depth5-7" , qName ) ;
1093           break ;
1094         case 8 :
1095           if ( qName == "FuncName" ) {
1096             if ( fieldvalue[depth] == NULLSTRING )
1097               return returnfalse( this , "depth5-8" , qName ) ;
1098             int l = aNode.theListOfFuncName.size() ;
1099             aNode.theListOfFuncName.resize( l+1 ) ;
1100             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1101               aNode.theListOfFuncName[ l ] = fieldvalue[depth].c_str() ;
1102             }
1103             else {
1104               aNode.theListOfFuncName[ l ] = "" ;
1105             }
1106             aNode.theListOfPythonFunctions.resize( l+1 ) ;
1107             aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings() ;
1108 #if TRACE
1109             MESSAGE( " ==========theListOfFuncName/theListOfPythonFunctions size "
1110                      << l+1 )
1111 #endif
1112             fieldvalue[depth] = NULLSTRING ;
1113             step[depth]++ ;
1114           }
1115           else
1116             return returnfalse( this , "depth5-8" , qName ) ;
1117           break ;
1118         case 9 :
1119           if ( qName == "PyFunc" ) {
1120             if ( fieldvalue[depth] == NULLSTRING )
1121               return returnfalse( this , "depth5-9" , qName ) ;
1122             int l = aNode.theListOfPythonFunctions.size() - 1 ;
1123             SUPERV::ListOfStrings aPythonFunction = *aNode.theListOfPythonFunctions[ l ] ;
1124             int ll = aPythonFunction.length() ;
1125             aPythonFunction.length( ll+1 ) ;
1126             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1127               aPythonFunction[ ll ] = fieldvalue[depth].c_str() ;
1128             }
1129             else {
1130               aPythonFunction[ ll ] = NULLSTRING ;
1131             }
1132             if ( ll ) {
1133               aNode.theListOfPythonFunctions.resize( l ) ;
1134               aNode.theListOfPythonFunctions.resize( l+1 ) ;
1135             }
1136             aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings( aPythonFunction ) ;
1137 #if TRACE
1138             MESSAGE( " ==========theListOfPythonFunctions[" << l << "] size " << ll+1
1139                      << " [" << ll << "] = " << aPythonFunction[ ll ] )
1140 #endif
1141             fieldvalue[depth] = NULLSTRING ;
1142 //            step[depth]++ ;
1143           }
1144           else
1145             return returnfalse( this , "depth5-9" , qName ) ;
1146           break ;
1147         default:
1148           return returnfalse( this , "depth5-d" , qName ) ;
1149           break ;
1150         }
1151       break ;
1152     }
1153
1154     case 6 : {
1155       switch ( step[depth] ) {
1156         case 0 :
1157           if ( qName == "inParameter-type" ) {
1158             if ( fieldvalue[depth] == NULLSTRING )
1159               return returnfalse( this , "depth6-0" , qName ) ;
1160             aParameter.Parametertype = fieldvalue[depth].c_str() ;
1161             fieldvalue[depth] = NULLSTRING ;
1162             step[depth]++ ;
1163           }
1164           else
1165             return returnfalse( this , "depth6-0" , qName ) ;
1166           break ;
1167         case 1 :
1168           if ( qName == "inParameter-name" ) {
1169             if ( fieldvalue[depth] == NULLSTRING )
1170               return returnfalse( this , "depth6-1" , qName ) ;
1171             aParameter.Parametername = fieldvalue[depth].c_str() ;
1172             fieldvalue[depth] = NULLSTRING ;
1173             step[depth]++ ;
1174           }
1175           else
1176             return returnfalse( this , "depth6-1" , qName ) ;
1177           break ;
1178         case 2 :
1179           if ( qName == "outParameter-type" ) {
1180             if ( fieldvalue[depth] == NULLSTRING )
1181               return returnfalse( this , "depth6-2" , qName ) ;
1182             aParameter.Parametertype = fieldvalue[depth].c_str() ;
1183             fieldvalue[depth] = NULLSTRING ;
1184             step[depth]++ ;
1185           }
1186           else
1187             return returnfalse( this , "depth6-2" , qName ) ;
1188           break ;
1189         case 3 :
1190           if ( qName == "outParameter-name" ) {
1191             if ( fieldvalue[depth] == NULLSTRING )
1192               return returnfalse( this , "depth6-3" , qName ) ;
1193             aParameter.Parametername = fieldvalue[depth].c_str() ;
1194             fieldvalue[depth] = NULLSTRING ;
1195             step[depth]++ ;
1196           }
1197           else
1198             return returnfalse( this , "depth6-3" , qName ) ;
1199           break ;
1200         default:
1201           return returnfalse( this , "depth6-d" , qName ) ;
1202           break ;
1203         }
1204       break ;
1205     }
1206   }
1207
1208 #if TRACE
1209   //cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
1210 #endif
1211   return TRUE;
1212 }
1213
1214
1215 bool GraphBase::XmlHandler::characters( const QString& ch ) {
1216   // we are not interested in whitespaces
1217   QString ch_simplified = ch.simplifyWhiteSpace();
1218   if ( ch_simplified.isEmpty() ) {
1219     return TRUE;
1220   }
1221   depth -= 1 ;
1222 #if TRACE
1223   MESSAGE( "characters step[" << depth << "]=" << step[depth]
1224        << " ch " << ch << " fieldvalue_must_be_NULL : '" << fieldvalue[depth] << "'" ) ;
1225 #endif
1226   if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
1227     return returnfalse( this , "characters " , ch ) ;
1228
1229 //  fieldvalue[depth] = (const char * ) ch ;
1230   fieldvalue[depth] = ch.latin1() ;
1231   return TRUE;
1232 }
1233
1234
1235 QString GraphBase::XmlHandler::errorString() {
1236   //cout << "the document is not in the quote file format" << endl ;
1237   return "the document is not in the quote file format";
1238 }
1239
1240
1241 bool GraphBase::XmlHandler::fatalError( const QXmlParseException& exception ) {
1242   errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
1243     .arg( exception.message() )
1244     .arg( exception.lineNumber() )
1245     .arg( exception.columnNumber() );
1246   //cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
1247   return QXmlDefaultHandler::fatalError( exception );
1248 }
1249
1250 #if 0
1251 SALOME_SuperVision::Date GraphBase::XmlHandler::StringToDate( QString& myStrDate) const
1252 {
1253   SALOME_SuperVision::Date aDate;
1254   QString qstrDate(myStrDate);
1255   QString qstrTemp;
1256
1257   // Date
1258   int iPos = qstrDate.find("/");
1259   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1260   aDate.Day = qstrTemp.toShort();
1261   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1262   iPos = qstrDate.find("/");
1263   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1264   aDate.Month = qstrTemp.toShort();
1265   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1266   iPos = qstrDate.find(" ");
1267   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1268   aDate.Year = qstrTemp.toShort();
1269
1270   // Time
1271   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1272   iPos = qstrDate.find(":");
1273   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1274   aDate.Hour = qstrTemp.toShort();
1275   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1276   iPos = qstrDate.find(":");
1277   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1278   aDate.Minute = qstrTemp.toShort();
1279   qstrDate = qstrDate.right(qstrDate.length()-iPos).stripWhiteSpace();
1280   aDate.Second = qstrDate.toShort();
1281
1282   return aDate;
1283 }
1284 #endif
1285
1286