The_concept_of_the_content


 * [[image:dorothy.jpg]]

Dorothy Hoskins || ** Exploring the concept of the content model ** || =** A).- ** Exploring the concept of the content model = By following the structure and meaning of the content model like a recipe, we can create a new instance of the content model as an XML document.   The XML content model provides a "recipe" to construct an XML document instance. The ingredients of the recipe are the XML elements, also called "tags" and their attribute, and the content of these elements and attributes (their "values"). What are the ingredients we see in the cookbook recipe XML file? The structure of the file has a root element, inside of which we need to put the content of each recipe in the correct order. This content model is informal, in that it doesn't have a defined Document Type Definition (DTD) attached to it, but even so there is a certain logic that we can understand. The name of the recipe is important for understanding what we are making. The kind of recipe helps us when we are looking for recips for a main dish, side dish, desert, etc. Then follows the general information about this recipe  with an appetizing photograph. The number of servings and the cooking time in minutes help us decide if we have enough time and whether it will feed enough people, even before we start assembling the ingredients. The difficulty tells us what to expect in the complexity of executing the recipe. When we look at the ingredients, we need to know how many or how much of each one we will need - including what the unit of measurement is (tablespoon, cup, etc.) . By reading the steps of the cooking process, we find out how the ingredients are combined and cooked and what utensils, or containers (pots and baking dishes) we will need for each step. Why are some values in the text of the element, while some values are in the attributes? The elements themselves are the building blocks of the content model - they provide the structural components that organize information in a meaningful way. Generally, we need to think of attributes as adjectives which add information about the element. For example, @unidad describes the unit of measure for each ingredient, and @numero tell us the order of the steps. As for, the value of the URL could have been in an attribute  because we don't intend to display this long URL on the webpage, we just want the image file to be presented. If we wanted to have a database behind the recipes, we might need to constrain the type of values (integer, decimal, text, yes/no) and make decisions about what is required and optional content for a recipe. This type of decision is common in a content model - and in some cases it is important. For example, in the @cantidad, will we want only numbers or could there be text such as "a pinch" for salt? Is @cantidad ever optional for ingredients, or is it requird for every ingredient? The beauty of XML is that the content model can be so descriptive and rich about the information, and can contain information inside information to a very granular level of detail. Compared with a spreadsheet or a relational data table, an XML content model better expresses the structural relationships of different kinds of content without complicated logic like data table "joins". The unfortunate aspect about XMl content models is that everyone can decide what the structural components will be called and how they will be organized. This means that unless there is agreement among different parties about that conception of the content, it may happen that there are competing content mdoels for the same kind of information. Usually when the information is important enough, a "standard" content model to use is decided by interested parties who want to interchange information reliably among systems. Once agreement on a standard is achieved, the content model is codified in a DTD or schema so that everyone can make their XML instance documents in the same way.

**B).- Test your understanding ** As an exercise, review the following translated XML recipe.
 * 1) <span style="color: #ff00ff; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">Can you determine the names of the elements and attributes in English that match each of the names in Spanish?
 * 2) <span style="color: #ff00ff; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">Make a table that lists the names of each element and attribute in each language.

<span style="color: #ff0000; font-family: Verdana,Geneva,sans-serif;">To get a completely English version of the recipe. copy the text of the comments surrounded by and paste them over the Spanish text.


 * C).- Receta XML/ XML recipe **

<?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/xsl" href="fitxa_recepta.xsl" ?> Besugo al horno Pescado <general_information> http://media-cache-ec0.pinimg.com/236x/7d/1c/28/7d1c28f81bdcb604a6a59b872653408c.jpg 4 45  Muy fácil </general_information> Besugo Limón <ingredient quantity="1" unit="cuchara sopera">Pan rallado <ingredient quantity="2" unit="dientes">Ajo <ingredient quantitat="1/2" unit="dl">Vino blanco Aceite Perejil Sal Lavamos las patatas bajo el grifo a conciencia. Introducimos en una cazuela, cubrimos con agua, añadimos las hojas de laurel y sazonamos al gusto. Ponemos a fuego alto y, en cuanto empiece a hervir, bajamos el fuego y dejamos cocer a fuego lento durante 15 minutos. Sacamos y dejamos templar. Quitamos la piel y cortamos en rodajas gruesas. Colocamos las rodajas de patatas sobre una fuente de horno. Lavamos y sazonamos el besugo. Le realizamos unos cortes en el lomo, con un cuchillo afilado, e introducimos en cada corte media rodaja de limón. Colocamos el besugo encima de las patatas. En una sartén con cuatro cucharadas de aceite de oliva doramos los ajos, pelados y cortados en láminas, añadimos el caldo de pescado y el vino, removemos y vertemos sobre el besugo. Introducimos la fuente en el horno (en la base) que tendremos precalentado a 170º, durante 20-25 minutos, dependiendo del tamaño del besugo. Comprobamos que el besugo está hecho y sacamos del horno.

<span style="color: #30d334; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">D).- Questions

<span style="font-family: Verdana,Geneva,sans-serif; font-size: 130%;">When people who speak different languages use XML, <span style="color: #0000ff; font-family: Verdana,Geneva,sans-serif; font-size: 130%;"> how do they decide which language to use for the element and attribute names <span style="font-family: Verdana,Geneva,sans-serif; font-size: 130%;">? If you need to make a recipe in English, c <span style="color: #0000ff; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">an you use the Spanish names and just put English text in the XML?


 * E).- Apply your Knowledge **


 * 1) <span style="color: #0000ff; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">Take the text of the following recipe and tag it as an XML document following the elements and attributes of the recipe content model.
 * 2) <span style="color: #0000ff; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">Add new elements and attributes, if necessary.
 * 3) <span style="color: #0000ff; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">Use the XSLT to display your recipe. How does it look? Is all the information displayed as you would like?

<span style="color: #30d334; font-family: Verdana,Geneva,sans-serif; font-size: 130%;">F).- Recip