共用方式為


IContentHandler.StartElement(String, String, String, IAttributes) Method

Definition

Receive notification of the beginning of an element.

[Android.Runtime.Register("startElement", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/xml/sax/Attributes;)V", "GetStartElement_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Lorg_xml_sax_Attributes_Handler:Org.Xml.Sax.IContentHandlerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void StartElement (string? uri, string? localName, string? qName, Org.Xml.Sax.IAttributes? atts);
[<Android.Runtime.Register("startElement", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/xml/sax/Attributes;)V", "GetStartElement_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Lorg_xml_sax_Attributes_Handler:Org.Xml.Sax.IContentHandlerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member StartElement : string * string * string * Org.Xml.Sax.IAttributes -> unit

Parameters

uri
String

the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed

localName
String

the local name (without prefix), or the empty string if Namespace processing is not being performed

qName
String

the qualified name (with prefix), or the empty string if qualified names are not available

atts
IAttributes

the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined

Attributes

Exceptions

any SAX exception, possibly wrapping another exception

Remarks

Receive notification of the beginning of an element.

The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding #endElement endElement event for every startElement event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement event.

This event allows up to three name components for each element:

<ol> <li>the Namespace URI;</li> <li>the local name; and</li> <li>the qualified (prefixed) name.</li> </ol>

Any or all of these may be provided, depending on the values of the <var>http://xml.org/sax/features/namespaces</var> and the <var>http://xml.org/sax/features/namespace-prefixes</var> properties:

<ul> <li>the Namespace URI and local name are required when the namespaces property is <var>true</var> (the default), and are optional when the namespaces property is <var>false</var> (if one is specified, both must be);</li> <li>the qualified name is required when the namespace-prefixes property is <var>true</var>, and is optional when the namespace-prefixes property is <var>false</var> (the default).</li> </ul>

Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted. The attribute list will contain attributes used for Namespace declarations (xmlns* attributes) only if the http://xml.org/sax/features/namespace-prefixes property is true (it is false by default, and support for a true value is optional).

Like #characters characters(), attribute values may have characters that need more than one char value.

Java documentation for org.xml.sax.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes).

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