// // the core policy reading logic // each step returns a list of lists -- an "and of ors": // each inner list is a policy alternative: it contains the set of assertions that comprise the alternative // the outer list represents the choice between alternatives // private IEnumerable <IEnumerable <XmlElement> > ReadNode(XmlNode node, XmlElement contextAssertion, YieldLimiter yieldLimiter) { if (_nodesRead >= _metadataImporter.Quotas.MaxPolicyNodes) { if (_nodesRead == _metadataImporter.Quotas.MaxPolicyNodes) { // add wirning once string warningMsg = string.Format(SRServiceModel.ExceededMaxPolicyComplexity, node.Name, PolicyHelper.GetFragmentIdentifier((XmlElement)node)); _metadataImporter.PolicyWarningOccured.Invoke(contextAssertion, warningMsg); _nodesRead++; } return(s_emptyEmpty); } _nodesRead++; IEnumerable <IEnumerable <XmlElement> > nodes = s_emptyEmpty; switch (PolicyHelper.GetNodeType(node)) { case PolicyHelper.NodeType.Policy: case PolicyHelper.NodeType.All: nodes = ReadNode_PolicyOrAll((XmlElement)node, contextAssertion, yieldLimiter); break; case PolicyHelper.NodeType.ExactlyOne: nodes = ReadNode_ExactlyOne((XmlElement)node, contextAssertion, yieldLimiter); break; case PolicyHelper.NodeType.Assertion: nodes = ReadNode_Assertion((XmlElement)node, yieldLimiter); break; case PolicyHelper.NodeType.PolicyReference: nodes = ReadNode_PolicyReference((XmlElement)node, contextAssertion, yieldLimiter); break; case PolicyHelper.NodeType.UnrecognizedWSPolicy: string warningMsg = string.Format(SRServiceModel.UnrecognizedPolicyElementInNamespace, node.Name, node.NamespaceURI); _metadataImporter.PolicyWarningOccured.Invoke(contextAssertion, warningMsg); break; //consider hsomu, add more error handling here. default? } return(nodes); }