Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlAttribute.cs')
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttribute.cs15
1 files changed, 7 insertions, 8 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
index f5bfcc958a0..d02dee88e5c 100644
--- a/mcs/class/System.XML/System.Xml/XmlAttribute.cs
+++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
@@ -104,9 +104,7 @@ namespace System.Xml
#region Properties
public override string BaseURI {
- get {
- return OwnerElement.BaseURI;
- }
+ get { return OwnerElement != null ? OwnerElement.BaseURI : String.Empty; }
}
public override string InnerText {
@@ -175,9 +173,7 @@ namespace System.Xml
}
public virtual XmlElement OwnerElement {
- get {
- return ownerElement;
- }
+ get { return ownerElement; }
}
public override XmlNode ParentNode {
@@ -248,11 +244,11 @@ namespace System.Xml
}
internal override string XmlLang {
- get { return OwnerElement.XmlLang; }
+ get { return OwnerElement != null ? OwnerElement.XmlLang : String.Empty; }
}
internal override XmlSpace XmlSpace {
- get { return OwnerElement.XmlSpace; }
+ get { return OwnerElement != null ? OwnerElement.XmlSpace : XmlSpace.None; }
}
#endregion
@@ -298,6 +294,9 @@ namespace System.Xml
internal DTDAttributeDefinition GetAttributeDefinition ()
{
+ if (OwnerElement == null)
+ return null;
+
// If it is default, then directly create new attribute.
DTDAttListDeclaration attList = OwnerDocument.DocumentType != null ? OwnerDocument.DocumentType.DTD.AttListDecls [OwnerElement.Name] : null;
return attList != null ? attList [Name] : null;