diva.compat.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:
$Revision: 1.1 $
Author:
John Reekie (johnr@eecs.berkeley.edu)

Method Summary
 Object build(XmlElement elt, String type)
          Given an XmlElement, create and return an internal representtion of it.
 XmlElement generate(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

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

Throws:
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(Object obj)
                    throws Exception
Given an object, produce an XML representation of it.

Throws:
Exception


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.