1 using System
.Collections
;
6 namespace Castle
.MonoRail
.Views
.Brail
8 public class XmlExtension
: IDslLanguageExtension
10 readonly private TextWriter _output
= null;
11 private readonly XmlWriter writer
;
13 public XmlExtension(TextWriter output
)
16 this.writer
= XmlWriter
.Create(_output
);
19 public TextWriter Output
21 get { return _output; }
24 public void text(string text
)
26 writer
.WriteString(text
);
29 private void BlockTag(string tag
, IDictionary attributes
, ICallable block
)
31 writer
.WriteStartElement(tag
);
33 if (null != attributes
)
35 foreach (DictionaryEntry entry
in attributes
)
37 writer
.WriteAttributeString((string)entry
.Key
,(string)entry
.Value
);
45 writer
.WriteEndElement();
48 public void Tag(string name
)
50 BlockTag(name
, null, null);
53 public void Tag(string name
, ICallable block
)
55 BlockTag(name
, null, block
);
58 public void Tag(string name
, IDictionary attributes
, ICallable block
)
60 BlockTag(name
, attributes
, block
);