Preparation Materials ‐ week 2 - LCAS/RBT1001 GitHub Wiki

XML format basics

  • XML Does Not DO Anything
  • XML was designed to store and transport data.
  • XML was designed to be both human- and machine-readable.
  • XML was designed to carry data - with focus on what data is
  <!-- Comment -->
  <element></element>
  <element />
  <gangster name='George "Shotgun" Ziegler'>
  <gangster name="George &quot;Shotgun&quot; Ziegler">
  • File Extention = .xml
  • Internet media-type = application/xml text/xml

XML Syntax Rules

  • XML documents must have a root element
  • XML elements must have a closing tag
  • XML tags are case sensitive
  • XML elements must be properly nested
  • XML attribute values must be quoted

XML Tree Structure

<root>
  <child>
    <subchild>.....</subchild>
  </child>
</root>

Sample XML Document .xml

<!-- XML Elements vs. Attributes -->

<!-- WAY 1 -->
<note date="2008-01-10">
    <to>Tove</to>
    <from>Jani</from>
</note>

<!-- WAY 2 -->
<note>
    <date>2008-01-10</date>
    <to>Tove</to>
    <from>Jani</from>
</note>

<!-- WAY 3 -->
<note>
    <date>
        <year>2008</year>
        <month>01</month>
        <day>10</day>
    </date>
    <to>Tove</to>
    <from>Jani</from>
</note>
⚠️ **GitHub.com Fallback** ⚠️