示例#1
0
        /// <summary>
        /// Attach the attribute's text or typed value to the previously constructed attribute node.
        /// </summary>
        public override void WriteEndAttribute()
        {
            Debug.Assert(_pageSibling != null);
            Debug.Assert(_pageSibling[_idxSibling].NodeType == XPathNodeType.Attribute);

            _pageSibling[_idxSibling].SetValue(_textBldr.ReadText());

            if (_idAttrName != null)
            {
                // If this is an ID attribute,
                if (_pageSibling[_idxSibling].LocalName == _idAttrName.Name &&
                    _pageSibling[_idxSibling].Prefix == _idAttrName.Namespace)
                {
                    // Then add its value to the idValueMap map
                    Debug.Assert(_idxParent != 0 && _pageParent != null, "ID attribute must have an element parent");
                    string?id = _pageSibling[_idxSibling].Value;
                    Debug.Assert(id != null);
                    _doc.AddIdElement(id, _pageParent, _idxParent);
                }
            }
        }