次の方法で共有


IXMLDOMEntityReference

 

Represents an entity reference node.

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

JScript Example

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");  
var root, nodeEntityReference;  
xmlDoc.async = false;  
xmlDoc.loadXML("<root/>");  
if (xmlDoc.parseError.errorCode != 0) {  
   var myErr = xmlDoc.parseError;  
   WScript.Echo("You have error " + myErr.reason);  
} else {  
   nodeEntityReference = xmlDoc.createEntityReference("nbsp");  
   root = xmlDoc.documentElement;  
   root.appendChild(nodeEntityReference);  
   WScript.Echo (xmlDoc.xml);  
}  

Output

<root></root>

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.

Requirements

Implementation:

msxml3.dll, msxml2.lib (MSXML 3.0)

msxml6.dll, msxml6.lib (MSXML 6.0)

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

Versioning

Implemented in: MSXML 3.0, MSXML 6.0

See Also

childNodes Property
IXMLDOMNode
IXMLDOMEntityReference Members
IXMLDOMEntity
IXMLDOMDocument-DOMDocument