Documentation
 
Installation
 
Setup guide
 
Advanced setups
 
  SSL Setup
  Filters
  Scripts
Schemas docs
 
Other
 
  Security
  XML basics
 
  Built with Apache Forrest logo Financial help logo
 
Designed for Firefox logo Java.net member logo
 


by SuperBonBon  PDF 

XML basics



What is XML  > A few rules  > A few examples taken from JAFS  > How to verify a document ?  > Still lost ? 

What is XML

XML is a markup language derivated from SGML, so it is only a language based on tags with very few syntax rules. XML allows you to structure the information with tag names. JAFS uses its own tag set ( or grammar ) for all its configuration files.

Documents are said to be :

  • well formed : when they follow the XML syntax rules.
  • valid : when they match a grammar defined in a DTD (Document Type Definition) or XML schema file.

You can edit XML files with a simple text editor such as Notepad under windows or VI under Unix.

A few rules

  • An XML document must always start with the following declaration

                <?xml version="1.0"?>
              
  • All non empty tags must have an opening and a closing tag

                <some-tag>content</some-tag>
              

    a closing tag starts as you can see with "</"

  • An empty tag ends with "/>"

                <some-empty-tag/>
              
  • The tag can contains either some data or other tags :

                <some-tag>
                  data
                  <other-empty-tag/>
                </some-tag>
              
  • A tag can have attributes

                <some-empty-tag some-attribute="attribute value"/>
              
  • The top level tag is named the document root

                <root-tag>
                  <a-child-tag/>
                </root-tag>
              
  • Comments are used within <!-- -->

                <root-tag>
                  <!-- a comment inside the tag -->
                </root-tag>
              

A few examples taken from JAFS

SSL configuration taken from service_config.xml

      <ssl-settings>
        <store-settings name="default">
          <key-store password="somePassword" type="jks">
            <path>  ../config/ssl/serverKeyStore.jks</path>
          </key-store>
          <cacerts-store password="somePassword" type="jks">
            <path>../config/ssl/serverCACerts.jks</path>
          </cacerts-store>
          <crls reload-time="10">
           <crl location="http://www.someServer.com/someCRL.crl" name="MyFirstCRL"/>
           <crl location="http://www.someOtherServer.com/someCRL.crl" name="MyOtherCRL"/>
          </crls>
        </store-settings>
      </ssl-settings>
      

How to verify a document ?

To make sure that a configuration file is "well formed" after an edition, try opening it with your favorite Internet browser, if you get an error message, it means that you've done something wrong, your browser should give you the line number where the error is located and a detailed error message

Wrong configuration file XML syntax after edition, here the 'sslSettings' tag is not closed correctly :

Invalid XML

Looks better after correction :

Valid XML

Still lost ?

If you're still lost with XML you can find tutorials at here or here.


 

Copyright © 2005 SuperBonBon Industries. All rights reserved.
Unless otherwise expressly noted, the contents of these pages are licensed under the Creative Commons - Attribution / Share Alike license.