|
February 23, 2002 Node Splitting by Entity References Tips: February 2002
Yehuda Shiran, Ph.D.
|
|
In Internet Explorer, whenever there is an entity reference within an XML element's string, the DOMDocument tree builder splits this string in order to isolate the entity reference. The entity reference must occupy a child node by itself. So there needs to be a string portion before the entity, and a string portion following it. If the entity reference is at the beginning of the string or at its end, only two children will be created.
Here is the
We find the author objects in the DOMDocument tree as follows:
Our author is the first and only instance, so its index is 0. The following script prints the text values of author's two children, and the entity definition (2nd child's child):
When running this script in Internet Explorer, you should get three stings. The string before the entity reference is "author: ", the entity reference (after substitution) is "John Smith", and the original entity definition is also "John Smith".
People who read this tip also read these tips: Look for similar tips by subject: |