private void Validate(XmlNode xml, string baseNodeXPath, string containedNodeXPath, Hl7Errors validationResult) { try { XmlNodeList baseNodes = xPathHelper.GetNodes(xml, baseNodeXPath, "cda", NAMESPACE); for (int i = 0, ilength = baseNodes.Count; i < ilength; i++) { ValidateSingleNode(baseNodes.Item(i), containedNodeXPath, validationResult); } } catch (XPathException e) { validationResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.SYNTAX_ERROR, "Unable to validate contained templates: " + e.Message , baseNodeXPath)); } }