Freigeben über


XmlRootAttribute.Namespace-Eigenschaft

Ruft den Namespace des XML-Stammelements ab oder legt diesen fest.

Namespace: System.Xml.Serialization
Assembly: System.Xml (in system.xml.dll)

Syntax

'Declaration
Public Property Namespace As String
'Usage
Dim instance As XmlRootAttribute
Dim value As String

value = instance.Namespace

instance.Namespace = value
public string Namespace { get; set; }
public:
property String^ Namespace {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_Namespace ()

/** @property */
public void set_Namespace (String value)
public function get Namespace () : String

public function set Namespace (value : String)

Eigenschaftenwert

Der Namespace des XML-Elements.

Hinweise

Die Namespace-Eigenschaft entspricht der World Wide Web Consortium-Spezifikation (www.w3.org) Namespaces in XML.

Zum Erstellen von Namespaces mit Präfix im XML-Dokument müssen Sie ein XmlSerializerNamespaces-Objekt erstellen, das sämtliche Paare aus Präfix und Namespace enthält. Der für das jeweilige XmlArrayAttribute festgelegte Namespace muss im XmlSerializerNamespaces-Objekt enthalten sein. Beim Generieren des Dokuments durch XmlSerializer wird allen Elementnamen der Arrayelemente das richtige Präfix vorangestellt.

Beispiel

Im folgenden Beispiel wird das XmlRootAttribute auf eine Klasse angewendet und die Namespace-Eigenschaft festgelegt.

<XmlRoot(Namespace := "http://www.cpandl.com")> _
Public Class Group
    ' Insert the members of the Group class.
End Class
[XmlRoot(Namespace = "http://www.cpandl.com")]
public class Group
{
   // Insert the members of the Group class.
}
   
[XmlRoot(Namespace="http://www.cpandl.com")]
public ref class Group{};
/** @attribute XmlRoot(Namespace = "http://www.cpandl.com")
 */
public class Group
{
    // Insert the members of the Group class.
} //Group

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

XmlRootAttribute-Klasse
XmlRootAttribute-Member
System.Xml.Serialization-Namespace
XmlAttributeOverrides-Klasse
XmlAttributes-Klasse
XmlAttributes.XmlRoot-Eigenschaft