Salome HOME
13d8095d1504af60cbeb6bca9dd2a259bb124b75
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 ( aLink.aLinkValue.type()->kind() == CORBA::tk_double ) // mkr : PAL12235
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               double d = 0.;
730 #ifdef REDHAT // mkr : debug for PAL12255
731               aLink.aLinkValue <<= (double ) 0. ;
732 #else
733               aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
734 #endif
735               aLink.aLinkValue >>= d;
736 #if TRACE
737               MESSAGE( d << " (double)" );
738 #endif
739               break;
740             }
741             case CORBA::tk_long: {
742               aLink.aLinkValue <<= (long ) 0 ;
743               long l;
744               aLink.aLinkValue >>= l;
745 #if TRACE
746               MESSAGE( l << " (long)" );
747 #endif
748               break;
749             }
750             case CORBA::tk_objref: {
751 //              aLink.aLinkValue.replace(CORBA::_tc_Object, NULL);
752               aLink.aLinkValue <<= CORBA::Object::_nil() ;
753 #if TRACE
754               MESSAGE( " (object reference)" );
755 #endif
756               break;
757             }
758             default:
759               MESSAGE( "(other ERROR)" );
760             }
761             fieldvalue[depth] = NULLSTRING ;
762             step[depth]++ ;
763             break ;
764           }
765           else
766             step[depth]++ ;
767 //            return returnfalse( this , "depth4-3" , qName ) ;
768 //          break ;
769         case 4 :
770           if ( qName == "value" ) {
771             if ( fieldvalue[depth] == NULLSTRING )
772               return returnfalse( this , "depth4-4" , qName ) ;
773             if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
774               aLink.aLinkValue <<= "" ;
775             }
776             else {
777               switch ( aLink.aLinkValue.type()->kind() ) {
778               case CORBA::tk_string: {
779                 aLink.aLinkValue <<= fieldvalue[depth].c_str() ;
780                 char * t;
781                 aLink.aLinkValue >>= t;
782 #if TRACE
783                 MESSAGE( t << " (string)" );
784 #endif
785                 break;
786               }
787               case CORBA::tk_double: {
788                 double d;
789                 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
790 #ifdef REDHAT // mkr : debug for PAL12255
791                 aLink.aLinkValue <<= d;
792                 aLinkValue <<= d;
793 #else
794                 aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
795                 aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
796 #endif          
797                 aLinkDoubleValue = new CORBA::Any( aLinkValue );
798 #if TRACE
799                 MESSAGE( d << " (double)" );
800 #endif
801                 break;
802               }
803               case CORBA::tk_long: {
804                 long l;
805                 sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ;
806                 aLink.aLinkValue <<= l;
807 #if TRACE
808                 MESSAGE( l << " (long)" );
809 #endif
810                 break;
811               }
812               case CORBA::tk_objref: {
813                 CORBA::Object_ptr ObjRef ;
814                 const char * IORObjRef = fieldvalue[depth].c_str() ;
815                 ObjRef = _Orb->string_to_object( IORObjRef ) ;
816                 aLink.aLinkValue <<= ObjRef;
817 #if TRACE
818                 MESSAGE( IORObjRef << "(object reference)" );
819 #endif
820                 break;
821               }
822               default: {
823                 aLink.aLinkValue <<= _Orb->string_to_object( fieldvalue[depth].c_str() ) ;
824                 MESSAGE( "(other ERROR)" );
825               }
826               }
827             }
828             fieldvalue[depth] = NULLSTRING ;
829             step[depth]++ ;
830             step[5] = 2 ;
831           break ;
832           }
833           else
834             step[depth]++ ;
835 //            return returnfalse( this , "depth4-4" , qName ) ;
836 //          break ;
837         case 5 :
838           if ( qName == "coord" ) {
839             if ( fieldvalue[depth] != NULLSTRING )
840               return returnfalse( this , "depth4-5" , qName ) ;
841             if ( VXSize == (int ) VX.size() ) {
842               VX.resize( VX.size() + 10 ) ;
843               VY.resize( VY.size() + 10 ) ;
844             }
845             VX[ VXSize ] = X ;
846             VY[ VXSize ] = Y ;
847             VXSize++ ;
848             step[5] = 2 ;
849           }
850           else
851             return returnfalse( this , "depth4-5" , qName ) ;
852           break ;
853         case 6 :
854           if ( qName == "inParameter" ) {
855             if ( fieldvalue[depth] != NULLSTRING )
856               return returnfalse( this , "depth4-6" , qName ) ;
857             int size = aNode.theListOfInDataStreams.size() ;
858             aNode.theListOfInDataStreams.resize( size+1 ) ;
859             aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
860             break ;
861 // One more aParameter input
862           }
863           else
864             step[depth]++ ;
865 //            return returnfalse( this , "depth4-6" , qName ) ;
866 //          break ;
867         case 7 :
868           if ( qName == "outParameter" ) {
869             if ( fieldvalue[depth] != NULLSTRING )
870               return returnfalse( this , "depth4-7" , qName ) ;
871             int size = aNode.theListOfOutDataStreams.size() ;
872             aNode.theListOfOutDataStreams.resize( size+1 ) ;
873             aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
874 // One more aParameter output
875             step[4] = 6 ;
876             step[5] = 4 ;
877           }
878           else
879             return returnfalse( this , "depth4-7" , qName ) ;
880           break ;
881         case 8 :
882           if ( qName == "PyFunction" ) {
883             if ( fieldvalue[depth] != NULLSTRING )
884               return returnfalse( this , "depth4-8" , qName ) ;
885 // One more PyFunction
886             step[4] = 8 ;
887             step[5] = 8 ;
888           }
889           else
890             return returnfalse( this , "depth4-8" , qName ) ;
891           break ;
892         default:
893           return returnfalse( this , "depth4-d" , qName ) ;
894           break ;
895         }
896       break ;
897     }
898
899
900     case 5 : {
901       switch ( step[depth] ) {
902         case 0 :
903           if ( qName == "inParameter" ) {
904             if ( fieldvalue[depth] != NULLSTRING )
905               return returnfalse( this , "depth5-0" , qName ) ;
906             fieldvalue[depth] = NULLSTRING ;
907             int size = aNode.theService.ServiceinParameter.length() ;
908             aNode.theService.ServiceinParameter.length( size+1 ) ;
909             aNode.theService.ServiceinParameter[size] = aParameter ;
910 // One more aParameter input
911             step[6] = 0 ; // Next one
912           }
913           else
914             return returnfalse( this , "depth5-0" , qName ) ;
915           break ;
916         case 1 :
917           if ( qName == "outParameter" ) {
918             if ( fieldvalue[depth] != NULLSTRING )
919               return returnfalse( this , "depth5-1" , qName ) ;
920             fieldvalue[depth] = NULLSTRING ;
921             int size = aNode.theService.ServiceoutParameter.length() ;
922             aNode.theService.ServiceoutParameter.length( size+1 ) ;
923             aNode.theService.ServiceoutParameter[size] = aParameter ;
924 // One more aParameter Output
925             step[6] = 2 ; // Next one
926           }
927           else
928             return returnfalse( this , "depth5-1" , qName ) ;
929           break ;
930         case 2 :
931           if ( qName == "x" ) {
932             if ( fieldvalue[depth] == NULLSTRING )
933               return returnfalse( this , "depth5-2" , qName ) ;
934             sscanf( fieldvalue[depth].c_str() , "%d" , &X ) ;
935             fieldvalue[depth] = NULLSTRING ;
936             step[depth]++ ;
937           }
938           else
939             return returnfalse( this , "depth5-2" , qName ) ;
940           break ;
941         case 3 :
942           if ( qName == "y" ) {
943             if ( fieldvalue[depth] == NULLSTRING )
944               return returnfalse( this , "depth5-3" , qName ) ;
945             sscanf( fieldvalue[depth].c_str() , "%d" , &Y ) ;
946             fieldvalue[depth] = NULLSTRING ;
947           }
948           else
949             return returnfalse( this , "depth5-3" , qName ) ;
950           break ;
951         case 4 :
952           if ( qName == "inParameter-type" ) {
953             if ( fieldvalue[depth] == NULLSTRING )
954               return returnfalse( this , "depth5-4" , qName ) ;
955             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ;
956             fieldvalue[depth] = NULLSTRING ;
957             step[depth]++ ;
958 #if TRACE
959   //cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ;
960 #endif
961             break ;
962           }
963           else
964             step[depth] = 6 ;
965 //            return returnfalse( this , "depth5-4" , qName ) ;
966 //          break ;
967         case 5 :
968           if ( qName == "inParameter-name" ) {
969             if ( fieldvalue[depth] == NULLSTRING )
970               return returnfalse( this , "depth5-5" , qName ) ;
971             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
972               anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
973             }
974             else {
975               anInDataStreamParameter.theDataStreamParameter.Parametername = "" ;
976             }
977             fieldvalue[depth] = NULLSTRING ;
978 #if TRACE
979   //cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
980 #endif
981 //            step[depth]++ ;
982 //            step[depth] = 4 ;
983             break ;
984           }
985           else if ( qName == "inParameter-dependency" ) {
986             if ( fieldvalue[depth] == NULLSTRING )
987               return returnfalse( this , "depth5-5" , qName ) ;
988             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
989             fieldvalue[depth] = NULLSTRING ;
990 #if TRACE
991   //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
992   //               << step[depth] << endl ;
993 #endif
994 //            step[depth]++ ;
995 //            step[depth] = 4 ;
996             break ;
997           }
998           else if ( qName == "inParameter-schema" ) {
999             if ( fieldvalue[depth] == NULLSTRING )
1000               return returnfalse( this , "depth5-5" , qName ) ;
1001             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ;
1002             fieldvalue[depth] = NULLSTRING ;
1003 #if TRACE
1004   //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
1005   //               << step[depth] << endl ;
1006 #endif
1007 //            step[depth]++ ;
1008 //            step[depth] = 4 ;
1009             break ;
1010           }
1011           else if ( qName == "inParameter-interpolation" ) {
1012             if ( fieldvalue[depth] == NULLSTRING )
1013               return returnfalse( this , "depth5-5" , qName ) ;
1014             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ;
1015             fieldvalue[depth] = NULLSTRING ;
1016 #if TRACE
1017   //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
1018   //               << step[depth] << endl ;
1019 #endif
1020 //            step[depth]++ ;
1021 //            step[depth] = 4 ;
1022             break ;
1023           }
1024           else if ( qName == "inParameter-extrapolation" ) {
1025             if ( fieldvalue[depth] == NULLSTRING )
1026               return returnfalse( this , "depth5-5" , qName ) ;
1027             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ;
1028             fieldvalue[depth] = NULLSTRING ;
1029 //            step[depth]++ ;
1030             step[depth] = 4 ;
1031 #if TRACE
1032   //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
1033   //               << step[depth] << endl ;
1034 #endif
1035             break ;
1036           }
1037 //          else
1038 //            return returnfalse( this , "depth5-5" , qName ) ;
1039 //          break ;
1040         case 6 :
1041           if ( qName == "outParameter-type" ) {
1042             if ( fieldvalue[depth] == NULLSTRING )
1043               return returnfalse( this , "depth5-6" , qName ) ;
1044             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ;
1045             fieldvalue[depth] = NULLSTRING ;
1046 //            step[depth]++ ;
1047             step[depth] = 7 ;
1048 #if TRACE
1049   //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
1050   //               << step[depth] << endl ;
1051 #endif
1052           }
1053           else
1054             return returnfalse( this , "depth5-6" , qName ) ;
1055           break ;
1056         case 7 : 
1057           if ( qName == "outParameter-name" ) {
1058             if ( fieldvalue[depth] == NULLSTRING )
1059               return returnfalse( this , "depth5-7" , qName ) ;
1060             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1061               anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
1062             }
1063             else {
1064               anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ;
1065             }
1066             fieldvalue[depth] = NULLSTRING ;
1067 #if TRACE
1068   //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
1069   //               << step[depth] << endl ;
1070 #endif
1071 //            step[depth]++ ;
1072 //            step[depth] = 6 ;
1073           }
1074           else if ( qName == "outParameter-dependency" ) {
1075             if ( fieldvalue[depth] == NULLSTRING )
1076               return returnfalse( this , "depth5-7" , qName ) ;
1077             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
1078             fieldvalue[depth] = NULLSTRING ;
1079 #if TRACE
1080   //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
1081   //               << step[depth] << endl ;
1082 #endif
1083 //            step[depth]++ ;
1084 //            step[depth] = 6 ;
1085           }
1086           else if ( qName == "outParameter-values" ) {
1087             if ( fieldvalue[depth] == NULLSTRING )
1088               return returnfalse( this , "depth5-7" , qName ) ;
1089             sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ;
1090             fieldvalue[depth] = NULLSTRING ;
1091 //            step[depth]++ ;
1092             step[depth] = 6 ;
1093 #if TRACE
1094   //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
1095   //               << step[depth] << endl ;
1096 #endif
1097           }
1098           else
1099             return returnfalse( this , "depth5-7" , qName ) ;
1100           break ;
1101         case 8 :
1102           if ( qName == "FuncName" ) {
1103             if ( fieldvalue[depth] == NULLSTRING )
1104               return returnfalse( this , "depth5-8" , qName ) ;
1105             int l = aNode.theListOfFuncName.size() ;
1106             aNode.theListOfFuncName.resize( l+1 ) ;
1107             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1108               aNode.theListOfFuncName[ l ] = fieldvalue[depth].c_str() ;
1109             }
1110             else {
1111               aNode.theListOfFuncName[ l ] = "" ;
1112             }
1113             aNode.theListOfPythonFunctions.resize( l+1 ) ;
1114             aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings() ;
1115 #if TRACE
1116             MESSAGE( " ==========theListOfFuncName/theListOfPythonFunctions size "
1117                      << l+1 )
1118 #endif
1119             fieldvalue[depth] = NULLSTRING ;
1120             step[depth]++ ;
1121           }
1122           else
1123             return returnfalse( this , "depth5-8" , qName ) ;
1124           break ;
1125         case 9 :
1126           if ( qName == "PyFunc" ) {
1127             // mkr : commented for PAL12309 (the function body can contains spaces, tabs, etc.)
1128             //if ( fieldvalue[depth] == NULLSTRING )
1129             //  return returnfalse( this , "depth5-9" , qName ) ;
1130             int l = aNode.theListOfPythonFunctions.size() - 1 ;
1131             SUPERV::ListOfStrings aPythonFunction = *aNode.theListOfPythonFunctions[ l ] ;
1132             int ll = aPythonFunction.length() ;
1133             aPythonFunction.length( ll+1 ) ;
1134             if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1135               aPythonFunction[ ll ] = fieldvalue[depth].c_str() ;
1136             }
1137             else {
1138               aPythonFunction[ ll ] = NULLSTRING ;
1139             }
1140             if ( ll ) {
1141               aNode.theListOfPythonFunctions.resize( l ) ;
1142               aNode.theListOfPythonFunctions.resize( l+1 ) ;
1143             }
1144             aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings( aPythonFunction ) ;
1145 #if TRACE
1146             MESSAGE( " ==========theListOfPythonFunctions[" << l << "] size " << ll+1
1147                      << " [" << ll << "] = " << aPythonFunction[ ll ] )
1148 #endif
1149             fieldvalue[depth] = NULLSTRING ;
1150 //            step[depth]++ ;
1151           }
1152           else
1153             return returnfalse( this , "depth5-9" , qName ) ;
1154           break ;
1155         default:
1156           return returnfalse( this , "depth5-d" , qName ) ;
1157           break ;
1158         }
1159       break ;
1160     }
1161
1162     case 6 : {
1163       switch ( step[depth] ) {
1164         case 0 :
1165           if ( qName == "inParameter-type" ) {
1166             if ( fieldvalue[depth] == NULLSTRING )
1167               return returnfalse( this , "depth6-0" , qName ) ;
1168             aParameter.Parametertype = fieldvalue[depth].c_str() ;
1169             fieldvalue[depth] = NULLSTRING ;
1170             step[depth]++ ;
1171           }
1172           else
1173             return returnfalse( this , "depth6-0" , qName ) ;
1174           break ;
1175         case 1 :
1176           if ( qName == "inParameter-name" ) {
1177             if ( fieldvalue[depth] == NULLSTRING )
1178               return returnfalse( this , "depth6-1" , qName ) ;
1179             aParameter.Parametername = fieldvalue[depth].c_str() ;
1180             fieldvalue[depth] = NULLSTRING ;
1181             step[depth]++ ;
1182           }
1183           else
1184             return returnfalse( this , "depth6-1" , qName ) ;
1185           break ;
1186         case 2 :
1187           if ( qName == "outParameter-type" ) {
1188             if ( fieldvalue[depth] == NULLSTRING )
1189               return returnfalse( this , "depth6-2" , qName ) ;
1190             aParameter.Parametertype = fieldvalue[depth].c_str() ;
1191             fieldvalue[depth] = NULLSTRING ;
1192             step[depth]++ ;
1193           }
1194           else
1195             return returnfalse( this , "depth6-2" , qName ) ;
1196           break ;
1197         case 3 :
1198           if ( qName == "outParameter-name" ) {
1199             if ( fieldvalue[depth] == NULLSTRING )
1200               return returnfalse( this , "depth6-3" , qName ) ;
1201             aParameter.Parametername = fieldvalue[depth].c_str() ;
1202             fieldvalue[depth] = NULLSTRING ;
1203             step[depth]++ ;
1204           }
1205           else
1206             return returnfalse( this , "depth6-3" , qName ) ;
1207           break ;
1208         default:
1209           return returnfalse( this , "depth6-d" , qName ) ;
1210           break ;
1211         }
1212       break ;
1213     }
1214   }
1215
1216 #if TRACE
1217   //cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
1218 #endif
1219   return TRUE;
1220 }
1221
1222
1223 bool GraphBase::XmlHandler::characters( const QString& ch ) {
1224   // we are not interested in whitespaces
1225   QString ch_simplified = ch.simplifyWhiteSpace();
1226   if ( ch_simplified.isEmpty() ) {
1227     return TRUE;
1228   }
1229   depth -= 1 ;
1230 #if TRACE
1231   MESSAGE( "characters step[" << depth << "]=" << step[depth]
1232        << " ch " << ch << " fieldvalue_must_be_NULL : '" << fieldvalue[depth] << "'" ) ;
1233 #endif
1234   if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
1235     return returnfalse( this , "characters " , ch ) ;
1236
1237 //  fieldvalue[depth] = (const char * ) ch ;
1238   fieldvalue[depth] = ch.latin1() ;
1239   return TRUE;
1240 }
1241
1242
1243 QString GraphBase::XmlHandler::errorString() {
1244   //cout << "the document is not in the quote file format" << endl ;
1245   return "the document is not in the quote file format";
1246 }
1247
1248
1249 bool GraphBase::XmlHandler::fatalError( const QXmlParseException& exception ) {
1250   errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
1251     .arg( exception.message() )
1252     .arg( exception.lineNumber() )
1253     .arg( exception.columnNumber() );
1254   //cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
1255   return QXmlDefaultHandler::fatalError( exception );
1256 }
1257
1258 #if 0
1259 SALOME_SuperVision::Date GraphBase::XmlHandler::StringToDate( QString& myStrDate) const
1260 {
1261   SALOME_SuperVision::Date aDate;
1262   QString qstrDate(myStrDate);
1263   QString qstrTemp;
1264
1265   // Date
1266   int iPos = qstrDate.find("/");
1267   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1268   aDate.Day = qstrTemp.toShort();
1269   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1270   iPos = qstrDate.find("/");
1271   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1272   aDate.Month = qstrTemp.toShort();
1273   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1274   iPos = qstrDate.find(" ");
1275   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1276   aDate.Year = qstrTemp.toShort();
1277
1278   // Time
1279   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1280   iPos = qstrDate.find(":");
1281   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1282   aDate.Hour = qstrTemp.toShort();
1283   qstrDate = qstrDate.right(qstrDate.length()-iPos);
1284   iPos = qstrDate.find(":");
1285   qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1286   aDate.Minute = qstrTemp.toShort();
1287   qstrDate = qstrDate.right(qstrDate.length()-iPos).stripWhiteSpace();
1288   aDate.Second = qstrDate.toShort();
1289
1290   return aDate;
1291 }
1292 #endif
1293
1294