return base.InnerText;
}
set {
- foreach(XmlNode n in ChildNodes)
- {
- this.RemoveChild(n);
+ // Why its behavior (of MS FCL) is different from InnerXml...?
+ if (FirstChild != null && FirstChild.NodeType == XmlNodeType.Text)
+ FirstChild.Value = value;
+ else {
+ if(FirstChild != null) {
+ foreach (XmlNode n in ChildNodes)
+ this.RemoveChild (n);
+ }
+ // creates new Text node
+ AppendChild(OwnerDocument.CreateTextNode(value));
}
- // creates new Text node
- AppendChild(OwnerDocument.CreateTextNode(value));
}
}
{
w.WriteStartElement(Prefix, LocalName, NamespaceURI);
- // write namespace declarations(if not exist)
- if(Prefix != null && w.LookupPrefix (Prefix) != NamespaceURI)
- w.WriteAttributeString ("xmlns", Prefix, "http://www.w3.org/2000/xmlns/", NamespaceURI);
-
foreach(XmlNode attributeNode in Attributes)
- {
attributeNode.WriteTo(w);
- // write namespace declarations(if not exist)
- if(attributeNode.Prefix != null && attributeNode.Prefix != "" &&\r
+
+ // write namespace declarations(if not exist)
+ foreach(XmlNode attributeNode in Attributes) {
+ if(attributeNode.Prefix != null && attributeNode.Prefix != String.Empty &&\r
w.LookupPrefix(attributeNode.Prefix) != attributeNode.NamespaceURI &&\r
attributeNode.Prefix != "xmlns")\r
w.WriteAttributeString("xmlns", attributeNode.Prefix, "http://www.w3.org/2000/xmlns/", attributeNode.NamespaceURI);