Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

IXMLDOMEntityReference

Represents an entity reference node.

[C/C++]

IXMLDOMEntityReference has no unique properties or methods of its own, but exposes the same objects and properties as the IXMLDOMNode object.

[Script]

Example

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var root, nodeEntityReference;
xmlDoc.async = false;
xmlDoc.loadXML("<root/>");
if (xmlDoc.parseError.errorCode <> 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   nodeEntityReference = xmlDoc.createEntityReference("nbsp");
   root = xmlDoc.documentElement;
   root.appendChild(nodeEntityReference);
   alert(xmlDoc.xml);
}
[Visual Basic]

Example

Dim xmlDoc As New Msxml2.DOMDocument50
Dim root As IXMLDOMElement
Dim nodeEntityReference As IXMLDOMEntityReference
xmlDoc.async = False
xmlDoc.loadXML "<root/>"
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   Set nodeEntityReference = xmlDoc.createEntityReference("nbsp")
   Set root = xmlDoc.documentElement
   root.appendChild nodeEntityReference
   MsgBox xmlDoc.xml
End If

Remarks

If the XML parser expands entity references while building the structure model, no EntityReference objects appear in the tree.

XML does not require non-validating processors to handle external entity declarations (those made in the external subset or declared in external parameter entities). This means that parsed entities declared in the external subset need not be expanded, and therefore the replacement value of the entity might not be available. If available, the replacement value of the referenced entity appears in the child list of EntityReference.

The resolution of the children of the EntityReference (the replacement value of the referenced entity) can be evaluated. Actions such as calling the childNodes property are assumed to trigger the evaluation. Character entities are expanded by the XML parser and do not appear as entity references, but instead appear within the character text in Unicode.

Versioning

MSXML 2.0 and later

Requirements

Implementation: msxml5.dll, msxml2.lib

[C/C++]

Header and IDL files: msxml2.h, msxml2.idl

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

childNodes Property | IXMLDOMNode | IXMLDOMEntityReference Members | IXMLDOMEntity | DOMDocument