|
February 22, 2002 DOM Tree Representation of Entity References Tips: February 2002
Yehuda Shiran, Ph.D.
|
|
The DOM tree creates a child for every entity reference. An interesting situation arises when an entity reference is embedded inside an XML string. Will the entity reference be a child of the whole XML string?
Let's look at an example. Here is the
The DOM tree splits the text of this description element to three nodes:
Let's show that indeed this is the case. First, we find the list of
Our description is the first and only instance, so its index is 0. The following script prints the text values of description's three children:
When running this script, you should get the three strings above.
People who read this tip also read these tips: Look for similar tips by subject: |