Consultor Eletrônico



Kbase 21442: Example of Retrieving a DTD Document Into an XML File
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/12/2004
Status: Verified

GOAL:

Simple example of retrieving some data from a DTD document into an XML file.

GOAL:

How to retrieve data from a DTD document into an XML file?

FACT(s) (Environment):

Progress 9.1C
OpenEdge 10

FIX:


DEFINE VARIABLE ghDoc AS HANDLE NO-UNDO.
DEFINE VARIABLE ghRoot AS HANDLE NO-UNDO.
DEFINE VARIABLE ghCustomers AS HANDLE NO-UNDO.

CREATE X-DOCUMENT ghdoc.

CREATE X-NODEREF ghroot.
CREATE X-NODEREF ghCustomers.

/* Initializes the document and creates the root node */

ghDoc:INITIALIZE-DOCUMENT-TYPE("",'INVOICEFILE',"",'Invoices1.dtd').
ghDoc:ENCODING = 'utf-8'.

/* Retrieves the root element of the document. */
ghdoc:GET-DOCUMENT-ELEMENT(ghroot).

/* CODE TO PUT DATA INTO XML FILE ... */

ghDoc:CREATE-NODE(ghcustomers, "CUSTOMERS", "ELEMENT":U).
ghRoot:APPEND-CHILD(ghcustomers).

...

/* END OF CODE TO PUT DATA INTO XML FILE ... */

ghDoc:SAVE("FILE":U, "FVCustomer.xml").

DELETE OBJECT ghCustomers.
DELETE OBJECT ghRoot.
DELETE OBJECT ghDoc.