Ignore:
Timestamp:
Mar 3, 2008, 8:38:25 PM (16 years ago)
Author:
dai
Message:

XmlDocument.Saveメソッドを実装。
Xml文書生成処理を改良。

File:
1 edited

Legend:

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

    r443 r451  
    4343    */
    4444    Sub XmlNode( nodeType As XmlNodeType, prefix As String, localName As String, namespaceURI As String, doc As XmlDocument )
     45        This.nodeType = nodeType
    4546        This.prefix = prefix
    4647        This.localName = localName
     
    5758    */
    5859    Sub XmlNode( nodeType As XmlNodeType, data As String, doc As XmlDocument )
     60        This.nodeType = nodeType
    5961        This.prefix = Nothing
    6062        This.localName = Nothing
     
    304306        End If
    305307
    306         If childNodes.Count = 0 Then
     308        If This.childNodes.Count = 0 Then
    307309            Return indentStr + "<" + localName + This.GetAttributesStr() + " />" + crlfStr
    308310        End If
     
    310312        Dim result = ""
    311313
    312         ' 開始タグ
    313         result += indentStr + "<" + localName + This.GetAttributesStr() + ">" + crlfStr
    314 
    315         ' 子ノードリスト
    316         result += InnerXmlSupportedIndent( isIndent, indent + 1 )
    317 
    318         ' 終了タグ
    319         result += indentStr + "</" + localName + ">" + crlfStr
     314        If This.FirstChild.NodeType = XmlNodeType.Text Then
     315            ' 子ノードがテキストのときは開始タグ、終了タグの間にインデントや改行を入れない
     316
     317            ' 開始タグ
     318            result += indentStr + "<" + localName + This.GetAttributesStr() + ">"
     319
     320            ' 子ノードリスト
     321            result += InnerXmlSupportedIndent( isIndent, indent + 1 )
     322
     323            ' 終了タグ
     324            result += "</" + localName + ">" + crlfStr
     325        Else
     326            ' 開始タグ
     327            result += indentStr + "<" + localName + This.GetAttributesStr() + ">" + crlfStr
     328
     329            ' 子ノードリスト
     330            result += InnerXmlSupportedIndent( isIndent, indent + 1 )
     331
     332            ' 終了タグ
     333            result += indentStr + "</" + localName + ">" + crlfStr
     334        End If
    320335
    321336        Return result
Note: See TracChangeset for help on using the changeset viewer.