Sdílet prostřednictvím


IContentHandler.StartPrefixMapping(String, String) Method

Definition

Begin the scope of a prefix-URI Namespace mapping.

[Android.Runtime.Register("startPrefixMapping", "(Ljava/lang/String;Ljava/lang/String;)V", "GetStartPrefixMapping_Ljava_lang_String_Ljava_lang_String_Handler:Org.Xml.Sax.IContentHandlerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void StartPrefixMapping (string? prefix, string? uri);
[<Android.Runtime.Register("startPrefixMapping", "(Ljava/lang/String;Ljava/lang/String;)V", "GetStartPrefixMapping_Ljava_lang_String_Ljava_lang_String_Handler:Org.Xml.Sax.IContentHandlerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member StartPrefixMapping : string * string -> unit

Parameters

prefix
String

the Namespace prefix being declared. An empty string is used for the default element namespace, which has no prefix.

uri
String

the Namespace URI the prefix is mapped to

Attributes

Exceptions

the client may throw an exception during processing

Remarks

Begin the scope of a prefix-URI Namespace mapping.

The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is <var>true</var> (the default).

There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.

Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each other: all startPrefixMapping events will occur immediately before the corresponding #startElement startElement event, and all #endPrefixMapping endPrefixMapping events will occur immediately after the corresponding #endElement endElement event, but their order is not otherwise guaranteed.

There should never be start/endPrefixMapping events for the "xml" prefix, since it is predeclared and immutable.

Java documentation for org.xml.sax.ContentHandler.startPrefixMapping(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

See also

  • EndPrefixMapping(String)
  • <xref:Org.Xml.Sax.IContentHandler.StartElement(System.String%2c+System.String%2c+System.String%2c+System.String)>