Kbase P95602: Error 9082 when trying to append a CHILD NODE to the current XML document or current XML element nod
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/04/2007 |
|
Status: Unverified
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
SYMPTOM(s):
Error 9082 when trying to append a CHILD NODE to the current XML element node
X-NODEREF or X-DOCUMENT <method-name> got an error: <xml-exception>. (9082)
X-NODEREF or X-DOCUMENT APPEND-CHILD got an error: A node was inserted where it doesn't belong (9082)
Executing code similar to:
DEFINE VARIABLE hDoc AS HANDLE.
DEFINE VARIABLE hRoot AS HANDLE.
DEFINE VARIABLE hRecord AS HANDLE .
DEFINE VARIABLE hField AS HANDLE .
DEFINE VARIABLE hCurrent AS HANDLE.
CREATE X-DOCUMENT hDoc.
CREATE X-NODEREF hRoot.
CREATE X-NODEREF hRecord.
CREATE X-NODEREF hField.
CREATE X-NODEREF hCurrent.
hDoc:CREATE-NODE(hRoot,"Customers","ELEMENT").
hDoc:APPEND-CHILD(hRoot).
hCurrent = hRoot.
hDoc:CREATE-NODE(hRecord,"Customer","ELEMENT").
hCurrent:APPEND-CHILD(hRecord).
/*** Code attempts to APPEND an hRecord element node to itself ***/
hCurrent = hRecord.
hDoc:CREATE-NODE(hRecord,"Name","ELEMENT").
hCurrent:APPEND-CHILD(hRecord).
hDoc:SAVE("file","Customers.xml").
DELETE OBJECT hDoc.
DELETE OBJECT hRoot.
DELETE OBJECT hRecord.
DELETE OBJECT hField.
CAUSE:
The Progress 4GL APPEND-CHILD( ) Method appends a CHILD NODE to the current XML document or current XML element node. Since hRecod node is not a CHILD of itself, The statement: "hCurrent:APPEND-CHILD(hRecord)." fails because it is attempting to append the element hRecord to itself.
FIX:
Append a CHILD (hField) to the hRecord element by changing the following lines of code:
hCurrent = hRecord.
hDoc:CREATE-NODE(hRecord,"Name","ELEMENT").
hCurrent:APPEND-CHILD(hRecord).
To:
hCurrent = hRecord.
hDoc:CREATE-NODE(hField,"Name","ELEMENT").
hCurrent:APPEND-CHILD(hField).