AddEntityReference method: XmlNode class

Syntax

AddEntityReference(Name)

Description

Use the AddEntityReference method to add an entity reference. An entity reference refers to the content of the named entity. The new entity reference is appended to the list of child nodes. In the generated XML, the entity reference is automatically prefaced with the '&' character and suffixed with a semi-colon.

The named entity must exist in the document type declaration (DTD).

To insert an entity reference at a particular place in the list of nodes, use the InsertEntityReference method instead.

Parameters

Parameter Description

Name

Specify the name of the entity to which this reference refers to.

Returns

A reference to the newly created entity reference.

Example

For example:

Local XmlDoc &inXMLDoc;
Local XmlNode &childNode;
Local XmlNode &entityRef;

&inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><myroot/>");
&childNode = &inXMLDoc.DocumentElement.AddElement("child");
&entityRef = &childNode.AddEntityReference("MyURL");

The preceding PeopleCode program produces the following XML:

<?xml version="1.0"?>
<myroot>
  <child>
&MyURL;  </child>
</myroot>