2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[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 abstract void WriteStartDocument ();             
43                 public abstract void WriteEndDocument ();
44                 
45                 public void WriteStartElement (string localName, string nsURI)
46                 {
47                         WriteStartElement (null, localName, nsURI);
48                 }
49                 
50                 public abstract void WriteStartElement (string prefix, string localName, string nsURI);
51                 public abstract void WriteEndElement ();
52                 public virtual void WriteFullEndElement ()
53                 {
54                         WriteEndElement ();
55                 }
56                 
57                 public void WriteAttributeString (string localName, string value)
58                 {
59                         WriteAttributeString ("", localName, "", value);
60                 }
61                 
62                 public abstract void WriteAttributeString (string prefix, string localName, string nsURI, string value);
63                 public abstract void WriteNamespaceDecl (string prefix, string nsUri);          
64                                                 
65                 public abstract void WriteComment (string text);
66                 
67                 public abstract void WriteProcessingInstruction (string name, string text);
68                 
69                 public abstract void WriteString (string text);
70                 public abstract void WriteRaw (string data);
71                 public abstract void WriteWhitespace (string text);
72                 
73                 public abstract void Done ();
74
75                 public virtual bool CanProcessAttributes {
76                         get { return false; }
77                 }
78
79                 public abstract WriteState WriteState { get; }
80
81                 public abstract bool InsideCDataSection { get; set; }
82         }
83 }