Consultor Eletrônico



Kbase P8055: Is the Data considered the NODE-VALUE in XML or the child of an ELEMENT node?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/20/2010
Status: Verified

GOAL:

Is the text data considered the NODE-VALUE in XML or the child of an ELEMENT node?

GOAL:

How to use NODE-VALUE

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

The TEXT data is a child of the ELEMENT node.

From the External Program Interfaces guide regarding the DOM Structure Model:

Node Interface Types:

Element: Represents an element node. This interface represents the data,
or the tags of the XML document. The text of the element is stored in a
Text or CDATASection node, which is the child of the element.

Text: Represents a Text node that is a child of an element node.


The External Program Interfaces guide also indicates the following regarding the use of NODE-VALUE:

11.4.3 Setting Node Attributes and Values

You can set the attributes of a node or the value of a node either
before or after it is appended by using the SET-ATTRIBUTE( ) method or
the NODE-VALUE attribute. The following code fragment depicts setting
attributes of the "employee" ELEMENT node with the SET-ATTRIBUTE( )
method and setting the value of the "address" TEXT node with the
NODE-VALUE attribute. Note that in this case, the "employee" node is a
child of the root node and the "address" node is a child of the
"employee" node:

hDoc:CREATE-NODE(hEmp,"employee","ELEMENT").
hDoc:CREATE-NODE(hAddr,?,"TEXT").
hEmp:SET-ATTRIBUTE("empID","10263").
hEmp:SET-ATTRIBUTE("empDept","Sales").
hRoot:APPEND-CHILD(hEmp).
hEmp:APPEND-CHILD(hAddr).
hAddr:NODE-VALUE = "121 State Street".