Поделиться через


startElement Method

 

Receives notification of the beginning of an element. The reader invokes the startElement method at the beginning of every element in the XML document.

Visual Basic Implementation Syntax

Sub startElement(strNamespaceURI As String, strLocalName As String,_   
strQName As String, oAttributes As IVBSAXAttributes)  

Visual Basic Usage Syntax

oContentHandler.startElement "xsl", "stylesheet", "xsl:stylesheet", _  
oAttributes  

Parameters

strNamespaceURI
The namespace URI.

strLocalName
The local name string.

strQName
The XML 1.0 qualified name (QName), with prefix, or an empty string (if QNames are not available).

oAttributes
The attributes collection attached to the element.

Return Values

If failed, the ContentHandler raises a trappable error.

C/C++ Syntax

HRESULT startElement(  
   [in] const wchar_t * pwchNamespaceUri,   
   [in] int cchNamespaceUri,   
   [in] const wchar_t * pwchLocalName,   
   [in] int cchLocalName  
   [in] const wchar_t * pwchQName  
   [in] int cchQName);  
   [in] ISAXAttributes * pAttributes);  

Parameters

pwchNamespaceUri[in]
The namespace URI.

cchNamespaceUri[in]
The length of the namespace URI.

pwchLocalName[in]
The local name string might not be zero terminated.

cchLocalName[in]
The length of the local name.

pwchQName[in]
The QName, with prefix, or, an empty string (if QNames are not available).

cchQName[in]
The length of the QName.

pAttributes[in]
The attributes attached to the element.

Return Values

S_OK
The value returned if no errors occur.

E_FAIL
The value returned if the parse operation should be aborted.

Remarks

This method allows up to three names for each element:

  • The namespace URI.

  • The local name.

  • The QName, if available.

Any or all of these name components may be specified, depending on the values of the "http://xml.org/sax/features/namespaces" and the "http://xml.org/sax/features/namespace-prefixes" features. The namespace URI and local name are required when the "http://xml.org/sax/features/namespaces" feature is set to True (the default). These values are optional when this feature is set to False.

Note

Neither the URI nor local name value can be specified on its own. Both values are required if either is used.

The QName is required when the "http://xml.org/sax/features/namespaces-prefixes feature" is set to True and is optional when this feature is set to False (the default).

The attribute list provided contains only attributes with explicit values (specified or default). The attribute list omits #IMPLIED attributes. Furthermore, the attribute list contains attributes used for namespace declarations (xmlns* attributes) only if the "http://xml.org/sax/features/namespace-prefixes" feature is set to True. This feature is set to False by default.

A corresponding endElement method is called for every startElement event, even when the element is empty.

Versioning

Implemented in: MSXML 3.0 and later

Applies to

ISAXContentHandler Interface

See Also

endElement Method