IMSEVimse 1.0
Draft

se.kth.cid.xml
Class XmlLoaderHelper

java.lang.Object
  |
  +--se.kth.cid.xml.XmlLoaderHelper
Direct Known Subclasses:
XmlMetaDataHandler

public class XmlLoaderHelper
extends Object

This class contains utility functions for loading and saving XML components.

Version:
$Revision: 1.1.1.1 $
Author:
Mikael Nilsson

Constructor Summary
protected XmlLoaderHelper()
          Constructing an XmlLoaderHelper is not allowed.
 
Method Summary
static XmlElement buildDataTags(String[] tags)
          Builds a DataTags element.
static XmlElement buildDataTagStyles(String[] tags)
          Builds a DataTagStyles element.
static XmlElement getSubElement(XmlElement el, String elname)
           
static String loadAttribute(XmlElement el, String attname, String def)
           
static String loadAttribute(XmlElement el, String attname, String def, boolean emptyAllowed)
           
static boolean loadBoolean(XmlElement el, String attr, String def)
          Loads a boolean attribute.
static int loadPositiveInteger(XmlElement el, String attr, String def, boolean allowInf)
          Loads a positive integer attribute.
static XmlElement maybeGetSubElement(XmlElement el, String elname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlLoaderHelper

protected XmlLoaderHelper()
Constructing an XmlLoaderHelper is not allowed.
Method Detail

loadAttribute

public static String loadAttribute(XmlElement el,
                                   String attname,
                                   String def)
                            throws XmlStructureException

loadAttribute

public static String loadAttribute(XmlElement el,
                                   String attname,
                                   String def,
                                   boolean emptyAllowed)
                            throws XmlStructureException

getSubElement

public static XmlElement getSubElement(XmlElement el,
                                       String elname)
                                throws XmlStructureException

maybeGetSubElement

public static XmlElement maybeGetSubElement(XmlElement el,
                                            String elname)
                                     throws XmlStructureException

loadBoolean

public static boolean loadBoolean(XmlElement el,
                                  String attr,
                                  String def)
                           throws XmlStructureException
Loads a boolean attribute. Allowed values are "true" and "false".
Parameters:
el - the element to load from.
attr - the name of the attribute containing a boolean.
Returns:
the loaded boolean.
Throws:
XmlStructureException - if the attribute was invalid.

loadPositiveInteger

public static int loadPositiveInteger(XmlElement el,
                                      String attr,
                                      String def,
                                      boolean allowInf)
                               throws XmlStructureException
Loads a positive integer attribute. If allowInf is true, the string "infinity" is interpreted as Integer.MAX_VALUE.
Parameters:
el - the element to load from.
attr - the name of the attribute containing a positive integer.
Returns:
the loaded integer.
Throws:
XmlStructureException - if the attribute was invalid.

buildDataTags

public static XmlElement buildDataTags(String[] tags)
                                throws XmlElementException
Builds a DataTags element.
Parameters:
tags - the DataTags wanted in the element.
Returns:
a DataTags XmlElement.

buildDataTagStyles

public static XmlElement buildDataTagStyles(String[] tags)
                                     throws XmlElementException
Builds a DataTagStyles element.
Parameters:
tags - the DataTagStyles wanted in the element.
Returns:
a DataTags XmlElement.

IMSEVimse 1.0
Draft

Centre for user-oriented IT -design