Method StartElement
StartElement(String, String, String, IAttributes)
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(String, String, String) event for every StartElement(String, String, String, IAttributes) event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding EndElement(String, String, String) event.
This event allows up to three name components for each element:
- the Namespace URI;
- the local name; and
- the qualified (prefixed) name.
Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and thehttp://xml.org/sax/features/namespace-prefixes properties:
- the Namespace URI and local name are required when the namespaces property is true (the default), and are optional when the namespaces property is false (if one is specified, both must be);
- the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default).
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(Char[], Int32, Int32), attribute values may have
characters that need more than one char
value.
Declaration
void StartElement(string uri, string localName, string qName, IAttributes atts)
Parameters
Type | Name | Description |
---|---|---|
System.String | uri | uri the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed |
System.String | localName | the local name (without prefix), or the empty string if Namespace processing is not being performed |
System.String | qName | the qualified name (with prefix), or the empty string if qualified names are not available |
IAttributes | atts | the attributes attached to the element. If there are no attributes, it shall be an empty IAttributes object. The value of this object after StartElement(String, String, String, IAttributes) returns is undefined |
Exceptions
Type | Condition |
---|---|
SAXException | any SAX exception, possibly wrapping another exception |