Skip to end of metadata
Go to start of metadata

Authoring the HelloWorld gadget is a simple process requiring an average amount of xml, HTML and JavaScript knowledge. A basic HelloWorld gadget code snippet is given below.

<?xml version="1.0" encoding="UTF-8" ?>  
<Module>  
<ModulePrefs title="hello world example"/>  
<Content type="html">  
<![CDATA[
Hello, world!
]]>  
</Content>  
</Module>
  • Gadgets are specified in XML. The first line is the standard way to start an XML file. This must be the first line in the file.
  • The <Module> tag indicates that this XML file contains a gadget.
  • The <ModulePrefs> tag contains information about the gadget such as its title, description, author, and other optional features.
  • The line <Content type="html"> indicates that the gadget's content type is HTML.
  • <![CDATA[ ...insert HTML here... ]]> is used to enclose HTML when a gadget's content type is html. It tells the gadget parser that the text within the CDATA section should not be treated as XML. The CDATA section typically contains HTML and JavaScript.
  • </Content> signifies the end of the Content section.
  • </Module> signifies the end of the gadget definition.

Also refer to the tutorial Google Gadget Basics.

  • No labels