Exemple #1
0
		internal GenericOutputter (XmlWriter writer, Hashtable outputs, Encoding encoding, bool isVariable)
			: this (outputs, encoding)
		{
			_emitter = new XmlWriterEmitter (writer);
			_state = writer.WriteState;
//			_isVariable = isVariable;
			_omitXmlDeclaration = true; // .Net never writes XML declaration via XmlWriter
		}
Exemple #2
0
		private void DetermineOutputMethod (string localName, string ns)
		{
			XslOutput xslOutput = (XslOutput)_outputs [String.Empty];
			switch (xslOutput.Method) {
				default: // .Custom format is not supported, only handled as unknown
				case OutputMethod.Unknown:
					if (localName != null && String.Compare (localName, "html", true, CultureInfo.InvariantCulture) == 0 && ns == String.Empty)
						goto case OutputMethod.HTML;
					goto case OutputMethod.XML;
				case OutputMethod.HTML:
					_emitter = new HtmlEmitter (pendingTextWriter, xslOutput);
					break;
				case OutputMethod.XML:
					XmlTextWriter w = new XmlTextWriter (pendingTextWriter);
					if (xslOutput.Indent == "yes")
						w.Formatting = Formatting.Indented;

					_emitter = new XmlWriterEmitter (w);
					if (!_omitXmlDeclaration && !xslOutput.OmitXmlDeclaration)
						_emitter.WriteStartDocument (
							_encoding != null ? _encoding : xslOutput.Encoding,
							xslOutput.Standalone);

					break;
				case OutputMethod.Text:
					_emitter = new TextEmitter (pendingTextWriter);
					break;
			}
			pendingTextWriter = null;
		}