/// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception> private void WriteRealmCode(BeanWrapper bean, Hl7Source source, IList <XmlNode> nodes, string traversalName) { XPathHelper xPathHelper = new XPathHelper(); foreach (XmlNode node in nodes) { try { string codeValue = xPathHelper.GetAttributeValue(node, "@code", null); if (codeValue != null) { bean.WriteRealmCode(RealmCodeHelper.LookupRealm(codeValue)); } } catch (XPathException e) { throw new XmlToModelTransformationException("Exception encountered while parsing realmCode", e); } } }