Kbase P26428: 4GL/ABL: Errors (9082) and (9102) referencing an X-noderef Object Handle attribute or invoking one o
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/30/2008 |
|
Status: Verified
SYMPTOM(s):
4GL/ABL: Errors (9082) and (9102) referencing an X-noderef Object Handle attribute or invoking one of its methods.
X-NODEREF or X-DOCUMENT <method-name> got an error: <xml-exception>. (9082)
X-NODEREF or X-DOCUMENT GET-CHILD got an error: Invalid child index. (9082)
X-NODEREF must be associated with a valid X-DOCUMENT in order to use it in method <method>. (9102)
X-NODEREF must be associated with a valid X-DOCUMENT in order to use it in method NODE-VALUE. (9102)
X-NODEREF must be associated with a valid X-DOCUMENT in order to use it in method LOCAL-NAME. (9102)
The errors are generated on running a 4GL procedure that includes code like:
...
ASSIGN
hParentNode:GET-CHILD(hChildNode,1).
DISPLAY
hChildNode:LOCAL-NAME FORMAT "X(35)" LABEL "ChildName"
hChildNode:NODE-VALUE LABEL "SubValue".
...
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.1x
OpenEdge 10.x
CAUSE:
The hParentNode is childless causing hParentNode:GET-CHILD(hChildNode,1) to return an invalid hChildNode handle. Since the hChildNode is not a valid handle, all attempts to access any of its attributes or invoke any of its methods fail.
FIX:
Ensure that node reference object handle is valid before calling its methods or accessing its attributes. For example, to correct the code snippet above, ASSIGN the result of the GET-CHILD() method to a logical variable using the NO-ERROR option and check if it is TRUE before referencing any of the hChildNode attributes or methods:
...
DEFINE VARIABLE lReturnValue AS LOGICAL NO-UNDO.
ASSIGN
lReturnValue = hParentNode:GET-CHILD(hChildNode,1) NO-ERROR.
IF lReturnValue = TRUE THEN
DISPLAY
hChildNode:LOCAL-NAME FORMAT "X(35)" LABEL "ChildName"
hChildNode:NODE-VALUE LABEL "SubValue".
ELSE
MESSAGE
"Current Node is childless. "
VIEW-AS ALERT-BOX INFO BUTTONS OK.
...