9aea425a735756cc0d81906c657136bdd8cc6c91
[mono.git] / mcs / class / referencesource / System.Web.Extensions / Compilation / WCFModel / MetadataFile.cs
1 #region Copyright (c) Microsoft Corporation
2 /// <copyright company='Microsoft Corporation'>
3 ///    Copyright (c) Microsoft Corporation. All Rights Reserved.
4 ///    Information Contained Herein is Proprietary and Confidential.
5 /// </copyright>
6 #endregion
7
8 using System;
9 using System.Diagnostics;
10 using System.IO;
11 using System.Xml;
12 using System.Xml.Schema;
13 using Discovery = System.Web.Services.Discovery;
14 using Description = System.Web.Services.Description;
15 using MetadataSection = System.ServiceModel.Description.MetadataSection;
16 using XmlSerialization = System.Xml.Serialization;
17
18 #if WEB_EXTENSIONS_CODE
19 using System.Web.Resources;
20 #else
21 using Microsoft.VSDesigner.WCF.Resources;
22 #endif
23
24 #if WEB_EXTENSIONS_CODE
25 namespace System.Web.Compilation.WCFModel
26 #else
27 namespace Microsoft.VSDesigner.WCFModel
28 #endif
29 {
30     /// <summary>
31     /// This class presents a single metadata file in the ReferenceGroup
32     /// </summary>
33     /// <remarks></remarks>
34 #if WEB_EXTENSIONS_CODE
35     internal class MetadataFile : ExternalFile
36 #else
37     [CLSCompliant(true)]
38     public class MetadataFile : ExternalFile
39 #endif
40     {
41
42         // Default File Name
43         public const string DEFAULT_FILE_NAME = "service";
44
45         private MetadataType m_MetadataType;
46         private string m_SourceUrl;
47
48         // A GUID string
49         private string m_ID;
50
51         private int m_SourceId;
52
53         // properties to merge metadata
54         private bool m_Ignore;
55         private bool m_IsMergeResult;
56
57         private int SOURCE_ID_NOT_SPECIFIED = 0;
58
59         private MetadataContent m_CachedMetadata;
60
61         // Content of the metadata file, one of them must be
62         private byte[] m_BinaryContent;
63
64         /// <summary>
65         /// Constructor
66         /// </summary>
67         /// <remarks> Must support a default construct for XmlSerializer</remarks>
68         public MetadataFile()
69         {
70             m_ID = Guid.NewGuid().ToString();
71             m_BinaryContent = new byte[] { };
72         }
73
74
75         /// <summary>
76         /// Constructor
77         /// </summary>
78         /// <param name="Name">File Name</param>
79         /// <param name="Url">SourceUrl</param>
80         /// <param name="Content">File Content</param>
81         /// <remarks></remarks>
82         public MetadataFile(string name, string url, string content)
83             : base(name)
84         {
85             m_ID = Guid.NewGuid().ToString();
86
87             m_SourceUrl = url;
88
89             if (content == null)
90             {
91                 throw new ArgumentNullException("content");
92             }
93
94             LoadContent(content);
95         }
96
97         /// <summary>
98         /// Constructor
99         /// </summary>
100         /// <param name="Name">File Name</param>
101         /// <param name="Url">SourceUrl</param>
102         /// <param name="byteContent">File Content</param>
103         /// <remarks></remarks>
104         public MetadataFile(string name, string url, byte[] byteContent)
105             : base(name)
106         {
107             m_ID = Guid.NewGuid().ToString();
108
109             m_SourceUrl = url;
110
111             if (byteContent == null)
112             {
113                 throw new ArgumentNullException("byteContent");
114             }
115
116             LoadContent(byteContent);
117         }
118
119         /// <summary>
120         /// Retrieves the file content in binary format
121         /// </summary>
122         /// <value></value>
123         /// <remarks></remarks>
124         public byte[] BinaryContent
125         {
126             get
127             {
128                 return m_BinaryContent;
129             }
130         }
131
132         /// <summary>
133         /// Cached state
134         /// </summary>
135         /// <value></value>
136         /// <remarks></remarks>
137         private MetadataContent CachedMetadata
138         {
139             get
140             {
141                 if (m_CachedMetadata == null)
142                 {
143                     m_CachedMetadata = LoadMetadataContent(m_MetadataType);
144                 }
145                 return m_CachedMetadata;
146             }
147         }
148
149
150         /// <summary>
151         /// Retrieves the file content
152         /// </summary>
153         /// <value></value>
154         /// <remarks></remarks>
155         public string Content
156         {
157             get
158             {
159                 StreamReader memReader = new StreamReader(new MemoryStream(m_BinaryContent));
160                 return memReader.ReadToEnd();
161             }
162         }
163
164         /// <summary>
165         /// The Type of Metadata
166         /// </summary>
167         /// <value></value>
168         /// <remarks></remarks>
169         [XmlSerialization.XmlAttribute("MetadataType")]
170         public MetadataType FileType
171         {
172             get
173             {
174                 return m_MetadataType;
175             }
176             set
177             {
178                 m_MetadataType = value;
179             }
180         }
181
182         /// <summary>
183         ///  GUID string, it is used to track a metadata item (when it is updated)
184         /// </summary>
185         /// <value></value>
186         /// <remarks></remarks>
187         [XmlSerialization.XmlAttribute()]
188         public string ID
189         {
190             get
191             {
192                 return m_ID;
193             }
194             set
195             {
196                 m_ID = value;
197             }
198         }
199
200         /// <summary>
201         /// If it is true, the metadata file will be ignored by the code generator
202         /// </summary>
203         /// <value></value>
204         /// <remarks></remarks>
205         [XmlSerialization.XmlAttribute()]
206         public bool Ignore
207         {
208             get
209             {
210                 return m_Ignore;
211             }
212             set
213             {
214                 m_Ignore = value;
215             }
216         }
217
218         /// <summary>
219         /// A special attribute used by XmlSerializer to decide whether Ignore attribute exists
220         /// </summary>
221         /// <value></value>
222         /// <remarks></remarks>
223         [XmlSerialization.XmlIgnore()]
224         public bool IgnoreSpecified
225         {
226             get
227             {
228                 return m_Ignore;
229             }
230             set
231             {
232                 if (!value)
233                 {
234                     m_Ignore = false;
235                 }
236             }
237         }
238
239         /// <summary>
240         /// whether the metadata file is a result of merging
241         /// </summary>
242         /// <value></value>
243         /// <remarks></remarks>
244         [XmlSerialization.XmlAttribute()]
245         public bool IsMergeResult
246         {
247             get
248             {
249                 return m_IsMergeResult;
250             }
251             set
252             {
253                 m_IsMergeResult = value;
254             }
255         }
256
257         /// <summary>
258         /// A special attribute used by XmlSerializer to decide whether IsMergeResult attribute exists
259         /// </summary>
260         /// <value></value>
261         /// <remarks></remarks>
262         [XmlSerialization.XmlIgnore()]
263         public bool IsMergeResultSpecified
264         {
265             get
266             {
267                 return m_IsMergeResult;
268             }
269             set
270             {
271                 if (!value)
272                 {
273                     m_IsMergeResult = false;
274                 }
275             }
276         }
277
278         /// <summary>
279         /// Retrieves the content of a discovery file
280         /// </summary>
281         /// <value></value>
282         /// <remarks></remarks>
283         public Discovery.DiscoveryDocument MetadataDiscoveryDocument
284         {
285             get
286             {
287                 return CachedMetadata.MetadataDiscoveryDocument;
288             }
289         }
290
291         /// <summary>
292         /// format error
293         /// </summary>
294         /// <value></value>
295         /// <remarks></remarks>
296         [XmlSerialization.XmlIgnore()]
297         public Exception MetadataFormatError
298         {
299             get
300             {
301                 return CachedMetadata.MetadataFormatError;
302             }
303         }
304
305         /// <summary>
306         /// Retrieves the content of a WSDL file
307         /// </summary>
308         /// <value></value>
309         /// <remarks></remarks>
310         public Description.ServiceDescription MetadataServiceDescription
311         {
312             get
313             {
314                 return CachedMetadata.MetadataServiceDescription;
315             }
316         }
317
318         /// <summary>
319         /// Retrieves the content of a schema file
320         /// </summary>
321         /// <value></value>
322         /// <remarks></remarks>
323         public XmlSchema MetadataXmlSchema
324         {
325             get
326             {
327                 return CachedMetadata.MetadataXmlSchema;
328             }
329         }
330
331         /// <summary>
332         /// Retrieves the content of an Xml file
333         /// </summary>
334         /// <value></value>
335         /// <remarks></remarks>
336         public XmlDocument MetadataXmlDocument
337         {
338             get
339             {
340                 return CachedMetadata.MetadataXmlDocument;
341             }
342         }
343
344         /// <summary>
345         /// the SourceId links the the SourceId in the MetadataSource table
346         /// </summary>
347         /// <value></value>
348         /// <remarks></remarks>
349         [XmlSerialization.XmlAttribute()]
350         public int SourceId
351         {
352             get
353             {
354                 return m_SourceId;
355             }
356             set
357             {
358                 if (value < 0)
359                 {
360                     Debug.Fail("Source ID shouldn't be a nagtive number");
361                     throw new ArgumentException(WCFModelStrings.ReferenceGroup_InvalidSourceId);
362                 }
363                 m_SourceId = value;
364             }
365         }
366
367         /// <summary>
368         /// A special attribute used by XmlSerializer to decide whether SourceId attribute exists
369         /// </summary>
370         /// <value></value>
371         /// <remarks></remarks>
372         [XmlSerialization.XmlIgnore()]
373         public bool SourceIdSpecified
374         {
375             get
376             {
377                 return m_SourceId != SOURCE_ID_NOT_SPECIFIED;
378             }
379             set
380             {
381                 if (!value)
382                 {
383                     m_SourceId = SOURCE_ID_NOT_SPECIFIED;
384                 }
385             }
386         }
387
388         /// <summary>
389         ///  The sourceUrl of the metadata file
390         /// </summary>
391         /// <value></value>
392         /// <remarks></remarks>
393         [XmlSerialization.XmlAttribute()]
394         public string SourceUrl
395         {
396             get
397             {
398                 return m_SourceUrl;
399             }
400             set
401             {
402                 m_SourceUrl = value;
403             }
404         }
405
406         /// <summary>
407         /// Retrieves the TargetNamespace when it is a schema item or a WSDL item
408         /// </summary>
409         /// <value></value>
410         /// <remarks></remarks>
411         public string TargetNamespace
412         {
413             get
414             {
415                 return CachedMetadata.TargetNamespace;
416             }
417         }
418
419         /// <summary>
420         /// Detemine the type of a metadata item
421         /// </summary>
422         /// <param name="reader"></param>
423         /// <returns>File Type</returns>
424         /// <remarks></remarks>
425         private MetadataType DetermineFileType(XmlReader reader)
426         {
427             try
428             {
429                 if (reader.IsStartElement(XmlStrings.WSDL.Elements.Root, XmlStrings.WSDL.NamespaceUri))
430                 {
431                     return MetadataType.Wsdl;
432                 }
433                 else if (reader.IsStartElement(XmlStrings.XmlSchema.Elements.Root, XmlStrings.XmlSchema.NamespaceUri))
434                 {
435                     return MetadataType.Schema;
436                 }
437                 else if (reader.IsStartElement(XmlStrings.WSPolicy.Elements.Policy, XmlStrings.WSPolicy.NamespaceUri)
438                          || reader.IsStartElement(XmlStrings.WSPolicy.Elements.Policy, XmlStrings.WSPolicy.NamespaceUri15))
439                 {
440                     return MetadataType.Policy;
441                 }
442                 else if (reader.IsStartElement(XmlStrings.DISCO.Elements.Root, XmlStrings.DISCO.NamespaceUri))
443                 {
444                     return MetadataType.Disco;
445                 }
446                 else if (reader.IsStartElement(XmlStrings.DataServices.Elements.Root, XmlStrings.DataServices.NamespaceUri))
447                 {
448                     return MetadataType.Edmx;
449                 }
450                 else
451                 {
452                     return MetadataType.Xml;
453                 }
454             }
455             catch (XmlException)
456             {
457                 // This must mean that the document isn't an XML Document so we continue trying other things...
458                 return MetadataType.Unknown;
459             }
460         }
461
462         /// <summary>
463         /// return the default extension
464         /// </summary>
465         /// <return></return>
466         /// <remarks></remarks>
467         public string GetDefaultExtension()
468         {
469             switch (m_MetadataType)
470             {
471                 case MetadataType.Disco:
472                     return "disco";
473                 case MetadataType.Wsdl:
474                     return "wsdl";
475                 case MetadataType.Schema:
476                     return "xsd";
477                 case MetadataType.Xml:
478                     return "xml";
479                 case MetadataType.Policy:
480                     return "xml";
481                 case MetadataType.Edmx:
482                     return "edmx";
483                 default:
484                     return "data";
485             }
486         }
487
488         /// <summary>
489         /// return the default filename without extension
490         /// </summary>
491         /// <return></return>
492         /// <remarks></remarks>
493         public string GetDefaultFileName()
494         {
495             if (!String.IsNullOrEmpty(TargetNamespace))
496             {
497                 string ns = TargetNamespace;
498                 if (!ns.EndsWith("/", StringComparison.Ordinal))
499                 {
500                     int i = ns.LastIndexOfAny(Path.GetInvalidFileNameChars());
501                     if (i >= 0)
502                     {
503                         ns = ns.Substring(i + 1);
504                     }
505
506                     string defaultExtension = "." + GetDefaultExtension();
507                     if (ns.Length > defaultExtension.Length && ns.EndsWith(defaultExtension, StringComparison.OrdinalIgnoreCase))
508                     {
509                         ns = ns.Substring(0, ns.Length - defaultExtension.Length);
510                     }
511
512                     if (ns.Length > 0)
513                     {
514                         return ns;
515                     }
516                 }
517             }
518
519             return DEFAULT_FILE_NAME;
520         }
521
522         /// <summary>
523         /// Load the content of a Metadata item into the object model
524         /// </summary>
525         /// <param name="byteContent"></param>
526         /// <remarks></remarks>
527         internal void LoadContent(byte[] byteContent)
528         {
529             m_BinaryContent = byteContent;
530             LoadContentFromTextReader(new StreamReader(new MemoryStream(byteContent)));
531         }
532
533         /// <summary>
534         /// Load the content of a Metadata item into the object model
535         /// </summary>
536         /// <param name="content"></param>
537         /// <remarks></remarks>
538         internal void LoadContent(string content)
539         {
540             MemoryStream memStream = new MemoryStream();
541             StreamWriter contentWriter = new StreamWriter(memStream);
542             contentWriter.Write(content);
543             contentWriter.Flush();
544             m_BinaryContent = memStream.ToArray();
545
546             LoadContentFromTextReader(new StringReader(content));
547         }
548
549         /// <summary>
550         /// Load the content of a Metadata item into the object model
551         /// </summary>
552         /// <param name="contentReader"></param>
553         /// <remarks></remarks>
554         private void LoadContentFromTextReader(TextReader contentReader)
555         {
556             if (contentReader == null)
557             {
558                 throw new ArgumentNullException("contentReader");
559             }
560
561             // reset...
562             ErrorInLoading = null;
563
564             m_CachedMetadata = null;
565
566             using (XmlTextReader xmlReader = new XmlTextReader(contentReader))
567             {
568                 if (m_MetadataType == MetadataType.Unknown)
569                 {
570                     // If we don't know the metedata type, we try to sniff it...
571                     MetadataType fileType = DetermineFileType(xmlReader);
572
573                     // try
574                     m_CachedMetadata = LoadMetadataContent(fileType, xmlReader);
575                     if (m_CachedMetadata.MetadataFormatError == null)
576                     {
577                         m_MetadataType = fileType;
578                     }
579                 }
580             }
581         }
582
583         /// <summary>
584         ///  the function is called when the metadata is removed, and we need clean up the content
585         /// </summary>
586         /// <remarks></remarks>
587         internal void CleanUpContent()
588         {
589             ErrorInLoading = null;
590             m_BinaryContent = new byte[] { };
591
592             m_CachedMetadata = null;
593         }
594
595         /// <summary>
596         /// Load schema/wsdl model from binary content.  -- Parse the metadata content 
597         /// </summary>
598         /// <return></return>
599         /// <remarks></remarks>
600         private MetadataContent LoadMetadataContent(MetadataType fileType)
601         {
602             if (ErrorInLoading != null)
603             {
604                 return new MetadataContent(ErrorInLoading);
605             }
606             using (XmlTextReader xmlReader = new XmlTextReader(new StreamReader(new MemoryStream(m_BinaryContent))))
607             {
608                 return LoadMetadataContent(fileType, xmlReader);
609             }
610         }
611
612         /// <summary>
613         /// Load schema/wsdl model from text reader.  -- it will parse the metadata content.
614         /// </summary>
615         /// <return></return>
616         /// <remarks></remarks>
617         private MetadataContent LoadMetadataContent(MetadataType fileType, XmlTextReader xmlReader)
618         {
619             MetadataContent cachedMetadata = new MetadataContent();
620
621             try
622             {
623                 switch (fileType)
624                 {
625                     case MetadataType.Disco:
626                         cachedMetadata = new MetadataContent(Discovery.DiscoveryDocument.Read(xmlReader));
627                         break;
628                     case MetadataType.Wsdl:
629                         cachedMetadata = new MetadataContent(Description.ServiceDescription.Read(xmlReader));
630                         cachedMetadata.MetadataServiceDescription.RetrievalUrl = GetMetadataSourceUrl();
631                         break;
632                     case MetadataType.Schema:
633                         cachedMetadata = new MetadataContent(XmlSchema.Read(xmlReader, null));
634                         cachedMetadata.MetadataXmlSchema.SourceUri = GetMetadataSourceUrl();
635                         break;
636                     case MetadataType.Unknown:
637                         // For unknown types, we don't do nothing...
638                         break;
639                     default:
640                         Debug.Assert(fileType == MetadataType.Xml || fileType == MetadataType.Policy || fileType == MetadataType.Edmx);
641                         XmlDocument tempDoc = new XmlDocument();
642                         tempDoc.Load(xmlReader);
643                         cachedMetadata = new MetadataContent(tempDoc);
644                         break;
645                 }
646             }
647             catch (Exception ex)
648             {
649                 cachedMetadata = new MetadataContent(ex);
650             }
651
652             return cachedMetadata;
653         }
654
655         /// <summary>
656         /// convert metadata file to MetadataSection (to feed code/proxy generator)
657         ///  We don't reuse the buffered object model, because the generator could modify & corrupt them.
658         /// </summary>
659         /// <remarks></remarks>
660         internal MetadataSection CreateMetadataSection()
661         {
662             MetadataContent metadata = LoadMetadataContent(m_MetadataType);
663             if (metadata.MetadataFormatError != null)
664             {
665                 throw metadata.MetadataFormatError;
666             }
667
668             MetadataSection metadataSection = null;
669
670             switch (FileType)
671             {
672                 case MetadataType.Unknown:
673                     break;
674                 case MetadataType.Disco:
675                     if (metadata.MetadataServiceDescription != null)
676                     {
677                         metadataSection = MetadataSection.CreateFromServiceDescription(metadata.MetadataServiceDescription);
678                     }
679                     break;
680                 case MetadataType.Wsdl:
681                     // We need to make a copy of the WSDL object model since the act of importing it actuall
682                     // modifies it, and we don't want the cached instance to be polluted...
683                     System.Web.Services.Description.ServiceDescription description = metadata.MetadataServiceDescription;
684                     if (description != null)
685                     {
686                         metadataSection = MetadataSection.CreateFromServiceDescription(description);
687                     }
688                     break;
689                 case MetadataType.Schema:
690                     if (metadata.MetadataXmlSchema != null)
691                     {
692                         metadataSection = MetadataSection.CreateFromSchema(metadata.MetadataXmlSchema);
693                     }
694                     break;
695                 case MetadataFile.MetadataType.Policy:
696                     if (metadata.MetadataXmlDocument != null)
697                     {
698                         metadataSection = MetadataSection.CreateFromPolicy(metadata.MetadataXmlDocument.DocumentElement, null);
699                     }
700                     break;
701                 case MetadataFile.MetadataType.Xml:
702                 case MetadataFile.MetadataType.Edmx:
703                     if (metadata.MetadataXmlDocument != null)
704                     {
705                         metadataSection = new MetadataSection(null, null, metadata.MetadataXmlDocument.DocumentElement);
706                     }
707                     break;
708                 default:
709                     System.Diagnostics.Debug.Fail("Unknown Type?");
710                     break;
711             }
712             return metadataSection;
713         }
714
715         /// <summary>
716         /// Metadata source Url is used in error messages
717         /// </summary>
718         /// <remarks></remarks>
719         internal string GetMetadataSourceUrl()
720         {
721             if (String.IsNullOrEmpty(SourceUrl))
722             {
723                 return FileName;
724             }
725             else
726             {
727                 return SourceUrl;
728             }
729         }
730
731         /// <summary>
732         /// Metadata File Type Enum
733         /// </summary>
734         /// <remarks></remarks>
735         public enum MetadataType
736         {
737             [XmlSerialization.XmlEnum(Name = "Unknown")]
738             Unknown = 0,
739             [XmlSerialization.XmlEnum(Name = "Disco")]
740             Disco = 1,
741             [XmlSerialization.XmlEnum(Name = "Wsdl")]
742             Wsdl = 2,
743             [XmlSerialization.XmlEnum(Name = "Schema")]
744             Schema = 3,
745             [XmlSerialization.XmlEnum(Name = "Policy")]
746             Policy = 4,
747             [XmlSerialization.XmlEnum(Name = "Xml")]
748             Xml = 5,
749             [XmlSerialization.XmlEnum(Name = "Edmx")]
750             Edmx = 6,
751         }
752
753         /// <summary>
754         /// Metadata contained inside the file. Only one of field is valid, which depends on the MetadataType
755         /// </summary>
756         /// <remarks></remarks>
757         private class MetadataContent
758         {
759
760             private Discovery.DiscoveryDocument m_MetadataDiscoveryDocument;
761             private Description.ServiceDescription m_MetadataServiceDescription;
762             private XmlSchema m_MetadataXmlSchema;
763             private XmlDocument m_MetadataXmlDocument;
764
765             private Exception m_MetadataFormatError;
766
767             private string m_TargetNamespace;
768
769             internal MetadataContent()
770             {
771                 m_TargetNamespace = String.Empty;
772             }
773
774             internal MetadataContent(Discovery.DiscoveryDocument discoveryDocument)
775             {
776                 m_MetadataDiscoveryDocument = discoveryDocument;
777                 m_TargetNamespace = String.Empty;
778             }
779
780             internal MetadataContent(Description.ServiceDescription serviceDescription)
781             {
782                 m_MetadataServiceDescription = serviceDescription;
783                 m_TargetNamespace = serviceDescription.TargetNamespace;
784             }
785
786             internal MetadataContent(XmlSchema schema)
787             {
788                 m_MetadataXmlSchema = schema;
789                 m_TargetNamespace = schema.TargetNamespace;
790             }
791
792             internal MetadataContent(XmlDocument document)
793             {
794                 m_MetadataXmlDocument = document;
795                 m_TargetNamespace = String.Empty;
796             }
797
798             internal MetadataContent(Exception metadataFormatError)
799             {
800                 m_MetadataFormatError = metadataFormatError;
801             }
802
803             /// <summary>
804             /// Retrieves the content of a discovery file
805             /// </summary>
806             /// <value></value>
807             /// <remarks></remarks>
808             public Discovery.DiscoveryDocument MetadataDiscoveryDocument
809             {
810                 get
811                 {
812                     return m_MetadataDiscoveryDocument;
813                 }
814             }
815
816             /// <summary>
817             /// Error message if 
818             /// </summary>
819             /// <value></value>
820             /// <remarks></remarks>
821             public Exception MetadataFormatError
822             {
823                 get
824                 {
825                     return m_MetadataFormatError;
826                 }
827             }
828
829             /// <summary>
830             /// Retrieves the content of a WSDL file
831             /// </summary>
832             /// <value></value>
833             /// <remarks></remarks>
834             public Description.ServiceDescription MetadataServiceDescription
835             {
836                 get
837                 {
838                     return m_MetadataServiceDescription;
839                 }
840             }
841
842             /// <summary>
843             /// Retrieves the content of a schema file
844             /// </summary>
845             /// <value></value>
846             /// <remarks></remarks>
847             public XmlSchema MetadataXmlSchema
848             {
849                 get
850                 {
851                     return m_MetadataXmlSchema;
852                 }
853             }
854
855             /// <summary>
856             /// Retrieves the content of an Xml file
857             /// </summary>
858             /// <value></value>
859             /// <remarks></remarks>
860             public XmlDocument MetadataXmlDocument
861             {
862                 get
863                 {
864                     return m_MetadataXmlDocument;
865                 }
866             }
867
868             /// <summary>
869             /// Retrieves the TargetNamespace when it is a schema item or a WSDL item
870             /// </summary>
871             /// <value></value>
872             /// <remarks></remarks>
873             public string TargetNamespace
874             {
875                 get
876                 {
877                     return m_TargetNamespace;
878                 }
879             }
880
881         }
882     }
883
884 }