public virtual void ReadFrom(XElement xE)
 {
     Key = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "key")
         {
             Key = new PolicyViolationKey();
             Key.ReadFrom(xItem);
         }
     }
 }
 public override void ReadFrom(XElement xE)
 {
     base.ReadFrom(xE);
     Key = null;
     ExternalPolicyName        = null;
     ExternalPolicyUrl         = null;
     ExternalPolicyDescription = null;
     IsExemptable   = null;
     ViolatingParts = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "key")
         {
             Key = new PolicyViolationKey();
             Key.ReadFrom(xItem);
         }
         else if (localName == "externalPolicyName")
         {
             ExternalPolicyName = xItem.Value;
         }
         else if (localName == "externalPolicyUrl")
         {
             ExternalPolicyUrl = xItem.Value;
         }
         else if (localName == "externalPolicyDescription")
         {
             ExternalPolicyDescription = xItem.Value;
         }
         else if (localName == "isExemptable")
         {
             IsExemptable = bool.Parse(xItem.Value);
         }
         else if (localName == "violatingParts")
         {
             if (ViolatingParts == null)
             {
                 ViolatingParts = new List <PolicyViolationErrorPart>();
             }
             var violatingPartsItem = new PolicyViolationErrorPart();
             violatingPartsItem.ReadFrom(xItem);
             ViolatingParts.Add(violatingPartsItem);
         }
     }
 }