ChildNodeValue - cXMLDOMDocumentFragment

Gets the "value" of an element

Type: Function

Return Data Type: String

Parameters: String sTagName

ParameterDescription
sTagNameThe Element tag Name


Return Value

The element's text value


Syntax
Function ChildNodeValue String sTagName Returns String

Call: Get ChildNodeValue sTagName to StringVariable


Description

ChildNodeValue is not namespace aware and only works reliably for elements with no namespaces and no prefixes. You should use ChildElementValueNS in its place.


ChildNodeValue is used to get the "value" of an element. The "Value" of an element is really stored as a cXmlDomTextNode object. In most cases this is overkill, and you want to just get at the value of an element the same way you get at the value of an attribute. This function lets you do this and hides the creation, finding and disposing of the text node.

If a node matching the passed sTagName does not exist, the result will be an empty string. If the node does exist, but is empty, the result will also be an empty string. So it is impossible to tell from the result of this call whether the node was there or not. If you want to handle empty nodes differently from non existing nodes, you should use the enumeration functions like NextSibling, PreviousSibling, NextNode.

Get ChildNodeValue of hoCustomerElement "Name" to sCustName


Using prefixes in the passed tag name (e.g. "xyz:myName" instead of "myName") has never been supported. Applications that use the pre-MSXML6 parser (prior to DataFlex 15.1 or using the Use_Legacy_XML_Lib command) might return the desired node when prefixes are used. This was an accidental behavior that is not supported with MSXML6.