Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Tag"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <param name="tagParent">The tag parent. I</param>
 /// <param name="configurationStore">The configuration store.</param>
 public Tag(XmlTextReader reader, Tag tagParent, IConfigurationStore configurationStore)
 {
     if (reader.Name.Length == 0)
     {
         // Case of txt node
         name = reader.NodeType.ToString();
     }
     else
     {
         name = reader.Name;
     }
     parent = tagParent;
     value  = Tag.ParsePropertyTokens(reader.Value, configurationStore);
     LoadAttributes(reader, configurationStore);
 }
Esempio n. 2
0
        /// <summary>
        /// Loads the attributes.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void LoadAttributes(XmlTextReader reader, IConfigurationStore configurationStore)
        {
            reader.MoveToFirstAttribute();

            for (int index = 0; index < reader.AttributeCount; index++)
            {
                attributesName.Add(reader.Name);

                string value = Tag.ParsePropertyTokens(reader.Value, configurationStore);
                attributesValue.Add(value);

                attributes[reader.Name] = value;
                reader.MoveToNextAttribute();
            }

            reader.MoveToElement();
        }
Esempio n. 3
0
        /// <summary>
        /// Loads the attributes.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void LoadAttributes(XmlTextReader reader, IConfigurationStore configurationStore)
        {
            reader.MoveToFirstAttribute();//指向第一个属性

            //遍历所有的当前节点的属性
            for (int index = 0; index < reader.AttributeCount; index++)
            {
                attributesName.Add(reader.Name);//当前节点的当前属性名称

                string value = Tag.ParsePropertyTokens(reader.Value, configurationStore);
                attributesValue.Add(value);      //当前节点的当前属性名称对应的值

                attributes[reader.Name] = value; //当前节点的当前属性名称与值
                reader.MoveToNextAttribute();    //指向下一个属性
            }

            reader.MoveToElement();
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tag"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="tagParent">The tag parent. I</param>
        /// <param name="configurationStore">The configuration store.</param>
        public Tag(XmlTextReader reader, Tag tagParent, IConfigurationStore configurationStore)
        {
            if (reader.Name.Length == 0)
            {
                // Case of txt node
                name = reader.NodeType.ToString();//当前节点的类型

                /*
                 * None:     None This is returned by the XmlReader if a Read method has not been called.
                 * Element :   An element (for example, <item> ).
                 * Attribute  :   An attribute (for example, id='123' ).
                 * Text  :    The text content of a node.
                 * CDATA  :      A CDATA section (for example, <![CDATA[my escaped text]]> ).
                 * EntityReference  :        A reference to an entity (for example, &num; ).
                 * Entity         :       An entity declaration (for example, <!ENTITY...> ).
                 * ProcessingInstruction :A processing instruction (for example, <?pi test?> ).
                 * Comment :A comment (for example, <!-- my comment --> ).
                 * Document:A document object that, as the root of the document tree, provides access to the entire XML document.
                 * DocumentType :The document type declaration, indicated by the following tag (for example, <!DOCTYPE...> ).
                 * DocumentFragment  : A document fragment.
                 * Notation : A notation in the document type declaration (for example, <!NOTATION...> ).
                 * Whitespace :  White space between markup.
                 * SignificantWhitespace : White space between markup in a mixed content model or white space within the xml:space="preserve" scope.
                 * EndElement : An end element tag (for example, </item> ).
                 * EndEntity : Returned when XmlReader gets to the end of the entity replacement as a result of a call to ResolveEntity.
                 * XmlDeclaration : The XML declaration (for example, <?xml version='1.0'?> ).
                 */
            }
            else
            {
                name = reader.Name;                                             //当前节点的名字
            }
            parent = tagParent;                                                 //当前节点的父节点
            value  = Tag.ParsePropertyTokens(reader.Value, configurationStore); //处理${}之间的属性值
            LoadAttributes(reader, configurationStore);
        }