WRITE

The WRITE command is used to create and write out XML components.

The OBJECT keyword specifies the type of XML component to create.

 

 

                                                         Required

 

 WRITE ---- OBJECT ---------- *DOCUMENTSTART ------------------->

                              *DOCTYPE

                              *COMMENT

                              *INSTRUCTION

                              *NAMESPACE

                              *ELEMENTSTART

                              *TEXT

                              *CDATA

                              *ELEMENTEMD

                              *DOCUMENTEND

 

                                                         Optional

 

        >-- NAME ------------ qualified name ------------------->

 

        >-- PREFIX ---------- prefix --------------------------->

 

        >-- NAMESPACE ------- namespace ------------------------>

 

        >-- TEXT ------------ text ----------------------------->

 

        >-- TARGET ---------- target --------------------------->

 

        >-- DATA ------------ data -----------------------------|

 

Keywords

OBJECT

This mandatory keywords specifies the type of XML element to be created.

The possible values for the OBJECT keyword are:

  • *DOCUMENTSTART
  • *DOCTYPE
  • *COMMENT
  • *INSTRUCTION
  • *NAMESPACE
  • *ELEMENTSTART
  • *TEXT
  • *CDATA
  • *ELEMENTEND
  • *ELEMENTEMPTY
  • *DOCUMENTEND

NAME

This keyword specifies the qualified XML element name.

This keyword is used with the following OBJECT types.

  • *ELEMENTSTART
  • *ELEMENTEMPTY

The notation for expressing a qualified element name as a string is to enclosed the namespace URI inside curly brackets and prefix the element name with this namespace.

For example: {http://www.cars.com/xml}part

Element attributes can be created by using a two field working list that contains qualified attribute name and values as an argument to the WRITE OBJECT(*ELEMENTSTART) command.

PREFIX

This keyword specifies an XML prefix and is only used with the OBJECT type of *NAMESPACE.

NAMESPACE

This keyword specifies an XML namespace and is only used with the OBJECT type of *NAMESPACE.

TEXT

This keyword specifies the text value.

This keyword is used with the following OBJECT types.

  • *DOCTYPE
  • *COMMENT
  • *TEXT
  • *CDATA

TARGET

This keyword specifies the processing instruction target and is only used with the OBJECT type of *INSTRUCTION.

DATA

This keyword specifies the processing instruction data and is only used with the OBJECT type of *INSTRUCTION.

 

Example

 

OPEN FILE ( order.xml )

 

WRITE OBJECT ( *DOCUMENTSTART )

 

WRITE OBJECT ( *DOCTYPE ) TEXT ( <!DOCTYPE Orders SYSTEM "order.dtd"> )

 

WRITE OBJECT ( *COMMENT ) TEXT ( Some comment text )

 

WRITE OBJECT ( *INSTRUCTION ) TARGET ( action ) DATA ( reply )

 

SET OBJECT ( *PREFIX ) PREFIX ( abc ) NAMESPACE ( http://salesorder.com )

 

SET OBJECT ( *DEFAULTNS ) NAMESPACE ( http://parts.com )

 

WRITE OBJECT ( *ELEMENTSTART ) NAME ( {http://acme.com}Orders )         #WRKLST - attribute list

 

WRITE OBJECT ( *TEXT ) TEXT ( Some text )

 

WRITE OBJECT ( *ELEMENTEND )

 

WRITE OBJECT ( *ELEMENTEMPTY ) NAME ( {http://acmme.com}SalesOrder )

 

WRITE OBJECT ( *ELEMENTSTART ) NAME ( {http://acme.com}Address )

 

WRITE OBJECT ( *CDATA ) TEXT ( Some text )

 

WRITE OBJECT ( *NAMESPACE ) PREFIX ( def ) NAMESPACE ( http://acme2.com )

 

WRITE OBJECT ( *ELEMENTEND )

 

WRITE OBJECT ( *DOCUMENTEND )

 

CLOSE

 

Examples

RDML

 

USE BUILTIN(JSM_COMMAND) WITH_ARGS('WRITE OBJECT(*DOCUMENTSTART)') TO_GET(#JSMSTS #JSMMSG #WRKLST)

 

RDMLX

 

use builtin(jsmx_command) with_args(#jsmxhdle1 'write object(*documentstart)') to_get(#jsmxsts #jsmxmsg #wrklst)