Combining XML and XHTML
To use combined XHTML and XML tags, you will need to instruct the browser
to render the XHTML tags as they should be and provide style definitions for
your own XML tags. Generally, it is a 5 step process.
- Put all XHTML code on the default namespace by adding the attribute
xmlns="http://www.w3.org/1999/xhtml"
to the html tag.
- Add other namespace attributes for the html tag that correspond
to the namespaces of the involved XML document(s).
- Example:
- <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:mod="http://cs2.uwsuper.edu/sb/model">
- Add namespace prefixes for all involved XML tags appearing within the
default XHTML namespace.
- Example:
- <td><mod:type>color laser</mod:type></td>
- Add namespaces in the style specifications for the involved XML
documents.
- Invoke the style definition files.
- Example:
- <style type="text/css">
@import url(model5.css);
@import url(parts6.css);
</style>