Method StartPrefixMapping
StartPrefixMapping(String, String)
Begin the scope of a prefix-URI Namespace mapping.
Declaration
void StartPrefixMapping(string prefix, string uri)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | the Namespace prefix being declared. An empty string is used for the default element namespace, which has no prefix. |
System.String | uri | the Namespace URI the prefix is mapped to |
Remarks
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 true (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(String, String, String, IAttributes) event, and all EndPrefixMapping(String) events will occur immediately after the corresponding EndElement(String, String, String) 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.
Exceptions
Type | Condition |
---|---|
SAXException | the client may throw an exception during processing |