HTML XML Use Case 05

From W3C Wiki
Jump to: navigation, search

Generating XML using string-concatenation

The way most authors generate HTML is by simply concatenating strings together. WordPress, the software behind Wikipedia, and many many other projects on the web work this way. Producing HTML in this way is very easy. The only thing you need to know are variables and "echo". Generating HTML this way is also guaranteed to lead to subtle errors at times. E.g. an ampersand that is not escaped or a missing end tag.

To do XML you really need to produce it by serializing a tree. Otherwise you are bound to bump into subtle bugs, such as unexpected Unicode characters. However, this means that producing XML is much more complicated than producing HTML. You need to have a tree model that you can manipulate, a serializer for that tree model, and maybe some other associated tools. This makes XML too hard for typical authors.

Potential solution: "XML5"

If XML is "replaced" by a fully backwards compatible version of XML that never fails with parsing the requirements on authoring XML will be much simpler since mistakes are tolerated. [1]