getDeclaration Method

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

getDeclaration Method

Returns an ISchemaItem object. This object is the declaration of the DOM node that is sent to the function. The declaration specifies the schema information that is used to validate the document item in the DOM node. The ISchemaItem interface can be used to obtain further information about the schema declaration stored in the ISchemaItem object.

[Script]

Implementation Syntax

var oSchemaItem = oDom.namespaces.getDeclaration(oDOMNode);

Parameters

oDOMNode
An object. The DOM node for which a declaration object will be returned.

Return Values

oSchemaItem
An object. The schema item object that describes the specified DOM node, passed in the node parameter.

Code Example

The following VBScript example shows the getDeclaration method in a schema.

' Load the doc.
Set oDoc = CreateObject("Msxml2.DOMDocument.5.0")
oDoc.async = false
oDoc.load "po2.xml"
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   ' Retrieve the namespace URI for schema used in
   ' purchase order document.
   Set oDecl = oDoc.namespaces.getDeclaration(oDoc.documentElement)
   WScript.Echo oDecl.namespaceURI
End If
[Visual Basic]

Implementation Syntax

Set oSchemaItem = oDom.namespaces.getDeclaration(oDOMNode)

Parameters

oDOMNode
An object. The DOM node for which a declaration object will be returned.

Return Values

oSchemaItem
An object. The schema item object for the specified DOM node, passed in the node parameter.
[C/C++]

Syntax

HRESULT getDeclaration(IXMLDOMNode* node, ISchemaItem** item);

Parameters

node [in]
An object. The DOM node.
item [out,retval]
An object. The schema object for the specified DOM.

Return Values

S_OK
The value returned if successful.
E_INVALIDARG
The value returned if the DOM node points to some object other than a Node or NULL.
E_POINTER
The value returned if the item object is NULL
E_FAIL
The value returned if the node does not have a corresponding declaration in the schema.

To view reference information for Visual Basic or C/C++ only, click the Language Filter button Language Filter in the upper-left corner of the page.

Note   The syntax oSchemaCollection.getDeclaration(oDOMNODE) is no longer supported and will return E_NOTIMPL.

See Also

DOM Node Interface

Applies to: IXMLDOMSchemaCollection2