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