## org.apache.cocoon.framework
Class XMLConfigurations

    java.lang.Object
      |
      +--org.apache.cocoon.framework.Configurations
            |
            +--org.apache.cocoon.framework.XMLConfigurations

public class XMLConfigurations
extends Configurations

This class makes a Configurations object from an XML source.

Version:
  $Revision: 1.3 $ $Date: 2000/02/13 18:29:22 $
Author:
  Donald Ball

Fields inherited from class org.apache.cocoon.framework.Configurations
`baseName, properties, root`

Constructor Summary
`XMLConfigurations()` Creates a new empty Configurations
`XMLConfigurations(java.lang.String file)` Creates a new Configurations object from the specified file

Method Summary
`protected static void` `buildConfigurations(XMLConfigurations confs, org.w3c.dom.Node source_node)` Builds a new Configurations object from the source node
`protected static void` `buildConfigurations(XMLConfigurations confs, org.w3c.dom.Node source_node, java.lang.String prefix)` Builds a new Configurations object from the source node with the given prefix
`java.lang.Object` `get(java.lang.String key)` Returns the value of the key, or null if the key has no value
`java.lang.Object` `get(java.lang.String key, java.lang.Object def)` Returns the value of the key, or the default if the key has no value
`Configurations` `getConfigurations(java.lang.String key)` Create a Configurations child consisting of all values that begin with the given key
`java.lang.Object` `getNotNull(java.lang.String key)` Returns the value of the key, or tosses a RuntimeException if the key has no value
`java.util.Vector` `getVector(java.lang.String key)` Returns a Vector of values.
`static void` `main(java.lang.String[] argv)` Strictly for testing
`void` `set(java.lang.String key, java.lang.Object value)` Associates the value with the key
`void` `setBasename(java.lang.String my_prefix)` Sets the prefix
`protected static java.lang.String` `stripBoundingWhitespace(java.lang.String input)` A utility routine that strips the starting and ending whitespace from the given string
`java.lang.String` `toString()`

Methods inherited from class org.apache.cocoon.framework.Configurations
`getAnyConfig, getProperties, keys, put`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### XMLConfigurations

    public XMLConfigurations()

  Creates a new empty Configurations

### XMLConfigurations

    public XMLConfigurations(java.lang.String file)
                      throws java.io.IOException,
                             org.xml.sax.SAXException

  Creates a new Configurations object from the specified file
  Parameters:
    `file` - the name of the file
  Throws:
    `java.io.IOException` - if the file does not exist or is unreadable
    `org.xml.sax.SAXException` - if the XML is not well formed

Method Detail

### main

    public static void main(java.lang.String[] argv)
                     throws java.lang.Exception

  Strictly for testing

### buildConfigurations

    protected static void buildConfigurations(XMLConfigurations confs,
                                              org.w3c.dom.Node source_node)

  Builds a new Configurations object from the source node
  Parameters:
    `confs` - the Configurations object to manipulate
    `source_node` - the node from which to read

### buildConfigurations

    protected static void buildConfigurations(XMLConfigurations confs,
                                              org.w3c.dom.Node source_node,
                                              java.lang.String prefix)

  Builds a new Configurations object from the source node with the given prefix
  Parameters:
    `confs` - the Configurations object to manipulate
    `source_node` - the node from which to read
    `prefix` - the prefix to use

### get

    public java.lang.Object get(java.lang.String key)

  Returns the value of the key, or null if the key has no value
  Overrides:
    `get` in class `Configurations`
  Parameters:
    `key` - the key
  Returns:
    the value

### set

    public void set(java.lang.String key,
                    java.lang.Object value)

  Associates the value with the key
  Overrides:
    `set` in class `Configurations`
  Parameters:
    `key` - the key
    `value` - the value

### get

    public java.lang.Object get(java.lang.String key,
                                java.lang.Object def)

  Returns the value of the key, or the default if the key has no value
  Overrides:
    `get` in class `Configurations`
  Parameters:
    `key` - the key
    `def` - the default value
  Returns:
    the value

### getNotNull

    public java.lang.Object getNotNull(java.lang.String key)

  Returns the value of the key, or tosses a RuntimeException if the key has no value
  Overrides:
    `getNotNull` in class `Configurations`
  Parameters:
    `key` - the key
  Returns:
    the value
  Throws:
    `java.lang.RuntimeException` - if the key has no value

### getVector

    public java.util.Vector getVector(java.lang.String key)

  Returns a Vector of values. FIXME better description
  Overrides:
    `getVector` in class `Configurations`
  Parameters:
    `key` - the key
  Returns:
    the vector

### getConfigurations

    public Configurations getConfigurations(java.lang.String key)

  Create a Configurations child consisting of all values that begin with the given key
  Overrides:
    `getConfigurations` in class `Configurations`
  Parameters:
    `key` - the key
  Returns:
    the child Configurations object

### setBasename

    public void setBasename(java.lang.String my_prefix)

  Sets the prefix
  Overrides:
    `setBasename` in class `Configurations`
  Parameters:
    `my_prefix` - the prefix

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### stripBoundingWhitespace

    protected static java.lang.String stripBoundingWhitespace(java.lang.String input)

  A utility routine that strips the starting and ending whitespace from the given string
  Parameters:
    `input` - the input string
  Returns:
    the input string with no bounding whitespace

Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.