CreateDocType Method (XDATA)


9.8A

 

The CreateDocType method generates a document type node at a specified position. The method uses the following format:

 

[label]

{object}.CreateDocType

[GIVING {return}] USING *Position={position}:

 

 

*Name={name}[,*SysId={sysid}][,*PubId={pubid}[:

 

 

*Options={mask}]

Where:

label
Optional. A Program Execution Label.
object
Required. An XDATA object.
return
Optional. A Numeric Variable that receives a value to signify a pass or fail condition for the method execution.
position
Required. A Numeric Variable or decimal number that specifies the position in the node tree where the document type is inserted.
name
Required. A Character String Variable or literal that specifies the name string value of the node represented as %name% in Note 9.
sysid
Optional. A Character String Variable or literal that specifies the sysid string value of the node represented as %sysid% in Note 9.
pubid
Option. A Character String Variable or literal that specifies the pubid string value of the node represented as %pubid% in Note 9.
mask
Optional. A Numeric Variable or decimal number that specifies a bit mask value to control the operations of this method.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. After the create operation, the node tree position does not move to the newly created node unless the OPTIONS parameter is used.

  2. The ZERO flag is set if the {return} value is zero.

  3. The OVER flag is set TRUE if the {return} variable is too small where the returned value is truncated.

  4. The EOS flag is always cleared.

  5. The {position} values are defined as follows:

  6.  

    Keyword

    Value

    Meaning...

    CREATE_AS_CURRENT_NODE

    0

    Replace the current node.

    CREATE_AS_PARENT_NODE

    1

    Insert node as the parent.

    CREATE_AS_FIRST_CHILD

    2

    Insert node as first child node.

    CREATE_AS_LAST_CHILD

    3

    Insert node as last child node.

    CREATE_AS_PREVIOUS_SIBLING

    4

    Insert node as previous sibling node.

    CREATE_AS_NEXT_SIBLING

    5

    Insert node as next sibling node.

     

  7. The *OPTIONS {mask} values are defined as follows:

  8.  

    Value

    Description

    0x1

    This bit value causes the current node tree position to be changed to the newly created node position of the attribute. See the MOVE_TO_CREATE_NODE value.

     

  9. The {return} value is a zero if the method execution is successful. Otherwise, a non-zero value is returned to indicate an error has occurred. See the XDATA Method Return Values for more details.

  10. This method can return these values:

  11.  

    Value

    Meaning

    0

    XDATA_ERR_NONE (Success)

    1

    XDATA_ERR_NO_MEM

    2

    XDATA_ERR_INVALID_POSITION_TYPE

    11

    XDATA_ERR_INVALID_POSITION

     

  12. The CreateDocType method generates a document node formatted as follows:

  13.  

    <!DOCTYPE %name% PUBLIC %pubid% %sysid%>

    Example:

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    Where:

    %name% is replaced with "html"
     
    %pubid% is replaced with "-//W3C//DTD XHTML 1.0 Strict //EN"
     
    %sysid% is replaced with "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 

 

See Also: XDATA, XDATA Methods, Method Syntax



PL/B Language Reference CreateComment Method (XDATA) CreateElement Method (XDATA)