Compartir a través de


IXmlSerializer.SetPrefix(String, String) Method

Definition

Binds the given prefix to the given namespace.

[Android.Runtime.Register("setPrefix", "(Ljava/lang/String;Ljava/lang/String;)V", "GetSetPrefix_Ljava_lang_String_Ljava_lang_String_Handler:Org.XmlPull.V1.IXmlSerializerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void SetPrefix (string? prefix, string? namespace);
[<Android.Runtime.Register("setPrefix", "(Ljava/lang/String;Ljava/lang/String;)V", "GetSetPrefix_Ljava_lang_String_Ljava_lang_String_Handler:Org.XmlPull.V1.IXmlSerializerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetPrefix : string * string -> unit

Parameters

prefix
String

must be not null (or IllegalArgumentException is thrown)

namespace
String

must be not null

Attributes

Exceptions

Remarks

Binds the given prefix to the given namespace. This call is valid for the next element including child elements. The prefix and namespace MUST be always declared even if prefix is not used in element (startTag() or attribute()) - for XML 1.0 it must result in declaring xmlns:prefix='namespace' (or xmlns:prefix="namespace" depending what character is used to quote attribute value).

<b>NOTE:</b> this method MUST be called directly before startTag() and if anything but startTag() or setPrefix() is called next there will be exception.

<b>NOTE:</b> prefixes "xml" and "xmlns" are already bound and can not be redefined see: Namespaces in XML Errata.

<b>NOTE:</b> to set default namespace use as prefix empty string.

Java documentation for org.xmlpull.v1.XmlSerializer.setPrefix(java.lang.String, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to