Пример #1
0
        private async ValueTask ReadInnerPayloadsAsync(XmlReader reader, Context validationContext, string ns)
        {
            string payloadElementName = string.Empty;

            bool PayloadElement(XmlReader internalReader)
            {
                return(internalReader.LocalName == payloadElementName &&
                       internalReader.NodeType == XmlNodeType.Element &&
                       internalReader.NamespaceURI == ns);
            }

            while (await reader.ReadAsync().ConfigureAwait(false))
            {
                if (reader.NodeType != XmlNodeType.Element && payloadElementName.Length == 0)
                {
                    continue;
                }

                if (string.IsNullOrEmpty(payloadElementName))
                {
                    payloadElementName = reader.LocalName;
                }
                else
                {
                    await reader.AdvanceToAsync("Identification", ns).ConfigureAwait(false);

                    var transactionId = await reader.ReadElementContentAsStringAsync().ConfigureAwait(false);

                    validationContext.TransactionIds.Add(transactionId);

                    if (!await reader.MoveToNextAsync(PayloadElement).ConfigureAwait(false))
                    {
                        return;
                    }
                }
            }
        }