Consultor Eletrônico



Kbase P30198: XML - Error 9082 with APPEND-CHILD
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   09/07/2003
Status: Unverified

FACT(s) (Environment):

Progress 9.1C

FACT(s) (Environment):

Progress 9.1D

SYMPTOM(s):

X-NODEREF or X-DOCUMENT APPEND-CHILD got an error: A node was inserted where it doesn't belong (9082)

CAUSE:

INITIALIZE-DOCUMENT-TYPE creates a document with a root node. Since XML can only have 1 root node, you cannot do an APPEND-CHILD on the document, unless it is a COMMENT node or PI node.

FIX:

Get the root node by calling GET-DOCUMENT-ELEMENT on the hDocument handle and then appending it to the children, as shown in this example:

DEF VAR hDocument AS HANDLE.
DEF VAR hOrder AS HANDLE.
DEF VAR hRoot AS HANDLE.

CREATE X-DOCUMENT hDocument.
CREATE X-NODEREF hRoot.
CREATE X-NODEREF hOrder.

hDocument:INITIALIZE-DOCUMENT-TYPE("" /*namespaceURI*/,
"EXAMPLE" /*rootNodeName*/,
"" /*publicId*/,
"http://mydtd_for_myxmldoc.dtd" /*systemId*/ ).

hDocument:GET-DOCUMENT-ELEMENT(hRoot).
hDocument:CREATE-NODE(hOrder, "ORDER", "ELEMENT").
hRoot:APPEND-CHILD(hOrder).

/* rest of code */