From 0fb894761c44b817fcf50bb24c86143242ddbc8c Mon Sep 17 00:00:00 2001 From: Gert Driesen Date: Fri, 23 Dec 2005 16:05:05 +0000 Subject: * XslOutput.cs: Reduced indentation of cases in switch statement. svn path=/trunk/mcs/; revision=54781 --- mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog | 4 + mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs | 242 ++++++++++++------------- 2 files changed, 125 insertions(+), 121 deletions(-) (limited to 'mcs/class/System.XML') diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog index 4a6a3ddda58..1718b338f42 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog @@ -1,3 +1,7 @@ +2005-12-23 Gert Driesen + + * XslOutput.cs: Reduced indentation of cases in switch statement. + 2005-12-23 Gert Driesen * ScriptCompilerInfo.cs: Fixed line endings. diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs index f6522e8d8ff..744cf22716d 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs @@ -158,135 +158,135 @@ namespace Mono.Xml.Xsl string value = nav.Value; switch (nav.LocalName) { - case "cdata-section-elements": - if (value.Length > 0) { - cdSectsList.AddRange (XslNameUtil.FromListString (value, nav)); - } + case "cdata-section-elements": + if (value.Length > 0) { + cdSectsList.AddRange (XslNameUtil.FromListString (value, nav)); + } + break; + case "method": + if (value.Length == 0) { break; - case "method": - if (value.Length == 0) { - break; - } + } - switch (value) { - case "xml": - method = OutputMethod.XML; - break; - case "html": - omitXmlDeclaration = true; - if (indent == IndentType.NotSet) { - indent = IndentType.Yes; - } - method = OutputMethod.HTML; - break; - case "text": - omitXmlDeclaration = true; - method = OutputMethod.Text; - break; - default: - method = OutputMethod.Custom; - customMethod = XslNameUtil.FromString (value, nav); - if (customMethod.Namespace == String.Empty) { - IXmlLineInfo li = nav as IXmlLineInfo; - throw new XsltCompileException (new ArgumentException ( - "Invalid output method value: '" + value + "'. It" + - " must be either 'xml' or 'html' or 'text' or QName."), - nav.BaseURI, - li != null ? li.LineNumber : 0, - li != null ? li.LinePosition : 0); - } - break; - } - break; - case "version": - if (value.Length > 0) { - this.version = value; - } - break; - case "encoding": - if (value.Length > 0) { - try { - this.encoding = System.Text.Encoding.GetEncoding (value); - } catch (ArgumentException) { - // MS.NET just leaves the default encoding when encoding is unknown - } catch (NotSupportedException) { - // Workaround for a bug in System.Text, it throws invalid exception + switch (value) { + case "xml": + method = OutputMethod.XML; + break; + case "html": + omitXmlDeclaration = true; + if (indent == IndentType.NotSet) { + indent = IndentType.Yes; } - } - break; - case "standalone": - switch (value) { - case "yes": - this.standalone = StandaloneType.YES; - break; - case "no": - this.standalone = StandaloneType.NO; - break; - default: - IXmlLineInfo li = nav as IXmlLineInfo; - throw new XsltCompileException (new XsltException ( - "'" + value + "' is an invalid value for 'standalone'" + - " attribute.", (Exception) null), - nav.BaseURI, - li != null ? li.LineNumber : 0, - li != null ? li.LinePosition : 0); - } - break; - case "doctype-public": - this.doctypePublic = value; - break; - case "doctype-system": - this.doctypeSystem = value; - break; - case "media-type": - if (value.Length > 0) { - this.mediaType = value; - } - break; - case "omit-xml-declaration": - switch (value) { - case "yes": - this.omitXmlDeclaration = true; - break; - case "no": - this.omitXmlDeclaration = false; - break; - default: - IXmlLineInfo li = nav as IXmlLineInfo; - throw new XsltCompileException (new XsltException ( - "'" + value + "' is an invalid value for 'omit-xml-declaration'" + - " attribute.", (Exception) null), - nav.BaseURI, - li != null ? li.LineNumber : 0, - li != null ? li.LinePosition : 0); - } - break; - case "indent": - switch (value) { - case "yes": - this.indent = IndentType.Yes; - break; - case "no": - this.indent = IndentType.No; - break; - default: + method = OutputMethod.HTML; + break; + case "text": + omitXmlDeclaration = true; + method = OutputMethod.Text; + break; + default: + method = OutputMethod.Custom; + customMethod = XslNameUtil.FromString (value, nav); + if (customMethod.Namespace == String.Empty) { IXmlLineInfo li = nav as IXmlLineInfo; - throw new XsltCompileException (new XsltException ( - "'" + value + "' is an invalid value for 'indent'" + - " attribute.", (Exception) null), + throw new XsltCompileException (new ArgumentException ( + "Invalid output method value: '" + value + "'. It" + + " must be either 'xml' or 'html' or 'text' or QName."), nav.BaseURI, li != null ? li.LineNumber : 0, li != null ? li.LinePosition : 0); + } + break; + } + break; + case "version": + if (value.Length > 0) { + this.version = value; + } + break; + case "encoding": + if (value.Length > 0) { + try { + this.encoding = System.Text.Encoding.GetEncoding (value); + } catch (ArgumentException) { + // MS.NET just leaves the default encoding when encoding is unknown + } catch (NotSupportedException) { + // Workaround for a bug in System.Text, it throws invalid exception } - break; - default: - IXmlLineInfo li = nav as IXmlLineInfo; - throw new XsltCompileException (new XsltException ( - "'" + nav.LocalName + "' is an invalid attribute for 'output'" + - " element.", (Exception) null), - nav.BaseURI, - li != null ? li.LineNumber : 0, - li != null ? li.LinePosition : 0); + } + break; + case "standalone": + switch (value) { + case "yes": + this.standalone = StandaloneType.YES; + break; + case "no": + this.standalone = StandaloneType.NO; + break; + default: + IXmlLineInfo li = nav as IXmlLineInfo; + throw new XsltCompileException (new XsltException ( + "'" + value + "' is an invalid value for 'standalone'" + + " attribute.", (Exception) null), + nav.BaseURI, + li != null ? li.LineNumber : 0, + li != null ? li.LinePosition : 0); + } + break; + case "doctype-public": + this.doctypePublic = value; + break; + case "doctype-system": + this.doctypeSystem = value; + break; + case "media-type": + if (value.Length > 0) { + this.mediaType = value; + } + break; + case "omit-xml-declaration": + switch (value) { + case "yes": + this.omitXmlDeclaration = true; + break; + case "no": + this.omitXmlDeclaration = false; + break; + default: + IXmlLineInfo li = nav as IXmlLineInfo; + throw new XsltCompileException (new XsltException ( + "'" + value + "' is an invalid value for 'omit-xml-declaration'" + + " attribute.", (Exception) null), + nav.BaseURI, + li != null ? li.LineNumber : 0, + li != null ? li.LinePosition : 0); + } + break; + case "indent": + switch (value) { + case "yes": + this.indent = IndentType.Yes; + break; + case "no": + this.indent = IndentType.No; + break; + default: + IXmlLineInfo li = nav as IXmlLineInfo; + throw new XsltCompileException (new XsltException ( + "'" + value + "' is an invalid value for 'indent'" + + " attribute.", (Exception) null), + nav.BaseURI, + li != null ? li.LineNumber : 0, + li != null ? li.LinePosition : 0); + } + break; + default: + IXmlLineInfo li = nav as IXmlLineInfo; + throw new XsltCompileException (new XsltException ( + "'" + nav.LocalName + "' is an invalid attribute for 'output'" + + " element.", (Exception) null), + nav.BaseURI, + li != null ? li.LineNumber : 0, + li != null ? li.LinePosition : 0); } } } -- cgit v1.2.3