2006-02-21 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / Mono.Xml.Xsl / Outputter.cs
1 //
2 // Outputter.cs
3 //
4 // Authors:
5 //      Oleg Tkachenko (oleg@tkachenko.com)
6 //      
7 // (C) 2003 Oleg Tkachenko
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.Xml;
33
34 namespace Mono.Xml.Xsl {
35         /// <summary>
36         /// Abstract XSLT outputter. 
37         /// Transformation classes build result tree using only with this class API.
38         /// Implementations of this class outputs result tree to an Emitter, which emits 
39         /// it further down to real consumers.
40         /// </summary>
41         internal abstract class Outputter {
42                 public void WriteStartElement (string localName, string nsURI)
43                 {
44                         WriteStartElement (null, localName, nsURI);
45                 }
46                 
47                 public abstract void WriteStartElement (string prefix, string localName, string nsURI);
48                 public abstract void WriteEndElement ();
49                 public virtual void WriteFullEndElement ()
50                 {
51                         WriteEndElement ();
52                 }
53                 
54                 public void WriteAttributeString (string localName, string value)
55                 {
56                         WriteAttributeString ("", localName, "", value);
57                 }
58                 
59                 public abstract void WriteAttributeString (string prefix, string localName, string nsURI, string value);
60                 public abstract void WriteNamespaceDecl (string prefix, string nsUri);          
61                                                 
62                 public abstract void WriteComment (string text);
63                 
64                 public abstract void WriteProcessingInstruction (string name, string text);
65                 
66                 public abstract void WriteString (string text);
67                 public abstract void WriteRaw (string data);
68                 public abstract void WriteWhitespace (string text);
69                 
70                 public abstract void Done ();
71
72                 public abstract bool CanProcessAttributes { get; }
73
74                 public abstract bool InsideCDataSection { get; set; }
75         }
76 }