AddCDataSection - cXMLDOMDocumentFragment

Encapsulates creation and addition of cDataSection nodes to a node

Type: Procedure

Parameters: String sValue

ParameterDescription
sValue The text value


Syntax
Procedure AddCDataSection String sValue

Call: Send AddCDataSection sValue


Description

AddCDataSection encapsulates creation and addition of cDataSection nodes to a node. A cDataSection is a special section of code that XML does not attempt to parse. It uses an unusual start and stop markup: <![CDATA[....your text.....]]>

If you use this procedure, make sure your text does not contain ": <![CDATA[" or "]]: >"

Example

The following example shows how you'd add cDataSection text, showing the differences from adding normal text. With a cDataSection you will leave the element text blank and actually create a child cDataSection node to store the data:

Procedure OutPutRows handle hoNode integer iFile
    integer iField iFields bRetVal
    string sTag sField
    handle hoRow hoField

    Get AddElement of hoNode "Row" "" to hoRow
    Get_Attribute DF_FILE_NUMBER_FIELDS of iFile to iFields
    For iField from 1 to iFields
        Get_Field_Value iFile iField to sField
        Move (trim(sField)) to sfield
        Get_Attribute DF_FIELD_NAME of iFile iField to sTag
 
        //the following line is changed:
        //Get AddElement of hoRow "Field" sField to hoField
        Get AddElement of hoRow "Field" "" to hoField
        Send AddAttribute Of hoField "Field-number" iField
        Send AddAttribute Of hoField "Name" sTag
        //the following line is added:
        Send AddCDataSection of hoField sField
        Send Destroy of hoField
    Loop
    Send Destroy of hoRow
End_Procedure

Note:If for any reason the node cannot be added to the document, an error will be generated.