Skip to content Skip to navigation

Connexions

You are here: Home » Content » Combining XML Languages

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • CNX Documentation display tagshide tags

    This module is included inLens: Connexions Documentation
    By: ConnexionsAs a part of collection:"Connexions Tutorial and Reference"

    Comments:

    "The canonical how-to guide to using Connexions."

    Click the "CNX Documentation" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • SHN CNX Workshop display tagshide tags

    This module is included inLens: Stategic Horizon Network Workshop on Alternative Couseware -- Connexions Session
    By: ConnexionsAs a part of collection:"Connexions Tutorial and Reference"

    Comments:

    "If you are ready to start creating new materials in Connexions, or adapting and reusing existing materials, this guide and tutorial will help you get started. Questions are always welcome to […]"

    Click the "SHN CNX Workshop" link to see all content selected in this lens.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

Combining XML Languages

Module by: Sarah Coppin, Brent Hendricks, Connexions. E-mail the authors

User rating (How does the rating system work?)
Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

:
(0 ratings)

Summary: This module explains how to use XML namespaces and DTDs to combine multiple XML languages in the same document.

XML allows you to create documents in custom markup languages. But what if you want to combine markup from multiple languages in the same document? What if there are one or more tags that exist in both languages, but with different meanings? You could, for example, have a <table> tag in HTML and one in a language describing office furniture as well. How do you use these tags unambiguously, without losing functionality?

The solution is to use an extension to XML called namespaces (See the W3C's recommendation, Namespaces in XML). A namespace associates a unique global identifier (usually a URI) with a particular set of tags and their usage rules. To declare a namespace for a particular tag, set the xmlns attribute to the value of the unique identifier.

You can also define a namespace prefix for use in your document. To do this, use a modified version of the xmlns attribute. For example, you would use the attribute xmlns:foo="http://somewhere.org/foo" to associate the prefix foo with the namespace identifier http://somewhere.org/foo. You can then indicate which tags come from that namespace by adding the appropriate prefix to each tag. Thus, the bar tag in foo's namespace would be written as <foo:bar> and </foo:bar>.

When you use the default namespace any children of that tag lacking an explicit prefix will be assumed to have come from the same namespace. This allows you to define a default namespace for all of the children of a tag. This is especially useful when used on the root node, which is the outermost tag in a document.

Example 1

For CNXML 0.6 there is only one schema. The document tag will contain the namespace for all available languages and will look like this:


    <document xmlns="http://cnx.rice.edu/cnxml"
              xmlns:md="http://cnx.rice.edu/mdml/0.4"
              xmlns:bib="http://bibtexml.sf.net/"
              xmlns:m="http://www.w3.org/1998/Math/MathML"
              xmlns:q="http://cnx.rice.edu/qml/1.0"
              id="new"
              cnxml-version="0.6"
              module-id="new">
      

Content actions

Give Feedback:

E-mail the module authors | Rate module ( How does the rating system work?)

Rating system

Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

(0 ratings)

Download:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.

| A lens (?)

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks