1 // -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
\r
3 // System.Xml.XmlDeclaration
\r
6 // Daniel Weber (daniel-weber@austin.rr.com)
\r
8 // (C) 2001 Daniel Weber
\r
12 namespace System.Xml
\r
17 public class XmlDeclaration : XmlLinkedNode
\r
19 // Private data members
\r
20 private string Fencoding = "UTF-8";
\r
23 // public properties
\r
25 /// Get/Set the encoding used for the document
\r
26 /// Typical values are "UTF-8", "UTF-16", "ISO-8859-nn" (where n is 0-9).
\r
27 /// If not defined, "UTF-8" is assumed.
\r
28 /// encoding is not case sensitive.
\r
30 public string Encoding
\r
39 string val = value.ToUpper();
\r
41 if ( (val == "UTF-8") | ( val == "UTF-16") )
\r
48 if ( ( val.StartsWith( "ISO-8859-" ) ) & (val.Length == 10) )
\r
52 int code = System.Convert.ToInt32( val.Substring(9,1) );
\r
57 throw new NotImplementedException("Encoding " + value + " is not supported");
\r
68 /// Get the local name of the declaration. Returns "xml"
\r
70 public override string LocalName
\r
79 /// Get the name of the node. For XmlDeclaration, returns "xml".
\r
81 public override string Name
\r
90 /// Return the node type. For XmlDeclaration, returns XmlNodeType.XmlDeclaration.
\r
92 public override XmlNodeType NodeType
\r
96 return XmlNodeType.XmlDeclaration;
\r
101 /// Get/Set the value of the standalone attribute.
\r
102 /// "yes" => no external DTD required.
\r
103 /// "no" => external data sources required.
\r
104 /// Silently fails if Set to invalid value.
\r
105 /// Not case sensitive.
\r
107 public string Standalone {
\r
118 if (value.ToUpper() == "YES")
\r
119 Fstandalone = true;
\r
120 if (value.ToUpper() == "NO")
\r
121 Fstandalone = false;
\r
126 /// Get the xml version of the file. Returns "1.0"
\r
128 public string Version
\r
138 /// Overriden. Returns a cloned version of this node.
\r
139 /// Serves as a copy constructor. Duplicate node has no parent.
\r
141 /// <param name="deep">Create deep copy. N/A for XmlDeclaration.</param>
\r
142 /// <returns>Cloned node.</returns>
\r
143 public override XmlNode CloneNode(bool deep)
\r
145 // TODO - implement XmlDeclration.CloneNode()
\r
146 throw new NotImplementedException("XmlDeclration.CloneNode() not implemented");
\r
150 /// Save the children of this node to the passed XmlWriter. Since an XmlDeclaration has
\r
151 /// no children, this call has no effect.
\r
153 /// <param name="w"></param>
\r
154 public override void WriteContentTo(XmlWriter w)
\r
156 // Nothing to do - no children.
\r
160 /// Saves the node to the specified XmlWriter
\r
162 /// <param name="w">XmlWriter to writ to.</param>
\r
163 public override void WriteTo(XmlWriter w)
\r
165 // TODO - implement XmlDeclration.WriteTo()
\r
166 throw new NotImplementedException("XmlDeclaration.WriteTo() not implemented");
\r
170 internal XmlDeclaration( XmlDocument aOwnerDoc) : base(aOwnerDoc)
\r