dataType Property
Specifies the data type for this node. This property applies to document type definitions (DTDs) only, not to XML-Data Reduced (XDR) schemas or XML Schema definition language (XSD) schemas.
[Script]
Script Syntax
objValue = oXMLDOMNode.dataType;
objXMLDOMNode.dataType = objValue;
Example
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmlDoc.async = false;
xmlDoc.loadXML("<root/>");
var root = xmlDoc.documentElement;
root.dataType = "int";
root.nodeTypedValue = 5;
alert(xmlDoc.xml);
[Visual Basic]
Visual Basic Syntax
objValue = oXMLDOMNode.dataType
objXMLDOMNode.dataType = objValue
Example
Dim xmlDoc As New Msxml2.DOMDocument40
Dim root As IXMLDOMElement
xmlDoc.async = False
xmlDoc.loadXML "<root/>"
Set root = xmlDoc.documentElement
root.dataType = "int"
root.nodeTypedValue = 5
MsgBox xmlDoc.xml
[C/C++]
C/C++ Syntax
HRESULT get_dataType(
VARIANT *dataTypeName);
HRESULT put_dataType(
BSTR dataTypeName);
Parameters
- dataTypeName [out, retval][in]
- The VARIANT can be a BSTR that contains the data type name, or VT_NULL if no data type is defined.
C/C++ Return Values
- S_OK
- The value returned if successful.
- S_FALSE (for get_dataType only)
- The value returned if the node is not typed.
- E_INVALIDARG (for get_dataType only)
- The value returned if dataTypeName is Null.
- E_FAIL (for put_dataType only)
- The value returned if an error occurs.
Remarks
The property is read/write. The VARIANT can be a BSTR that contains the data type name, or VT_NULL if no data type is defined. This property applies to DTDs only, not to XML-Data Reduced (XDR) schemas or XML Schemas (XSD). This value depends on the value of the nodeType property of the IXMLDOMNode.
This member is an extension of the Worldwide Web Consortium (W3C) Document Object Model (DOM).
| NODE_ATTRIBUTE |
Contains the string representation of the data type specifier included in the schema, or Null if no data type is specified. |
| NODE_CDATA_SECTION, NODE_COMMENT, NODE_DOCUMENT, NODE_DOCUMENT_FRAGMENT, NODE_DOCUMENT_TYPE, NODE_ENTITY, NODE_NOTATION, NODE_PROCESSING_INSTRUCTION, NODE_TEXT |
Contains the constant string value "string." These node types do not have data types, so the dataType property cannot be set for these node types. Attempts to set this property are ignored. |
| NODE_ELEMENT |
Contains the string representation of the data type specifier included on the instance of the element or in the schema, or Null if no data type is specified. |
| NODE_ENTITY_REFERENCE |
Contains the string representation of the data type specifier 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. Contains Null if no data type is specified. It is not possible to set the data type of an entity reference. The data type must be set directly on the referenced element. Attempts to set the value of the dataType property are ignored. |
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.
See Also
nodeType Property
Applies to: IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText