Bookmark and Share Share

Declaring Namespaces

You must declare these namespaces in a mashup script:

  • Namespaces used in component services

  • Namespaces used in the construction of input parameters, output parameters or variables.

  • The macro reference namespace for any custom statements (macros) that you use in your mashup. See Calling a Macro in a Mashup Script for more information.

  • The EMML namespace.

Note: see EMML Namespaces for the currently supported namespaces for EMML and macros.

You declare namespaces using the xmlns attribute on any element in a mashup script. Typically, it is easier to define all the namespaces used in the script on the <mashup> element. For macros, especially in a macro library, it is a good practice to define namespaces on <macro>.

This example shows <mashup> with the default namespace set to EMML:

<mashup xmlns="http://www.openemml.org/2009-04-15/EMMLSpec" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://http://www.openemml.org/2009-04-15/EMMLSpec/  ../schemas/EMMLSpec.xsd" 
    xmlns:atm="http://www.w3.org/2005/Atom" 
    xmlns:xhtml="http://www.w3.org/1999/xhtml" 
     name="blogPost"> 
... 
  <constructor outputvariable="$xmlPost"> 
    <atm:entry> 
      <title type="text">Publishing from the Mashup Server</atm:title> 
      <content type="xhtml"> 
        <xhtml:div><p>{$thoughts}</p></xhtml:div> 
      </content> 
      <author><name>Mia</name><email>mia@myCo.com</email></author> 
    </atm:entry> 
  </constructor> 
... 
  <directinvoke enpoint="$bloggerURL" outputvariable="$blogstatus" 
    method="post" header="$myheader" requestbody="$xmlPost" /> 
</mashup>

It has two additional namespace declarations, for Atom and XHTML, that are used in the <constructor> statement to build the body of a <directinvoke> that posts to a blogging service. Namespaces are simply valid URIs - they can be URLs or URNs.