Package diva.util.xml

Class CompositeBuilder

  • All Implemented Interfaces:
    XmlBuilder

    public class CompositeBuilder
    extends AbstractXmlBuilder
    CompositeBuilder is a non-validating parser that uses other builders to parse and generate XML files from arbitrary collections of objects. (FIXME - more documentation here)
    Version:
    $Id$
    Author:
    Michael Shilman
    Pt.AcceptedRating:
    Red
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BUILDER_DECLS_TAG
      Indicates a group of builder declarations
      static java.lang.String BUILDER_TAG
      Indicates a builder for a recognizer
      static java.lang.String CLASS_TAG
      Indicates a recognizer class
      static java.lang.String DTD_1
      The DTD for builder declarations.
      static java.lang.String DTD_URL
      The URL where the DTD is stored.
      static java.lang.String PUBLIC_ID
      The public identity of the RCL dtd file.
      static java.lang.String TAG_TAG
      Indicates the tag of a recognizer
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBuilderDecls​(java.io.Reader in)
      Add all of the builder declarations in the given XML document to the builder map.
      java.lang.Object build​(XmlElement elt, java.lang.String type)
      Build an object based on the XML element by looking up the appropriate builder and calling that builder on the element.
      XmlElement generate​(java.lang.Object in)
      Build an XML element based on given object by looking up the appropriate builder based on the object's class name and calling that builder's generate method on the object.
      static void main​(java.lang.String[] args)
      Simple test of this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PUBLIC_ID

        public static final java.lang.String PUBLIC_ID
        The public identity of the RCL dtd file.
        See Also:
        Constant Field Values
      • DTD_URL

        public static final java.lang.String DTD_URL
        The URL where the DTD is stored.
        See Also:
        Constant Field Values
      • DTD_1

        public static final java.lang.String DTD_1
        The DTD for builder declarations.
        See Also:
        Constant Field Values
      • CLASS_TAG

        public static final java.lang.String CLASS_TAG
        Indicates a recognizer class
        See Also:
        Constant Field Values
      • TAG_TAG

        public static final java.lang.String TAG_TAG
        Indicates the tag of a recognizer
        See Also:
        Constant Field Values
      • BUILDER_TAG

        public static final java.lang.String BUILDER_TAG
        Indicates a builder for a recognizer
        See Also:
        Constant Field Values
      • BUILDER_DECLS_TAG

        public static final java.lang.String BUILDER_DECLS_TAG
        Indicates a group of builder declarations
        See Also:
        Constant Field Values
    • Constructor Detail

      • CompositeBuilder

        public CompositeBuilder()
    • Method Detail

      • addBuilderDecls

        public void addBuilderDecls​(java.io.Reader in)
                             throws java.lang.Exception
        Add all of the builder declarations in the given XML document to the builder map.
        Throws:
        java.lang.Exception
      • build

        public java.lang.Object build​(XmlElement elt,
                                      java.lang.String type)
                               throws java.lang.Exception
        Build an object based on the XML element by looking up the appropriate builder and calling that builder on the element.
        Specified by:
        build in interface XmlBuilder
        Specified by:
        build in class AbstractXmlBuilder
        Throws:
        java.lang.Exception
      • generate

        public XmlElement generate​(java.lang.Object in)
                            throws java.lang.Exception
        Build an XML element based on given object by looking up the appropriate builder based on the object's class name and calling that builder's generate method on the object.
        Specified by:
        generate in interface XmlBuilder
        Overrides:
        generate in class AbstractXmlBuilder
        Throws:
        java.lang.Exception
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Simple test of this class.
        Throws:
        java.lang.Exception