Changeset 443


Ignore:
Timestamp:
Feb 28, 2008, 11:36:03 PM (16 years ago)
Author:
dai
Message:

タグ属性に対応。

Location:
trunk/Include/Classes/System/Xml
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Xml/XmlAttribute.ab

    r442 r443  
    1212        XmlNode( XmlNodeType.Attribute, prefix, localName, namespaceURI, doc )
    1313    End Sub
     14
     15    /*!
     16    @brief  このノードの子ノードだけを表すマークアップを取得または設定します。
     17    */
     18    Override Function InnerXml() As String
     19        Return This.Value
     20    End Function
     21
     22    /*!
     23    @brief  このノードとそのすべての子ノードを表すマークアップを取得します。
     24    @return このノードとそのすべての子ノードを格納しているマークアップ。
     25    */
     26    Override Function OuterXml() As String
     27        Return This.LocalName + Ex"=\q" + InnerXml + Ex"\q"
     28    End Function
    1429End Class
    1530
  • trunk/Include/Classes/System/Xml/XmlDocument.ab

    r442 r443  
    3939    /*!
    4040    @brief  指定した値を使用して、XmlDeclaration ノードを作成します。
     41    @param  version XMLのバージョン番号。
     42            encoding 文字コード。(例:"shift-jis", "UTF-8", "EUC-JP")
     43            standalone 外部DTDの参照が必要かどうか。"yes" or "no"
    4144    */
    4245    Function CreateXmlDeclaration( version As String, encoding As String, standalone As String ) As XmlDeclaration
     
    4548
    4649    /*!
     50    @brief  指定した名前を使用して属性を作成します。
     51    @param  name 属性名
     52    */
     53    Function CreateAttribute( name As String) As XmlAttribute
     54        VerifyLocalName( name )
     55
     56        Return New XmlAttribute( "", name, "", This )
     57    End Function
     58
     59    /*!
    4760    @brief  指定した名前を使用して要素を作成します。
     61    @param  name 要素名。
    4862    */
    4963    Function CreateElement( name As String ) As XmlElement
  • trunk/Include/Classes/System/Xml/XmlNode.ab

    r442 r443  
    2828Class XmlNode
    2929
    30     'attributes As XmlAttributeCollection
     30    attributes As XmlAttributeCollection
    3131    childNodes As XmlNodeList
    3232    prefix As String
     
    4949        This.value = Nothing
    5050
     51        attributes = New XmlAttributeCollection
    5152        childNodes = New XmlNodeList()
    5253    End Sub
     
    6263        This.value = data
    6364
     65        attributes = New XmlAttributeCollection
    6466        childNodes = Nothing
    6567    End Sub
     
    7375    @brief  名前またはインデックスによってアクセスできる属性のコレクションを表します。
    7476    */
    75     'Virtual Function Attributes() As XmlAttributeCollection
    76     '   Return attributes
    77     'End Function
     77    Virtual Function Attributes() As XmlAttributeCollection
     78        Return attributes
     79    End Function
    7880
    7981    /*!
     
    157159    End Function
    158160
    159    
     161    /*!
     162    @brief  このノードの値を取得します。
     163    @return このノードの値。
     164    */
     165    Virtual Function Value() As String
     166        return value
     167    End Function
     168
     169    /*!
     170    @brief  このノードの値を設定します。
     171    @param  value 値文字列。
     172    */
     173    Virtual Sub Value( value As String )
     174        This.value = value
     175    End Sub
    160176
    161177
     
    250266
    251267Protected
     268
     269    Function GetAttributesStr() As String
     270        If attributes.Count = 0 Then
     271            ' 属性が1つもない場合
     272            Return ""
     273        End If
     274
     275        Dim result = ""
     276        Foreach attribute In attributes
     277            result += " " + attribute.OuterXml
     278        Next
     279        Return result
     280    End Function
     281
    252282    Virtual Function InnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
    253283        Dim result = ""
     
    275305
    276306        If childNodes.Count = 0 Then
    277             Return indentStr + "<" + localName + " />" + crlfStr
     307            Return indentStr + "<" + localName + This.GetAttributesStr() + " />" + crlfStr
    278308        End If
    279309
     
    281311
    282312        ' 開始タグ
    283         result += indentStr + "<" + localName + ">" + crlfStr
     313        result += indentStr + "<" + localName + This.GetAttributesStr() + ">" + crlfStr
    284314
    285315        ' 子ノードリスト
Note: See TracChangeset for help on using the changeset viewer.