Namespace System
Namespace Xml

/*!
@brief	XML 宣言ノード <?xml version='1.0' ...?> を表します。
*/
Class XmlDeclaration
	Inherits XmlLinkedNode

	version As String
	encoding As String
	standalone As String

Public
	Sub XmlDeclaration( version As String, encoding As String, standalone As String, doc As XmlDocument )
		XmlLinkedNode( XmlNodeType.XmlDeclaration, "", "xml", "", doc )
		This.version = version
		This.encoding = encoding
		This.standalone = standalone
	End Sub

Protected
	Override Function InnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
		Return Ex"version=\q" + This.version + Ex"\q encoding=\q" + This.encoding + Ex"\q"
	End Function

	Override Function OwnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
		Dim crlfStr = ""
		If isIndent Then
			' インデントをサポートする場合
			crlfStr = Ex"\r\n"
		End If
		Return "<?xml " + InnerXml + "?>" + crlfStr
	End Function
End Class


End Namespace
End Namespace
