Q&A

Q1:If you have a node tree with three layers, how do you traverse the nodes at the third level?
A1: Using either the firstChild or lastChild property will take you to the second level. A second use of the firstChild or lastChild property will take you to the third level. Using the nextSibling or previousSibling property will then allow you to traverse the siblings of that node.
Q2:Under what circumstances would you extract the data from a node using the nodeTypedValue property rather than the text property?
A2: If the data is typed, extracting it using the nodeTypedValue property will preserve the type information, whereas the text property is always just simple text.
Q3:Under what circumstances would you perform a replaceChild() operation? ...

Get Sams Teach Yourself XML in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.