Difference between revisions of "HTML XML Use Cases"

From W3C Wiki
Jump to: navigation, search
(Created page with "The following initial use cases have been identified. * HTML XML Use Case 01 - Using an XML toolchain to consume HTML * HTML XML Use Case 02 - Using an HTML toolchain t…")
 
(add chapter on Generating XML using string-concatenation)
Line 1: Line 1:
The following initial use cases have been identified.  
+
The following initial use cases have been identified.
  
 
* [[HTML XML Use Case 01]] - Using an XML toolchain to consume HTML
 
* [[HTML XML Use Case 01]] - Using an XML toolchain to consume HTML
Line 5: Line 5:
 
* [[HTML XML Use Case 03]] - Islands of HTML in XML
 
* [[HTML XML Use Case 03]] - Islands of HTML in XML
 
* [[HTML XML Use Case 04]] - Islands of XML in HTML
 
* [[HTML XML Use Case 04]] - Islands of XML in HTML
* [[HTML XML Use Case 05]] - Making XML easier to use (generating XML with non-XML tools, as HTML is often generated)
 
 
* [[HTML XML Use Case 06]] - XForms
 
* [[HTML XML Use Case 06]] - XForms
 +
 +
== 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.

Revision as of 12:21, 21 January 2011

The following initial use cases have been identified.

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.