diva.util.xml
Interface XmlBuilder

All Known Implementing Classes:
AbstractXmlBuilder, CompositeBuilder

public interface XmlBuilder

An XmlBuilder is an interface that can be implemented by classes that convert between XmlElements and some internal data representation. The main reason for doing so is to allow other builders to "reuse" parts of an XML DTD. For example, we could have a builder that builds Java2D objects, such as "line" and "polygon". Then some other builder, that for example builds libraries of graphical icons, can use an instance of the Java2D builder internally -- if it does not recognize the type of an XML element, it calls the Java2D builder to see if it can get a low-level graphical object.

Version:
$Id: XmlBuilder.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie
Accepted Rating:
Red

Method Summary
 java.lang.Object build(XmlElement elt, java.lang.String type)
          Given an XmlElement, create and return an internal representation of it.
 XmlElement generate(java.lang.Object obj)
          Given an object, produce an XML representation of it.
 void setDelegate(XmlBuilder child)
          Delegate builders can be used to build/generate for objects that are unknown by the current builder, as might be the case in a hierarchy of heterogeneous objects.
 

Method Detail

build

java.lang.Object build(XmlElement elt,
                       java.lang.String type)
                       throws java.lang.Exception
Given an XmlElement, create and return an internal representation of it. Implementors should also provide a more type-specific version of this method:
   public Graph build (XmlELement elt, String type);
 

Throws:
java.lang.Exception

setDelegate

void setDelegate(XmlBuilder child)
Delegate builders can be used to build/generate for objects that are unknown by the current builder, as might be the case in a hierarchy of heterogeneous objects.

See Also:
CompositeBuilder

generate

XmlElement generate(java.lang.Object obj)
                    throws java.lang.Exception
Given an object, produce an XML representation of it.

Throws:
java.lang.Exception