Difference between Element node and Text Node
dom, java, xml, xml-parsing
Solution
All the XML elements present in a XML is an element node. The text present in the XML elements are text nodes.
Problem
``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE people SYSTEM "validator.dtd"> <people> <student> <name>John</name> <course>Computer Technology</course> <semester>6</semester> <scheme>E</scheme> </student> <student> <name>Foo</name> <course>Industrial Electronics</course> <semester>6</semester> <scheme>E</scheme> </student> </people> ``` In simple XML language `<open-tag> data </open-tag>` is an element. As per my XML above, `<student> ... </student>` is an element and so are the other tags. In DOM parsing, there is an `Element` node and a `Text` node. Referring to the book I am using, `<student>` is an `Element` node and `<name>`, `<course>` and the other nested tags are `Text` nodes. So, if I am understanding DOM properly, all the outer tags are `Elements` and the tags that contain the actual data are `Text` nodes ?