Validates a specified DOM fragment. A DOM fragment is a sub-tree spanning from a given node.
var objErr = objXMLDOMDocument3.validateNode(node);
Set objErr = objXMLDOMDocument3.validateNode(node);
IXMLDOMParseErrorPtr objErr = objXMLDOMDocument3->validateNode(node);
HRESULT IXMLDOMDocument3::validateNode( ...[in] IXMLDOMNode* node, ...[out, retval] IXMLDOMParseError** objErr);
IXMLDOMNode object representing the node from which the fragment or sub-tree expands.IXMLDOMParseError object that indicates exactly what error occurred, if any. Use the properties on this object to examine specific parse error information.objErr object for detailed parse error information.Note This method returns the sameHRESULTvalue that is returned by theIXMLDOMDocument2::importmethod.
In the syntax for Visual Basic and JScript above, an objXMLDOMDocument3 object is a DOMDocument instance that implements the IXMLDOMDocument3 interface.
Unlike IXMLDOMDocument2::validate, validateNode will not cause a new schema to load. Furthermore, validateNode assumes that the rest of the document is valid. Without this assumption it would not be possible to validate ID/IDREFs at all with the validateNode method.
The validateNode method is applicable only to element or attribute nodes located within the same DOM document. Any attempt to call it on other types of nodes or nodes in other DOM documents results in an error.
The validateNode example shows how to validate a DOM fragment at run time. The example uses two resource files, validateNode.xml and validateNode.xsd. The first is an XML data file, and the second is the XML Schema for the XML data. The first <book> element in validateNode.xml is valid against validateNode.xsd; the second <book> element is not.
We've provided source files for the sample in three languages: JScript, Visual Basic, and C++. The output is the same in each language.
MSXML 5.0 and later
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button
in the upper-left corner of the page.
IXMLDOMNode | IXMLDOMNodeList | IXMLDOMParseError | IXMLDOMSchemaCollection/XMLSchemaCache