[Previous] [Contents] [Next]
Q & A
- Q Is it easier to process XML than HTML?
- A Yes, for two reasons.
The first is that you normally model your data better with XML than with HTML. You can better capture the hierarchical structure, the semantics, and the meta-data of your information without bothering too much with formatting.
The second reason is that XML files are well formed. You have a much better idea what comes in the data stream. HTML files, on the other hand, can take many forms and appearances.
- Q Which processing approach do you recommend?
- A It depends on the problem that you want to tackle.
For example, if you want to count the number of times the element tool is used in an XML document, it is not very efficient to first build a tree representation of your document and then traverse it. When you have to deal with complex structural objects such as tables that require a lot of look-ahead, the tree-based approach simplifies the processing task.
Also of importance is that the DOM, which is tree-based, is an official W3C recommendation now, and a lot of tools will support it as the standard API.
[Previous] [Contents] [Next]