-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSupportClass.cs
6948 lines (6379 loc) · 240 KB
/
SupportClass.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// In order to convert some functionality to Visual C#, the Java Language Conversion Assistant
// creates "support classes" that duplicate the original functionality.
//
// Support classes replicate the functionality of the original code, but in some cases they are
// substantially different architecturally. Although every effort is made to preserve the
// original architecture of the application in the converted project, the user should be aware that
// the primary goal of these support classes is to replicate functionality, and that at times
// the architecture of the resulting solution may differ somewhat.
//
using System;
/// <summary>
/// This interface should be implemented by any class whose instances are intended
/// to be executed by a thread.
/// </summary>
public interface IThreadRunnable
{
/// <summary>
/// This method has to be implemented in order that starting of the thread causes the object's
/// run method to be called in that separately executing thread.
/// </summary>
void Run();
}
/*******************************/
/// <summary>
/// This interface will manage errors during the parsing of a XML document.
/// </summary>
public interface XmlSaxErrorHandler
{
/// <summary>
/// This method manage an error exception ocurred during the parsing process.
/// </summary>
/// <param name="exception">The exception thrown by the parser.</param>
void error(System.Xml.XmlException exception);
/// <summary>
/// This method manage a fatal error exception ocurred during the parsing process.
/// </summary>
/// <param name="exception">The exception thrown by the parser.</param>
void fatalError(System.Xml.XmlException exception);
/// <summary>
/// This method manage a warning exception ocurred during the parsing process.
/// </summary>
/// <param name="exception">The exception thrown by the parser.</param>
void warning(System.Xml.XmlException exception);
}
/*******************************/
/// <summary>
/// This class is used to encapsulate a source of Xml code in an single class.
/// </summary>
public class XmlSourceSupport
{
private System.IO.Stream bytes;
private System.IO.StreamReader characters;
private System.String uri;
/// <summary>
/// Constructs an empty XmlSourceSupport instance.
/// </summary>
public XmlSourceSupport()
{
bytes = null;
characters = null;
uri = null;
}
/// <summary>
/// Constructs a XmlSource instance with the specified source System.IO.Stream.
/// </summary>
/// <param name="stream">The stream containing the document.</param>
public XmlSourceSupport(System.IO.Stream stream)
{
bytes = stream;
characters = null;
uri = null;
}
/// <summary>
/// Constructs a XmlSource instance with the specified source System.IO.StreamReader.
/// </summary>
/// <param name="reader">The reader containing the document.</param>
public XmlSourceSupport(System.IO.StreamReader reader)
{
bytes = null;
characters = reader;
uri = null;
}
/// <summary>
/// Construct a XmlSource instance with the specified source Uri string.
/// </summary>
/// <param name="source">The source containing the document.</param>
public XmlSourceSupport(System.String source)
{
bytes = null;
characters = null;
uri = source;
}
/// <summary>
/// Represents the source Stream of the XmlSource.
/// </summary>
public System.IO.Stream Bytes
{
get
{
return bytes;
}
set
{
bytes = value;
}
}
/// <summary>
/// Represents the source StreamReader of the XmlSource.
/// </summary>
public System.IO.StreamReader Characters
{
get
{
return characters;
}
set
{
characters = value;
}
}
/// <summary>
/// Represents the source URI of the XmlSource.
/// </summary>
public System.String Uri
{
get
{
return uri;
}
set
{
uri = value;
}
}
}
/*******************************/
/// <summary>
/// Basic interface for resolving entities.
/// </summary>
public interface XmlSaxEntityResolver
{
/// <summary>
/// Allow the application to resolve external entities.
/// </summary>
/// <param name="publicId">The public identifier of the external entity being referenced, or null if none was supplied.</param>
/// <param name="systemId">The system identifier of the external entity being referenced.</param>
/// <returns>A XmlSourceSupport object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.</returns>
XmlSourceSupport resolveEntity(System.String publicId, System.String systemId);
}
/*******************************/
/// <summary>
/// This interface will manage the Content events of a XML document.
/// </summary>
public interface XmlSaxContentHandler
{
/// <summary>
/// This method manage the notification when Characters elements were found.
/// </summary>
/// <param name="ch">The array with the characters found.</param>
/// <param name="start">The index of the first position of the characters found.</param>
/// <param name="length">Specify how many characters must be read from the array.</param>
void characters(char[] ch, int start, int length);
/// <summary>
/// This method manage the notification when the end document node were found.
/// </summary>
void endDocument();
/// <summary>
/// This method manage the notification when the end element node was found.
/// </summary>
/// <param name="namespaceURI">The namespace URI of the element.</param>
/// <param name="localName">The local name of the element.</param>
/// <param name="qName">The long (qualified) name of the element.</param>
void endElement(System.String namespaceURI, System.String localName, System.String qName);
/// <summary>
/// This method manage the event when an area of expecific URI prefix was ended.
/// </summary>
/// <param name="prefix">The prefix that ends.</param>
void endPrefixMapping(System.String prefix);
/// <summary>
/// This method manage the event when a ignorable whitespace node was found.
/// </summary>
/// <param name="Ch">The array with the ignorable whitespaces.</param>
/// <param name="Start">The index in the array with the ignorable whitespace.</param>
/// <param name="Length">The length of the whitespaces.</param>
void ignorableWhitespace(char[] Ch, int Start, int Length);
/// <summary>
/// This method manage the event when a processing instruction was found.
/// </summary>
/// <param name="target">The processing instruction target.</param>
/// <param name="data">The processing instruction data.</param>
void processingInstruction(System.String target, System.String data);
/// <summary>
/// This method is not supported, it is included for compatibility.
/// </summary>
void setDocumentLocator(XmlSaxLocator locator);
/// <summary>
/// This method manage the event when a skipped entity was found.
/// </summary>
/// <param name="name">The name of the skipped entity.</param>
void skippedEntity(System.String name);
/// <summary>
/// This method manage the event when a start document node was found.
/// </summary>
void startDocument();
/// <summary>
/// This method manage the event when a start element node was found.
/// </summary>
/// <param name="namespaceURI">The namespace uri of the element tag.</param>
/// <param name="localName">The local name of the element.</param>
/// <param name="qName">The long (qualified) name of the element.</param>
/// <param name="atts">The list of attributes of the element.</param>
void startElement(System.String namespaceURI, System.String localName, System.String qName, SaxAttributesSupport atts);
/// <summary>
/// This methods indicates the start of a prefix area in the XML document.
/// </summary>
/// <param name="prefix">The prefix of the area.</param>
/// <param name="uri">The namespace URI of the prefix area.</param>
void startPrefixMapping(System.String prefix, System.String uri);
}
/*******************************/
/// <summary>
/// This interface is created to emulate the SAX Locator interface behavior.
/// </summary>
public interface XmlSaxLocator
{
/// <summary>
/// This method return the column number where the current document event ends.
/// </summary>
/// <returns>The column number where the current document event ends.</returns>
int getColumnNumber();
/// <summary>
/// This method return the line number where the current document event ends.
/// </summary>
/// <returns>The line number where the current document event ends.</returns>
int getLineNumber();
/// <summary>
/// This method is not supported, it is included for compatibility.
/// </summary>
/// <returns>The saved public identifier.</returns>
System.String getPublicId();
/// <summary>
/// This method is not supported, it is included for compatibility.
/// </summary>
/// <returns>The saved system identifier.</returns>
System.String getSystemId();
}
/*******************************/
/// <summary>
/// This class is created for emulates the SAX LocatorImpl behaviors.
/// </summary>
public class XmlSaxLocatorImpl : XmlSaxLocator
{
/// <summary>
/// This method returns a new instance of 'XmlSaxLocatorImpl'.
/// </summary>
/// <returns>A new 'XmlSaxLocatorImpl' instance.</returns>
public XmlSaxLocatorImpl()
{
}
/// <summary>
/// This method returns a new instance of 'XmlSaxLocatorImpl'.
/// Create a persistent copy of the current state of a locator.
/// </summary>
/// <param name="locator">The current state of a locator.</param>
/// <returns>A new 'XmlSaxLocatorImpl' instance.</returns>
public XmlSaxLocatorImpl(XmlSaxLocator locator)
{
setPublicId(locator.getPublicId());
setSystemId(locator.getSystemId());
setLineNumber(locator.getLineNumber());
setColumnNumber(locator.getColumnNumber());
}
/// <summary>
/// This method is not supported, it is included for compatibility.
/// Return the saved public identifier.
/// </summary>
/// <returns>The saved public identifier.</returns>
public virtual System.String getPublicId()
{
return publicId;
}
/// <summary>
/// This method is not supported, it is included for compatibility.
/// Return the saved system identifier.
/// </summary>
/// <returns>The saved system identifier.</returns>
public virtual System.String getSystemId()
{
return systemId;
}
/// <summary>
/// Return the saved line number.
/// </summary>
/// <returns>The saved line number.</returns>
public virtual int getLineNumber()
{
return lineNumber;
}
/// <summary>
/// Return the saved column number.
/// </summary>
/// <returns>The saved column number.</returns>
public virtual int getColumnNumber()
{
return columnNumber;
}
/// <summary>
/// This method is not supported, it is included for compatibility.
/// Set the public identifier for this locator.
/// </summary>
/// <param name="publicId">The new public identifier.</param>
public virtual void setPublicId(System.String publicId)
{
this.publicId = publicId;
}
/// <summary>
/// This method is not supported, it is included for compatibility.
/// Set the system identifier for this locator.
/// </summary>
/// <param name="systemId">The new system identifier.</param>
public virtual void setSystemId(System.String systemId)
{
this.systemId = systemId;
}
/// <summary>
/// Set the line number for this locator.
/// </summary>
/// <param name="lineNumber">The line number.</param>
public virtual void setLineNumber(int lineNumber)
{
this.lineNumber = lineNumber;
}
/// <summary>
/// Set the column number for this locator.
/// </summary>
/// <param name="columnNumber">The column number.</param>
public virtual void setColumnNumber(int columnNumber)
{
this.columnNumber = columnNumber;
}
// Internal state.
private System.String publicId;
private System.String systemId;
private int lineNumber;
private int columnNumber;
}
/*******************************/
/// <summary>
/// This interface will manage the Content events of a XML document.
/// </summary>
public interface XmlSaxLexicalHandler
{
/// <summary>
/// This method manage the notification when Characters elements were found.
/// </summary>
/// <param name="ch">The array with the characters found.</param>
/// <param name="start">The index of the first position of the characters found.</param>
/// <param name="length">Specify how many characters must be read from the array.</param>
void comment(char[] ch, int start, int length);
/// <summary>
/// This method manage the notification when the end of a CDATA section were found.
/// </summary>
void endCDATA();
/// <summary>
/// This method manage the notification when the end of DTD declarations were found.
/// </summary>
void endDTD();
/// <summary>
/// This method report the end of an entity.
/// </summary>
/// <param name="name">The name of the entity that is ending.</param>
void endEntity(System.String name);
/// <summary>
/// This method manage the notification when the start of a CDATA section were found.
/// </summary>
void startCDATA();
/// <summary>
/// This method manage the notification when the start of DTD declarations were found.
/// </summary>
/// <param name="name">The name of the DTD entity.</param>
/// <param name="publicId">The public identifier.</param>
/// <param name="systemId">The system identifier.</param>
void startDTD(System.String name, System.String publicId, System.String systemId);
/// <summary>
/// This method report the start of an entity.
/// </summary>
/// <param name="name">The name of the entity that is ending.</param>
void startEntity(System.String name);
}
/*******************************/
/// <summary>
/// This class will manage all the parsing operations emulating the SAX parser behavior
/// </summary>
public class SaxAttributesSupport
{
private System.Collections.ArrayList MainList;
/// <summary>
/// Builds a new instance of SaxAttributesSupport.
/// </summary>
public SaxAttributesSupport()
{
MainList = new System.Collections.ArrayList();
}
/// <summary>
/// Creates a new instance of SaxAttributesSupport from an ArrayList of Att_Instance class.
/// </summary>
/// <param name="arrayList">An ArraList of Att_Instance class instances.</param>
/// <returns>A new instance of SaxAttributesSupport</returns>
public SaxAttributesSupport(SaxAttributesSupport List)
{
SaxAttributesSupport temp = new SaxAttributesSupport();
temp.MainList = (System.Collections.ArrayList) List.MainList.Clone();
}
/// <summary>
/// Adds a new attribute elment to the given SaxAttributesSupport instance.
/// </summary>
/// <param name="Uri">The Uri of the attribute to be added.</param>
/// <param name="Lname">The Local name of the attribute to be added.</param>
/// <param name="Qname">The Long(qualify) name of the attribute to be added.</param>
/// <param name="Type">The type of the attribute to be added.</param>
/// <param name="Value">The value of the attribute to be added.</param>
public virtual void Add(System.String Uri, System.String Lname, System.String Qname, System.String Type, System.String Value)
{
Att_Instance temp_Attributes = new Att_Instance(Uri, Lname, Qname, Type, Value);
MainList.Add(temp_Attributes);
}
/// <summary>
/// Clears the list of attributes in the given AttributesSupport instance.
/// </summary>
public virtual void Clear()
{
MainList.Clear();
}
/// <summary>
/// Obtains the index of an attribute of the AttributeSupport from its qualified (long) name.
/// </summary>
/// <param name="Qname">The qualified name of the attribute to search.</param>
/// <returns>An zero-based index of the attribute if it is found, otherwise it returns -1.</returns>
public virtual int GetIndex(System.String Qname)
{
int index = GetLength() - 1;
while ((index >= 0) && !(((Att_Instance) (MainList[index])).att_fullName.Equals(Qname)))
index--;
if (index >= 0)
return index;
else
return -1;
}
/// <summary>
/// Obtains the index of an attribute of the AttributeSupport from its namespace URI and its localname.
/// </summary>
/// <param name="Uri">The namespace URI of the attribute to search.</param>
/// <param name="Lname">The local name of the attribute to search.</param>
/// <returns>An zero-based index of the attribute if it is found, otherwise it returns -1.</returns>
public virtual int GetIndex(System.String Uri, System.String Lname)
{
int index = GetLength() - 1;
while ((index >= 0) && !(((Att_Instance) (MainList[index])).att_localName.Equals(Lname) && ((Att_Instance)(MainList[index])).att_URI.Equals(Uri)))
index--;
if (index >= 0)
return index;
else
return -1;
}
/// <summary>
/// Returns the number of attributes saved in the SaxAttributesSupport instance.
/// </summary>
/// <returns>The number of elements in the given SaxAttributesSupport instance.</returns>
public virtual int GetLength()
{
return MainList.Count;
}
/// <summary>
/// Returns the local name of the attribute in the given SaxAttributesSupport instance that indicates the given index.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <returns>The local name of the attribute indicated by the index or null if the index is out of bounds.</returns>
public virtual System.String GetLocalName(int index)
{
try
{
return ((Att_Instance) MainList[index]).att_localName;
}
catch (System.ArgumentOutOfRangeException)
{
return "";
}
}
/// <summary>
/// Returns the qualified name of the attribute in the given SaxAttributesSupport instance that indicates the given index.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <returns>The qualified name of the attribute indicated by the index or null if the index is out of bounds.</returns>
public virtual System.String GetFullName(int index)
{
try
{
return ((Att_Instance) MainList[index]).att_fullName;
}
catch (System.ArgumentOutOfRangeException)
{
return "";
}
}
/// <summary>
/// Returns the type of the attribute in the given SaxAttributesSupport instance that indicates the given index.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <returns>The type of the attribute indicated by the index or null if the index is out of bounds.</returns>
public virtual System.String GetType(int index)
{
try
{
return ((Att_Instance) MainList[index]).att_type;
}
catch(System.ArgumentOutOfRangeException)
{
return "";
}
}
/// <summary>
/// Returns the namespace URI of the attribute in the given SaxAttributesSupport instance that indicates the given index.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <returns>The namespace URI of the attribute indicated by the index or null if the index is out of bounds.</returns>
public virtual System.String GetURI(int index)
{
try
{
return ((Att_Instance) MainList[index]).att_URI;
}
catch(System.ArgumentOutOfRangeException)
{
return "";
}
}
/// <summary>
/// Returns the value of the attribute in the given SaxAttributesSupport instance that indicates the given index.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <returns>The value of the attribute indicated by the index or null if the index is out of bounds.</returns>
public virtual System.String GetValue(int index)
{
try
{
return ((Att_Instance) MainList[index]).att_value;
}
catch(System.ArgumentOutOfRangeException)
{
return "";
}
}
/// <summary>
/// Modifies the local name of the attribute in the given SaxAttributesSupport instance.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <param name="LocalName">The new Local name for the attribute.</param>
public virtual void SetLocalName(int index, System.String LocalName)
{
((Att_Instance) MainList[index]).att_localName = LocalName;
}
/// <summary>
/// Modifies the qualified name of the attribute in the given SaxAttributesSupport instance.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <param name="FullName">The new qualified name for the attribute.</param>
public virtual void SetFullName(int index, System.String FullName)
{
((Att_Instance) MainList[index]).att_fullName = FullName;
}
/// <summary>
/// Modifies the type of the attribute in the given SaxAttributesSupport instance.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <param name="Type">The new type for the attribute.</param>
public virtual void SetType(int index, System.String Type)
{
((Att_Instance) MainList[index]).att_type = Type;
}
/// <summary>
/// Modifies the namespace URI of the attribute in the given SaxAttributesSupport instance.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <param name="URI">The new namespace URI for the attribute.</param>
public virtual void SetURI(int index, System.String URI)
{
((Att_Instance) MainList[index]).att_URI = URI;
}
/// <summary>
/// Modifies the value of the attribute in the given SaxAttributesSupport instance.
/// </summary>
/// <param name="index">The attribute index.</param>
/// <param name="Value">The new value for the attribute.</param>
public virtual void SetValue(int index, System.String Value)
{
((Att_Instance) MainList[index]).att_value = Value;
}
/// <summary>
/// This method eliminates the Att_Instance instance at the specified index.
/// </summary>
/// <param name="index">The index of the attribute.</param>
public virtual void RemoveAttribute(int index)
{
try
{
MainList.RemoveAt(index);
}
catch(System.ArgumentOutOfRangeException)
{
throw new System.IndexOutOfRangeException("The index is out of range");
}
}
/// <summary>
/// This method eliminates the Att_Instance instance in the specified index.
/// </summary>
/// <param name="indexName">The index name of the attribute.</param>
public virtual void RemoveAttribute(System.String indexName)
{
try
{
int pos = GetLength() - 1;
while ((pos >= 0) && !(((Att_Instance) (MainList[pos])).att_localName.Equals(indexName)))
pos--;
if (pos >= 0)
MainList.RemoveAt(pos);
}
catch(System.ArgumentOutOfRangeException)
{
throw new System.IndexOutOfRangeException("The index is out of range");
}
}
/// <summary>
/// Replaces an Att_Instance in the given SaxAttributesSupport instance.
/// </summary>
/// <param name="index">The index of the attribute.</param>
/// <param name="Uri">The namespace URI of the new Att_Instance.</param>
/// <param name="Lname">The local name of the new Att_Instance.</param>
/// <param name="Qname">The namespace URI of the new Att_Instance.</param>
/// <param name="Type">The type of the new Att_Instance.</param>
/// <param name="Value">The value of the new Att_Instance.</param>
public virtual void SetAttribute(int index, System.String Uri, System.String Lname, System.String Qname, System.String Type, System.String Value)
{
MainList[index] = new Att_Instance(Uri, Lname, Qname, Type, Value);
}
/// <summary>
/// Replaces all the list of Att_Instance of the given SaxAttributesSupport instance.
/// </summary>
/// <param name="Source">The source SaxAttributesSupport instance.</param>
public virtual void SetAttributes(SaxAttributesSupport Source)
{
MainList = Source.MainList;
}
/// <summary>
/// Returns the type of the Attribute that match with the given qualified name.
/// </summary>
/// <param name="Qname">The qualified name of the attribute to search.</param>
/// <returns>The type of the attribute if it exist otherwise returns null.</returns>
public virtual System.String GetType(System.String Qname)
{
int temp_Index = GetIndex(Qname);
if (temp_Index != -1)
return ((Att_Instance) MainList[temp_Index]).att_type;
else
return "";
}
/// <summary>
/// Returns the type of the Attribute that match with the given namespace URI and local name.
/// </summary>
/// <param name="Uri">The namespace URI of the attribute to search.</param>
/// <param name="Lname">The local name of the attribute to search.</param>
/// <returns>The type of the attribute if it exist otherwise returns null.</returns>
public virtual System.String GetType(System.String Uri, System.String Lname)
{
int temp_Index = GetIndex(Uri, Lname);
if (temp_Index != -1)
return ((Att_Instance) MainList[temp_Index]).att_type;
else
return "";
}
/// <summary>
/// Returns the value of the Attribute that match with the given qualified name.
/// </summary>
/// <param name="Qname">The qualified name of the attribute to search.</param>
/// <returns>The value of the attribute if it exist otherwise returns null.</returns>
public virtual System.String GetValue(System.String Qname)
{
int temp_Index = GetIndex(Qname);
if (temp_Index != -1)
return ((Att_Instance) MainList[temp_Index]).att_value;
else
return "";
}
/// <summary>
/// Returns the value of the Attribute that match with the given namespace URI and local name.
/// </summary>
/// <param name="Uri">The namespace URI of the attribute to search.</param>
/// <param name="Lname">The local name of the attribute to search.</param>
/// <returns>The value of the attribute if it exist otherwise returns null.</returns>
public virtual System.String GetValue(System.String Uri, System.String Lname)
{
int temp_Index = GetIndex(Uri, Lname);
if (temp_Index != -1)
return ((Att_Instance) MainList[temp_Index]).att_value;
else
return "";
}
/*******************************/
/// <summary>
/// This class is created to save the information of each attributes in the SaxAttributesSupport.
/// </summary>
public class Att_Instance
{
public System.String att_URI;
public System.String att_localName;
public System.String att_fullName;
public System.String att_type;
public System.String att_value;
/// <summary>
/// This is the constructor of the Att_Instance
/// </summary>
/// <param name="Uri">The namespace URI of the attribute</param>
/// <param name="Lname">The local name of the attribute</param>
/// <param name="Qname">The long(Qualify) name of attribute</param>
/// <param name="Type">The type of the attribute</param>
/// <param name="Value">The value of the attribute</param>
public Att_Instance(System.String Uri, System.String Lname, System.String Qname, System.String Type, System.String Value)
{
this.att_URI = Uri;
this.att_localName = Lname;
this.att_fullName = Qname;
this.att_type = Type;
this.att_value = Value;
}
}
}
/*******************************/
/// <summary>
/// This exception is thrown by the XmlSaxDocumentManager in the SetProperty and SetFeature
/// methods if a property or method couldn't be found.
/// </summary>
public class ManagerNotRecognizedException : System.Exception
{
/// <summary>
/// Creates a new ManagerNotRecognizedException with the message specified.
/// </summary>
/// <param name="Message">Error message of the exception.</param>
public ManagerNotRecognizedException(System.String Message) : base(Message)
{
}
}
/*******************************/
/// <summary>
/// This exception is thrown by the XmlSaxDocumentManager in the SetProperty and SetFeature methods
/// if a property or method couldn't be supported.
/// </summary>
public class ManagerNotSupportedException : System.Exception
{
/// <summary>
/// Creates a new ManagerNotSupportedException with the message specified.
/// </summary>
/// <param name="Message">Error message of the exception.</param>
public ManagerNotSupportedException(System.String Message) : base(Message)
{
}
}
/*******************************/
/// <summary>
/// This class provides the base implementation for the management of XML documents parsing.
/// </summary>
public class XmlSaxDefaultHandler : XmlSaxContentHandler, XmlSaxErrorHandler, XmlSaxEntityResolver
{
/// <summary>
/// This method manage the notification when Characters element were found.
/// </summary>
/// <param name="ch">The array with the characters founds</param>
/// <param name="start">The index of the first position of the characters found</param>
/// <param name="length">Specify how many characters must be read from the array</param>
public virtual void characters(char[] ch, int start, int length)
{
}
/// <summary>
/// This method manage the notification when the end document node were found
/// </summary>
public virtual void endDocument()
{
}
/// <summary>
/// This method manage the notification when the end element node were found
/// </summary>
/// <param name="namespaceURI">The namespace URI of the element</param>
/// <param name="localName">The local name of the element</param>
/// <param name="qName">The long name (qualify name) of the element</param>
public virtual void endElement(System.String uri, System.String localName, System.String qName)
{
}
/// <summary>
/// This method manage the event when an area of expecific URI prefix was ended.
/// </summary>
/// <param name="prefix">The prefix that ends</param>
public virtual void endPrefixMapping(System.String prefix)
{
}
/// <summary>
/// This method manage when an error exception ocurrs in the parsing process
/// </summary>
/// <param name="exception">The exception throws by the parser</param>
public virtual void error(System.Xml.XmlException e)
{
}
/// <summary>
/// This method manage when a fatal error exception ocurrs in the parsing process
/// </summary>
/// <param name="exception">The exception Throws by the parser</param>
public virtual void fatalError(System.Xml.XmlException e)
{
}
/// <summary>
/// This method manage the event when a ignorable whitespace node were found
/// </summary>
/// <param name="Ch">The array with the ignorable whitespaces</param>
/// <param name="Start">The index in the array with the ignorable whitespace</param>
/// <param name="Length">The length of the whitespaces</param>
public virtual void ignorableWhitespace(char[] ch, int start, int length)
{
}
/// <summary>
/// This method is not supported only is created for compatibility
/// </summary>
public virtual void notationDecl(System.String name, System.String publicId, System.String systemId)
{
}
/// <summary>
/// This method manage the event when a processing instruction were found
/// </summary>
/// <param name="target">The processing instruction target</param>
/// <param name="data">The processing instruction data</param>
public virtual void processingInstruction(System.String target, System.String data)
{
}
/// <summary>
/// Allow the application to resolve external entities.
/// </summary>
/// <param name="publicId">The public identifier of the external entity being referenced, or null if none was supplied.</param>
/// <param name="systemId">The system identifier of the external entity being referenced.</param>
/// <returns>A XmlSourceSupport object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.</returns>
public virtual XmlSourceSupport resolveEntity(System.String publicId, System.String systemId)
{
return null;
}
/// <summary>
/// This method is not supported, is include for compatibility
/// </summary>
public virtual void setDocumentLocator(XmlSaxLocator locator)
{
}
/// <summary>
/// This method manage the event when a skipped entity were found
/// </summary>
/// <param name="name">The name of the skipped entity</param>
public virtual void skippedEntity(System.String name)
{
}
/// <summary>
/// This method manage the event when a start document node were found
/// </summary>
public virtual void startDocument()
{
}
/// <summary>
/// This method manage the event when a start element node were found
/// </summary>
/// <param name="namespaceURI">The namespace uri of the element tag</param>
/// <param name="localName">The local name of the element</param>
/// <param name="qName">The Qualify (long) name of the element</param>
/// <param name="atts">The list of attributes of the element</param>
public virtual void startElement(System.String uri, System.String localName, System.String qName, SaxAttributesSupport attributes)
{
}
/// <summary>
/// This methods indicates the start of a prefix area in the XML document.
/// </summary>
/// <param name="prefix">The prefix of the area</param>
/// <param name="uri">The namespace uri of the prefix area</param>
public virtual void startPrefixMapping(System.String prefix, System.String uri)
{
}
/// <summary>
/// This method is not supported only is created for compatibility
/// </summary>
public virtual void unparsedEntityDecl(System.String name, System.String publicId, System.String systemId, System.String notationName)
{
}
/// <summary>
/// This method manage when a warning exception ocurrs in the parsing process
/// </summary>
/// <param name="exception">The exception Throws by the parser</param>
public virtual void warning(System.Xml.XmlException e)
{
}
}
/*******************************/
/// <summary>
/// This class provides the base implementation for the management of XML documents parsing.
/// </summary>
public class XmlSaxParserAdapter : XmlSAXDocumentManager, XmlSaxContentHandler