XML Syntax

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

Extensible Markup Language (XML) A simple, very flexible text format derived from SGML (ISO 8879).

The XML Document Object Model (DOM) defines a standard set of commands that parsers should expose so you can access HTML and XML document content from your programs. A DOM for XML is an object model that exposes the contents of an XML document. The W3C's Document Object Model (DOM) Level 1 Specification currently defines what a DOM should expose as properties, methods, and events.

Rules:

  • In XML, it is illegal to omit the closing tag.
  • XML tags are case sensitive.
  • Elements must be properly nested.
  • One element per page must be the parent of all other elements, the "root" element.
  • Some characters have a special meaning in XML.
  • An XML element is everything from (including) the element's start tag to (including) the element's end tag.
  • An element can contain other elements, simple text or a mixture of both.
  • Elements can also have attributes.
  • XML Names can contain letters, numbers, and other characters
  • XML Names must not start with a number or punctuation character
  • XML Names must not start with the letters xml (or XML, or Xml, etc)
  • XML Names cannot contain spaces

 

Sample XML from Sims 2 Storybook Viewer

 <?xml version="1.0" encoding="UTF-8"?>
 <StoryCreator>
   <ClientEnvironment>
     <AppVersion>1.0.0.971</AppVersion>
     <LanguageCode>en-us</LanguageCode>
     <LanguageId>1</LanguageId>
     <SKU>14726</SKU>
     <GameVersion>2141707388.153.1</GameVersion>
   </ClientEnvironment>
   <ExchangeMetadata>
     <Album>
       <ID>0x00000001</ID>
       <FamilyName><![CDATA[]]></FamilyName>
       <FamilyId>0</FamilyId>
       <LinkName></LinkName>
       <NeighborhoodName><![CDATA[Pleasantview]]></NeighborhoodName>
       <LotID>0x00000000</LotID>
       <LotName><![CDATA[]]></LotName>
       <Title><![CDATA[]]></Title>
       <Style>Blog</Style>
       <Entry>
         <Title><![CDATA[]]></Title>
         <ThumbnailFilename>thumbnail_6ef1c7e8_af7830ec.jpg</ThumbnailFilename>
         <Snapshot>snapshot_6ef1c7e8_af7830ec.jpg</Snapshot>
         <Text><![CDATA[Little shrimp grows up.  Now will he be able to get Daisy Jane to take him seriously?]]></Text>
         <TextResourceId>0x00000001</TextResourceId>
         <TimeStamp>4/25/2005 19:37:34</TimeStamp>
       </Entry>
       <Entry>
         <Title><![CDATA[]]></Title>
         <ThumbnailFilename>thumbnail_af781efb_2f782402.jpg</ThumbnailFilename>
         <Snapshot>snapshot_af781efb_2f782402.jpg</Snapshot>
         <Text><![CDATA[The boys were equally upset about the loss of their father. ]]></Text>
         <TextResourceId>0x00000001</TextResourceId>
         <TimeStamp>4/25/2005 19:37:17</TimeStamp>
       </Entry>
       <KeywordList>
         <Keyword>Sims Life Stories</Keyword>
       </KeywordList>
       <UploadDescription><![CDATA[Pleasantview story Chapter I - not just another boring simtail.  Updated Feb 7, 2005.]]></UploadDescription>
     </Album>
   </ExchangeMetadata>
 </StoryCreator>