   
nodeTypedValue
Is a member of:
|
DOMDocument
XMLDOMNode
XMLDOMAttribute
XMLDOMCDATASection
XMLDOMComment
XMLDOMDocumentFragment
XMLDOMDocumentType
XMLDOMElement
XMLDOMEntity
XMLDOMEntityReference
XMLDOMNotation
XMLDOMProcessingInstruction
XMLDOMText
XTLRuntime
|
SyntaxvntValue = objXMLDOMElement.nodeTypedValue
RemarkIn VB's object browser, its description of this propery is: property
get the strongly typed value of the node. For an element Node, it returns a variant datatype of the contents of the Node. If you're working with an attribute Node, you will only get the value of
attribute, which does not return much value. (See
nodeValue for working with attribute Nodes.)
If you have used a Schema in your XML, which does not have a datatype specified for the element in the
Schema, a string value datatype is the default datatype returned. Otherwise, it
returns the data in the specified datatype value. This is the main strength of
this property.
When working with an element Node, you could also use
the Text property to get the value of a Node. It's a matter of
preference.
ExampleYou cannot use the nodeTypedValue property to set the
value of a Node, as it will return a runtime error. You need to use the text
property to do this.
In the following example, after loading our DOMDocument,
we want to get the value of the first child's value of the first element
(firstChild) of the root element (documentElement), using the nodeTypedValue
property:
Dim objDOMDocument As DOMDocument
Dim objXMLDOMElement As IXMLDOMElement
Dim strFirstValue As String
Set objDOMDocument = New DOMDocument
objDOMDocument.async = False
objDOMDocument.Load "http://localhost/xmlcode/people2.dtd"
Set objXMLDOMElement = objDOMDocument.documentElement.first-Child
strFirstValue = objXMLDOMElement.firstChild.nodeTypedValue
¬
Get the root Node's first child element.
¬
From the first child of the root Node, get the first child of that element.
¬
This returns "Mark Wilson" from our main XML example.
   
This manuscript is an abridged version of a chapter
from the Manning
Publications book XML
Programming with VB and ASP. This chapter looks at the Microsoft DOM objects. NOTE: Most images have been removed to increase speed and many of the code comments have also been removed for presentation. Please purchase the book to enjoy the full experience of all the chapters with images and code comments!
|