示例#1
0
        /// <summary>
        /// Creates <see cref="AttributeDefinition"/> and adds it to the <see cref="SpecAttributes"/> list.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        /// <param name="xmlname">
        /// The XML Element name of the <see cref="AttributeDefinition"/>
        /// </param>
        private void CreateAttributeDefinition(XmlReader reader, string xmlname)
        {
            var attributeDefinition = ReqIfFactory.AttributeDefinitionConstruct(xmlname, this);

            if (attributeDefinition == null)
            {
                return;
            }

            using (var attributeDefTree = reader.ReadSubtree())
            {
                attributeDefTree.MoveToContent();
                attributeDefinition.ReadXml(attributeDefTree);
            }
        }
示例#2
0
        /// <summary>
        /// Asynchronously creates <see cref="AttributeDefinition"/> and adds it to the <see cref="SpecAttributes"/> list.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        /// <param name="xmlname">
        /// The XML Element name of the <see cref="AttributeDefinition"/>
        /// </param>
        /// <param name="token">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        private async Task CreateAttributeDefinitionAsync(XmlReader reader, string xmlname, CancellationToken token)
        {
            var attributeDefinition = ReqIfFactory.AttributeDefinitionConstruct(xmlname, this, this.loggerFactory);

            if (attributeDefinition == null)
            {
                return;
            }

            if (token.IsCancellationRequested)
            {
                token.ThrowIfCancellationRequested();
            }

            using (var attributeDefTree = reader.ReadSubtree())
            {
                await attributeDefTree.MoveToContentAsync();

                await attributeDefinition.ReadXmlAsync(attributeDefTree, token);
            }
        }