XML DOM » Document » createEntityReference

Syntax:
document.createEntityReference(name)
name
Receives the name to be assigned to the newly created EntityReference object.

This method creates a new EntityReference object of the specified name.

Creating an instance of this object does not automatically include it in the XML Document tree, and so its parentNode property is set to null.

Examples

Code:
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("quotations.xml")

Dim root, objNewEntityRef, currNode
Set root = objXMLDoc.documentElement
Set objNewEntityRef = objXMLDoc.createEntityReference("newRef")
root.appendChild(objNewEntityRef)

Set currNode = root.lastChild
document.write(currNode.nodeType)
document.write("<br>" currNode.nodeName)
Output:
5
newRef
Explanation:

This example creates an EntityReference by the name of 'newRef', and appends it to the children of the document's root element. It then displays the type and name of this new node.

Language(s): VBScript

See Also: