nodeTypedValue Property

 

Contains the node value expressed in its defined data type.

This property only works for elements that have XDR data types. In MSXML 3.0, this property returns correct types for elements defined in an XDR schema, as well as elements that are defined using dt:dt types.

In MSXML 6.0, XDR is no longer supported. Therefore, the nodeTypedValue property returns the correct value only for elements that are defined using dt:dt types.

Elements that are defined in an XSD schema return VT_BSTR for all data types.

For more information, see Removal of XDR Schema Support in MSXML 6.0.

objValue = oXMLDOMNode.nodeTypedValue;  
objXMLDOMNode.nodeTypedValue = objValue;  

Example

var xmlDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0");
xmlDoc.documentElement = xmlDoc.createElement("Test");
xmlDoc.documentElement.dataType = "bin.hex";
xmlDoc.documentElement.nodeTypedValue = "ffab123d";
WScript.Echo(xmlDoc.xml);

Output

The following is output in a message box.

<Test xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.hex">ffab123d</Test>  

objValue = oXMLDOMNode.nodeTypedValue  
objXMLDOMNode.nodeTypedValue = objValue  

HRESULT get_nodeTypedValue(  
    VARIANT *typedValue);  
HRESULT put_nodeTypedValue(  
    VARIANT typedValue);  

Parameters

typedValue[out, retval][in]
Value of this node in its defined data type, if such a data type is defined. If this node has no content, the value of the typedValue parameter is Null.

C/C++ Return Values

S_OK
Value returned if successful.

E_INVALIDARG
Value returned if the typedValue parameter is Null.

E_FAIL (for put_nodeTypedValueonly)
Value returned if an error occurs.

Variant. The property is read/write. It returns the value of this node in its defined data type, if such a data type is defined. If the node has no content, this property returns Null.

This value depends on the value of the nodeType property of the IXMLDOMNode.

This member is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).

The data type for this node is defined in its dataType property. This property also depends on the value of the node type, in the nodeType property.

Although you can explicitly set the nodeTypedValue property with a particular data type in the VARIANT, the set operation does not change the data type. The value in the VARIANT is coerced to the data type specified in the dataType property, and the set operation returns an error if the type coercion is not possible.

Changes to this property are also immediately available from the nodeValue property.

NODE_ATTRIBUTEReturns the value in the data representation of the type specified in the schema for the attribute. (Data types are specified using the dt:dt attribute, and because attributes cannot be applied to attributes, the attribute's data type can be specified only in the schema.) If no type was specified, returns a string identical to the nodeValue property. If the new value is not of the type specified in the schema or cannot be coerced to the type specified in the schema, then an error occurs.
NODE_CDATA_SECTION

NODE_COMMENT

NODE_DOCUMENT

NODE_DOCUMENT_FRAGMENT

NODE_DOCUMENT_TYPE

NODE_ENTITY

NODE_NOTATION

NODE_PROCESSING_INSTRUCTION
Returns a string that is equal to the nodeValue property. These node types do not have data types.
NODE_ELEMENTReturns the value in the data representation of the type specified on the element instance (using the dt:dt attribute) or specified in the schema. If no type was specified on the instance or in the schema, returns a string identical to the nodeValue property. If the element has an attribute data type, returns null.
NODE_ENTITY_REFERENCEReturns the value in the data representation of the type specified for the referenced entity. This is limited to entities with a single data type on the root level element of the subtree corresponding to the entity. If no data type was specified, returns a string identical to the nodeValue property.
NODE_TEXTReturns the value in the data representation of the type of the containing element. If the containing element was not typed, returns a string identical to the nodeValue property.
VARIANT returnedCorresponding element data type
VT_BSTRstring
VT_BSTRnumber
VT_I4Int
VT_CYFixed.14.4
VT_BOOLBoolean
VT_DATEdateTime
VT_DATEdateTime.tz
VT_DATEDate
VT_DATETime
VT_DATETime.tz
VT_I1i1 byte
VT_I2i2
VT_I4i4, int
VT_UI1ui1
VT_UI2ui2
VT_UI4ui4
VT_FLOATr4
VT_DOUBLEr8, float
VT_BSTRuuid
VT_ARRAYbin.hex
VT_ARRAYbin.base64

Implemented in: MSXML 3.0.

IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMDocument-DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText

dataType Property1
nodeType Property1
nodeValue Property

Show: