SaveToXml() 공개 메소드

Generates an XML representation of the add-in description
public SaveToXml ( ) : XmlDocument
리턴 System.Xml.XmlDocument
		public static void SaveFormatted (AddinDescription adesc)
		{
			XmlDocument doc = adesc.SaveToXml ();
			XmlFormatter formatter = new XmlFormatter ();
			
			TextStylePolicy textPolicy = new TextStylePolicy (80, 4, false, false, true, EolMarker.Unix);
			XmlFormattingPolicy xmlPolicy = new XmlFormattingPolicy ();
			
			XmlFormatingSettings f = new XmlFormatingSettings ();
			f.ScopeXPath.Add ("*/*");
			f.EmptyLinesBeforeStart = 1;
			f.EmptyLinesAfterEnd = 1;
			xmlPolicy.Formats.Add (f);
			
			f = new XmlFormatingSettings ();
			f.ScopeXPath.Add ("Addin");
			f.AttributesInNewLine = true;
			f.AlignAttributes = true;
			f.AttributesInNewLine = false;
			xmlPolicy.Formats.Add (f);
				
			string xml = formatter.FormatXml (textPolicy, xmlPolicy, doc.OuterXml);
			File.WriteAllText (adesc.FileName, xml);
		}
예제 #2
0
		public static string SaveFormattedXml (PolicyContainer policies, AddinDescription adesc)
		{
			XmlDocument doc = adesc.SaveToXml ();
			
			TextStylePolicy textPolicy = policies.Get<TextStylePolicy> (DesktopService.GetMimeTypeInheritanceChain ("application/x-addin+xml"));
			XmlFormattingPolicy xmlPolicy = policies.Get<XmlFormattingPolicy> (DesktopService.GetMimeTypeInheritanceChain ("application/x-addin+xml"));
			
			return XmlFormatter.FormatXml (textPolicy, xmlPolicy, doc.OuterXml);
		}